<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">

 <title>Van den Hof Linux Engineering</title>
 <link href="https://vandenhof.eu/atom.xml" rel="self"/>
 <link href="https://vandenhof.eu/"/>
 <updated>2026-03-30T22:18:06+02:00</updated>
 <id>https://vandenhof.eu</id>
 <author>
   <name>Rick van den Hof</name>
   <email>rick@vandenhof.eu</email>
 </author>

 
 <entry>
   <title>BetterBe B.V.</title>
   <link href="https://vandenhof.eu/employments/devops/betterbe"/>
   <updated>2024-06-01T02:00:00+02:00</updated>
   <id>https://vandenhof.eu/employments/devops/betterbe</id>
   <content type="html">&lt;p&gt;BetterBe provides an API/SaaS solution to the leading automotive companies like Alphabet, Arval, DirectLease etc for calculating complex automotive leasing products.
At BetterBe I implemented Terraform to manage the on-premise Rancher kubernetes clusters on both bare-metal hardware, using Foreman, and virtual machines using Harvester.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>TenneT TSO</title>
   <link href="https://vandenhof.eu/employments/devops/tennet"/>
   <updated>2022-06-01T02:00:00+02:00</updated>
   <id>https://vandenhof.eu/employments/devops/tennet</id>
   <content type="html">&lt;p&gt;TenneT is a leading European grid operator, committed to providing a secure and reliable supply of electricity 24 hours a day, 365 days a year.
My job at TenneT was to implement Terraform to manage the on-premise Rancher kubernetes clusters for various applications.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>RAMLAB</title>
   <link href="https://vandenhof.eu/employments/devops/ramlab"/>
   <updated>2021-02-01T10:15:00+01:00</updated>
   <id>https://vandenhof.eu/employments/devops/ramlab</id>
   <content type="html">&lt;p&gt;RAMLAB created a system to utilize a welding robot to 3D print metal parts on demand. Cool stuff. The hardware needed to support this, is powered by inhouse developed software.&lt;/p&gt;

&lt;p&gt;My job as a Linux Engineer was to enable RAMLAB to automatically roll out these new hardware systems with as little human interaction as possible. We achieved this by utilizing MAAS (Ubuntu server deployments), Ansible (AWX), SSH authentication, JIRA Asset Management and some Google Cloud resources. By connecting all the API’s we were able to automate installations from beginning to end.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>I4Networks</title>
   <link href="https://vandenhof.eu/employments/devops/i4networks"/>
   <updated>2020-02-01T10:15:00+01:00</updated>
   <id>https://vandenhof.eu/employments/devops/i4networks</id>
   <content type="html">&lt;p&gt;I4Networks is constantly improving their customer services, by automating as much as possible (and thereby eliminating human error) and making use of Cloud resources whenever possible.
By deploying apps serverless (using Google Cloud Run), they can focus on developing applications instead of hosting and maintaining secure environments.&lt;/p&gt;

&lt;p&gt;With automation, configuration changes are as easy as creating a Pull Request and merging.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Ultimaker</title>
   <link href="https://vandenhof.eu/employments/devops/ultimaker"/>
   <updated>2019-02-01T10:15:00+01:00</updated>
   <id>https://vandenhof.eu/employments/devops/ultimaker</id>
   <content type="html">&lt;p&gt;Ultimaker creates the best 3D-printers in the world. These printers are manageable through the cloud, enable you to monitor, start, stop and duplicate print jobs and much more, from anywhere.
As a Cloud Operations Engineer my main job was to help Ultimaker bring their Cloud Infrastructure to a higher standard.&lt;/p&gt;

&lt;p&gt;I achieved this by creating an infrastructure-as-code setup and ensuring all the Google Cloud Platform resources were described in Terraform code.
Next, building applications was streamlined using Docker, docker-compose and GitHub Actions. Built docker images were pushed to the Google Container Registry, after which our GitOps implementation would detect the new images and deploy them on the relevant clusters automatically using custom Helm charts.&lt;/p&gt;

&lt;p&gt;To be able to replace the entire infrastructure with zero downtime, we migrated local MongoDB databases to MongoDB Atlas to get rid of the last bit of stateful data in the clusters.&lt;/p&gt;

&lt;p&gt;I implemented the Istio Service Mesh for detailed insights into the performance of our clusters, ratelimiting and to be able to do canary / A-B / green-blue deployments.&lt;/p&gt;

&lt;p&gt;I made it possible for developers to show their new features to stakeholders, by launching ‘lab environments’ on Google Cloud Run, using a custom made GitHub Action.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Refactory</title>
   <link href="https://vandenhof.eu/employments/devops/refactory"/>
   <updated>2018-04-30T11:15:00+02:00</updated>
   <id>https://vandenhof.eu/employments/devops/refactory</id>
   <content type="html">&lt;p&gt;Refactory is an early adopter of the latest and greatest DevOps technologies. Because of this, they are able to quickly and efficiently help many customers overcome seemingly difficult and complex problems.&lt;/p&gt;

&lt;p&gt;I helped Refactory to update their Ansible playbooks and roles to new and higher standards, therefor increasing scalability and maintainability. The playbooks will now be automatically checked whether they conform to the Coding Style guidelines aswell as valid syntax. A number of custom rules were developed in Python.&lt;/p&gt;

&lt;p&gt;I also extended the playbooks to be able to run PHP applications with dedicated user accounts and roll out new websites automatically. Additionally, servers can now be updated automatically and will export statistics to Prometheus.&lt;/p&gt;
</content>
 </entry>
 
 <entry>
   <title>Xolphin</title>
   <link href="https://vandenhof.eu/employments/devops/xolphin"/>
   <updated>2018-04-04T11:15:00+02:00</updated>
   <id>https://vandenhof.eu/employments/devops/xolphin</id>
   <content type="html">&lt;p&gt;Xolphin uses a number of different websites to sell their SSL products. They wanted to switch from using Apache to Nginx, and in the process, implement a method to better maintain and more easily roll out additional websites. I have converted their existing Apache configuration to nginx virtualhosts, which are deployed using Ansible. A simple YAML configuration file is now used to describe the virtualhost and, if applicable, any settings that deviate from the defaults.&lt;/p&gt;

&lt;p&gt;Obviously the entire setup can first be tested locally using Vagrant.&lt;/p&gt;

&lt;p&gt;The ansible playbooks will:&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;ensure the unix users and groups exist&lt;/li&gt;
  &lt;li&gt;generate new Diffie-Hellman parameters (if needed)&lt;/li&gt;
  &lt;li&gt;create documentroots with proper permissions and ownerships&lt;/li&gt;
  &lt;li&gt;ensure the nginx virtualhost configurations&lt;/li&gt;
  &lt;li&gt;configure PHP-FPM pools per user&lt;/li&gt;
&lt;/ul&gt;
</content>
 </entry>
 
 <entry>
   <title>Tuxis Internet Engineering</title>
   <link href="https://vandenhof.eu/employments/devops/tuxis"/>
   <updated>2017-03-07T10:15:00+01:00</updated>
   <id>https://vandenhof.eu/employments/devops/tuxis</id>
   <content type="html">&lt;p&gt;Tuxis asked me to develop Ansible playbooks that would roll out and configure &lt;a href=&quot;https://sensu.io&quot;&gt;Sensu&lt;/a&gt; across their various platforms. I developed this locally using Vagrant, I started with a basic server and client and basic checks. From there I expanded the monitoring with more complicated checks and notification methods.&lt;/p&gt;

&lt;p&gt;Using the ansible playbooks, you can easily subscribe to sensu checks or add your own.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>IJsvogel Retail</title>
   <link href="https://vandenhof.eu/employments/devops/ijsvogel"/>
   <updated>2017-01-09T10:15:00+01:00</updated>
   <id>https://vandenhof.eu/employments/devops/ijsvogel</id>
   <content type="html">&lt;p&gt;As DevOps Architect Online, I supported a number of teams in the IJsvogel Retail organisation, the corporation behind &lt;a href=&quot;https://www.petsplace.nl&quot;&gt;Pets Place&lt;/a&gt; and &lt;a href=&quot;https://www.boerenbond.com&quot;&gt;Boerenbond&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I was responsible for the day-to-day operations revolving around the ecommerce platform built on &lt;a href=&quot;https://magento.com/products/enterprise-edition&quot;&gt;Magento 2&lt;/a&gt; - running on &lt;a href=&quot;https://aws.amazon.com&quot;&gt;Amazon Web Services&lt;/a&gt; behind Varnish caching servers.&lt;/p&gt;

&lt;p&gt;This included troubleshooting issues and reporting these to the correct suppliers, such as Payment Service Providers (&lt;a href=&quot;https://buckaroo.nl&quot;&gt;Buckaroo&lt;/a&gt;), Magento 2 developers (&lt;a href=&quot;http://www.50x-solutions.com/&quot;&gt;50x Solutions&lt;/a&gt;), iOS/Android developers (&lt;a href=&quot;https://www.egeniq.com/&quot;&gt;Egeniq&lt;/a&gt;) or the Delivery Management Software provider &lt;a href=&quot;https://www.paazl.com/&quot;&gt;Paazl&lt;/a&gt;. Together with the Online Business team I was responsible for Scrum sprint planning and project prioritization.&lt;/p&gt;

&lt;p&gt;I also helped introduce a Customers Loyalty program (&lt;a href=&quot;https://petsplace.nl/vipclub&quot;&gt;VIP Club&lt;/a&gt;) consisting of iOS and Android mobile apps built by &lt;a href=&quot;https://www.egeniq.com/&quot;&gt;Egeniq&lt;/a&gt;, the ecommerce website and a CRM platform built by &lt;a href=&quot;http://thevalley.nl/&quot;&gt;The Valley&lt;/a&gt;.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Avisi BV</title>
   <link href="https://vandenhof.eu/employments/devops/avisi"/>
   <updated>2016-06-20T16:15:00+02:00</updated>
   <id>https://vandenhof.eu/employments/devops/avisi</id>
   <content type="html">&lt;p&gt;As a DevOps engineer, I’ve been tasked to setup a new fully automated platform. Customers will be able to request a dedicated, &lt;a href=&quot;https://www.atlassian.com/&quot;&gt;Atlassian&lt;/a&gt;-stack based &lt;a href=&quot;https://en.wikipedia.org/wiki/Development,_testing,_acceptance_and_production&quot;&gt;DTAP&lt;/a&gt; environment in a private cloud. Other tools like &lt;a href=&quot;https://jenkins.io/&quot;&gt;Jenkins&lt;/a&gt; and &lt;a href=&quot;http://rundeck.org/&quot;&gt;Rundeck&lt;/a&gt; may be added to the stack.
I developed a Python tool that reads configuration from &lt;a href=&quot;https://docs.puppet.com/hiera/3.2/&quot;&gt;Puppet Hiera&lt;/a&gt; and consequently creates the necessary virtual machines in a &lt;a href=&quot;http://vcloud.vmware.com/&quot;&gt;VMware vCloud&lt;/a&gt; environment. It will also configure a private LAN for the customer as well as networking (&lt;a href=&quot;https://en.wikipedia.org/wiki/Network_address_translation#SNAT&quot;&gt;SNAT&lt;/a&gt;) and firewalling rules. The public internet facing proxy servers, running &lt;a href=&quot;http://nginx.org/&quot;&gt;nginx&lt;/a&gt;, will receive a signal to update their configuration. Aside from creating the &lt;a href=&quot;https://en.wikipedia.org/wiki/Development,_testing,_acceptance_and_production&quot;&gt;DTAP&lt;/a&gt; environment, documentation and instructions for maintenance and provisioning new customers must be created. A follow-up project consists of migrating current customers to a new, private cloud.&lt;/p&gt;

&lt;p&gt;Other software used:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Vagrant&lt;/li&gt;
  &lt;li&gt;PostgreSQL&lt;/li&gt;
  &lt;li&gt;OpenDJ (LDAP server)&lt;/li&gt;
&lt;/ul&gt;

</content>
 </entry>
 
 <entry>
   <title>Protecting your servers against ImageTragick (CVE-2016-3714) and CVE-2016-5118 using Ansible</title>
   <link href="https://vandenhof.eu/blog/ansible/imagetragick"/>
   <updated>2016-06-02T16:00:00+02:00</updated>
   <id>https://vandenhof.eu/blog/ansible/imagetragick</id>
   <content type="html">&lt;p&gt;On May 3rd, &lt;a href=&quot;https://imagetragick.com/&quot;&gt;details were published&lt;/a&gt; about a vulnerability in ImageMagick (&lt;a href=&quot;https://security-tracker.debian.org/tracker/CVE-2016-3714&quot;&gt;CVE-2016-3714&lt;/a&gt;), allowing remote code execution if you process user submitted images. Exploits for this vulnerability are being used in the wild.&lt;/p&gt;

&lt;p&gt;The following ansible playbook may be used to apply the policy file mitigation discussed on that website. If the server(s) you wish to protect has a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;policy.xml&lt;/code&gt; file in a different location, be sure to modify the with_items list of the first task.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Update 2nd of June&lt;/em&gt;: on May 29th, another vulnerability was &lt;a href=&quot;http://permalink.gmane.org/gmane.comp.security.oss.general/19669&quot;&gt;disclosed&lt;/a&gt; regarding ImageMagick.
This vulnerability was assigned &lt;a href=&quot;https://security-tracker.debian.org/tracker/CVE-2016-5118&quot;&gt;CVE-2016-5118&lt;/a&gt;. It is possible to execute shell commands by using a pipe in the file open syntax. The playbook
below has been modified to protect agains this vulnerability as well, with special thanks to
&lt;a href=&quot;https://twitter.com/hj8rs/status/737977620617396224&quot;&gt;Henk-Jan Agteresch&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note&lt;/em&gt;: Updated packages have been released that fix this vulnerability for
&lt;a href=&quot;https://launchpad.net/~ubuntu-security-proposed/+archive/ubuntu/ppa/+packages&quot;&gt;Ubuntu&lt;/a&gt; and &lt;a href=&quot;https://packages.debian.org/jessie/imagemagick&quot;&gt;Debian&lt;/a&gt;. The updated packages make the policy.xml file change unnecessary (but
it wont hurt either).&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-ruby&quot; data-lang=&quot;ruby&quot;&gt;&lt;span class=&quot;o&quot;&gt;---&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;hosts: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;all&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;become: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;true&lt;/span&gt;
  &lt;span class=&quot;ss&quot;&gt;gather_facts: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;

  &lt;span class=&quot;ss&quot;&gt;tasks:
    &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;name: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;find&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;out&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;what&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;default&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;policy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;xml&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;location&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;is&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;command: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;convert&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;list&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;policy&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;register: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;convert_policy&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;failed_when: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;changed_when: &lt;/span&gt;&lt;span class=&quot;kp&quot;&gt;false&lt;/span&gt;

    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;set_fact:
        default_convert_policy: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;{{ convert_policy.stdout_lines[1]|regex_replace(&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Path: (.*)&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;, &lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;\\&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;)}}&quot;&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;when: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&apos;Path&apos; in convert_policy.stdout&quot;&lt;/span&gt;

    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;name: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;check&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;which&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;policy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;xml&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;exists&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;stat:
        path: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;{{ item }}&quot;&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;with_items:
        &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;{{ default_convert_policy|default(&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;/etc/ImageMagick/policy.xml&lt;/span&gt;&lt;span class=&quot;se&quot;&gt;\&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;) }}&quot;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/etc/&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ImageMagick&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;policy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;xml&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/etc/&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ImageMagick&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;policy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;xml&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/usr/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;local&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ImageMagick&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;policy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;xml&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/usr/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;local&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ImageMagick&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;6&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;policy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;xml&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;sr&quot;&gt;/usr/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;local&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;etc&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;ImageMagick&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;7&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;/&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;policy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;xml&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;register: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;policy_xml&lt;/span&gt;

    &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;ss&quot;&gt;name: &lt;/span&gt;&lt;span class=&quot;k&quot;&gt;for&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;every&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;policy&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;xml&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;that&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;exists&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;ensure&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;lines&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;are&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;the&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;config&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;lineinfile:
        dest: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;{{ item.0.item }}&quot;&lt;/span&gt;
        &lt;span class=&quot;ss&quot;&gt;insertbefore: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&amp;lt;/policymap&amp;gt;&quot;&lt;/span&gt;
        &lt;span class=&quot;ss&quot;&gt;line: &lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;{{ item.1 }}&quot;&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;with_nested:
        &lt;/span&gt;&lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;{{ policy_xml.results }}&quot;&lt;/span&gt;
        &lt;span class=&quot;o&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;&apos;  &amp;lt;policy domain=&quot;coder&quot; rights=&quot;none&quot; pattern=&quot;EPHEMERAL&quot; /&amp;gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
           &lt;span class=&quot;s1&quot;&gt;&apos;  &amp;lt;policy domain=&quot;coder&quot; rights=&quot;none&quot; pattern=&quot;URL&quot; /&amp;gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
           &lt;span class=&quot;s1&quot;&gt;&apos;  &amp;lt;policy domain=&quot;coder&quot; rights=&quot;none&quot; pattern=&quot;HTTPS&quot; /&amp;gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
           &lt;span class=&quot;s1&quot;&gt;&apos;  &amp;lt;policy domain=&quot;coder&quot; rights=&quot;none&quot; pattern=&quot;MVG&quot; /&amp;gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
           &lt;span class=&quot;s1&quot;&gt;&apos;  &amp;lt;policy domain=&quot;coder&quot; rights=&quot;none&quot; pattern=&quot;MSL&quot; /&amp;gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
           &lt;span class=&quot;s1&quot;&gt;&apos;  &amp;lt;policy domain=&quot;path&quot; rights=&quot;none&quot; pattern=&quot;|*&quot; /&amp;gt;&apos;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
          &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
      &lt;span class=&quot;ss&quot;&gt;when: &lt;/span&gt;&lt;span class=&quot;n&quot;&gt;item&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;stat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;exists&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;To execute the playbook, save it in a file called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;imagetragick.yml&lt;/code&gt; and execute it using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;ansible-playbook&lt;/code&gt;:&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-shell&quot; data-lang=&quot;shell&quot;&gt;&lt;span class=&quot;nv&quot;&gt;$ &lt;/span&gt;ansible-playbook imagetragick.yml&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

</content>
 </entry>
 
 <entry>
   <title>Applying two-factor authentication to SSH logins with Duo Security</title>
   <link href="https://vandenhof.eu/blog/security/duosecurity/twofactor-protect-ssh"/>
   <updated>2016-05-19T16:00:00+02:00</updated>
   <id>https://vandenhof.eu/blog/security/duosecurity/twofactor-protect-ssh</id>
   <content type="html">&lt;p&gt;Adding &lt;a href=&quot;https://en.wikipedia.org/wiki/Two-factor_authentication&quot;&gt;Two Factor Authentication&lt;/a&gt; to your server is a great way to increase security. After doing research on a number of different implemententations for getting two-factor authentication enabled on SSH login sessions, I came to the conclusion &lt;a href=&quot;https://duo.com/&quot;&gt;Duo Security&lt;/a&gt; is the easiest to setup and most mature of the available solutions. Other solutions are &lt;a href=&quot;https://github.com/google/google-authenticator&quot;&gt;Google Authenticator&lt;/a&gt; and &lt;a href=&quot;https://www.authy.com/integrations/ssh/&quot;&gt;Authy&lt;/a&gt;. Google Authenticator is not an option if you want to add multiple SSH keys to a single user (i.e. root) - it requires seperate user accounts. I discarded Authy as an option because it breaks scp, required typing over a 7-digit code every time you log in, I could not login to the site using Safari and text messages were sent twice each time.&lt;/p&gt;

&lt;p&gt;This guide aims to get you up and running with Duo Security as quickly as possible. The quickest way would be to run the ansible playbook at the bottom of this guide, but I suggest following the guide step by step to ensure that you know what you are doing (and what the playbook does). &lt;em&gt;Note&lt;/em&gt;: It is also possible to configure Duo with PAM, but this is a little more complex. For now I will focus on getting the login_duo program to work, but we will compile and install the Duo Unix package with PAM support should you want to use it later.&lt;/p&gt;

&lt;h2 id=&quot;getting-an-integration-and-security-key&quot;&gt;Getting an Integration and Security key&lt;/h2&gt;
&lt;p&gt;To use Duo Security, you need two keys: an Integration and a security key. These will be used in the configuration files below. To get the keys, &lt;a href=&quot;https://duo.com/docs/creating_applications&quot;&gt;create an application&lt;/a&gt; in the Duo Security Admin dashboard.&lt;/p&gt;

&lt;h2 id=&quot;install-duo-security-dependencies&quot;&gt;Install Duo Security dependencies&lt;/h2&gt;
&lt;p&gt;The Duo Security login binary depends on the PAM and OpenSSL library development headers.
On Debian and Ubuntu the packages are called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libpam0g-dev&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;libssl-dev&lt;/code&gt; and can be installed by executing:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo apt-get install libpam0g-dev libssl-dev
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;On RedHat-based systems install the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pam-devel&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;openssl-devel&lt;/code&gt; packages:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo yum install pam-devel openssl-devel
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;download-the-duo-security-unix-source&quot;&gt;Download the Duo Security unix source&lt;/h2&gt;
&lt;p&gt;Download and unpack the latest version of the Duo Security unix source code:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ wget https://dl.duosecurity.com/duo_unix-latest.tar.gz
$ tar xzvf duo_unix-latest.tar.gz
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;install-the-duo-security-binaries&quot;&gt;Install the Duo Security binaries&lt;/h2&gt;
&lt;p&gt;Configure, compile and install the Duo Security binaries:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ cd duo_unix-1.9.18
$ ./configure --prefix=/usr --with-pam
$ make
$ sudo make install
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;configure-etcduologin_duoconf&quot;&gt;Configure /etc/duo/login_duo.conf&lt;/h2&gt;
&lt;p&gt;Make sure the /etc/duo/login_duo.conf file consists of the following lines:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[duo]
ikey = {{ duo_integration_key }}
skey = {{ duo_secret_key }}
host = {{ duo_api_host }}
pushinfo = yes
failmode = secure
autopush = yes
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Replace the three values in double curly brackets with your own information. Notice the three other settings: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pushinfo = yes&lt;/code&gt; makes duo send additional information to the authenticator client, such as which IP is trying to SSH into the server. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;failmode = secure&lt;/code&gt; indicates we do not want you to be able to log in if Duo Security is unavailable or in maintenance. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;autopush = yes&lt;/code&gt; means we will automatically receive a push message to our phone, instead of having to choose an authentication method from a menu.&lt;/p&gt;

&lt;h2 id=&quot;configure-etcduopam_duoconf&quot;&gt;Configure /etc/duo/pam_duo.conf&lt;/h2&gt;
&lt;p&gt;Symlink the /etc/duo/login_duo.conf file to /etc/duo/pam_duo.conf. As stated previously, we will not be using PAM, but if you decide you want to use Duo with PAM, follow &lt;a href=&quot;https://duo.com/docs/duounix&quot;&gt;this guide&lt;/a&gt;.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;$ sudo ln -s /etc/duo/login_duo.conf /etc/duo/pam_duo.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;configure-ssh&quot;&gt;Configure SSH&lt;/h2&gt;
&lt;p&gt;Now that the Duo program is configured, we will configure SSH to use it. To do this, all you need to do is modify your &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;authorized_keys&lt;/code&gt; file to invoke the login_duo binary for every public key you wish to enable it for:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;command=&quot;/usr/sbin/login_duo&quot; ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDlEJbk7t/XSl7EABuKHZgRuipHJ3bDKMurZxeMaJA5P7ZwmESqcsjccCT9Ep2HF21LhnWIfMWFKv+cyzmhhkRLOmFuGcHB7vZH5RGVjncChzwJx7uOVOkajk/ECJDZdh8gdUdUC8BXe3OkdiojgakiEMhx8/5m0u1WLGLf2jIun4efXORlTK3HRoNBwk5aLUTtehnssELXczeLtMdpeIjCl8iZww0v2zD9FqkUvwd+DkGw4ijtADjH0UA/p6uaS8wV9Tu1FwfiM3yrnQrRT2x/vWNNaqiWZbBYnL2Gr+jpeJeSuFsN2uB6HaTbAt2BP/kZvdszt91Q7ixpe3htdLpv7DaRcxfh7OfkpjJ8+9eZ9iqrqxDWhK1SQyFWKnncQAQgca4FksmmFM7K7RuXwTx09kaCOwQkFpnu+rAMKUVjKiJuy7GdszgZczpz/3xDFisgD/+myBx2ITkhtPTLeadVKyTyp/0Plb03UWOcGOhNdUna/QrT8ZSPQrVH3ejEk8uPcYmv/mEYVqLBlauB+E6CIkYRpraGZySfk+9sKcFnZPC++D61jCXqU3eofZG2QK69pdn25cZlihAdCy4FpHDJ8Fd5V1w8Pmy2SxpVehggnQe0S4N0cIcnpRr0JaE7k6al429LLMPBcWKzo4pnGp9ugvuicDckp7Hem2MgeUR+vw== rvdhof
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This will execute the login_duo binary when you use this public key to login to the server. If the username of the account you are logging in to does not match your Duo account name, specify it with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;-f username&lt;/code&gt; option:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;command=&quot;/usr/sbin/login_duo -f rvdhof&quot; ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDlEJbk7t/XSl7EABuKHZgRuipHJ3bDKMurZxeMaJA5P7ZwmESqcsjccCT9Ep2HF21LhnWIfMWFKv+cyzmhhkRLOmFuGcHB7vZH5RGVjncChzwJx7uOVOkajk/ECJDZdh8gdUdUC8BXe3OkdiojgakiEMhx8/5m0u1WLGLf2jIun4efXORlTK3HRoNBwk5aLUTtehnssELXczeLtMdpeIjCl8iZww0v2zD9FqkUvwd+DkGw4ijtADjH0UA/p6uaS8wV9Tu1FwfiM3yrnQrRT2x/vWNNaqiWZbBYnL2Gr+jpeJeSuFsN2uB6HaTbAt2BP/kZvdszt91Q7ixpe3htdLpv7DaRcxfh7OfkpjJ8+9eZ9iqrqxDWhK1SQyFWKnncQAQgca4FksmmFM7K7RuXwTx09kaCOwQkFpnu+rAMKUVjKiJuy7GdszgZczpz/3xDFisgD/+myBx2ITkhtPTLeadVKyTyp/0Plb03UWOcGOhNdUna/QrT8ZSPQrVH3ejEk8uPcYmv/mEYVqLBlauB+E6CIkYRpraGZySfk+9sKcFnZPC++D61jCXqU3eofZG2QK69pdn25cZlihAdCy4FpHDJ8Fd5V1w8Pmy2SxpVehggnQe0S4N0cIcnpRr0JaE7k6al429LLMPBcWKzo4pnGp9ugvuicDckp7Hem2MgeUR+vw== rvdhof
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Thats it! If you followed the steps in this guide, the next time you log in to your server with SSH, you will be asked to confirm the login:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Ricks-MacBook-Pro:~ rick$ ssh rick@vps01
Enter passphrase for key &apos;/Users/rick/.ssh/id_rsa&apos;:
Autopushing login request to phone...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You will now get a Push Message on your phone:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/img/blog/duo_security.png&quot; alt=&quot;Duo Mobile Screenshot&quot; /&gt;&lt;/p&gt;

&lt;p&gt;After tapping the big green button, you will be logged in:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;Success. Logging you in...
rick@vps01:~$
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;ansible-playbook&quot;&gt;Ansible Playbook&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Note:&lt;/em&gt; the following will only work on Debian based servers.&lt;/p&gt;

&lt;p&gt;To run all the above commands (except for configuring SSH) on one or more servers using Ansible,
save the following as a .yml file:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;---
- hosts: test

  vars:
    - duo_url: &quot;https://dl.duosecurity.com/duo_unix-latest.tar.gz&quot;
    - duo_version: &quot;1.9.18&quot;

  vars_prompt:
    - name: duo_integration_key
      prompt: Duo integration key
      private: false
    - name: duo_secret_key
      prompt: Duo secret key
      private: false
    - name: duo_api_host
      prompt: Duo API host
      private: false

  tasks:
    - name: install dependencies
      apt:
        name: &quot;{{ item }}&quot;
        update_cache: true
        cache_valid_time: 86400
      with_items:
        - libpam0g-dev
        - libssl-dev

    - name: download duosecurity
      get_url:
        url: &quot;{{ duo_url }}&quot;
        dest: /usr/src/duo_unix-latest.tar.gz

    - name: unpack it
      unarchive:
        src: /usr/src/duo_unix-latest.tar.gz
        dest: /usr/src/
        copy: false

    - name: configure duo
      command: ./configure --prefix=/usr --with-pam
      args:
        chdir: /usr/src/duo_unix-{{ duo_version }}
        creates: /usr/src/duo_unix-{{ duo_version }}/Makefile

    - name: compile duo
      command: make -j{{ ansible_processor_cores }}
      args:
        chdir: /usr/src/duo_unix-{{ duo_version }}
        creates: /usr/src/duo_unix-{{ duo_version }}/login_duo/login_duo

    - name: install duo
      command: make install
      args:
        chdir: /usr/src/duo_unix-{{ duo_version }}

    - name: configure login_duo.conf
      template:
        src: login_duo.conf.j2
        dest: /etc/duo/login_duo.conf

    - name: configure pam_duo.conf
      template:
        src: login_duo.conf.j2
        dest: /etc/duo/pam_duo.conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Save the following file as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;templates/login_duo.conf.j2&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;[duo]
ikey = {{ duo_integration_key }}
skey = {{ duo_secret_key }}
host = {{ duo_api_host }}
pushinfo = yes
failmode = secure
autopush = yes
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;You can now run the playbook:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;ansible-playbook -i &amp;lt;your inventory file&amp;gt; playbook.yml
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;It will prompt you for the needed Duo variables and do everything else automatically. This makes it
easy to deploy Duo on multiple servers simultaneously!&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>Running ownCloud on DirectAdmin server with Nginx and PHP-FPM</title>
   <link href="https://vandenhof.eu/blog/nginx/owncloud/directadmin-nginx-phpfpm-owncloud"/>
   <updated>2016-05-12T16:00:00+02:00</updated>
   <id>https://vandenhof.eu/blog/nginx/owncloud/directadmin-nginx-phpfpm-owncloud</id>
   <content type="html">&lt;p&gt;If you’re like me, you want the ease of use of a commonly known Control Panel for your own server. We all know how to configure Postfix, Dovecot, MySQL, nginx etc., but when it comes to the day-to-day operating of a server on which you might give out accounts to family members and friends, you just want to click a button to create room for a website and e-mail accounts, give them their username and password and get on with the more fun stuff.&lt;/p&gt;

&lt;p&gt;So you have chosen DirectAdmin as your Control Panel, and because you &lt;em&gt;are&lt;/em&gt; like me, you have quickly replaced Apache with nginx (if only because it’s what the cool kids use these days) and mod_php with PHP-FPM.&lt;/p&gt;

&lt;p&gt;Now you want to do something actually useful with your server, so why not host your very own file storage cloud? In comes ownCloud. ownCloud has been the de-facto “Be your own Dropbox” software for a number of years now and keeps growing in popularity. Unfortunately, getting it to run well on nginx and PHP-FPM can be somewhat of a challenge, and using DirectAdmin can make it even more difficult because of the way configuration files are generated.&lt;/p&gt;

&lt;p&gt;So enough with the smalltalk, here are the nitty-gritty details on what steps you need to take to get ownCloud running succesfully on your DirectAdmin nginx server. &lt;strong&gt;This guide requires you to have root access to your DirectAdmin server.&lt;/strong&gt; Well, if you have a well-willing webhost, you might ask them to apply the nginx and php-fpm customizations. But I’m guessing there aren’t that many DirectAdmin webhosts that use nginx and PHP-FPM (yet!).&lt;/p&gt;

&lt;h3 id=&quot;subdirectory-or-subdomain&quot;&gt;Subdirectory or subdomain?&lt;/h3&gt;
&lt;p&gt;First, you’ll need to decide if you’re going to run ownCloud from a subdomain or a subdirectory. In this guide I’ll assume you’ve chosen to run ownCloud on a subdomain, called “owncloud.yourdomain.com”. Ofcourse you’re free to choose to run ownCloud in a subdirectory, but you’ll have to modify the steps in this guide accordingly. 
If you can, &lt;strong&gt;create the subdomain as a new domain in your DirectAdmin account&lt;/strong&gt;. This helps when you’re going to protect your ownCloud installation with an SSL certificate if you’re not in possession of a wildcard SSL certificate for your domain.&lt;/p&gt;

&lt;h3 id=&quot;apply-custom-httpd-settings&quot;&gt;Apply custom httpd settings&lt;/h3&gt;
&lt;p&gt;In DirectAdmin, go to “Custom HTTPD Configurations” and click on the account you’re planning to use for ownCloud. Add these settings. These settings were taken from &lt;a href=&quot;https://github.com/owncloud/documentation/wiki/NGINX-Configuration&quot;&gt;the ownCloud documentation for nginx&lt;/a&gt;.
To get rid of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;The &quot;Strict-Transport-Security&quot; header is not configured&lt;/code&gt; warning, uncomment the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;# add_header Strict-Transport-Security&lt;/code&gt; line, but pay heed to the warning.&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;# Add headers to serve security related headers
# Before enabling Strict-Transport-Security headers please read into this topic first.
# add_header Strict-Transport-Security &quot;max-age=15768000; includeSubDomains; preload;&quot;;
add_header X-Content-Type-Options nosniff;
add_header X-Frame-Options &quot;SAMEORIGIN&quot;;
add_header X-XSS-Protection &quot;1; mode=block&quot;;
add_header X-Robots-Tag none;

# set max upload size
client_max_body_size 512M;
fastcgi_buffers 64 4K;

# Disable gzip to avoid the removal of the ETag header
gzip off;

# Uncomment if your server is build with the ngx_pagespeed module
# This module is currently not supported.
#pagespeed off;

index index.php;
error_page 403 /core/templates/403.php;
error_page 404 /core/templates/404.php;

rewrite ^/.well-known/carddav /remote.php/carddav/ permanent;
rewrite ^/.well-known/caldav /remote.php/caldav/ permanent;

# The following 2 rules are only needed for the user_webfinger app.
# Uncomment it if you&apos;re planning to use this app.
#rewrite ^/.well-known/host-meta /public.php?service=host-meta last;
#rewrite ^/.well-known/host-meta.json /public.php?service=host-meta-json last;

location = /robots.txt {
    allow all;
    log_not_found off;
    access_log off;
}

location ~ ^/(build|tests|config|lib|3rdparty|templates|data)/ {
    deny all;
}

location ~ ^/(?:\.|autotest|occ|issue|indie|db_|console) {
    deny all;
}

rewrite ^/remote/(.*) /remote.php last;
rewrite ^(/core/doc/[^\/]+/)$ $1/index.html;

location ~ \.php(?:$|/) {
    fastcgi_split_path_info ^(.+\.php)(/.+)$;
    include fastcgi_params;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_param PATH_INFO $fastcgi_path_info;
    fastcgi_param HTTPS on;
    fastcgi_param modHeadersAvailable true; #Avoid sending the security headers twice
    fastcgi_pass unix:/usr/local/php|PHP1_RELEASE|/sockets/|USER|.sock;

    fastcgi_intercept_errors on;
}

# Adding the cache control header for js and css files
# Make sure it is BELOW the location ~ \.php(?:$|/) { block
location ~* \.(?:css|js)$ {
    add_header Cache-Control &quot;public, max-age=7200&quot;;
    # Add headers to serve security related headers
    # Before enabling Strict-Transport-Security headers please read into this topic first.
    # add_header Strict-Transport-Security &quot;max-age=15768000; includeSubDomains; preload;&quot;;
    add_header X-Content-Type-Options nosniff;
    add_header X-Frame-Options &quot;SAMEORIGIN&quot;;
    add_header X-XSS-Protection &quot;1; mode=block&quot;;
    add_header X-Robots-Tag none;
    # Optional: Don&apos;t log access to assets
    access_log off;
}

# Optional: Don&apos;t log access to other assets
location ~* \.(?:jpg|jpeg|gif|bmp|ico|png|swf)$ {
    access_log off;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;customize-the-php-fpm-template&quot;&gt;Customize the PHP-FPM template&lt;/h3&gt;
&lt;p&gt;In order to get rid of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;The test with getenv(&quot;PATH&quot;) only returns an empty response&lt;/code&gt; warning, copy the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/directadmin/data/templates/php-fpm.conf&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/directadmin/data/templates/custom/php-fpm.conf&lt;/code&gt; and add the following line:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;env[PATH] = /usr/local/bin:/usr/bin:/bin
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To get rid of the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/urandom is not readable by PHP&lt;/code&gt; warning, add &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/dev/urandom&lt;/code&gt; to the OPEN_BASEDIR_PATH variable:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;|?OPEN_BASEDIR_PATH=`HOME`/:/tmp/:/var/tmp/:/usr/local/php`PHP_VER`/lib/:/usr/local/php54/lib/:/usr/local/php55/lib/:/usr/local/lib/php/:/dev/urandom|
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;After doing this, we need to regenerate the config files using &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;./build rewrite_confs&lt;/code&gt;, but we’ll save that for later.&lt;/p&gt;

&lt;h3 id=&quot;enable-webdav-http-request-methods&quot;&gt;Enable WebDAV HTTP request methods&lt;/h3&gt;
&lt;p&gt;To enable WebDAV functionality, we must copy &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/nginx/webapps.conf&lt;/code&gt; to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/directadmin/custombuild/custom/nginx/conf&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;mkdir -p /usr/local/directadmin/custombuild/custom/nginx/conf
cp /etc/nginx/webapps.conf /usr/local/directadmin/custombuild/custom/nginx/conf
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Now change the following line in the file &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/directadmin/custombuild/custom/nginx/conf/webapps.conf&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;if ($request_method !~ ^(GET|HEAD|POST)$ ) {
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;To:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;if ($request_method !~ ^(GET|HEAD|POST|PROPFIND|PROPPATCH|MKCOL|COPY|MOVE|LOCK|UNLOCK)$ ) {
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h1 id=&quot;rewrite-the-configuration-files&quot;&gt;Rewrite the configuration files&lt;/h1&gt;
&lt;p&gt;After making the above changes, go to &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/usr/local/directadmin/custombuild&lt;/code&gt; and execute the following command:&lt;/p&gt;

&lt;div class=&quot;language-plaintext highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;./build rewrite_confs
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Beware: sometimes after the above command, nginx has failed to start up. If that is the case, simply run &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;service nginx restart&lt;/code&gt; manually.
Once this is done, you should have a fully operational ownCloud installation.&lt;/p&gt;

</content>
 </entry>
 
 <entry>
   <title>ImageTragick</title>
   <link href="https://vandenhof.eu/links/ansible/imagetragick"/>
   <updated>2016-02-20T22:15:00+01:00</updated>
   <id>https://vandenhof.eu/links/ansible/imagetragick</id>
   <content type="html">
</content>
 </entry>
 

</feed>