<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Olivier Mauras</title><link href="http://www.mauras.ch/" rel="alternate"></link><link href="http://www.mauras.ch/feeds/all.atom.xml" rel="self"></link><id>http://www.mauras.ch/</id><updated>2023-10-03T23:53:14+02:00</updated><subtitle>Senior system engineer // Linux consultant</subtitle><entry><title>Introducing dns-blackhole</title><link href="http://www.mauras.ch/introducing-dns-blackhole.html" rel="alternate"></link><published>2017-09-05T23:34:00+02:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2017-09-05:/introducing-dns-blackhole.html</id><summary type="html">&lt;p&gt;So the other day I wanted to remove ads on my Android phone, but apparently you can't install extensions on Android chromium and I didn't feel like using Firefox for that.&lt;br /&gt;
Since I use non …&lt;/p&gt;</summary><content type="html">&lt;p&gt;So the other day I wanted to remove ads on my Android phone, but apparently you can't install extensions on Android chromium and I didn't feel like using Firefox for that.&lt;br /&gt;
Since I use non rooted &lt;a href="https://copperhead.co/android/"&gt;CopperHeadOS&lt;/a&gt; as my main mobile OS, solutions like &lt;a href="https://f-droid.org/packages/org.adaway/"&gt;AdAway&lt;/a&gt; that require root access were not possible either.... What to do then?&lt;br /&gt;
Oh wait don't we have a recursive DNS resolver on this OpenVPN tunnel? We sure do! And wouldn't it be nice that it removes ads for us?  Indeed it would!  &lt;/p&gt;
&lt;p&gt;On this particular setup I was using &lt;a href="https://www.powerdns.com/recursor.html"&gt;PowerDNS Recursor&lt;/a&gt; and so stumbled upon this &lt;a href="https://blog.powerdns.com/2016/01/19/efficient-optional-filtering-of-domains-in-recursor-4-0-0/"&gt;nice blog article&lt;/a&gt; from last year where they explain how to use the &lt;a href="https://disconnect.me/"&gt;Disconnect&lt;/a&gt; list used by the &lt;a href="https://blog.mozilla.org/blog/2015/12/07/focus-by-firefox-content-blocking-for-the-open-web/"&gt;Mozilla Focus project&lt;/a&gt; to efficiently block ads/tracking domains.  &lt;/p&gt;
&lt;p&gt;While the process is quite easy, after reading some of &lt;a href="https://github.com/mozilla-mobile/focus-ios/tree/master/shavar-prod-lists"&gt;the project readme&lt;/a&gt; it seemed even more simple to just get the domains from &lt;a href="https://services.disconnect.me/disconnect-plaintext.json"&gt;the original list&lt;/a&gt;.&lt;br /&gt;
I thus wrote &lt;a href="http://git.mauras.ch/Various/powerdns_recursor_ads_blocking/src/master/lua_blocking_from_disconnect.py"&gt;this tiny script&lt;/a&gt; that would do the job for me, without even touching the &lt;code&gt;Git&lt;/code&gt; repo from the blog post, and &lt;a href="https://www.powerdns.com/recursor.html"&gt;PowerDNS Recursor&lt;/a&gt; was now happily blocking DNS queries to &lt;em&gt;some&lt;/em&gt; advertisement and tracking domains...&lt;br /&gt;
&lt;em&gt;Some&lt;/em&gt; seemed suddenly too few... With the ~1500 domains that the &lt;a href="https://services.disconnect.me/disconnect-plaintext.json"&gt;Disconnect list&lt;/a&gt; was offering, I was only blocking a tiny fraction of the trash that most of Internet has become today. We could surely do better :)  &lt;/p&gt;
&lt;p&gt;I decided that it would be interesting to include the content of several well known host lists and ended up with more than &lt;strong&gt;690000&lt;/strong&gt; domains blocked!!&lt;br /&gt;
That sure was some improvement, but this proved the lua method to be unable to cope with that many entries - recursor crashed at startup with a constant overflow - so I searched how to make recursor behave correctly while still be able to block all those bad domains.&lt;br /&gt;
The idea has been to generate a &lt;code&gt;zone&lt;/code&gt; file that would respect recursor's syntax and that could be fed through the &lt;code&gt;forward-zones-file&lt;/code&gt; option.&lt;br /&gt;
Syntax looks like this:  &lt;/p&gt;
&lt;p&gt;&lt;code&gt;&amp;lt;domain&amp;gt;=&amp;lt;where to forward the query&amp;gt;&lt;/code&gt;  &lt;/p&gt;
&lt;p&gt;The nice thing here is that if you don't specify any &lt;code&gt;&amp;lt;where to forward the query&amp;gt;&lt;/code&gt;, recursor will directly reply with a &lt;code&gt;NXDOMAIN&lt;/code&gt; answer.&lt;br /&gt;
That's perfect! For all those bad domains my client would receive a &lt;code&gt;NXDOMAIN&lt;/code&gt; return and wouldn't even try to connect anywhere. Exactly what was needed!  &lt;/p&gt;
&lt;p&gt;So basically if we can make a file with one domain per line for PowerDNS Recursor, we should be able to do so for other DNS servers...  &lt;/p&gt;
&lt;p&gt;After a major cleanup, here comes &lt;a href="http://git.mauras.ch/Various/dns-blackhole"&gt;dns-blackhole&lt;/a&gt;!&lt;/p&gt;
&lt;h2 id="features"&gt;Features&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Not bound to a specific DNS server, generates a file format of your choice&lt;/li&gt;
&lt;li&gt;Supports 3 different list format&lt;ul&gt;
&lt;li&gt;Host file&lt;/li&gt;
&lt;li&gt;&lt;a href="https://easylist.to/"&gt;Easylist&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://disconnect.me/"&gt;Disconnect&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Lets you whitelist/blacklist domains&lt;/li&gt;
&lt;li&gt;YAML configuration file&lt;/li&gt;
&lt;li&gt;Easy installation with &lt;code&gt;pip&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It has been successfully tested with:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.unbound.net/"&gt;Unbound&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.powerdns.com/recursor.html"&gt;PowerDNS recursor&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.thekelleys.org.uk/dnsmasq/doc.html"&gt;Dnsmasq&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Even generating an agregated host file is possible.&lt;/p&gt;
&lt;p&gt;The &lt;a href="http://git.mauras.ch/Various/dns-blackhole/src/master/README.md"&gt;project's README&lt;/a&gt; covers pretty much every details needed to use it, just keep in mind that without a whitelist your browsing sessions will lack a lot of content.&lt;br /&gt;
Here's a short whitelist example:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;amazon.com
amazon.de
amazon.fr
amazonaws.com
cloudfront.net
freenode.net
google.ch
google.com
google.fr
googleapis.com
imgur.com
intel.com
licdn.com
linkedin.com
msecnd.net # Skype CDN
netdna-cdn.com # bootstrapcdn.com
reddit.com
redditstatic.com
search.ch
thetvdb.com
yahoo.com
yimg.com
youtube.com
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And indeed you'll have to re-run &lt;code&gt;dns-blackhole&lt;/code&gt; each time you add something to the whitelist.  &lt;/p&gt;
&lt;p&gt;I hope you'll find this tool useful, and as usual feel free to &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; should you have any questions.&lt;/p&gt;</content><category term="Code"></category><category term="python"></category><category term="dns"></category><category term="unbound"></category><category term="dnsmasq"></category><category term="hosts file"></category><category term="pdns-recursor"></category><category term="blackhole"></category></entry><entry><title>devops REX 2016</title><link href="http://www.mauras.ch/devops-rex-2016.html" rel="alternate"></link><published>2016-12-22T11:40:00+01:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2016-12-22:/devops-rex-2016.html</id><content type="html">&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=Il29C1tmfTk"&gt;&lt;img src="/img/talks/devops_REX_2016_preview.jpg" alt="devops REX 2016"/&gt;&lt;/a&gt;
&lt;br/&gt;
&lt;br/&gt;
Corrected slides are available &lt;a href="http://www.slideshare.net/devopsrex/comment-lit-peut-arrter-de-se-faire-vanner-par-les-devs"&gt;on slideshare&lt;/a&gt;&lt;/p&gt;</content><category term="Talks"></category><category term="devops"></category><category term="devopsRex"></category></entry><entry><title>Hope that we get in touch again next year :)</title><link href="http://www.mauras.ch/hope-that-we-get-in-touch-again-next-year.html" rel="alternate"></link><published>2016-12-05T22:30:00+01:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2016-12-05:/hope-that-we-get-in-touch-again-next-year.html</id><content type="html">&lt;p&gt;&lt;img src='/img/devopsREX/badge.jpg'&gt;&lt;/img&gt;&lt;/p&gt;</content><category term="Talks"></category><category term="normation"></category><category term="devops"></category><category term="devopsRex"></category></entry><entry><title>Git replication: Part 2 - Now you can scale</title><link href="http://www.mauras.ch/git-replication-part-2-now-you-can-scale.html" rel="alternate"></link><published>2016-12-01T20:00:00+01:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2016-12-01:/git-replication-part-2-now-you-can-scale.html</id><summary type="html">&lt;div class="toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#main-features"&gt;Main features&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#prerequisites"&gt;Prerequisites&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#the-hook"&gt;The hook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#the-consul-watch"&gt;The consul watch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#the-reponame_sync-script"&gt;The ${REPONAME_SYNC} script&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#variants"&gt;Variants&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;In my &lt;a href="/git-replication-part-1-the-poor-mans-way.html"&gt;Part 1&lt;/a&gt; - which I know is already more than a year old now - we saw that we could make it very …&lt;/p&gt;</summary><content type="html">&lt;div class="toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#main-features"&gt;Main features&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#prerequisites"&gt;Prerequisites&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#the-hook"&gt;The hook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#the-consul-watch"&gt;The consul watch&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#the-reponame_sync-script"&gt;The ${REPONAME_SYNC} script&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#variants"&gt;Variants&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;p&gt;In my &lt;a href="/git-replication-part-1-the-poor-mans-way.html"&gt;Part 1&lt;/a&gt; - which I know is already more than a year old now - we saw that we could make it very easy to replicate between a Git repo and another remote automatically using a &lt;code&gt;post-receive&lt;/code&gt; hook. We also saw that it wasn't really scalable as it was looping over the remotes.  &lt;/p&gt;
&lt;p&gt;So what if we have like 20 different remote repositories that we want to keep in sync with our master repository?  &lt;/p&gt;
&lt;p&gt;Let's use &lt;a href="https://www.consul.io/"&gt;Consul&lt;/a&gt; to the rescue!&lt;/p&gt;
&lt;h4 id="main-features"&gt;Main features&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;It scales \o/&lt;/li&gt;
&lt;li&gt;Notifies all remotes in near real time of the master modification&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="prerequisites"&gt;Prerequisites&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;You've got a Consul cluster available&lt;/li&gt;
&lt;li&gt;All your Git repos are members of the Consul cluster&lt;/li&gt;
&lt;li&gt;You've set the correct ACL to the key you wanna use for the notification - Check my &lt;a href="/securing-consul.html"&gt;Securing Consul&lt;/a&gt; article for that&lt;/li&gt;
&lt;li&gt;Have &lt;code&gt;curl&lt;/code&gt; binary available on master repo&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="the-hook"&gt;The hook&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="ch"&gt;#!/bin/bash&lt;/span&gt;

&lt;span class="c1"&gt;# Get repo name&lt;/span&gt;
&lt;span class="nv"&gt;REPONAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;basename&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;dirname&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;pwd&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;.git&lt;span class="k"&gt;))&lt;/span&gt;
&lt;span class="nv"&gt;CONSUL_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;9c058400-8cfb-4dd0-ae75-698165a737ac&amp;quot;&lt;/span&gt;
&lt;span class="nv"&gt;CONSUL_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;http://localhost:8500/v1/kv/git/&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;REPONAME&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/id?token=&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CONSUL_TOKEN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;

&lt;span class="nb"&gt;read&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;oldrev&lt;span class="w"&gt; &lt;/span&gt;newrev&lt;span class="w"&gt; &lt;/span&gt;refname

curl&lt;span class="w"&gt; &lt;/span&gt;-X&lt;span class="w"&gt; &lt;/span&gt;PUT&lt;span class="w"&gt; &lt;/span&gt;-d&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$newrev&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;CONSUL_URL&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;That's it, nothing more! Indeed if you don't have any ACL to write on the key &lt;code&gt;git/${REPONAME}/id&lt;/code&gt; don't even bother with the token.&lt;/p&gt;
&lt;h4 id="the-consul-watch"&gt;The consul watch&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;watches&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;type&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;key&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;key&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;git/${REPONAME}/id&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;handler&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/etc/consul/watch_scripts/${REPONAME_SYNC}.sh&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;type&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;key&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;key&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;git/${ANOTHER_REPONAME}/id&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;handler&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/etc/consul/watch_scripts/another_sync_script.sh&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;With this configuration, a Consul agent started will constantly &lt;code&gt;watch&lt;/code&gt; any modification happening on the configured &lt;code&gt;key&lt;/code&gt;.&lt;br /&gt;
Upon modification, it will execute the configured &lt;code&gt;handler&lt;/code&gt;.&lt;br /&gt;
You can indeed have multiple keys watched at the same time - Please see &lt;a href="https://www.consul.io/docs/agent/watches.html"&gt;Consul watches documentation&lt;/a&gt; for more details.  &lt;/p&gt;
&lt;p&gt;If you had followed my &lt;a href="/securing-consul.html"&gt;Securing Consul&lt;/a&gt; article, it means you're running the Consul agent with an unpriviledged user. &lt;code&gt;handler&lt;/code&gt; will thus be executed using this account, think about it when debugging why your &lt;code&gt;handler&lt;/code&gt; doesn't work.&lt;br /&gt;
Also if you have set ACL on the &lt;code&gt;key&lt;/code&gt;, mind to set the &lt;code&gt;acl_token&lt;/code&gt; in your Consul agent config.  &lt;/p&gt;
&lt;h4 id="the-reponame_sync-script"&gt;The ${REPONAME_SYNC} script&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="ch"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/sbin:/bin:/usr/sbin:/usr/bin

ssh-agent&lt;span class="w"&gt; &lt;/span&gt;bash&lt;span class="w"&gt; &lt;/span&gt;-c&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;ssh-add /home/git/.ssh/&amp;lt;your_key&amp;gt;.rsa; cd /srv/git/${REPONAME}; git fetch origin; git reset --hard origin/master; git clean -fd&amp;#39;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This script is indeed just an example. You can pretty much do what you want in there and do all the Git voodo you need.&lt;br /&gt;
This one is just making sure that the &lt;code&gt;master&lt;/code&gt; branch of the clone in &lt;code&gt;/srv/git/${REPONAME}&lt;/code&gt; is exactly as the &lt;code&gt;master&lt;/code&gt; branch on the &lt;code&gt;origin&lt;/code&gt; remote - Nothing fancy.&lt;br /&gt;
Please note that &lt;code&gt;handlers&lt;/code&gt; will be executed at agent start as well so depending of the script you run, a server down restarted could cope with missing key changes and just get synced again.  &lt;/p&gt;
&lt;p&gt;This somewhat simple setup lets you have all your Git backup repositories and clones get notified when a modification happens on master repository and act according to your needs.&lt;br /&gt;
Here on a local network, it takes 1 second for my clones to be in sync with my master repository.  &lt;/p&gt;
&lt;h4 id="variants"&gt;Variants&lt;/h4&gt;
&lt;p&gt;While I use Consul there, it's indeed possible to mimic the same behaviour with any publish/subscribe system - Redis, MQTT, Saltstack events/reactors, and the list goes on.&lt;br /&gt;
&lt;br&gt;
&lt;br&gt;
As usual, feel free to &lt;a href="/pages/contact.html"&gt;contact me&lt;/a&gt; if you have any questions.&lt;/p&gt;</content><category term="Howto"></category><category term="git"></category><category term="hook"></category><category term="consul"></category></entry><entry><title>New Alpine Linux repository, EL6 repositories discontinued</title><link href="http://www.mauras.ch/new-alpine-linux-repository-el6-repositories-discontinued.html" rel="alternate"></link><published>2016-06-19T12:45:00+02:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2016-06-19:/new-alpine-linux-repository-el6-repositories-discontinued.html</id><summary type="html">&lt;p&gt;I've decided to start a new &lt;a href="http://alpinelinux.org/"&gt;Alpine Linux&lt;/a&gt; repository, mainly to support latest &lt;a href="https://grsecurity.net/"&gt;Grsecurity&lt;/a&gt; with options that are disabled in defaut Alpine's kernel configuration.&lt;br /&gt;
All sources and configurations can be found in their dedicated &lt;a href="http://git.mauras.ch/repos.mauras.ch/aports"&gt;git …&lt;/a&gt;&lt;/p&gt;</summary><content type="html">&lt;p&gt;I've decided to start a new &lt;a href="http://alpinelinux.org/"&gt;Alpine Linux&lt;/a&gt; repository, mainly to support latest &lt;a href="https://grsecurity.net/"&gt;Grsecurity&lt;/a&gt; with options that are disabled in defaut Alpine's kernel configuration.&lt;br /&gt;
All sources and configurations can be found in their dedicated &lt;a href="http://git.mauras.ch/repos.mauras.ch/aports"&gt;git repository&lt;/a&gt;.  &lt;/p&gt;
&lt;p&gt;At the same time, I've decided to discontinue the EL6 repositories as I prefer to focus my time on Alpine. I removed all binary RPMs but SRPMS will stay available.  &lt;/p&gt;
&lt;p&gt;Please check &lt;a href="http://www.mauras.ch/pages/repositories.html"&gt;repositories&lt;/a&gt; page for details.  &lt;/p&gt;
&lt;p&gt;As usual feel free to &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact&lt;/a&gt; me if you encounter any issues.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="alpinelinux"></category></entry><entry><title>Kickstart: Securely save your Rudder/CFEngine's agent keys during installation</title><link href="http://www.mauras.ch/kickstart-securely-save-your-ruddercfengines-agent-keys-during-installation.html" rel="alternate"></link><published>2016-06-08T14:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2016-06-08:/kickstart-securely-save-your-ruddercfengines-agent-keys-during-installation.html</id><summary type="html">&lt;p&gt;Reinstalling a server, be it for testing or upgrade, I'm sure you've had the need to.&lt;br /&gt;
If you use &lt;a href="http://www.rudder-project.org"&gt;Rudder&lt;/a&gt;/CFEngine, you know you need to take care of those little agent keys if you …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Reinstalling a server, be it for testing or upgrade, I'm sure you've had the need to.&lt;br /&gt;
If you use &lt;a href="http://www.rudder-project.org"&gt;Rudder&lt;/a&gt;/CFEngine, you know you need to take care of those little agent keys if you don't want to have problems with your configuration management. Indeed you could end up deleting your node in your &lt;a href="http://www.rudder-project.org"&gt;Rudder&lt;/a&gt; interface, but this is taking you a bit away of a fully automated process isn't it?&lt;br /&gt;
I've noted that the less I mess up with my agent keys, the less I need to do manual tasks, so it would be nice if I could ensure a server keeps the same agent key for as long as it exists.  &lt;/p&gt;
&lt;p&gt;Now the main issue is that the kickstart file concerning a server is &lt;em&gt;publicly&lt;/em&gt; available as it must be fetched by the machine when it starts its installation - One could try to put some address restrictions in place, but I felt like it would be a burden... I'm not sure I'll be on the correct subnet next time I need to verify a Kickstart file for a server - that means that the saving process will be in clear for everyone that gets access to the kickstart file.&lt;br /&gt;
Having someone getting access to a server agent key could have dramatic results, so the saving process must be as secure as possible.  &lt;/p&gt;
&lt;p&gt;To summarize:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Must be easy to save/retrieve the key during Kickstart process - No need to fire up a restore from a backup agent or anything, it's fully automated&lt;/li&gt;
&lt;li&gt;Saving process logic is in clear for everyone&lt;/li&gt;
&lt;li&gt;Secure enough that anyone can't just retrieve your server key&lt;/li&gt;
&lt;li&gt;Server identifier must be unique so that keys can be retrieved easily across reinstallations&lt;/li&gt;
&lt;li&gt;Lowest dependancy possible during Kickstart - curl, sha512sum&lt;/li&gt;
&lt;li&gt;It's fine for Root user to be able to retrieve the saved server keys - If you're root on the server you can already access its CFEngine keys...&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I've decided to use the &lt;em&gt;system-uuid&lt;/em&gt; that is contained in &lt;code&gt;/sys/class/dmi/id/product_uuid&lt;/code&gt;. You can find it as well using &lt;code&gt;dmidecode&lt;/code&gt; or &lt;code&gt;lshw&lt;/code&gt; as Root.&lt;br /&gt;
Mind you that depending of your setup, this may not work for you - especially on VMs where you could get duplicates if they're not centrally managed.&lt;br /&gt;
&lt;strong&gt;Warning&lt;/strong&gt;: Older distributions that still use &lt;code&gt;HAL&lt;/code&gt; may let this information leak to non privileged users through &lt;code&gt;lshal&lt;/code&gt;. It requires &lt;code&gt;HAL&lt;/code&gt; to be installed and the service to be started though ... Beware of default installations!  &lt;/p&gt;
&lt;p&gt;Now that I have my system UUID, I'll make a hash of it - a long one - and upload/retrieve my keys from an HTTP server using my hash as filename/prefix.&lt;br /&gt;
Why over HTTP ? Simply because it requires nothing else than &lt;code&gt;curl&lt;/code&gt; to do so, and that it can be hosted pretty much anywhere you want. For that very specific need, I've made a tiny &lt;a href="http://git.mauras.ch/Various/http_store"&gt;HTTP file server&lt;/a&gt; that only does:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Stores a file uploaded by its name&lt;/li&gt;
&lt;li&gt;Cannot overwrite a file that already exists&lt;/li&gt;
&lt;li&gt;Download a file by its name&lt;/li&gt;
&lt;li&gt;Returns 404 if filename is unknown&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Please find below the Cobbler snippet that will do just that.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;#set $rudder_cf_path    = &amp;#39;/var/rudder/CFEngine-community&amp;#39;&lt;/span&gt;
&lt;span class="c1"&gt;#set $rudder_opt_path   = &amp;#39;/opt/rudder&amp;#39;&lt;/span&gt;
&lt;span class="c1"&gt;#set $rudder_keys_path  = $rudder_cf_path + &amp;#39;/ppkeys&amp;#39;&lt;/span&gt;

&lt;span class="c1"&gt;# Generate server unique hash&lt;/span&gt;
&lt;span class="nv"&gt;SRV_UUID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;cat&lt;span class="w"&gt; &lt;/span&gt;/sys/class/dmi/id/product_uuid&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="nv"&gt;SRV_HASH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-n&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;SRV_UUID&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;sha512sum&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;cut&lt;span class="w"&gt; &lt;/span&gt;-f&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-d&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Check if our hash exist&lt;/span&gt;
curl&lt;span class="w"&gt; &lt;/span&gt;-X&lt;span class="w"&gt; &lt;/span&gt;GET&lt;span class="w"&gt; &lt;/span&gt;https://&lt;span class="nv"&gt;$http_store&lt;/span&gt;:8080/get/&lt;span class="se"&gt;\$&lt;/span&gt;SRV_HASH.pub&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/tmp/localhost.pub
grep&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;404 page not found&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;/tmp/localhost.pub&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/dev/null
&lt;span class="nv"&gt;RET&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;?

&lt;span class="c1"&gt;# Process result&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="se"&gt;\$&lt;/span&gt;&lt;span class="nv"&gt;RET&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;# Keys doesn&amp;#39;t exist upload them&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;curl&lt;span class="w"&gt; &lt;/span&gt;-s&lt;span class="w"&gt; &lt;/span&gt;-X&lt;span class="w"&gt; &lt;/span&gt;POST&lt;span class="w"&gt; &lt;/span&gt;https://&lt;span class="nv"&gt;$http_store&lt;/span&gt;:8080/add/&lt;span class="se"&gt;\$&lt;/span&gt;SRV_HASH.priv&lt;span class="w"&gt; &lt;/span&gt;-F&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;file=@&lt;/span&gt;&lt;span class="nv"&gt;$rudder_keys_path&lt;/span&gt;&lt;span class="s2"&gt;/localhost.priv&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;curl&lt;span class="w"&gt; &lt;/span&gt;-s&lt;span class="w"&gt; &lt;/span&gt;-X&lt;span class="w"&gt; &lt;/span&gt;POST&lt;span class="w"&gt; &lt;/span&gt;https://&lt;span class="nv"&gt;$http_store&lt;/span&gt;:8080/add/&lt;span class="se"&gt;\$&lt;/span&gt;SRV_HASH.pub&lt;span class="w"&gt; &lt;/span&gt;-F&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;file=@&lt;/span&gt;&lt;span class="nv"&gt;$rudder_keys_path&lt;/span&gt;&lt;span class="s2"&gt;/localhost.pub&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;curl&lt;span class="w"&gt; &lt;/span&gt;-s&lt;span class="w"&gt; &lt;/span&gt;-X&lt;span class="w"&gt; &lt;/span&gt;POST&lt;span class="w"&gt; &lt;/span&gt;https://&lt;span class="nv"&gt;$http_store&lt;/span&gt;:8080/add/&lt;span class="se"&gt;\$&lt;/span&gt;SRV_HASH.hive&lt;span class="w"&gt; &lt;/span&gt;-F&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;file=@&lt;/span&gt;&lt;span class="nv"&gt;$rudder_opt_path&lt;/span&gt;&lt;span class="s2"&gt;/etc/uuid.hive&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;# They seem to exist download them &lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;curl&lt;span class="w"&gt; &lt;/span&gt;-s&lt;span class="w"&gt; &lt;/span&gt;-X&lt;span class="w"&gt; &lt;/span&gt;GET&lt;span class="w"&gt; &lt;/span&gt;https://&lt;span class="nv"&gt;$http_store&lt;/span&gt;:8080/get/&lt;span class="se"&gt;\$&lt;/span&gt;SRV_HASH.priv&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$rudder_keys_path&lt;/span&gt;/localhost.priv
&lt;span class="w"&gt;    &lt;/span&gt;curl&lt;span class="w"&gt; &lt;/span&gt;-s&lt;span class="w"&gt; &lt;/span&gt;-X&lt;span class="w"&gt; &lt;/span&gt;GET&lt;span class="w"&gt; &lt;/span&gt;https://&lt;span class="nv"&gt;$http_store&lt;/span&gt;:8080/get/&lt;span class="se"&gt;\$&lt;/span&gt;SRV_HASH.pub&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$rudder_keys_path&lt;/span&gt;/localhost.pub
&lt;span class="w"&gt;    &lt;/span&gt;curl&lt;span class="w"&gt; &lt;/span&gt;-s&lt;span class="w"&gt; &lt;/span&gt;-X&lt;span class="w"&gt; &lt;/span&gt;GET&lt;span class="w"&gt; &lt;/span&gt;https://&lt;span class="nv"&gt;$http_store&lt;/span&gt;:8080/get/&lt;span class="se"&gt;\$&lt;/span&gt;SRV_HASH.hive&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$rudder_opt_path&lt;/span&gt;/etc/uuid.hive
&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So with this code you generate a hash that is never printed anywhere in the kickstart file nor on the installed system but only gets saved/retrieved remotely on/from a HTTP file server.&lt;br /&gt;
This example uses &lt;a href="http://www.rudder-project.org"&gt;Rudder&lt;/a&gt; default path but by using Cobbler you could easily set the path based on a profil ksmeta to make it available for CFEngine as well.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="c1"&gt;#set $ppkeys_path = $getVar(&amp;#39;$ppkeys_path&amp;#39;, &amp;#39;/var/lib/cfengine/ppkeys&amp;#39;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The code will store files looking like this on your HTTP file server:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;0bc29c7d604b38c14c42b495c075e003e2b1cc36f92d60ad70eb9c5c2408175ff72d6038dfca6a2a1fe1a8c4032642650295a4bc7dab8d57177942092c83e78b.hive
0bc29c7d604b38c14c42b495c075e003e2b1cc36f92d60ad70eb9c5c2408175ff72d6038dfca6a2a1fe1a8c4032642650295a4bc7dab8d57177942092c83e78b.priv
0bc29c7d604b38c14c42b495c075e003e2b1cc36f92d60ad70eb9c5c2408175ff72d6038dfca6a2a1fe1a8c4032642650295a4bc7dab8d57177942092c83e78b.pub
906e84086789e32421a45622286e096a735c36cd636934bc91dcb8c280a8b4424958452903199bb133330721402fb12bbf175c78ea706d4f54d089dc15567863.hive
906e84086789e32421a45622286e096a735c36cd636934bc91dcb8c280a8b4424958452903199bb133330721402fb12bbf175c78ea706d4f54d089dc15567863.priv
906e84086789e32421a45622286e096a735c36cd636934bc91dcb8c280a8b4424958452903199bb133330721402fb12bbf175c78ea706d4f54d089dc15567863.pub
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So that even you shouldn't know which file comes from which server.  &lt;/p&gt;
&lt;p&gt;Now your reinstallation should be as simple as wiping your disk boot sectors and reboot.  &lt;/p&gt;
&lt;p&gt;As usual, feel free to &lt;a href="/pages/contact.html"&gt;contact&lt;/a&gt; me if you have any question!&lt;/p&gt;</content><category term="Rudder"></category><category term="Rudder"></category><category term="http_store"></category><category term="kickstart"></category><category term="cobbler"></category></entry><entry><title>Systemd: Run it last ...</title><link href="http://www.mauras.ch/systemd-run-it-last.html" rel="alternate"></link><published>2016-02-26T06:00:00+01:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2016-02-26:/systemd-run-it-last.html</id><summary type="html">&lt;p&gt;You remember the good ol' days when running a command &lt;em&gt;last&lt;/em&gt; was as easy as &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;last_command&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/etc/rc.local
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Sure you do, and I bet you also know that now that &lt;a href="https://www.freedesktop.org/wiki/Software/systemd/"&gt;systemd&lt;/a&gt; has become …&lt;/p&gt;</summary><content type="html">&lt;p&gt;You remember the good ol' days when running a command &lt;em&gt;last&lt;/em&gt; was as easy as &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;last_command&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/etc/rc.local
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Sure you do, and I bet you also know that now that &lt;a href="https://www.freedesktop.org/wiki/Software/systemd/"&gt;systemd&lt;/a&gt; has become the default init on pretty much all major distributions, it doesn't work anymore.&lt;br /&gt;
Wait, &lt;code&gt;/etc/rc.local&lt;/code&gt; still works and a lot of people will jump on the occasion to tell you, but &lt;strong&gt;NO&lt;/strong&gt;, it doesn't work to run your command &lt;em&gt;last&lt;/em&gt;. It's even written there in the file&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run &amp;#39;chmod +x /etc/rc.d/rc.local&amp;#39; to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Yes that means that putting command there will have them run in parallel with the other services and you have no control over it.  &lt;/p&gt;
&lt;p&gt;Did it need improvement? Well maybe, I particularly like how &lt;a href="https://wiki.gentoo.org/wiki/Project:OpenRC"&gt;openrc&lt;/a&gt; has handled the local service. Let's look at the README in &lt;code&gt;/etc/local.d&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;This directory should contain programs or scripts which are to be run
when the local service is started or stopped.

If a file in this directory is executable and it has a .start extension,
it will be run when the local service is started. If a file is
executable and it has a .stop extension, it will be run when the local
service is stopped.

All files are processed in lexical order.

Keep in mind that files in this directory are processed sequencially,
and the local service is not considered started or stopped until
everything is processed, so if you have a process which takes a long
time to run, it can delay your boot or shutdown processing.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Seems like a smart way of enhancing the feature to me.  &lt;/p&gt;
&lt;p&gt;But let's get back to our concern, how does one run a command &lt;em&gt;last&lt;/em&gt; on &lt;a href="https://www.freedesktop.org/wiki/Software/systemd/"&gt;systemd&lt;/a&gt;?&lt;br /&gt;
When you reach to people which are supposedly knowledgeable about &lt;a href="https://www.freedesktop.org/wiki/Software/systemd/"&gt;systemd&lt;/a&gt;, you often end up with this kind of discussion:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;you: Hello, I&amp;#39;m wondering what would be the best way to paint my car red?
them: Why don&amp;#39;t you first start telling us why you think you need to paint your car red
you: ??? I want it red that&amp;#39;s all ???
them: Well usually people think they _want_ their car red, but that&amp;#39;s wrong, they just _need_ it black
you: Well I don&amp;#39;t _need_ it black I _want_ it red
them: Yep, you _want_ it black
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Yes, true story, people will try to make you think that you don't need/want to run anything &lt;em&gt;last&lt;/em&gt;. Well aren't we using Linux because we like the idea of being able to do what we &lt;em&gt;want&lt;/em&gt; with our systems? Seems like mentality is changing...  &lt;/p&gt;
&lt;p&gt;Come on there must be a way?! Yes there is, and this is how you do:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a new custom target&lt;/li&gt;
&lt;li&gt;Make this target &lt;code&gt;Requires&lt;/code&gt; multi-user.target&lt;/li&gt;
&lt;li&gt;Create a unit file for your command with &lt;code&gt;After&lt;/code&gt; multi-user.target&lt;/li&gt;
&lt;li&gt;Put the unit file in &lt;code&gt;custom.target.wants&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Make this new custom target default&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sounds easy right? Here's a bit more details.  &lt;/p&gt;
&lt;h4 id="create-a-new-custom-target"&gt;Create a new custom target&lt;/h4&gt;
&lt;p&gt;/etc/systemd/system/custom.target&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;[Unit]&lt;/span&gt;
&lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;Custom Target&lt;/span&gt;
&lt;span class="na"&gt;Requires&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;multi-user.target&lt;/span&gt;
&lt;span class="na"&gt;After&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;multi-user.target&lt;/span&gt;
&lt;span class="na"&gt;AllowIsolate&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;yes&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Here you have a new target that should run after multi-user.target that can be used in a similar way as a runlevel thanks to &lt;a href="https://www.freedesktop.org/software/systemd/man/systemd.unit.html#AllowIsolate="&gt;AllowIsolate&lt;/a&gt;  &lt;/p&gt;
&lt;h4 id="create-a-unit-file-for-your-command"&gt;Create a unit file for your command&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="k"&gt;[Unit]&lt;/span&gt;
&lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;My last command&lt;/span&gt;
&lt;span class="na"&gt;After&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;multi-user.target&lt;/span&gt;

&lt;span class="k"&gt;[Service]&lt;/span&gt;
&lt;span class="na"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;simple&lt;/span&gt;
&lt;span class="na"&gt;ExecStart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/sbin/last_command&lt;/span&gt;

&lt;span class="k"&gt;[Install]&lt;/span&gt;
&lt;span class="na"&gt;WantedBy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;custom.target&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;After&lt;/code&gt; is important here else it'll be run in parallel with other services of multi-user.target.
You wanna put this service file in &lt;code&gt;/etc/systemd/system/custom.target.wants&lt;/code&gt; directory.  &lt;/p&gt;
&lt;h4 id="make-your-new-target-default"&gt;Make your new target default&lt;/h4&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;systemctl&lt;span class="w"&gt; &lt;/span&gt;list-units&lt;span class="w"&gt; &lt;/span&gt;--type&lt;span class="w"&gt; &lt;/span&gt;target&lt;span class="w"&gt; &lt;/span&gt;--all
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Should show you the complete list of available targets, with your custom.target being &lt;code&gt;inactive&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;systemctl&lt;span class="w"&gt; &lt;/span&gt;isolate&lt;span class="w"&gt; &lt;/span&gt;custom.target
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Will switch your current target to your custom.target. Good time to see if it's working and debug.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;ln&lt;span class="w"&gt; &lt;/span&gt;-sf&lt;span class="w"&gt; &lt;/span&gt;/etc/systemd/system/custom.target&lt;span class="w"&gt; &lt;/span&gt;/etc/systemd/system/default.target
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Will switch your custom target to the default.  &lt;/p&gt;
&lt;p&gt;You can now reboot and enjoy your "last_command" being run &lt;em&gt;last&lt;/em&gt;, but note that services that take time to start, like a Java app, may very well still be starting when "last_command" will be executed.&lt;br /&gt;
If this is an issue you'll have to play with &lt;a href="https://www.freedesktop.org/software/systemd/man/systemd.service.html#ExecStartPre="&gt;ExecStartPre=/ExecStartPost=&lt;/a&gt;  &lt;/p&gt;
&lt;p&gt;When I have to do this to simply run a command &lt;em&gt;last&lt;/em&gt; in my boot process, I clearly miss the good ol' days, and luckily there's still a bunch a excellent distributions that keep the &lt;a href="https://en.wikipedia.org/wiki/KISS_principle"&gt;KISS principle&lt;/a&gt; as a priority.  &lt;/p&gt;
&lt;p&gt;As usual, feel free to &lt;a href="/pages/contact.html"&gt;contact&lt;/a&gt; me!&lt;/p&gt;</content><category term="Howto"></category><category term="systemd"></category><category term="EL7"></category><category term="lol"></category></entry><entry><title>Rudder 3.2: Default group classes</title><link href="http://www.mauras.ch/rudder-32-default-group-classes.html" rel="alternate"></link><published>2016-02-16T06:00:00+01:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2016-02-16:/rudder-32-default-group-classes.html</id><summary type="html">&lt;p&gt;If you've followed the latest Rudder's release note, you've noted in &lt;a href="http://www.rudder-project.org/foswiki/bin/view/System/Documentation:ChangeLog32"&gt;3.2 changelog&lt;/a&gt; - amongst other nice stuff - this new feature:  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add CFEngine classes for each group of a node &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now in Rudder 3.2 …&lt;/p&gt;</summary><content type="html">&lt;p&gt;If you've followed the latest Rudder's release note, you've noted in &lt;a href="http://www.rudder-project.org/foswiki/bin/view/System/Documentation:ChangeLog32"&gt;3.2 changelog&lt;/a&gt; - amongst other nice stuff - this new feature:  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Add CFEngine classes for each group of a node &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Now in Rudder 3.2 you have this new display in the group page:&lt;br /&gt;
&lt;img alt="Display group classes" src="/img/group_classes/display_cfengine_classes.png" /&gt;&lt;/p&gt;
&lt;p&gt;In this example you have two available CFengine classes that you can use in your mustache templates - Or actually anywhere you need to match them:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;group_d57ff100_33c7_410f_82a5_a6098b6de321&lt;/li&gt;
&lt;li&gt;group_test1&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As the group name can change, you also have the possibility to use the group UUID.  &lt;/p&gt;
&lt;p&gt;I believe you've already read &lt;a href="https://www.normation.com/en/blog/2015/11/26/mustache-templating-with-ncf-and-cfengine/"&gt;this nice post&lt;/a&gt; on Normation's blog about the usage of mustache templates with &lt;a href="http://www.ncf.io/"&gt;NCF&lt;/a&gt;.&lt;br /&gt;
Let's see an example with /etc/resolv.conf&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt;vars.parameters.rudder_header&lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;span class="x"&gt;search domain.com&lt;/span&gt;
&lt;span class="x"&gt;options timeout:1&lt;/span&gt;
&lt;span class="x"&gt;options attempts:2&lt;/span&gt;
&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="m m-Attribute"&gt;#classes.group_test1&lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;span class="x"&gt;nameserver 192.168.1.10&lt;/span&gt;
&lt;span class="x"&gt;nameserver 192.168.1.11&lt;/span&gt;
&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="m m-Attribute"&gt;/classes.group_test1&lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="m m-Attribute"&gt;#classes.group_test2&lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;span class="x"&gt;nameserver 10.10.0.10&lt;/span&gt;
&lt;span class="x"&gt;nameserver 10.10.0.11&lt;/span&gt;
&lt;span class="cp"&gt;{{&lt;/span&gt;&lt;span class="m m-Attribute"&gt;/classes.group_test2&lt;/span&gt;&lt;span class="cp"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Group classes are already defined by Rudder now, it's just up to you to have them in your templates.  &lt;/p&gt;
&lt;p&gt;As usual, feel free to &lt;a href="/pages/contact.html"&gt;contact&lt;/a&gt; me if you have any question!&lt;/p&gt;</content><category term="Rudder"></category><category term="Rudder"></category><category term="mustache"></category><category term="template"></category></entry><entry><title>Speed up Rudder new node's detection - 2016 Update</title><link href="http://www.mauras.ch/speed-up-rudder-new-nodes-detection-2016-update.html" rel="alternate"></link><published>2016-02-16T06:00:00+01:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2016-02-16:/speed-up-rudder-new-nodes-detection-2016-update.html</id><summary type="html">&lt;p&gt;In my &lt;a href="/speed-up-rudder-new-nodes-detection.html"&gt;previous article&lt;/a&gt;, I was proposing a way to update the new inventory list sent to &lt;code&gt;Rudder&lt;/code&gt; more quickly.&lt;br /&gt;
Upon upgrading to &lt;a href="http://www.rudder-project.org/foswiki/bin/view/System/Documentation:ChangeLog32"&gt;Rudder 3.2&lt;/a&gt; and &lt;code&gt;CentOS 7&lt;/code&gt; at the same time, this was …&lt;/p&gt;</summary><content type="html">&lt;p&gt;In my &lt;a href="/speed-up-rudder-new-nodes-detection.html"&gt;previous article&lt;/a&gt;, I was proposing a way to update the new inventory list sent to &lt;code&gt;Rudder&lt;/code&gt; more quickly.&lt;br /&gt;
Upon upgrading to &lt;a href="http://www.rudder-project.org/foswiki/bin/view/System/Documentation:ChangeLog32"&gt;Rudder 3.2&lt;/a&gt; and &lt;code&gt;CentOS 7&lt;/code&gt; at the same time, this was not working anymore. It seemed that the way inventories are handled slightly changed and for some reasons &lt;code&gt;inotify&lt;/code&gt; wasn't detecting the inventories creation anymore.&lt;br /&gt;
After some digging, it appears that the inventories are renamed from a temporary &lt;code&gt;.davfs.xxxxx&lt;/code&gt; instead of being created directly in &lt;code&gt;incoming&lt;/code&gt; directory - Seems like a webdav behaviour change in Apache 2.4.  &lt;/p&gt;
&lt;p&gt;Please find below and updated version using &lt;a href="http://man7.org/linux/man-pages/man7/inotify.7.html"&gt;IN_MOVED_TO&lt;/a&gt; event to correctly detect new inventories sent to server - I've kept IN_CREATE event, but it shouldn't be matched anymore, you can safely remove it.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="ch"&gt;#!/usr/bin/python&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;os&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nn"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nn"&gt;subprocess&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nn"&gt;re&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nn"&gt;thread&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nn"&gt;sys&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;pyinotify&lt;/span&gt;

&lt;span class="n"&gt;inventories_path&lt;/span&gt;    &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/var/rudder/inventories/&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;cmd_new_inv_to_cmdb&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/opt/rudder/bin/rudder agent run -b sendInventoryToCmdb&amp;quot;&lt;/span&gt;

&lt;span class="n"&gt;wm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pyinotify&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WatchManager&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;# Watch Manager&lt;/span&gt;
&lt;span class="n"&gt;mask&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pyinotify&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IN_DELETE&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;pyinotify&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IN_CREATE&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;pyinotify&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IN_MOVED_TO&lt;/span&gt; 

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;exec_sendtocmdb&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dummy1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;process&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Popen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd_new_inv_to_cmdb&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;PIPE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stderr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;shell&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;process&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;communicate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt;: &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt; - &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]))&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;EventHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pyinotify&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ProcessEvent&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;process_IN_CREATE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt;: &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt; - &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt; created&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;incoming&amp;quot;&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;.davfs&amp;quot;&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;dummy_tup&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;null&amp;#39;&lt;/span&gt;
                &lt;span class="n"&gt;thread&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;start_new_thread&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exec_sendtocmdb&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dummy_tup&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;process_IN_MOVED_TO&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt;: &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt; - &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt; moved to&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;incoming&amp;quot;&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;.davfs&amp;quot;&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;dummy_tup&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;null&amp;#39;&lt;/span&gt;
                &lt;span class="n"&gt;thread&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;start_new_thread&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exec_sendtocmdb&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dummy_tup&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;process_IN_DELETE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt;: &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt; - &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt; deleted&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;span class="n"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;EventHandler&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;notifier&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pyinotify&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Notifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;wm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;wdd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;wm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add_watch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;inventories_path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rec&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;notifier&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And as we're now using &lt;code&gt;systemd&lt;/code&gt;, here is the unit file to have it running as a service and be automatically respawned in case it should crash.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;[Unit]
Description=Rudder inventory watcher
After=syslog.target network.target

[Service]
Type=simple
Environment=PYTHONUNBUFFERED=true
ExecStart=/sbin/rudder-inventory-watcher
PrivateTmp=true
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As usual, feel free to &lt;a href="/pages/contact.html"&gt;contact&lt;/a&gt; me if you have any question!&lt;/p&gt;</content><category term="Rudder"></category><category term="python"></category><category term="inotify"></category><category term="Rudder"></category><category term="EL7"></category><category term="systemd"></category></entry><entry><title>Introducing g2rudder</title><link href="http://www.mauras.ch/introducing-g2rudder.html" rel="alternate"></link><published>2015-11-11T20:00:00+01:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2015-11-11:/introducing-g2rudder.html</id><summary type="html">&lt;p&gt;Accessing a REST API without the proper tools is often bothersome, especially when you only have a shell and curl at hand - like in a kickstart %post part - and parsing JSON replies or building parameters …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Accessing a REST API without the proper tools is often bothersome, especially when you only have a shell and curl at hand - like in a kickstart %post part - and parsing JSON replies or building parameters can quickly become a mess.&lt;br /&gt;
&lt;a href="http://git.mauras.ch/Rudder/g2rudder"&gt;g2rudder&lt;/a&gt; is here to help you cope with that issue in the form of a gateway written in Go that let's you use &lt;a href="http://www.rudder-project.org/rudder-api-doc/"&gt;Rudder's API&lt;/a&gt; easily in a consistent way.  &lt;/p&gt;
&lt;h3 id="features"&gt;Features&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;Support Rudder server over HTTPS&lt;/li&gt;
&lt;li&gt;Can disable SSL verification and/or provide a root CA certificate&lt;/li&gt;
&lt;li&gt;Groups:&lt;ul&gt;
&lt;li&gt;Add hosts in Rudder groups&lt;/li&gt;
&lt;li&gt;Automatically add regex if provided host contains the following characters: &lt;code&gt;*[]|&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Hosts:&lt;ul&gt;
&lt;li&gt;Check if hostname is pending&lt;/li&gt;
&lt;li&gt;Check if hostname exists&lt;/li&gt;
&lt;li&gt;Get node uuid from hostname&lt;/li&gt;
&lt;li&gt;Accept pending node from hostname&lt;/li&gt;
&lt;li&gt;Add/delete properties&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="usage"&gt;Usage&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="n"&gt;Groups&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="n"&gt;curl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;POST&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;://&lt;/span&gt;&lt;span class="n"&gt;localhost&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;8181&lt;/span&gt;&lt;span class="sr"&gt;/group/&lt;/span&gt;&lt;span class="n"&gt;addHost&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;g_uuid=5af30b6b-c8cd-4405-9d0c-410c2b05e220&amp;amp;host=test.domain.com&amp;quot;&lt;/span&gt;

&lt;span class="n"&gt;Hosts&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;span class="n"&gt;curl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;GET&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;://&lt;/span&gt;&lt;span class="n"&gt;localhost&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;8181&lt;/span&gt;&lt;span class="sr"&gt;/host/is&lt;/span&gt;&lt;span class="n"&gt;Exist&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;test&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;domain&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;com&lt;/span&gt;
&lt;span class="n"&gt;curl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;GET&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;://&lt;/span&gt;&lt;span class="n"&gt;localhost&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;8181&lt;/span&gt;&lt;span class="sr"&gt;/host/is&lt;/span&gt;&lt;span class="n"&gt;Pending&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;test&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;domain&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;com&lt;/span&gt;
&lt;span class="n"&gt;curl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;GET&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;://&lt;/span&gt;&lt;span class="n"&gt;localhost&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;8181&lt;/span&gt;&lt;span class="sr"&gt;/host/g&lt;/span&gt;&lt;span class="n"&gt;etId&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="n"&gt;host&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;test&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;domain&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;com&lt;/span&gt;
&lt;span class="n"&gt;curl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;POST&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;://&lt;/span&gt;&lt;span class="n"&gt;localhost&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;8181&lt;/span&gt;&lt;span class="sr"&gt;/host/&lt;/span&gt;&lt;span class="n"&gt;addProperty&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;host=demo-latest.rudder-project.org&amp;amp;key=KEY1&amp;amp;value=VALUE1&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;curl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;POST&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;://&lt;/span&gt;&lt;span class="n"&gt;localhost&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;8181&lt;/span&gt;&lt;span class="sr"&gt;/host/&lt;/span&gt;&lt;span class="n"&gt;delProperty&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;host=demo-latest.rudder-project.org&amp;amp;key=KEY1&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;curl&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;POST&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="n"&gt;http&lt;/span&gt;&lt;span class="o"&gt;://&lt;/span&gt;&lt;span class="n"&gt;localhost&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;8181&lt;/span&gt;&lt;span class="sr"&gt;/host/&lt;/span&gt;&lt;span class="n"&gt;accept&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;host=demo-latest.rudder-project.org&amp;quot;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
Project readme will be updated along with the addition of new features.&lt;br /&gt;
Don't hesitate to &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact&lt;/a&gt; me if you encounter any issue.&lt;/p&gt;</content><category term="Rudder"></category><category term="rudder"></category><category term="golang"></category><category term="API"></category></entry><entry><title>EL6 extras update and new package: Nginx and Nginx-modsecurity</title><link href="http://www.mauras.ch/el6-extras-update-and-new-package-nginx-and-nginx-modsecurity.html" rel="alternate"></link><published>2015-06-26T14:35:00+02:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2015-06-26:/el6-extras-update-and-new-package-nginx-and-nginx-modsecurity.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;Nginx - &lt;a href="http://nginx.org/en/CHANGES-1.8"&gt;1.8.0&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;Update to new stable release&lt;/li&gt;
&lt;li&gt;Enable http_auth_request_module&lt;/li&gt;
&lt;li&gt;Compile with GCC 4.9.1 from devtoolset-3  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Nginx-modsecurity - &lt;a href="http://nginx.org/en/CHANGES-1.8"&gt;1.8.0&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;Update to new stable release&lt;/li&gt;
&lt;li&gt;Enable http_auth_request_module&lt;/li&gt;
&lt;li&gt;Add modsecurity module - &lt;a href="https://github.com/SpiderLabs/ModSecurity/releases/tag/v2.9.0"&gt;2.9 …&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;Nginx - &lt;a href="http://nginx.org/en/CHANGES-1.8"&gt;1.8.0&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;Update to new stable release&lt;/li&gt;
&lt;li&gt;Enable http_auth_request_module&lt;/li&gt;
&lt;li&gt;Compile with GCC 4.9.1 from devtoolset-3  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Nginx-modsecurity - &lt;a href="http://nginx.org/en/CHANGES-1.8"&gt;1.8.0&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;Update to new stable release&lt;/li&gt;
&lt;li&gt;Enable http_auth_request_module&lt;/li&gt;
&lt;li&gt;Add modsecurity module - &lt;a href="https://github.com/SpiderLabs/ModSecurity/releases/tag/v2.9.0"&gt;2.9.0&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Compile with GCC 4.9.1 from devtoolset-3&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;No reason for those versions to not be identical, minor release may change on &lt;code&gt;-modsecurity&lt;/code&gt; if modification is only on &lt;a href="https://www.modsecurity.org/"&gt;ModSecurity&lt;/a&gt;.&lt;br /&gt;
As usual, you can install the package using my &lt;a href="http://repos.mauras.ch/EL6/el6_extras.repo"&gt;el6_extras&lt;/a&gt; repository, and feel free to &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact&lt;/a&gt; me if you encounter any issues.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="nginx"></category></entry><entry><title>Git replication: Part 1 - The poor man's way</title><link href="http://www.mauras.ch/git-replication-part-1-the-poor-mans-way.html" rel="alternate"></link><published>2015-04-18T05:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2015-04-18:/git-replication-part-1-the-poor-mans-way.html</id><summary type="html">&lt;p&gt;There's a lot of ressources about that on the web, it's a well covered topic already.&lt;br /&gt;
Still I wanted to give out my own way of keeping Git repositories synchronized.  &lt;/p&gt;
&lt;h5 id="main-features"&gt;Main features:&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;It's cheap :)&lt;/li&gt;
&lt;li&gt;It …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;There's a lot of ressources about that on the web, it's a well covered topic already.&lt;br /&gt;
Still I wanted to give out my own way of keeping Git repositories synchronized.  &lt;/p&gt;
&lt;h5 id="main-features"&gt;Main features:&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;It's cheap :)&lt;/li&gt;
&lt;li&gt;It doesn't scale&lt;/li&gt;
&lt;li&gt;Supports pushing/deleting branches and tags&lt;/li&gt;
&lt;li&gt;Uses Git remote to know the remote repositories, no config file needed&lt;/li&gt;
&lt;/ul&gt;
&lt;h5 id="prerequisites"&gt;Prerequisites:&lt;/h5&gt;
&lt;ul&gt;
&lt;li&gt;You've set your remotes correctly in your - bare - repository&lt;/li&gt;
&lt;li&gt;You've set your SSH key(s) as needed&lt;/li&gt;
&lt;/ul&gt;
&lt;h5 id="installation"&gt;Installation:&lt;/h5&gt;
&lt;p&gt;&lt;code&gt;cp &amp;lt;the following script&amp;gt; &amp;lt;your Git repo&amp;gt;/hooks/post-receive &amp;amp;&amp;amp; chmod +x &amp;lt;your Git repo&amp;gt;/hooks/post-receive&lt;/code&gt;  &lt;/p&gt;
&lt;h5 id="the-hook"&gt;The hook:&lt;/h5&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="ch"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="c1"&gt;# Read commit values&lt;/span&gt;
&lt;span class="nb"&gt;read&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;oldrev&lt;span class="w"&gt; &lt;/span&gt;newrev&lt;span class="w"&gt; &lt;/span&gt;refname
&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;post-receive&amp;quot;&lt;/span&gt;

&lt;span class="c1"&gt;# Is the action a delete ?&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$newrev&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;0000000000000000000000000000000000000000&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;PUSH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;push --delete&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;else&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;PUSH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;push&amp;quot;&lt;/span&gt;
&lt;span class="k"&gt;fi&lt;/span&gt;

&lt;span class="c1"&gt;# Get out if there&amp;#39;s no remote set&lt;/span&gt;
&lt;span class="nv"&gt;REMOTE&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;git&lt;span class="w"&gt; &lt;/span&gt;remote&lt;span class="k"&gt;)&lt;/span&gt;
&lt;span class="o"&gt;[[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-z&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$REMOTE&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;!! No remote set&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;exit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;

&lt;span class="c1"&gt;# Else loop and push to them&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;remote&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;in&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;REMOTE&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;do&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;git&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$PUSH&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$remote&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$refname&lt;/span&gt;
&lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So you get it as it's looping over the remotes, having more than 2 or 3 will seriously make long pushes... Still works like a charm to keep an external copy of your repository.&lt;/p&gt;</content><category term="Howto"></category><category term="Git"></category><category term="hook"></category></entry><entry><title>EL6 extras updates: Nginx, Uwsgi and GeoIP</title><link href="http://www.mauras.ch/el6-extras-updates-nginx-uwsgi-and-geoip.html" rel="alternate"></link><published>2015-04-16T20:00:00+02:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2015-04-16:/el6-extras-updates-nginx-uwsgi-and-geoip.html</id><content type="html">&lt;ul&gt;
&lt;li&gt;Nginx - &lt;a href="http://nginx.org/en/CHANGES-1.6"&gt;1.6.3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Uwsgi - &lt;a href="https://github.com/unbit/uwsgi/releases/tag/2.0.10"&gt;2.0.10&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;GeoIP - &lt;a href="https://github.com/maxmind/geoip-api-c/releases/tag/v1.6.5"&gt;1.6.5&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As usual, you can install the package using my &lt;a href="http://repos.mauras.ch/EL6/el6_extras.repo"&gt;el6_extras&lt;/a&gt; repository, and feel free to &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact&lt;/a&gt; me if you encounter any issues.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="nginx"></category><category term="uwsgi"></category></entry><entry><title>Consul update - 0.5.0</title><link href="http://www.mauras.ch/consul-update-050.html" rel="alternate"></link><published>2015-02-23T20:00:00+01:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2015-02-23:/consul-update-050.html</id><content type="html">&lt;ul&gt;
&lt;li&gt;Consul - &lt;a href="https://github.com/hashicorp/consul/blob/master/CHANGELOG.md"&gt;0.5.0&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As usual, you can install the package using my &lt;a href="http://repos.mauras.ch/EL6/el6_extras.repo"&gt;el6_extras&lt;/a&gt; repository, and feel free to &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact&lt;/a&gt; me if you encounter any issues.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="consul"></category></entry><entry><title>Grsecurity update - 3.14.33-100</title><link href="http://www.mauras.ch/grsecurity-update-31433-100.html" rel="alternate"></link><published>2015-02-19T12:30:00+01:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2015-02-19:/grsecurity-update-31433-100.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.33-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.33-201502181906&lt;/li&gt;
&lt;li&gt;Upgrade to devtoolset 3 with GCC 4.9.1&lt;/li&gt;
&lt;li&gt;Add overlayfs patch from &lt;a href="https://github.com/openwrt-mirror/openwrt/blob/master/target/linux/generic/patches-3.14/100-overlayfs.patch"&gt;openwrt&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Include kernel config in tarball
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.33-100&amp;amp;id2=linux-grsecurity-3.14.28-100"&gt;my …&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.33-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.33-201502181906&lt;/li&gt;
&lt;li&gt;Upgrade to devtoolset 3 with GCC 4.9.1&lt;/li&gt;
&lt;li&gt;Add overlayfs patch from &lt;a href="https://github.com/openwrt-mirror/openwrt/blob/master/target/linux/generic/patches-3.14/100-overlayfs.patch"&gt;openwrt&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Include kernel config in tarball
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.33-100&amp;amp;id2=linux-grsecurity-3.14.28-100"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The biggest change is actually how I now handle the branches for package tagging on the &lt;a href="http://git.mauras.ch/linux-grsecurity/"&gt;Git repo&lt;/a&gt;.&lt;br /&gt;
Up until now package tagging couldn't reflect any configuration change and the overrall numbering was then not so consistent. I'm now adding a branch &lt;code&gt;-coredumb&lt;/code&gt; wich contains modifications on top of the &lt;code&gt;Grsecurity&lt;/code&gt; patchset - Like &lt;a href="https://github.com/openwrt-mirror/openwrt/blob/master/target/linux/generic/patches-3.14/100-overlayfs.patch"&gt;overlayfs&lt;/a&gt; patch addition - as well as the full kernel configuration. All package tags will now be based on a &lt;code&gt;-coredumb&lt;/code&gt; branch.  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;At least on some servers - CPU related ? - &lt;code&gt;pcid&lt;/code&gt; detection is still broken... &lt;/p&gt;
&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Update: Nginx + Uwsgi + Cgit</title><link href="http://www.mauras.ch/update-nginx-uwsgi-cgit.html" rel="alternate"></link><published>2015-02-05T01:36:00+01:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2015-02-05:/update-nginx-uwsgi-cgit.html</id><summary type="html">&lt;h2 id="update"&gt;Update:&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://www.linkedin.com/profile/view?id=206424096"&gt;Steeve Chailloux&lt;/a&gt; notified me that this howto wasn't updated to the latest release of the &lt;code&gt;uwsgi&lt;/code&gt; package that now have all modules as plugins.&lt;br /&gt;
You should read the following:  &lt;/p&gt;
&lt;h4 id="install-the-packages"&gt;Install the packages&lt;/h4&gt;
&lt;p&gt;Now that …&lt;/p&gt;</summary><content type="html">&lt;h2 id="update"&gt;Update:&lt;/h2&gt;
&lt;p&gt;&lt;a href="https://www.linkedin.com/profile/view?id=206424096"&gt;Steeve Chailloux&lt;/a&gt; notified me that this howto wasn't updated to the latest release of the &lt;code&gt;uwsgi&lt;/code&gt; package that now have all modules as plugins.&lt;br /&gt;
You should read the following:  &lt;/p&gt;
&lt;h4 id="install-the-packages"&gt;Install the packages&lt;/h4&gt;
&lt;p&gt;Now that you're good with the repository, install the packages:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# yum -y install nginx uwsgi uwsgi-cgi cgit
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h4 id="configure-uwsgi"&gt;Configure Uwsgi&lt;/h4&gt;
&lt;p&gt;Just add this simple conf&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# mkdir /etc/uwsgi
# cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/uwsgi.d/cgit.ini
[uwsgi]
plugin = cgi
socket = 127.0.0.1:8080
uid = cgit
gid = cgit
processes = 1
threads = 2
cgi = /usr/libexec/cgit/cgit.cgi
EOF
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;There's no init script provided in my package yet, so just manually run - or any way you want&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# uwsgi --plugins-dir /usr/lib64/uwsgi/ --ini /etc/uwsgi.d/cgit.ini &amp;amp;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;hr /&gt;
&lt;h2 id="original-post"&gt;Original post:&lt;/h2&gt;
&lt;p&gt;As you've seen in my previous post, there's been some package updates in the &lt;code&gt;EL6 Extras&lt;/code&gt; repository, so let's have some fun with them!  &lt;/p&gt;
&lt;p&gt;First you indeed need my &lt;code&gt;EL6 Extras&lt;/code&gt; repository if it's not done yet, please start with the &lt;a href="pages/repositories.html"&gt;repositories&lt;/a&gt; page.  &lt;/p&gt;
&lt;h4 id="install-the-packages_1"&gt;Install the packages&lt;/h4&gt;
&lt;p&gt;Now that you're good with the repository, install the packages:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# yum -y install nginx uwsgi cgit
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h4 id="configure-cgit"&gt;Configure Cgit&lt;/h4&gt;
&lt;p&gt;The default config from the package is pretty sane, the only thing you'll need to add to your &lt;code&gt;/etc/gitrc&lt;/code&gt; - And indeed your &lt;code&gt;Git&lt;/code&gt; repositories config - is:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;virtual-root&lt;span class="o"&gt;=&lt;/span&gt;/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This will keep &lt;code&gt;cgit&lt;/code&gt; from adding &lt;code&gt;cgit.cgi&lt;/code&gt; to your URL.&lt;br /&gt;
To enable syntax highlighting, uncomment the following line in your &lt;code&gt;/etc/cgitrc&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;source-filter=/usr/libexec/cgit/filters/syntax-highlighting.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Then install &lt;code&gt;pygments&lt;/code&gt; package&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# yum -y install python-pygments
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h4 id="configure-uwsgi_1"&gt;Configure Uwsgi&lt;/h4&gt;
&lt;p&gt;Just add this simple conf&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# mkdir /etc/uwsgi
# cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/uwsgi/cgit.ini
[uwsgi]
socket = 127.0.0.1:8080
uid = cgit
gid = cgit
processes = 1
threads = 2
cgi = /usr/libexec/cgit/cgit.cgi
EOF
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;There's no init script provided in my package yet, so just manually run - or any way you want&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# uwsgi --ini /etc/uwsgi/cgit.ini &amp;amp;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h4 id="configure-nginx"&gt;Configure Nginx&lt;/h4&gt;
&lt;p&gt;Finally just add this simple &lt;code&gt;server&lt;/code&gt; block to your Nginx config and customize it to your needs&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;server {
    # Change this to your taste
    listen       80 default_server;
    server_name  _;

    # We want to serve cgit static content from /usr/share/cgit and let Nginx cache it
    location ~* ^.+(cgit.(css|png)|favicon.ico) {
        root /usr/share/cgit;
        expires 30d;
    }

    # Now forward everything else to our uwsgi instance
    location / {
        include uwsgi_params;
        uwsgi_modifier1 9;
        uwsgi_pass 127.0.0.1:8080;
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Start Nginx, and enjoy your &lt;code&gt;Cgit&lt;/code&gt; running on your &lt;code&gt;server_name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;As usual, &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; if you have any question.&lt;/p&gt;</content><category term="Howto"></category><category term="el6"></category><category term="nginx"></category><category term="uwsgi"></category><category term="cgit"></category></entry><entry><title>Securing Consul</title><link href="http://www.mauras.ch/securing-consul.html" rel="alternate"></link><published>2015-02-02T23:00:00+01:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2015-02-02:/securing-consul.html</id><summary type="html">&lt;div class="toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#consul"&gt;Consul&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#binary-execution-rights-and-user-running-the-daemon"&gt;Binary execution rights and user running the daemon&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#prevent-users-to-execute-their-own-consul-binary"&gt;Prevent users to execute their own Consul binary&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#configuration-access-rights"&gt;Configuration access rights&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#prevent-rogue-nodes-joining-the-cluster"&gt;Prevent rogue nodes joining the cluster&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#encrypt"&gt;Encrypt&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tls"&gt;TLS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#disable-remote-execution"&gt;Disable remote execution&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#prevent-http-api-from-clients"&gt;Prevent HTTP API from …&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;</summary><content type="html">&lt;div class="toc"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#consul"&gt;Consul&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#binary-execution-rights-and-user-running-the-daemon"&gt;Binary execution rights and user running the daemon&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#prevent-users-to-execute-their-own-consul-binary"&gt;Prevent users to execute their own Consul binary&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#configuration-access-rights"&gt;Configuration access rights&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#prevent-rogue-nodes-joining-the-cluster"&gt;Prevent rogue nodes joining the cluster&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#encrypt"&gt;Encrypt&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#tls"&gt;TLS&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#disable-remote-execution"&gt;Disable remote execution&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#prevent-http-api-from-clients"&gt;Prevent HTTP API from clients&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#completely"&gt;Completely&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#allow-some-users"&gt;Allow some users&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#keyvalue-store-acls"&gt;Key/Value store ACLs&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="#deny-by-default"&gt;Deny by default&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#add-rights-per-key"&gt;Add rights per key&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#actually-running-consul"&gt;Actually running Consul&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#wrap-it-all-up"&gt;Wrap it all up&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;h2 id="consul"&gt;Consul&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://www.consul.io"&gt;Consul&lt;/a&gt; is an excellent piece of software, really. I don't think I've been this excited by any other software for the last couple of years.&lt;br /&gt;
As they state in their &lt;a href="https://consul.io/intro/index.html"&gt;Intro&lt;/a&gt; page : &lt;em&gt;Consul has multiple components, but as a whole, it is a tool for discovering and configuring services in your infrastructure&lt;/em&gt;&lt;br /&gt;
&lt;a href="http://www.consul.io"&gt;Consul&lt;/a&gt; is well documented, robust, fast, replicated, datacenter aware, integrates a Key/Value store, etc...  And their IRC community is very friendly.  &lt;/p&gt;
&lt;p&gt;The only major flaw I've found, is that by default, it is not &lt;em&gt;secure enough&lt;/em&gt;.&lt;br /&gt;
What I mean by not &lt;em&gt;secure enough&lt;/em&gt;, is that you must take a good care of how you configure and run the service if you don't wish to let too much opened doors to a &lt;em&gt;harmful user&lt;/em&gt;.  &lt;/p&gt;
&lt;p&gt;Here's a list of &lt;em&gt;threats&lt;/em&gt; I've identified - Please mind that a threat for me may very well be a nice feature for you - followed by configuration to circumvent them: &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Any node could join your cluster and access sensitive information&lt;/li&gt;
&lt;li&gt;Any user on any joined node can access cluster details/information&lt;/li&gt;
&lt;li&gt;Any user on any joined node can execute cluster wide remote commands&lt;/li&gt;
&lt;li&gt;Any user on any joined node can tamper with the HTTP API and&lt;ul&gt;
&lt;li&gt;Declare potentially harmful events&lt;/li&gt;
&lt;li&gt;Declare watches with potentially harmful events&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt;&lt;br /&gt;
All the commands and system details provided in this excerpt are with an &lt;code&gt;EL6&lt;/code&gt; based distribution in mind. Configurations and data paths are purely based by choice.&lt;br /&gt;
Please adapt accordingly :)&lt;/p&gt;
&lt;h3 id="binary-execution-rights-and-user-running-the-daemon"&gt;Binary execution rights and user running the daemon&lt;/h3&gt;
&lt;p&gt;No surprise here, this is a rule of thumbs for any daemon running on Unix/Linux, privileges must be dropped as much as possible.&lt;br /&gt;
Consul doesn't require you to run it as &lt;code&gt;root&lt;/code&gt; and that's a good thing.&lt;br /&gt;
The thing is, that by using RPC communication, any user on the joined node can run any cluster wide command as well as remote executing command on all your cluster's nodes. It is thus important that any user cannot execute your system wide Consul binary.  &lt;/p&gt;
&lt;p&gt;Start by creating a new dedicated user without any shell access with a dedicated home directory:  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;useradd -d /srv/consul -s /sbin/nologin consul
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;On most distributions it will create a matching default group for your user as well, if not, do so.  &lt;/p&gt;
&lt;p&gt;Ensure that the home directory can only be accessed by the new &lt;code&gt;consul&lt;/code&gt; user and its default group:  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;chown -R consul: /srv/consul
chmod 750 /srv/consul
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Ensure the Consul binary is executable only by &lt;code&gt;root&lt;/code&gt; user and &lt;code&gt;consul&lt;/code&gt; group:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;chown root:consul /usr/sbin/consul
chmod 750 /usr/sbin/consul
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h4 id="prevent-users-to-execute-their-own-consul-binary"&gt;Prevent users to execute their own Consul binary&lt;/h4&gt;
&lt;p&gt;This is a bit out of the Consul scope, and more a matter of user containment, but indeed you must prevent a user to be able to upload and execute his/her own Consul binary.&lt;br /&gt;
The two main solutions i think of:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Mount filesystems where local users have write access with &lt;code&gt;noexec&lt;/code&gt; flag&lt;/li&gt;
&lt;li&gt;&lt;a href="http://grsecurity.net/features.php#tpe"&gt;Trusted Path Execution&lt;/a&gt; from the &lt;a href="_http://grsecurity.net/"&gt;Grsecurity&lt;/a&gt; patchset&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="configuration-access-rights"&gt;Configuration access rights&lt;/h3&gt;
&lt;p&gt;It's important that you forbid any read access of your Consul configuration by other unprivileged user in order to not leak sensible settings.  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;mkdir /etc/consul
chown root:consul /etc/consul
chmod 750 /etc/consul
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id="prevent-rogue-nodes-joining-the-cluster"&gt;Prevent rogue nodes joining the cluster&lt;/h3&gt;
&lt;p&gt;As described in &lt;a href="https://consul.io/docs/agent/encryption.html"&gt;this page&lt;/a&gt; there's two major way to prevent that any untrusted node join your cluster&lt;/p&gt;
&lt;h4 id="encrypt"&gt;Encrypt&lt;/h4&gt;
&lt;p&gt;With the help of &lt;code&gt;consul keygen&lt;/code&gt; command, you can generate gossip encryption key that you can use in your server/agent configuration&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;encrypt&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;UgmMsZwR2XFNGGvJTnpHRg==&amp;quot;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This key must be used on both servers and clients for the communication to work.&lt;/p&gt;
&lt;h4 id="tls"&gt;TLS&lt;/h4&gt;
&lt;p&gt;TLS can/&lt;em&gt;must&lt;/em&gt; be used to verify servers and clients authenticity. Consul requires that all servers and clients have certificates signed by a certificate authority.&lt;br /&gt;
You can leverage the use of your corporate PKI if you have one, just remember as per &lt;a href="https://github.com/golang/go/issues/7423"&gt;this thread&lt;/a&gt; that &lt;a href="http://golang.org/"&gt;Go&lt;/a&gt; requires the certificate to have &lt;code&gt;extendedKeyUsage clientAuth&lt;/code&gt; enabled.&lt;br /&gt;
Here's a sample configuration of enabling TLS:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Servers:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;ca_file&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/etc/consul/ssl/ca_cert.pem&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;cert_file&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/etc/consul/ssl/server.pem&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;key_file&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/etc/consul/ssl/server.key&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;verify_incoming&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;verify_outgoing&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Clients:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;ca_file&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/etc/consul/ssl/ca_cert.pem&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;cert_file&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/etc/consul/ssl/client.pem&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;key_file&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/etc/consul/ssl/client.key&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;verify_outgoing&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id="disable-remote-execution"&gt;Disable remote execution&lt;/h3&gt;
&lt;p&gt;Remote execution let's you execute commands and get the output of said command using&lt;br /&gt;
&lt;code&gt;consul exec "command"&lt;/code&gt;&lt;br /&gt;
So if you were running your Consul daemon as &lt;code&gt;root&lt;/code&gt;, running the command &lt;code&gt;consul exec "shutdown -h now"&lt;/code&gt; would have the tremendous effect of shutting down all your Consul servers as well as all the clients nodes joined to them...&lt;br /&gt;
There's luckily a configuration option that should in my opinion be enabled by default:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;disable_remote_exec&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now this remote execution feature could prove itself useful... This is why you limit its availability per node - Consul servers should never have it enabled - as well as its execution rights, by running the Consul binary with the unprivileged &lt;code&gt;consul&lt;/code&gt; user we created earlier which you can couple with &lt;code&gt;sudo&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="prevent-http-api-from-clients"&gt;Prevent HTTP API from clients&lt;/h2&gt;
&lt;p&gt;Consul &lt;a href="https://consul.io/docs/agent/http.html"&gt;HTTP API&lt;/a&gt; is by default available for all joined nodes on &lt;code&gt;http://localhost:8500&lt;/code&gt;, this means that by default anyone connected on a cluster's node can use the API and/or K/V store to gather informations or change settings.&lt;/p&gt;
&lt;h3 id="completely"&gt;Completely&lt;/h3&gt;
&lt;p&gt;Plain and simple, use &lt;code&gt;iptables&lt;/code&gt; to prevent access to the port:  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;iptables&lt;span class="w"&gt; &lt;/span&gt;-A&lt;span class="w"&gt; &lt;/span&gt;OUTPUT&lt;span class="w"&gt; &lt;/span&gt;-p&lt;span class="w"&gt; &lt;/span&gt;tcp&lt;span class="w"&gt; &lt;/span&gt;-m&lt;span class="w"&gt; &lt;/span&gt;tcp&lt;span class="w"&gt; &lt;/span&gt;--dport&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;8500&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-j&lt;span class="w"&gt; &lt;/span&gt;REJECT
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h3 id="allow-some-users"&gt;Allow some users&lt;/h3&gt;
&lt;p&gt;As you may require some of your nodes to be able to access the API and/or the K/V store, you can use the &lt;code&gt;ipt_owner&lt;/code&gt; module of &lt;code&gt;iptables&lt;/code&gt;:  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;iptables&lt;span class="w"&gt; &lt;/span&gt;-A&lt;span class="w"&gt; &lt;/span&gt;OUTPUT&lt;span class="w"&gt; &lt;/span&gt;-m&lt;span class="w"&gt; &lt;/span&gt;tcp&lt;span class="w"&gt; &lt;/span&gt;-p&lt;span class="w"&gt; &lt;/span&gt;tcp&lt;span class="w"&gt; &lt;/span&gt;--dport&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;8500&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-m&lt;span class="w"&gt; &lt;/span&gt;owner&lt;span class="w"&gt; &lt;/span&gt;--uid-owner&lt;span class="w"&gt; &lt;/span&gt;consul&lt;span class="w"&gt; &lt;/span&gt;-j&lt;span class="w"&gt; &lt;/span&gt;ACCEPT
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This would let only the &lt;code&gt;consul&lt;/code&gt; user access the port locally, which is the user under which your daemon is running, and is unavailable to an unprivileged user.&lt;/p&gt;
&lt;h2 id="keyvalue-store-acls"&gt;Key/Value store ACLs&lt;/h2&gt;
&lt;p&gt;I've found the ACL system for the key/value store quite unsettling, it can be broken out like this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Enable ACL at datacenter level&lt;/li&gt;
&lt;li&gt;Set a master token - Not mandatory but i find it easier to manage&lt;/li&gt;
&lt;li&gt;Chose a default policy&lt;/li&gt;
&lt;li&gt;Set access rules to keys using API&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="deny-by-default"&gt;Deny by default&lt;/h3&gt;
&lt;p&gt;As a habit, i found that denying by default is easier to manage and allow read and/or write accesses per clients.&lt;br /&gt;
Enabling the ACL system is a server only configuration:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;acl_datacenter&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;lt;your datacenter name&amp;gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;acl_master_token&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;f45cbd0b-5022-47ab-8640-4eaa7c1f40f1&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;acl_default_policy&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;deny&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;acl_down_policy&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;deny&amp;quot;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;acl_master_token&lt;/code&gt; can be easily generated with the &lt;code&gt;uuidgen&lt;/code&gt; command but this is just to keep the same thing as Consul generates, it seems to accept any string format.&lt;/p&gt;
&lt;h3 id="add-rights-per-key"&gt;Add rights per key&lt;/h3&gt;
&lt;p&gt;You can list the ACLs using this curl command
&lt;code&gt;curl "http://localhost:8500/v1/acl/list?token=f45cbd0b-5022-47ab-8640-4eaa7c1f40f1&amp;amp;pretty=true"&lt;/code&gt;  &lt;/p&gt;
&lt;p&gt;As an example we'll add an ACL giving &lt;code&gt;read&lt;/code&gt; only permission to the store key &lt;code&gt;git/lastcommit&lt;/code&gt;.  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;First create a text file containing the following &lt;code&gt;json&lt;/code&gt; code:&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;                      &lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;git_slave&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;Type&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;client&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;Rules&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;key git/lastcommit {policy = read}&amp;quot;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Then create the ACL using your &lt;code&gt;acl_master_token&lt;/code&gt;:  &lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;curl&lt;span class="w"&gt; &lt;/span&gt;-X&lt;span class="w"&gt; &lt;/span&gt;PUT&lt;span class="w"&gt; &lt;/span&gt;-d&lt;span class="w"&gt; &lt;/span&gt;@kv_create_rule.json&lt;span class="w"&gt; &lt;/span&gt;http://localhost:8500/v1/acl/create?token&lt;span class="o"&gt;=&lt;/span&gt;f45cbd0b-5022-47ab-8640-4eaa7c1f40f1
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;This &lt;code&gt;curl&lt;/code&gt; command will return you a client token that you can reuse in your agent configurations that need to access - through &lt;a href="http://www.consul.io/docs/agent/watches.html"&gt;watches&lt;/a&gt; - to this key&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nt"&gt;&amp;quot;acl_token&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;d17fade7-2391-45a4-aa00-c9ed5e707e0b&amp;quot;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2 id="actually-running-consul"&gt;Actually running Consul&lt;/h2&gt;
&lt;p&gt;Here's an EL6 based init script to automatically start Consul with the correct user at startup:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="ch"&gt;#!/bin/sh&lt;/span&gt;
&lt;span class="c1"&gt;#&lt;/span&gt;
&lt;span class="c1"&gt;# consul        Start the consul daemon&lt;/span&gt;
&lt;span class="c1"&gt;#&lt;/span&gt;
&lt;span class="c1"&gt;# Author:      Olivier Mauras &amp;lt;olivier@mauras.ch&amp;gt;&lt;/span&gt;
&lt;span class="c1"&gt;#&lt;/span&gt;
&lt;span class="c1"&gt;# chkconfig: 345 99 10&lt;/span&gt;
&lt;span class="c1"&gt;# description: Starts the Consul daemon&lt;/span&gt;
&lt;span class="c1"&gt;#&lt;/span&gt;
&lt;span class="c1"&gt;# processname: consul&lt;/span&gt;

&lt;span class="c1"&gt;# Source function library.&lt;/span&gt;
.&lt;span class="w"&gt; &lt;/span&gt;/etc/rc.d/init.d/functions

&lt;span class="nv"&gt;RETVAL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;

&lt;span class="c1"&gt;# Default variables&lt;/span&gt;
&lt;span class="nv"&gt;CONSUL_BIN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/usr/sbin/consul&amp;quot;&lt;/span&gt;
&lt;span class="nv"&gt;CONSUL_CONF&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/etc/consul&amp;quot;&lt;/span&gt;
&lt;span class="nv"&gt;CONSUL_USER&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;consul&amp;quot;&lt;/span&gt;

&lt;span class="c1"&gt;# See how we were called.&lt;/span&gt;
&lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;in&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;start&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-n&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Starting Consul daemon: &amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;daemon&lt;span class="w"&gt; &lt;/span&gt;--check&lt;span class="w"&gt; &lt;/span&gt;consul&lt;span class="w"&gt; &lt;/span&gt;--user&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$CONSUL_USER&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$CONSUL_BIN&lt;/span&gt;&lt;span class="s2"&gt; agent -config-dir=&lt;/span&gt;&lt;span class="nv"&gt;$CONSUL_CONF&lt;/span&gt;&lt;span class="s2"&gt; &amp;gt; /dev/null 2&amp;gt;&amp;amp;1 &amp;amp;&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;stop&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-n&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Stopping Consul daemon: &amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;killproc&lt;span class="w"&gt; &lt;/span&gt;consul
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;status&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;status&lt;span class="w"&gt; &lt;/span&gt;consul
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nv"&gt;RETVAL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;restart&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nv"&gt;$0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;stop
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nv"&gt;$0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;start
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nv"&gt;RETVAL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;*&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Usage: consul {start|stop|status|restart}&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nb"&gt;exit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;span class="k"&gt;esac&lt;/span&gt;

&lt;span class="nb"&gt;exit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$REVAL&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h2 id="wrap-it-all-up"&gt;Wrap it all up&lt;/h2&gt;
&lt;p&gt;I've made up an RPM package, that takes care of creating the &lt;code&gt;consul&lt;/code&gt; user and setting up the correct rights, on the binary - It also includes the init script :). You can download the &lt;a href="http://repos.mauras.ch/EL6/SRPMS/consul-0.5.0-1.el6.src.rpm"&gt;SRPM&lt;/a&gt; directly or just use my &lt;a href="http://repos.mauras.ch/EL6/el6_extras.repo"&gt;el6 extras&lt;/a&gt; repository.  &lt;/p&gt;
&lt;p&gt;Use your favorite configuration management tool - &lt;a href="http://www.rudder-project.org/site/"&gt;Rudder&lt;/a&gt;? :) - to handle the configuration deployment and &lt;code&gt;/etc/consul&lt;/code&gt; rights.  &lt;/p&gt;
&lt;p&gt;Don't hesitate to &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact&lt;/a&gt; me if you find inconsistencies, or if you have questions about this guide.  &lt;/p&gt;</content><category term="Howto"></category><category term="el6"></category><category term="consul"></category><category term="security"></category></entry><entry><title>New package - Consul 0.4.1</title><link href="http://www.mauras.ch/new-package-consul-041.html" rel="alternate"></link><published>2015-02-02T21:40:00+01:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2015-02-02:/new-package-consul-041.html</id><content type="html">&lt;p&gt;A package addition to my &lt;a href="http://repos.mauras.ch/EL6/el6_extras.repo"&gt;el6_extras&lt;/a&gt; repository.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Consul - 0.4.1&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As usual, you can install the package using my &lt;a href="http://repos.mauras.ch/EL6/el6_extras.repo"&gt;el6_extras&lt;/a&gt; repository, and feel free to &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact&lt;/a&gt; me if you encounter any issues.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="consul"></category></entry><entry><title>New package - tinc 1.0.25</title><link href="http://www.mauras.ch/new-package-tinc-1025.html" rel="alternate"></link><published>2015-01-29T12:08:00+01:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2015-01-29:/new-package-tinc-1025.html</id><summary type="html">&lt;p&gt;I've been suprised to see that EPEL wasn't providing any init script for their &lt;code&gt;tinc&lt;/code&gt; package.&lt;br /&gt;
Here's a version with an init script and PIE/Full RELRO support.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Tinc - &lt;a href="http://www.tinc-vpn.org/download/"&gt;1.0.25&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;Version update - from …&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;I've been suprised to see that EPEL wasn't providing any init script for their &lt;code&gt;tinc&lt;/code&gt; package.&lt;br /&gt;
Here's a version with an init script and PIE/Full RELRO support.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Tinc - &lt;a href="http://www.tinc-vpn.org/download/"&gt;1.0.25&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;Version update - from EPEL&lt;/li&gt;
&lt;li&gt;Provide an init script and sysconfig file&lt;/li&gt;
&lt;li&gt;Compile with the usual PIE and Full RELRO&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;One note about the init script. The goal of the script is to support multiple networks just like tinc does.&lt;br /&gt;
In order to do so, you have to create a symbolic link of the init script matching your network name &lt;code&gt;ln -s /etc/init.d/tinc /etc/init.d/tinc.xxxx&lt;/code&gt; &lt;/p&gt;
&lt;p&gt;If you need to have different options - like enabling debug - or key size on this network, copy the &lt;code&gt;sysconfig&lt;/code&gt; file with the network name suffix &lt;code&gt;cp /etc/sysconfig/tinc /etc/sysconfig/tinc.xxxx&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;So as usual, you can install the package using my &lt;a href="http://repos.mauras.ch/EL6/el6_extras.repo"&gt;el6_extras&lt;/a&gt; repository, and feel free to &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact&lt;/a&gt; me if you encounter any issues.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="tinc"></category></entry><entry><title>Grsecurity update - 3.14.28-100</title><link href="http://www.mauras.ch/grsecurity-update-31428-100.html" rel="alternate"></link><published>2015-01-13T20:00:00+01:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2015-01-13:/grsecurity-update-31428-100.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.28-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.28-201501120819&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.28-100&amp;amp;id2=linux-grsecurity-3.14.22-100"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sorry being slow during the holidays :)   &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;At least on some servers - CPU related ? - &lt;code&gt;pcid&lt;/code&gt; detection is …&lt;/p&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.28-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.28-201501120819&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.28-100&amp;amp;id2=linux-grsecurity-3.14.22-100"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Sorry being slow during the holidays :)   &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;At least on some servers - CPU related ? - &lt;code&gt;pcid&lt;/code&gt; detection is still broken... &lt;/p&gt;
&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Grsecurity update - 3.14.22-100</title><link href="http://www.mauras.ch/grsecurity-update-31422-100.html" rel="alternate"></link><published>2014-10-31T01:10:00+01:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-10-31:/grsecurity-update-31422-100.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.22-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.22-201410250026&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.22-100&amp;amp;id2=linux-grsecurity-3.14.21-100"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This version fixes several &lt;a href="http://www.openwall.com/lists/oss-security/2014/10/24/9"&gt;KVM issues&lt;/a&gt;  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3 …&lt;/p&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.22-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.22-201410250026&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.22-100&amp;amp;id2=linux-grsecurity-3.14.21-100"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This version fixes several &lt;a href="http://www.openwall.com/lists/oss-security/2014/10/24/9"&gt;KVM issues&lt;/a&gt;  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF&lt;/code&gt; will make &lt;code&gt;udev&lt;/code&gt; segfault and make the init process exit before completing boot.&lt;br /&gt;
The solution to fallback on &lt;em&gt;slow and weak &lt;code&gt;UDEREF&lt;/code&gt;&lt;/em&gt; - which in my opinion is better than having no &lt;code&gt;UDEREF&lt;/code&gt; at all - is to pass &lt;code&gt;nopcid&lt;/code&gt; flag to your kernel command line.&lt;br /&gt;
The issue has been reported to PAX team and we're waiting for a fix :)  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# dmesg | grep UDEREF 
PAX: slow and weak UDEREF enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Qemu, libvirt and tmux updates</title><link href="http://www.mauras.ch/qemu-libvirt-and-tmux-updates.html" rel="alternate"></link><published>2014-10-24T09:40:00+02:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-10-24:/qemu-libvirt-and-tmux-updates.html</id><summary type="html">&lt;p&gt;I had not updated my &lt;a href="http://repos.mauras.ch/virt/"&gt;virt&lt;/a&gt; repository for more than a year now... Mostly because i had not needed to.&lt;br /&gt;
Here's two major updates today!&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Qemu - &lt;a href="http://wiki.qemu.org/ChangeLog/2.1"&gt;2.1.2&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;Compiled against ceph-0.80 and glusterfs-3 …&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;I had not updated my &lt;a href="http://repos.mauras.ch/virt/"&gt;virt&lt;/a&gt; repository for more than a year now... Mostly because i had not needed to.&lt;br /&gt;
Here's two major updates today!&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Qemu - &lt;a href="http://wiki.qemu.org/ChangeLog/2.1"&gt;2.1.2&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;Compiled against ceph-0.80 and glusterfs-3.5.2&lt;/li&gt;
&lt;li&gt;Enable LZO and RDMA support&lt;/li&gt;
&lt;li&gt;Compiled with GCC 4.8 from devtoolset 2 &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Libvirt - &lt;a href="http://libvirt.org/news.html"&gt;1.2.9&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;Enable PIE, Full relro &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Please mind that both &lt;code&gt;qemu&lt;/code&gt; and &lt;code&gt;libvirtd&lt;/code&gt; binaries require to disable PAX &lt;code&gt;mprotect&lt;/code&gt;
&lt;code&gt;paxctl -cm /usr/bin/qemu* /usr/sbin/libvirtd&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Tmux - &lt;a href="http://sourceforge.net/p/tmux/tmux-code/ci/master/tree/CHANGES"&gt;1.9a&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As usual, i'm dogfooding all my packages, but it may happen that i miss a bug on an option or something, so &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; if you encounter any issues.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="tmux"></category><category term="qemu"></category><category term="libvirt"></category></entry><entry><title>Grsecurity - Kernel Panic on UDP traffic</title><link href="http://www.mauras.ch/grsecurity-kernel-panic-on-udp-traffic.html" rel="alternate"></link><published>2014-10-24T09:30:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-10-24:/grsecurity-kernel-panic-on-udp-traffic.html</id><summary type="html">&lt;p&gt;So it appears that the issue doesn't come from the &lt;code&gt;e1000&lt;/code&gt; driver, but from a &lt;a href="http://cwe.mitre.org/data/definitions/416.html"&gt;use-after-free&lt;/a&gt; in the udp protocol structure.&lt;br /&gt;
I've made &lt;a href="http://git.mauras.ch/linux-grsecurity/patch/?id=5e71707811ce0c38c3861eecb6a2f6761251880b"&gt;a patch&lt;/a&gt; available that disables slab sanitization in udp protocol structure.&lt;br /&gt;
I've …&lt;/p&gt;</summary><content type="html">&lt;p&gt;So it appears that the issue doesn't come from the &lt;code&gt;e1000&lt;/code&gt; driver, but from a &lt;a href="http://cwe.mitre.org/data/definitions/416.html"&gt;use-after-free&lt;/a&gt; in the udp protocol structure.&lt;br /&gt;
I've made &lt;a href="http://git.mauras.ch/linux-grsecurity/patch/?id=5e71707811ce0c38c3861eecb6a2f6761251880b"&gt;a patch&lt;/a&gt; available that disables slab sanitization in udp protocol structure.&lt;br /&gt;
I've been toroughly testing it under &lt;strong&gt;heavy&lt;/strong&gt; DNS load  for two weeks and can confirm it's working well.  &lt;/p&gt;
&lt;p&gt;Indeed the drawback is that it lowers the protections on the udp protocol, that's why i won't include this patch in my default builds, just use it if you need it - I guess it will be long before we see it fixed upstream...&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Grsecurity update - 3.14.21-100</title><link href="http://www.mauras.ch/grsecurity-update-31421-100.html" rel="alternate"></link><published>2014-10-14T23:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-10-14:/grsecurity-update-31421-100.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.21-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.22-201410192047&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.21-100&amp;amp;id2=linux-grsecurity-3.14.19-101"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF&lt;/code&gt; will make &lt;code&gt;udev …&lt;/code&gt;&lt;/p&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.21-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.22-201410192047&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.21-100&amp;amp;id2=linux-grsecurity-3.14.19-101"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF&lt;/code&gt; will make &lt;code&gt;udev&lt;/code&gt; segfault and make the init process exit before completing boot.&lt;br /&gt;
The solution to fallback on &lt;em&gt;slow and weak &lt;code&gt;UDEREF&lt;/code&gt;&lt;/em&gt; - which in my opinion is better than having no &lt;code&gt;UDEREF&lt;/code&gt; at all - is to pass &lt;code&gt;nopcid&lt;/code&gt; flag to your kernel command line.&lt;br /&gt;
The issue has been reported to PAX team and we're waiting for a fix :)  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# dmesg | grep UDEREF 
PAX: slow and weak UDEREF enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Grsecurity update - 3.14.19-101</title><link href="http://www.mauras.ch/grsecurity-update-31419-101.html" rel="alternate"></link><published>2014-10-06T23:54:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-10-06:/grsecurity-update-31419-101.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.19-101&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.19-201409282024
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.19-101&amp;amp;id2=linux-grsecurity-3.14.19-100"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="note"&gt;Note:&lt;/h4&gt;
&lt;p&gt;If you're running &lt;code&gt;e1000&lt;/code&gt; driver with intensive UDP traffic, you surely have encountered kernel panics.&lt;br /&gt;
I've …&lt;/p&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.19-101&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.19-201409282024
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.19-101&amp;amp;id2=linux-grsecurity-3.14.19-100"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="note"&gt;Note:&lt;/h4&gt;
&lt;p&gt;If you're running &lt;code&gt;e1000&lt;/code&gt; driver with intensive UDP traffic, you surely have encountered kernel panics.&lt;br /&gt;
I've &lt;a href="https://forums.grsecurity.net/viewtopic.php?f=3&amp;amp;t=4037"&gt;reported the issue&lt;/a&gt;, which seems to be an upstream bug. Hope to see a patch soon.  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF&lt;/code&gt; will make &lt;code&gt;udev&lt;/code&gt; segfault and make the init process exit before completing boot.&lt;br /&gt;
The solution to fallback on &lt;em&gt;slow and weak &lt;code&gt;UDEREF&lt;/code&gt;&lt;/em&gt; - which in my opinion is better than having no &lt;code&gt;UDEREF&lt;/code&gt; at all - is to pass &lt;code&gt;nopcid&lt;/code&gt; flag to your kernel command line.&lt;br /&gt;
The issue has been reported to PAX team and we're waiting for a fix :)  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# dmesg | grep UDEREF 
PAX: slow and weak UDEREF enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Nginx update - 1.62-2</title><link href="http://www.mauras.ch/nginx-update-162-2.html" rel="alternate"></link><published>2014-09-26T00:45:00+02:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-09-26:/nginx-update-162-2.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;Nginx - 1.62&lt;ul&gt;
&lt;li&gt;Compile with kernel 4.8 from devtoolset2 to enable PIE&lt;/li&gt;
&lt;li&gt;Remove Perl RPATH&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As usual, i'm dogfooding all my packages, but it may happen that i miss a bug on an option …&lt;/p&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;Nginx - 1.62&lt;ul&gt;
&lt;li&gt;Compile with kernel 4.8 from devtoolset2 to enable PIE&lt;/li&gt;
&lt;li&gt;Remove Perl RPATH&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As usual, i'm dogfooding all my packages, but it may happen that i miss a bug on an option or something, so &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; if you encounter any issues.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="nginx"></category></entry><entry><title>Exim update - 4.84-1</title><link href="http://www.mauras.ch/exim-update-484-1.html" rel="alternate"></link><published>2014-09-20T15:55:00+02:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-09-20:/exim-update-484-1.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;Exim - &lt;a href="http://git.exim.org/exim.git/blob/exim-4_84:/doc/doc-txt/ChangeLog"&gt;4.84&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;latest stable version &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As usual, i'm dogfooding all my packages, but it may happen that i miss a bug on an option or something, so &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; if you encounter any issues …&lt;/p&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;Exim - &lt;a href="http://git.exim.org/exim.git/blob/exim-4_84:/doc/doc-txt/ChangeLog"&gt;4.84&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;latest stable version &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As usual, i'm dogfooding all my packages, but it may happen that i miss a bug on an option or something, so &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; if you encounter any issues.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="exim"></category></entry><entry><title>Grsecurity update - 3.14.19-100</title><link href="http://www.mauras.ch/grsecurity-update-31419-100.html" rel="alternate"></link><published>2014-09-18T23:50:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-09-18:/grsecurity-update-31419-100.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;3.14.18-100&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.18-201409141906&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.18-100&amp;amp;id2=linux-grsecurity-3.14.17-100"&gt;my Git repo&lt;/a&gt;&lt;br /&gt;
I just had compiled this package when &lt;code&gt;3.14.19&lt;/code&gt; release got out, so this version is …&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;3.14.18-100&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.18-201409141906&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.18-100&amp;amp;id2=linux-grsecurity-3.14.17-100"&gt;my Git repo&lt;/a&gt;&lt;br /&gt;
I just had compiled this package when &lt;code&gt;3.14.19&lt;/code&gt; release got out, so this version is untested&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;3.14.19-100&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.19-201409180900&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.19-100&amp;amp;id2=linux-grsecurity-3.14.18-100"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I've jumped the packaging of several versions since &lt;code&gt;3.14.17-100&lt;/code&gt; but as usual, all the branches are available in &lt;a href="http://git.mauras.ch/linux-grsecurity/"&gt;my Git repo&lt;/a&gt;  &lt;/p&gt;
&lt;h4 id="note"&gt;Note:&lt;/h4&gt;
&lt;p&gt;If you're running &lt;code&gt;e1000&lt;/code&gt; driver with intensive UDP traffic, you surely have encountered kernel panics.&lt;br /&gt;
I've &lt;a href="https://forums.grsecurity.net/viewtopic.php?f=3&amp;amp;t=4037"&gt;reported the issue&lt;/a&gt;, which seems to be an upstream bug. Hope to see a patch soon.  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF&lt;/code&gt; will make &lt;code&gt;udev&lt;/code&gt; segfault and make the init process exit before completing boot.&lt;br /&gt;
The solution to fallback on &lt;em&gt;slow and weak &lt;code&gt;UDEREF&lt;/code&gt;&lt;/em&gt; - which in my opinion is better than having no &lt;code&gt;UDEREF&lt;/code&gt; at all - is to pass &lt;code&gt;nopcid&lt;/code&gt; flag to your kernel command line.&lt;br /&gt;
The issue has been reported to PAX team and we're waiting for a fix :)  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# dmesg | grep UDEREF 
PAX: slow and weak UDEREF enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>EL6 Extras updates and new packages</title><link href="http://www.mauras.ch/el6-extras-updates-and-new-packages.html" rel="alternate"></link><published>2014-09-18T23:30:00+02:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-09-18:/el6-extras-updates-and-new-packages.html</id><summary type="html">&lt;p&gt;A bunch of new packages/versions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Nginx - &lt;a href="http://nginx.org/en/CHANGES-1.6"&gt;1.6.2&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;latest stable version fixing CVE-2014-3616&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Uwsgi - 2.0.6&lt;ul&gt;
&lt;li&gt;New modular build with multiple language support&lt;ul&gt;
&lt;li&gt;Lua 5.1 - lua plugin&lt;/li&gt;
&lt;li&gt;Python 2.6 - python …&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;A bunch of new packages/versions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Nginx - &lt;a href="http://nginx.org/en/CHANGES-1.6"&gt;1.6.2&lt;/a&gt;&lt;ul&gt;
&lt;li&gt;latest stable version fixing CVE-2014-3616&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Uwsgi - 2.0.6&lt;ul&gt;
&lt;li&gt;New modular build with multiple language support&lt;ul&gt;
&lt;li&gt;Lua 5.1 - lua plugin&lt;/li&gt;
&lt;li&gt;Python 2.6 - python plugin&lt;/li&gt;
&lt;li&gt;Python 2.7 - python27 plugin&lt;/li&gt;
&lt;li&gt;Python 2.6 - python33 plugin&lt;/li&gt;
&lt;li&gt;PHP 5.3 - php plugin&lt;/li&gt;
&lt;li&gt;PHP 5.4 - php54 plugin &lt;em&gt;please see below&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;CGI is now a plugin as well&lt;br /&gt;
Python 2.7 and 3.3 requires that you enable the &lt;code&gt;software collections&lt;/code&gt; repository&lt;br /&gt;
Next version will contain init script and perl support&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;PHP 5.4 - 5.4.16-116&lt;ul&gt;
&lt;li&gt;Include mcrypt module&lt;/li&gt;
&lt;li&gt;Include -embedded package&lt;br /&gt;
I was kinda pissed off by RH purposely removing the support of PHP embedded library in their &lt;code&gt;software collections&lt;/code&gt; versions, as well as still not supporting mcrypt module, so i just rebuilded it with a higher release number (+100).&lt;br /&gt;
You still need to enable &lt;code&gt;software collections&lt;/code&gt; repository for &lt;code&gt;php54-php-pear*&lt;/code&gt; dependancies.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Libmcrypt - 2.5.8&lt;br /&gt;
Basically a rebuild of &lt;a href="http://springdale.princeton.edu/data/puias/unsupported/6"&gt;PUIAS&lt;/a&gt; SRPM  &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As usual, i'm dogfooding all my packages, but it may happen that i miss a bug on an option or something, so &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; if you encounter any issues.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="nginx"></category><category term="uwsgi"></category><category term="php"></category></entry><entry><title>Grsecurity update - 3.14.17-100</title><link href="http://www.mauras.ch/grsecurity-update-31417-100.html" rel="alternate"></link><published>2014-08-22T00:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-08-22:/grsecurity-update-31417-100.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.17-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.17-201408212334&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.17-100&amp;amp;id2=linux-grsecurity-3.14.15-102"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I've jumped the packaging of several versions since &lt;code&gt;3.14.15-102&lt;/code&gt; but all the branches are available …&lt;/p&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.17-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.17-201408212334&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.17-100&amp;amp;id2=linux-grsecurity-3.14.15-102"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I've jumped the packaging of several versions since &lt;code&gt;3.14.15-102&lt;/code&gt; but all the branches are available in &lt;a href="http://git.mauras.ch/linux-grsecurity/"&gt;my Git repo&lt;/a&gt;  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF&lt;/code&gt; will make &lt;code&gt;udev&lt;/code&gt; segfault and make the init process exit before completing boot.&lt;br /&gt;
The solution to fallback on &lt;em&gt;slow and weak &lt;code&gt;UDEREF&lt;/code&gt;&lt;/em&gt; - which in my opinion is better than having no &lt;code&gt;UDEREF&lt;/code&gt; at all - is to pass &lt;code&gt;nopcid&lt;/code&gt; flag to your kernel command line.&lt;br /&gt;
The issue has been reported to PAX team and we're waiting for a fix :)  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# dmesg | grep UDEREF 
PAX: slow and weak UDEREF enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Grsecurity update - 3.14.15-102</title><link href="http://www.mauras.ch/grsecurity-update-31415-102.html" rel="alternate"></link><published>2014-08-05T19:41:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-08-05:/grsecurity-update-31415-102.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.15-102&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.15-201408032014&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.15-102&amp;amp;id2=linux-grsecurity-3.14.15-101"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF&lt;/code&gt; will make &lt;code&gt;udev …&lt;/code&gt;&lt;/p&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.15-102&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.15-201408032014&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.15-102&amp;amp;id2=linux-grsecurity-3.14.15-101"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF&lt;/code&gt; will make &lt;code&gt;udev&lt;/code&gt; segfault and make the init process exit before completing boot.&lt;br /&gt;
The solution to fallback on &lt;em&gt;slow and weak &lt;code&gt;UDEREF&lt;/code&gt;&lt;/em&gt; - which in my opinion is better than having no &lt;code&gt;UDEREF&lt;/code&gt; at all - is to pass &lt;code&gt;nopcid&lt;/code&gt; flag to your kernel command line.&lt;br /&gt;
The issue has been reported to PAX team and we're waiting for a fix :)  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# dmesg | grep UDEREF 
PAX: slow and weak UDEREF enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Grsecurity update - 3.14.15-101</title><link href="http://www.mauras.ch/grsecurity-update-31415-101.html" rel="alternate"></link><published>2014-08-01T22:40:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-08-01:/grsecurity-update-31415-101.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.15-101&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.15-201408010644&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.15-101&amp;amp;id2=linux-grsecurity-3.14.15-100"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Even if i haven't built the last two &lt;code&gt;Grsecurity&lt;/code&gt; versions, their branches are up in &lt;a href="http://git.mauras.ch/linux-grsecurity/"&gt;my Git …&lt;/a&gt;&lt;/p&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.15-101&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.15-201408010644&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.15-101&amp;amp;id2=linux-grsecurity-3.14.15-100"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Even if i haven't built the last two &lt;code&gt;Grsecurity&lt;/code&gt; versions, their branches are up in &lt;a href="http://git.mauras.ch/linux-grsecurity/"&gt;my Git repo&lt;/a&gt;  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF&lt;/code&gt; will make &lt;code&gt;udev&lt;/code&gt; segfault and make the init process exit before completing boot.&lt;br /&gt;
The solution to fallback on &lt;em&gt;slow and weak &lt;code&gt;UDEREF&lt;/code&gt;&lt;/em&gt; - which in my opinion is better than having no &lt;code&gt;UDEREF&lt;/code&gt; at all - is to pass &lt;code&gt;nopcid&lt;/code&gt; flag to your kernel command line.&lt;br /&gt;
The issue has been reported to PAX team and we're waiting for a fix :)  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# dmesg | grep UDEREF 
PAX: slow and weak UDEREF enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Grsecurity update - 3.14.13-100</title><link href="http://www.mauras.ch/grsecurity-update-31413-100.html" rel="alternate"></link><published>2014-07-24T06:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-07-24:/grsecurity-update-31413-100.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;3.14.12-102&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.12-201407170638&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.12-102&amp;amp;id2=linux-grsecurity-3.14.12-101"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;3.14.13-100&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.13-201407232159&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.13-100&amp;amp;id2=linux-grsecurity-3.14.12-102"&gt;my Git …&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;3.14.12-102&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.12-201407170638&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.12-102&amp;amp;id2=linux-grsecurity-3.14.12-101"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;code&gt;3.14.13-100&lt;/code&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.13-201407232159&lt;br /&gt;
Diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.13-100&amp;amp;id2=linux-grsecurity-3.14.12-102"&gt;my Git repo&lt;/a&gt;  &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF&lt;/code&gt; will make &lt;code&gt;udev&lt;/code&gt; segfault and make the init process exit before completing boot.&lt;br /&gt;
The solution to fallback on &lt;em&gt;slow and weak &lt;code&gt;UDEREF&lt;/code&gt;&lt;/em&gt; - which in my opinion is better than having no &lt;code&gt;UDEREF&lt;/code&gt; at all - is to pass &lt;code&gt;nopcid&lt;/code&gt; flag to your kernel command line.&lt;br /&gt;
The issue has been reported to PAX team and we're waiting for a fix :)  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# dmesg | grep UDEREF 
PAX: slow and weak UDEREF enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Gradm update</title><link href="http://www.mauras.ch/gradm-update.html" rel="alternate"></link><published>2014-07-17T04:55:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-07-17:/gradm-update.html</id><content type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.0-201405281853_1&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Version bump&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Complete changelog can be found &lt;a href="https://grsecurity.net/gradm3-changelog.txt"&gt;here&lt;/a&gt;  &lt;/p&gt;
&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="gradm"></category><category term="el6"></category></entry><entry><title>Grsecurity update - 3.14.12-101</title><link href="http://www.mauras.ch/grsecurity-update-31412-101.html" rel="alternate"></link><published>2014-07-16T19:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-07-16:/grsecurity-update-31412-101.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.12-101&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.12-201407151838&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can see a diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.12-101&amp;amp;id2=linux-grsecurity-3.14.12-100"&gt;my Git repo&lt;/a&gt;  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree …&lt;/p&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.12-101&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.12-201407151838&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can see a diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.12-101&amp;amp;id2=linux-grsecurity-3.14.12-100"&gt;my Git repo&lt;/a&gt;  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF&lt;/code&gt; will make &lt;code&gt;udev&lt;/code&gt; segfault and make the init process exit before completing boot.&lt;br /&gt;
The solution to fallback on &lt;em&gt;slow and weak &lt;code&gt;UDEREF&lt;/code&gt;&lt;/em&gt; - which in my opinion is better than having no &lt;code&gt;UDEREF&lt;/code&gt; at all - is to pass &lt;code&gt;nopcid&lt;/code&gt; flag to your kernel command line.&lt;br /&gt;
The issue has been reported to PAX team and we're waiting for a fix :)  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# dmesg | grep UDEREF 
PAX: slow and weak UDEREF enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Grsecurity update - 3.14.12-100</title><link href="http://www.mauras.ch/grsecurity-update-31412-100.html" rel="alternate"></link><published>2014-07-10T13:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-07-10:/grsecurity-update-31412-100.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.12-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.12-201407100035&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can see a diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.12-201407100035&amp;amp;id2=linux-grsecurity-3.14.11-201407081919"&gt;my Git repo&lt;/a&gt;  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree …&lt;/p&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.12-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to grsecurity-3.0-3.14.12-201407100035&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can see a diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.12-201407100035&amp;amp;id2=linux-grsecurity-3.14.11-201407081919"&gt;my Git repo&lt;/a&gt;  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF&lt;/code&gt; will make &lt;code&gt;udev&lt;/code&gt; segfault and make the init process exit before completing boot.&lt;br /&gt;
The solution to fallback on &lt;em&gt;slow and weak &lt;code&gt;UDEREF&lt;/code&gt;&lt;/em&gt; - which in my opinion is better than having no &lt;code&gt;UDEREF&lt;/code&gt; at all - is to pass &lt;code&gt;nopcid&lt;/code&gt; flag to your kernel command line.&lt;br /&gt;
The issue has been reported to PAX team and we're waiting for a fix :)  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# dmesg | grep UDEREF 
PAX: slow and weak UDEREF enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Grsecurity update - 3.14.11-101</title><link href="http://www.mauras.ch/grsecurity-update-31411-101.html" rel="alternate"></link><published>2014-07-09T16:10:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-07-09:/grsecurity-update-31411-101.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.11-101&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update grsecurity-3.0-3.14.11-201407081919&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can see a diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.11-201407081919&amp;amp;id2=linux-grsecurity-3.14.11-201407072045"&gt;my Git repo&lt;/a&gt;  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF …&lt;/code&gt;&lt;/p&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.11-101&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update grsecurity-3.0-3.14.11-201407081919&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can see a diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.11-201407081919&amp;amp;id2=linux-grsecurity-3.14.11-201407072045"&gt;my Git repo&lt;/a&gt;  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF&lt;/code&gt; will make &lt;code&gt;udev&lt;/code&gt; segfault and make the init process exit before completing boot.&lt;br /&gt;
The solution to fallback on &lt;em&gt;slow and weak &lt;code&gt;UDEREF&lt;/code&gt;&lt;/em&gt; - which in my opinion is better than having no &lt;code&gt;UDEREF&lt;/code&gt; at all - is to pass &lt;code&gt;nopcid&lt;/code&gt; flag to your kernel command line.&lt;br /&gt;
The issue has been reported to PAX team and we're waiting for a fix :)  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# dmesg | grep UDEREF 
PAX: slow and weak UDEREF enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Grsecurity update - 3.14.10-101</title><link href="http://www.mauras.ch/grsecurity-update-31410-101.html" rel="alternate"></link><published>2014-07-06T15:01:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-07-06:/grsecurity-update-31410-101.html</id><summary type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.10-101&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update grsecurity-3.0-3.14.10-201407052031&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can see a diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.10-201407052031&amp;amp;id2=linux-grsecurity-3.14.10-201407012152"&gt;my Git repo&lt;/a&gt;  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF …&lt;/code&gt;&lt;/p&gt;</summary><content type="html">&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.10-101&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update grsecurity-3.0-3.14.10-201407052031&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can see a diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.10-201407052031&amp;amp;id2=linux-grsecurity-3.14.10-201407012152"&gt;my Git repo&lt;/a&gt;  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING:&lt;/h4&gt;
&lt;p&gt;It appears that &lt;code&gt;pcid&lt;/code&gt; detection is broken on latest 3.14 tree. &lt;code&gt;UDEREF&lt;/code&gt; will make &lt;code&gt;udev&lt;/code&gt; segfault and make the init process exit before completing boot.&lt;br /&gt;
The solution to fallback on &lt;em&gt;slow and weak &lt;code&gt;UDEREF&lt;/code&gt;&lt;/em&gt; - which in my opinion is better than having no &lt;code&gt;UDEREF&lt;/code&gt; at all - is to pass &lt;code&gt;nopcid&lt;/code&gt; flag to your kernel command line.&lt;br /&gt;
The issue has been reported to PAX team and we're waiting for a fix :)  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# dmesg | grep UDEREF 
PAX: slow and weak UDEREF enabled
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Nginx update to new stable</title><link href="http://www.mauras.ch/nginx-update-to-new-stable.html" rel="alternate"></link><published>2014-07-05T20:49:00+02:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-07-05:/nginx-update-to-new-stable.html</id><content type="html">&lt;p&gt;Nginx latest stable version - &lt;a href="http://nginx.org/en/CHANGES-1.6"&gt;1.6.0&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As usual, &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; if you encounter any issues.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="nginx"></category></entry><entry><title>Grsecurity update - 3.14.10</title><link href="http://www.mauras.ch/grsecurity-update-31410.html" rel="alternate"></link><published>2014-07-02T20:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-07-02:/grsecurity-update-31410.html</id><summary type="html">&lt;p&gt;And there's another one today :)  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.10-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update grsecurity-3.14.10-201407012152&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can see a diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.10-201407012152&amp;amp;id2=linux-grsecurity-3.14.9-201406262057"&gt;my Git repo&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and …&lt;/p&gt;</summary><content type="html">&lt;p&gt;And there's another one today :)  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.10-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update grsecurity-3.14.10-201407012152&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can see a diff from the previous version on &lt;a href="http://git.mauras.ch/linux-grsecurity/diff/?id=linux-grsecurity-3.14.10-201407012152&amp;amp;id2=linux-grsecurity-3.14.9-201406262057"&gt;my Git repo&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Grsecurity update - 3.14.9</title><link href="http://www.mauras.ch/grsecurity-update-3149.html" rel="alternate"></link><published>2014-06-27T20:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-06-27:/grsecurity-update-3149.html</id><summary type="html">&lt;p&gt;And there's another one today :)  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.9-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update grsecurity-3.0-3.14.9-201406262057&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You surely have noted that the two latest kernels come only in &lt;code&gt;nozfs&lt;/code&gt; flavor. This is indeed correct, and that's because i'm …&lt;/p&gt;</summary><content type="html">&lt;p&gt;And there's another one today :)  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.9-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update grsecurity-3.0-3.14.9-201406262057&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You surely have noted that the two latest kernels come only in &lt;code&gt;nozfs&lt;/code&gt; flavor. This is indeed correct, and that's because i'm wondering if it makes any sense to continue supporting both at the same time... I'm not so sure about it.&lt;/p&gt;
&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hsitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Grsecurity update to new stable kernel</title><link href="http://www.mauras.ch/grsecurity-update-to-new-stable-kernel.html" rel="alternate"></link><published>2014-06-26T21:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-06-26:/grsecurity-update-to-new-stable-kernel.html</id><summary type="html">&lt;p&gt;It's here!! Grsecurity finally chose &lt;code&gt;Kernel 3.14&lt;/code&gt; as the new stable kernel.&lt;br /&gt;
I know i could have updated the &lt;code&gt;3.2&lt;/code&gt; branch while waiting, but i secretely hopped for the decision to come sooner …&lt;/p&gt;</summary><content type="html">&lt;p&gt;It's here!! Grsecurity finally chose &lt;code&gt;Kernel 3.14&lt;/code&gt; as the new stable kernel.&lt;br /&gt;
I know i could have updated the &lt;code&gt;3.2&lt;/code&gt; branch while waiting, but i secretely hopped for the decision to come sooner ;)  &lt;/p&gt;
&lt;p&gt;Here's the changelog compared to my latest &lt;code&gt;3.2&lt;/code&gt; kernel.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.14.8-100&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Update to devtoolset 2 with GCC 4.8&lt;/li&gt;
&lt;li&gt;Don't apply grsecurity patch anymore use http://git.mauras.ch/linux-grsecurity/ tagged archives&lt;/li&gt;
&lt;li&gt;Enable CONFIG_PAX_RANDKSTACK and CONFIG_GRKERNSEC_KSTACKOVERFLOW&lt;/li&gt;
&lt;li&gt;Force dracut's detection of virtio_blk module - see &lt;a href="https://bugzilla.redhat.com/show_bug.cgi?id=1103455"&gt;bug&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Yes, aside the version, the biggest change is the way i will now handle kernel archives.&lt;br /&gt;
I'll now track all the Grsecurity patches in separate branches in my &lt;a href="http://git.mauras.ch/linux-grsecurity/"&gt;Git repo&lt;/a&gt;. This makes packaging easier, aswell as comparing patch versions.&lt;br /&gt;
I'm still thinking of doing a repo containing all my &lt;code&gt;RPM spec&lt;/code&gt; files to make &lt;em&gt;your&lt;/em&gt; life easier, just have to find the correct way to have something nice and well sorted.  &lt;/p&gt;
&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;, and don't hsitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category></entry><entry><title>Nginx + Uwsgi + Cgit</title><link href="http://www.mauras.ch/nginx-uwsgi-cgit.html" rel="alternate"></link><published>2014-06-25T01:36:00+02:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-06-25:/nginx-uwsgi-cgit.html</id><summary type="html">&lt;p&gt;As you've seen in my previous post, there's been some package updates in the &lt;code&gt;EL6 Extras&lt;/code&gt; repository, so let's have some fun with them!  &lt;/p&gt;
&lt;p&gt;First you indeed need my &lt;code&gt;EL6 Extras&lt;/code&gt; repository if it's not …&lt;/p&gt;</summary><content type="html">&lt;p&gt;As you've seen in my previous post, there's been some package updates in the &lt;code&gt;EL6 Extras&lt;/code&gt; repository, so let's have some fun with them!  &lt;/p&gt;
&lt;p&gt;First you indeed need my &lt;code&gt;EL6 Extras&lt;/code&gt; repository if it's not done yet, please start with the &lt;a href="pages/repositories.html"&gt;repositories&lt;/a&gt; page.  &lt;/p&gt;
&lt;h4 id="install-the-packages"&gt;Install the packages&lt;/h4&gt;
&lt;p&gt;Now that you're good with the repository, install the packages:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# yum -y install nginx uwsgi cgit
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h4 id="configure-cgit"&gt;Configure Cgit&lt;/h4&gt;
&lt;p&gt;The default config from the package is pretty sane, the only thing you'll need to add to your &lt;code&gt;/etc/gitrc&lt;/code&gt; - And indeed your &lt;code&gt;Git&lt;/code&gt; repositories config - is:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;virtual-root&lt;span class="o"&gt;=&lt;/span&gt;/
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This will keep &lt;code&gt;cgit&lt;/code&gt; from adding &lt;code&gt;cgit.cgi&lt;/code&gt; to your URL.&lt;br /&gt;
To enable syntax highlighting, uncomment the following line in your &lt;code&gt;/etc/cgitrc&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;source-filter=/usr/libexec/cgit/filters/syntax-highlighting.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Then install &lt;code&gt;pygments&lt;/code&gt; package&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# yum -y install python-pygments
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h4 id="configure-uwsgi"&gt;Configure Uwsgi&lt;/h4&gt;
&lt;p&gt;Just add this simple conf&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# mkdir /etc/uwsgi
# cat &amp;lt;&amp;lt; EOF &amp;gt; /etc/uwsgi/cgit.ini
[uwsgi]
socket = 127.0.0.1:8080
uid = cgit
gid = cgit
processes = 1
threads = 2
cgi = /usr/libexec/cgit/cgit.cgi
EOF
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;There's no init script provided in my package yet, so just manually run - or any way you want&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# uwsgi --ini /etc/uwsgi/cgit.ini &amp;amp;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;h4 id="configure-nginx"&gt;Configure Nginx&lt;/h4&gt;
&lt;p&gt;Finally just add this simple &lt;code&gt;server&lt;/code&gt; block to your Nginx config and customize it to your needs&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;server {
    # Change this to your taste
    listen       80 default_server;
    server_name  _;

    # We want to serve cgit static content from /usr/share/cgit and let Nginx cache it
    location ~* ^.+(cgit.(css|png)|favicon.ico) {
        root /usr/share/cgit;
        expires 30d;
    }

    # Now forward everything else to our uwsgi instance
    location / {
        include uwsgi_params;
        uwsgi_modifier1 9;
        uwsgi_pass 127.0.0.1:8080;
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Start Nginx, and enjoy your &lt;code&gt;Cgit&lt;/code&gt; running on your &lt;code&gt;server_name&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;As usual, &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; if you have any question.&lt;/p&gt;</content><category term="Howto"></category><category term="el6"></category><category term="nginx"></category><category term="uwsgi"></category><category term="cgit"></category></entry><entry><title>EL6 Extras updates</title><link href="http://www.mauras.ch/el6-extras-updates.html" rel="alternate"></link><published>2014-06-25T01:20:00+02:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-06-25:/el6-extras-updates.html</id><summary type="html">&lt;p&gt;I've been quite slow to keep up with updates for the last 3 months.&lt;br /&gt;
Here's a bunch of updates:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Nginx - Update to latest stable release &lt;a href="http://nginx.org/en/CHANGES-1.4"&gt;1.4.7&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Uwsgi&lt;ul&gt;
&lt;li&gt;Update to latest release &lt;a href="https://github.com/unbit/uwsgi-docs/blob/master/Changelog-2.0.5.rst"&gt;2.0 …&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;I've been quite slow to keep up with updates for the last 3 months.&lt;br /&gt;
Here's a bunch of updates:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Nginx - Update to latest stable release &lt;a href="http://nginx.org/en/CHANGES-1.4"&gt;1.4.7&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Uwsgi&lt;ul&gt;
&lt;li&gt;Update to latest release &lt;a href="https://github.com/unbit/uwsgi-docs/blob/master/Changelog-2.0.5.rst"&gt;2.0.5.1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Now also support CGI plugin&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Cgit&lt;ul&gt;
&lt;li&gt;Update to latest release &lt;a href="http://git.zx2c4.com/cgit/diff/?id=v0.10.1&amp;amp;id2=v0.10"&gt;0.10.1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Major refactoring of the package&lt;ul&gt;
&lt;li&gt;Add /var/cache/cgit directory&lt;/li&gt;
&lt;li&gt;Fix syntax-highlight.py&lt;/li&gt;
&lt;li&gt;Modify cgitrc for a saner default config&lt;/li&gt;
&lt;li&gt;Create cgit user and group&lt;/li&gt;
&lt;li&gt;Overral files/paths cleanup&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As usual, &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; if you encounter any issues.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="nginx"></category><category term="uwsgi"></category><category term="cgit"></category></entry><entry><title>Rudder: Fun with variables</title><link href="http://www.mauras.ch/rudder-fun-with-variables.html" rel="alternate"></link><published>2014-06-19T02:41:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-06-19:/rudder-fun-with-variables.html</id><summary type="html">&lt;p&gt;How many different configuration files do you maintain for the same service spread over your different &lt;code&gt;Rudder&lt;/code&gt; groups?&lt;br /&gt;
Personnaly only one!  &lt;/p&gt;
&lt;p&gt;I hate having to maintain multiple - almost - identical configuration files, it's counterproductive and definitely …&lt;/p&gt;</summary><content type="html">&lt;p&gt;How many different configuration files do you maintain for the same service spread over your different &lt;code&gt;Rudder&lt;/code&gt; groups?&lt;br /&gt;
Personnaly only one!  &lt;/p&gt;
&lt;p&gt;I hate having to maintain multiple - almost - identical configuration files, it's counterproductive and definitely prone to errors. Having to change one setting in twenty files is always a painful task.&lt;br /&gt;
Hopefully &lt;code&gt;Rudder&lt;/code&gt; let's you easily manage your config file by keeping the relevant parts of it as variables and i'll show you how to get the most out of it.  &lt;/p&gt;
&lt;h4 id="modifying-default-technique"&gt;Modifying default technique&lt;/h4&gt;
&lt;p&gt;I started this post so long ago that this point is not even needed anymore. &lt;a href="https://github.com/Normation/rudder-techniques/commit/6eb99e651d288a4af8f307a37ea01566af212020"&gt;This commit&lt;/a&gt; merged it so you should have it by default on any latest &lt;code&gt;Rudder&lt;/code&gt; minor version - &lt;code&gt;2.10.2, 2.9.5 and 2.6.14&lt;/code&gt;.  &lt;/p&gt;
&lt;p&gt;While, in this example, we're going to mainly use &lt;code&gt;genericVariableDefinition&lt;/code&gt; and &lt;code&gt;checkGenericFileContent&lt;/code&gt; techniques, since &lt;code&gt;Rudder 2.7&lt;/code&gt;, you can also set &lt;code&gt;parameters&lt;/code&gt; and reuse them as variables inside directives.&lt;/p&gt;
&lt;h4 id="using-variables-to-dynamically-change-settings-in-enforced-files"&gt;Using variables to dynamically change settings in enforced files&lt;/h4&gt;
&lt;p&gt;&lt;code&gt;sshd_config&lt;/code&gt; seems like a good example, i use the same default configuration - applied on all nodes - everywhere with only slight changes in &lt;code&gt;AllowGroups&lt;/code&gt; section depending in which group the managed node is located.  &lt;/p&gt;
&lt;p&gt;Without using variables, i'd have to use at least 10 different directives to apply to my node groups, with actually only a tiny part of a line different from the default...&lt;br /&gt;
If for some reason i'd want to change a default setting - not related to my &lt;code&gt;AllowGroups&lt;/code&gt; section, let's say &lt;code&gt;PermitRootLogin&lt;/code&gt; - i'd then have to modify 10 directives, and this would be painful...&lt;br /&gt;
Modifying a directive is at least 3 manual actions + 1 rule generation, so i would end up with &lt;strong&gt;30&lt;/strong&gt; manual actions + &lt;strong&gt;10&lt;/strong&gt; rule generations.&lt;br /&gt;
Not really efficient is it ? And along the way I could just mess one of the file syntax, rendering &lt;code&gt;sshd&lt;/code&gt; unavailable for some of my nodes.  &lt;/p&gt;
&lt;h4 id="how-does-it-look-like"&gt;How does it look like?&lt;/h4&gt;
&lt;p&gt;First what do we want to achieve? We want that our &lt;code&gt;sshd_config AllowGroups&lt;/code&gt; always contain the group &lt;code&gt;admins&lt;/code&gt; and that some node groups also contain the group &lt;code&gt;not_admins&lt;/code&gt;.  &lt;/p&gt;
&lt;p&gt;Let's start by creating a &lt;code&gt;default_admin_group&lt;/code&gt; parameter - It's the default you should find everywhere on all your nodes, it makes sense to have it as a parameter.&lt;br /&gt;
&lt;em&gt;click on images to get them in fullscreen&lt;/em&gt;  &lt;/p&gt;
&lt;p&gt;&lt;a href=/img/rudder_fun_with_variables/parameters.png&gt;&lt;img alt="Rudder parameters" src="/img/rudder_fun_with_variables/parameters.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now create a new &lt;code&gt;Generic CFEngine variable definition&lt;/code&gt; directive with the default priority - &lt;code&gt;5&lt;/code&gt;.&lt;br /&gt;
This one will be applied to &lt;em&gt;all&lt;/em&gt; your nodes.
&lt;a href=/img/rudder_fun_with_variables/gen_var_5.png&gt;&lt;img alt="Generic variable definition 5" src="/img/rudder_fun_with_variables/gen_var_5.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Create a second one with priority set to &lt;code&gt;9&lt;/code&gt; this time - Actually anything higher than &lt;code&gt;5&lt;/code&gt;.&lt;br /&gt;
This one will be applied &lt;em&gt;only&lt;/em&gt; to the node groups where you want the group &lt;code&gt;not_admins&lt;/code&gt;
&lt;a href=/img/rudder_fun_with_variables/gen_var_9.png&gt;&lt;img alt="Generic variable definition 9" src="/img/rudder_fun_with_variables/gen_var_9.png" /&gt;&lt;/a&gt;
The higher priority means that this directive will be applied &lt;em&gt;after&lt;/em&gt; the first one and consequently override &lt;code&gt;${generic_variable_definition.SSH_ALLOWED}&lt;/code&gt;.  &lt;/p&gt;
&lt;p&gt;Finally create your default &lt;code&gt;Enforce a file content&lt;/code&gt; directive.&lt;br /&gt;
&lt;a href=/img/rudder_fun_with_variables/enforce_file_content.png&gt;&lt;img alt="Rudder parameters" src="/img/rudder_fun_with_variables/enforce_file_content.png" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;In plain text&lt;/em&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;${rudder.rudder_file_edit_header}
# stripped down default sshd config for the sake of example
LoginGraceTime 30s
PermitRootLogin no
StrictModes yes
MaxAuthTries 3
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
UsePAM yes
X11Forwarding yes
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
Subsystem   sftp    /usr/libexec/openssh/sftp-server
AllowGroups ${generic_variable_definition.SSH_ALLOWED}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Once applied on your nodes you'll get this&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;#########################################
### Managed by Rudder, edit with care ###
#########################################
# stripped down default sshd config for the sake of example
LoginGraceTime 30s
PermitRootLogin no
StrictModes yes
MaxAuthTries 3
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
UsePAM yes
X11Forwarding yes
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
Subsystem   sftp    /usr/libexec/openssh/sftp-server
AllowGroups admins
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Or depending if you apply the second generic variable directive with the priority &lt;code&gt;9&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;#########################################
### Managed by Rudder, edit with care ###
#########################################
# stripped down default sshd config for the sake of example
LoginGraceTime 30s
PermitRootLogin no
StrictModes yes
MaxAuthTries 3
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
UsePAM yes
X11Forwarding yes
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
Subsystem   sftp    /usr/libexec/openssh/sftp-server
AllowGroups admins not_admins
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now you can just easily add/change settings of your &lt;code&gt;sshd&lt;/code&gt; service in a single location.  &lt;/p&gt;
&lt;h4 id="even-more-fun"&gt;Even more fun?&lt;/h4&gt;
&lt;p&gt;You can also set empty values for your variables in the &lt;code&gt;Generic CFEngine variable definition&lt;/code&gt;, this will let you insert &lt;em&gt;default&lt;/em&gt; empty values replaced by actual content when needed.  &lt;/p&gt;
&lt;p&gt;&lt;em&gt;Default variable&lt;/em&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;variable name: SFTP
variable content: 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;You set an empty variable here because you need your &lt;em&gt;default&lt;/em&gt; configuration to have &lt;em&gt;nothing&lt;/em&gt; set. In this example only your SFTP nodes group will have something configured.  &lt;/p&gt;
&lt;p&gt;&lt;em&gt;For your SFTP nodes group&lt;/em&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;variable name: SFTP
variable content: Match group sftpusers$(const.n)$(const.t)ChrootDirectory /sftp/$(const.n)$(const.t)ForceCommand internal-sftp
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;em&gt;Your default &lt;code&gt;Enforce a file content&lt;/code&gt; directive&lt;/em&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;${rudder.rudder_file_edit_header}
# stripped down default sshd config for the sake of example
LoginGraceTime 30s
PermitRootLogin no
StrictModes yes
MaxAuthTries 3
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
UsePAM yes
X11Forwarding yes
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
Subsystem   sftp    /usr/libexec/openssh/sftp-server
AllowGroups ${generic_variable_definition.SSH_ALLOWED}

# Only populated on SFTP servers
${generic_variable_definition.SFTP}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Which would be expanded to&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;#########################################
### Managed by Rudder, edit with care ###
#########################################
# stripped down default sshd config for the sake of example
LoginGraceTime 30s
PermitRootLogin no
StrictModes yes
MaxAuthTries 3
AuthorizedKeysFile .ssh/authorized_keys
PasswordAuthentication yes
ChallengeResponseAuthentication no
GSSAPIAuthentication yes
GSSAPICleanupCredentials yes
UsePAM yes
X11Forwarding yes
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
AcceptEnv XMODIFIERS
Subsystem   sftp    /usr/libexec/openssh/sftp-server
AllowGroups admins not_admins

# Only populated on SFTP servers
Match group sftpusers
    ChrootDirectory /sftp/
    ForceCommand internal-sftp
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Hope you'll find this article useful and as usual, feel free to &lt;a href="/pages/contact.html"&gt;contact&lt;/a&gt; me if you have any question!&lt;/p&gt;</content><category term="Rudder"></category></entry><entry><title>Grsecurity updates and kernel-test "EOL"</title><link href="http://www.mauras.ch/grsecurity-updates-and-kernel-test-eol.html" rel="alternate"></link><published>2014-04-05T00:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-04-05:/grsecurity-updates-and-kernel-test-eol.html</id><summary type="html">&lt;p&gt;New versions of my grsecurity kernels.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.2.55-4&lt;/code&gt; and &lt;code&gt;3.2.55-104&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Upgrade to grsecurity-3.0-3.2.55-201403252026.patch&lt;/li&gt;
&lt;li&gt;Set CONFIG_GRKERNSEC_FLOODBURST=1000&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Yes they were actually available in the repo since end of march …&lt;/p&gt;</summary><content type="html">&lt;p&gt;New versions of my grsecurity kernels.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;3.2.55-4&lt;/code&gt; and &lt;code&gt;3.2.55-104&lt;/code&gt;&lt;ul&gt;
&lt;li&gt;Upgrade to grsecurity-3.0-3.2.55-201403252026.patch&lt;/li&gt;
&lt;li&gt;Set CONFIG_GRKERNSEC_FLOODBURST=1000&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Yes they were actually available in the repo since end of march but i hadn't time to blog about it.&lt;br /&gt;
Please also note that i'm not gonna update &lt;code&gt;kernel-test&lt;/code&gt; anymore. It takes too much time to keep up, and &lt;code&gt;Grsecurity&lt;/code&gt; stable kernel should soon switch to 3.13 or 3.14 - Depending what Canonical decides for their 14.04 LTS.&lt;br /&gt;
I'll let the reposiroty as it is for those interested in SRPMs.  &lt;/p&gt;
&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;  &lt;/p&gt;
&lt;p&gt;Don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="el6"></category><category term="zfs"></category></entry><entry><title>Unbound update - Now with pythonmodule!</title><link href="http://www.mauras.ch/unbound-update-now-with-pythonmodule.html" rel="alternate"></link><published>2014-03-22T12:45:00+01:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-03-22:/unbound-update-now-with-pythonmodule.html</id><summary type="html">&lt;p&gt;Unbound latest version - &lt;a href="http://www.unbound.net/download.html"&gt;1.4.22&lt;/a&gt;&lt;br /&gt;
Notable differences:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Doesn't depend on &lt;code&gt;ldns&lt;/code&gt; anymore - &lt;code&gt;yum -y update unbound &amp;amp;&amp;amp; yum -y remove ldns&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Built with pythonmodule support&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Init script will populate &lt;code&gt;chroot&lt;/code&gt; with your &lt;code&gt;python2.6&lt;/code&gt; directory …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Unbound latest version - &lt;a href="http://www.unbound.net/download.html"&gt;1.4.22&lt;/a&gt;&lt;br /&gt;
Notable differences:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Doesn't depend on &lt;code&gt;ldns&lt;/code&gt; anymore - &lt;code&gt;yum -y update unbound &amp;amp;&amp;amp; yum -y remove ldns&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Built with pythonmodule support&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Init script will populate &lt;code&gt;chroot&lt;/code&gt; with your &lt;code&gt;python2.6&lt;/code&gt; directory so that &lt;a href="http://www.mauras.ch/tag/python.html"&gt;python&lt;/a&gt; scripts can be fully usable.  &lt;/p&gt;
&lt;p&gt;As usual, &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; if you encounter any issues.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="unbound"></category><category term="python"></category></entry><entry><title>Nginx update</title><link href="http://www.mauras.ch/nginx-update.html" rel="alternate"></link><published>2014-03-07T17:00:00+01:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-03-07:/nginx-update.html</id><content type="html">&lt;p&gt;Nginx latest stable version - &lt;a href="http://nginx.org/en/CHANGES-1.4"&gt;1.4.6&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As usual, &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; if you encounter any issues.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="nginx"></category></entry><entry><title>EL6 Extras update</title><link href="http://www.mauras.ch/el6-extras-update.html" rel="alternate"></link><published>2014-03-01T15:47:00+01:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-03-01:/el6-extras-update.html</id><content type="html">&lt;p&gt;Keeping up with non up to date packages. Please find latest version 2.68 of &lt;a href="http://www.thekelleys.org.uk/dnsmasq/doc.html"&gt;dnsmasq&lt;/a&gt;  &lt;/p&gt;
&lt;p&gt;As usual, &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; if you encounter any issues.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="dnsmasq"></category></entry><entry><title>EL6 Extras additions and Grsecurity kernels</title><link href="http://www.mauras.ch/el6-extras-additions-and-grsecurity-kernels.html" rel="alternate"></link><published>2014-02-26T20:00:00+01:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-02-26:/el6-extras-additions-and-grsecurity-kernels.html</id><summary type="html">&lt;h4 id="el6-extras"&gt;El6 Extras&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Updates:&lt;ul&gt;
&lt;li&gt;Nginx 1.4.5&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Additions:&lt;ul&gt;
&lt;li&gt;Exim 4.82&lt;/li&gt;
&lt;li&gt;Libgsasl 1.8.0 - needed by exim&lt;/li&gt;
&lt;li&gt;Unbound 1.4.21&lt;/li&gt;
&lt;li&gt;Ldns 1.6.17 - needed by unbound&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The usual, Full RELRO, PIE, no …&lt;/p&gt;</summary><content type="html">&lt;h4 id="el6-extras"&gt;El6 Extras&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Updates:&lt;ul&gt;
&lt;li&gt;Nginx 1.4.5&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Additions:&lt;ul&gt;
&lt;li&gt;Exim 4.82&lt;/li&gt;
&lt;li&gt;Libgsasl 1.8.0 - needed by exim&lt;/li&gt;
&lt;li&gt;Unbound 1.4.21&lt;/li&gt;
&lt;li&gt;Ldns 1.6.17 - needed by unbound&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The usual, Full RELRO, PIE, no RPATH and up to date builds.  &lt;/p&gt;
&lt;h4 id="grsecurity"&gt;Grsecurity&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;Completely re-arranged the repository, please update your &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repo file&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;I added a new kernel without ZFS compatibility. It will be numbered starting 100 to differenciate from the classic stable with ZFS kernel. Please enable &lt;a href="http://repos.mauras.ch/RPM-GPG-KEY-build_at_mauras.ch"&gt;kernel-nozfs&lt;/a&gt; repo in your &lt;code&gt;grsecurity.repo&lt;/code&gt; file.&lt;/li&gt;
&lt;li&gt;Updates:&lt;ul&gt;
&lt;li&gt;Kernel stable 3.2.55 to grsecurity-3.0-3.2.55-201402152203.patch&lt;ul&gt;
&lt;li&gt;&lt;code&gt;kernel-nozfs&lt;/code&gt; has the &lt;a href="http://en.wikibooks.org/wiki/Grsecurity/Appendix/Grsecurity_and_PaX_Configuration_Options#Randomize_layout_of_sensitive_kernel_structures"&gt;RANDSTRUCT option&lt;/a&gt; enabled&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;ZFS modules now synced from the git master repo of &lt;code&gt;zfsonlinux&lt;/code&gt; - Still have snapshot automount issue.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As usual please &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; if you encounter any issues with these packages.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="nginx"></category><category term="exim"></category><category term="unbound"></category><category term="kernel"></category><category term="zfs"></category></entry><entry><title>EL6 Extras package additions</title><link href="http://www.mauras.ch/el6-extras-package-additions.html" rel="alternate"></link><published>2014-01-31T07:00:00+01:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-01-31:/el6-extras-package-additions.html</id><summary type="html">&lt;p&gt;I forgot to port my old &lt;a href="http://tmux.sourceforge.net/"&gt;tmux&lt;/a&gt; package over the new &lt;a href="http://repos.mauras.ch/EL6/el6_extras.repo"&gt;EL6 Extras&lt;/a&gt; repo, so here comes the addition.  &lt;/p&gt;
&lt;p&gt;Please note that i updated it to version 1.8 which now requires the use of …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I forgot to port my old &lt;a href="http://tmux.sourceforge.net/"&gt;tmux&lt;/a&gt; package over the new &lt;a href="http://repos.mauras.ch/EL6/el6_extras.repo"&gt;EL6 Extras&lt;/a&gt; repo, so here comes the addition.  &lt;/p&gt;
&lt;p&gt;Please note that i updated it to version 1.8 which now requires the use of libevent 2 - since version 1.7 actually, tmux 1.6 was the last version compatible with libevent 1.4 that you may find on EPEL.&lt;br /&gt;
To keep compatibility between libevent versions, libevent2 package will install itself in &lt;code&gt;/opt/el6_extras&lt;/code&gt;.&lt;br /&gt;
Starting from now, i'll use this directory to support multiple versions of apps/libs.  &lt;/p&gt;
&lt;p&gt;As usual you'll have to use the &lt;a href="http://repos.mauras.ch/RPM-GPG-KEY-build_at_mauras.ch"&gt;GPG public key&lt;/a&gt; to verify packages signature.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="tmux"></category><category term="libevent2"></category></entry><entry><title>Grsecurity updates</title><link href="http://www.mauras.ch/grsecurity-updates.html" rel="alternate"></link><published>2014-01-24T00:00:00+01:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-01-24:/grsecurity-updates.html</id><summary type="html">&lt;p&gt;I've been quite busy during December with holidays and all, so here's my attempt to keep up with up to date grsecurity patches.  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Stable 3.2.54 kernel&lt;/li&gt;
&lt;li&gt;Test 3.12.8 kernel&lt;/li&gt;
&lt;li&gt;Gradm 201401231926 …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;I've been quite busy during December with holidays and all, so here's my attempt to keep up with up to date grsecurity patches.  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Stable 3.2.54 kernel&lt;/li&gt;
&lt;li&gt;Test 3.12.8 kernel&lt;/li&gt;
&lt;li&gt;Gradm 201401231926&lt;/li&gt;
&lt;li&gt;spl/zfs &lt;a href="https://github.com/ryao"&gt;Ryao&lt;/a&gt;'s gentoo-next branch&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://github.com/ryao"&gt;Ryao&lt;/a&gt; is one of the main &lt;code&gt;zfsonlinux&lt;/code&gt; developpers which is also maintaining &lt;code&gt;Gentoo&lt;/code&gt;'s ZFS port with &lt;code&gt;hardened&lt;/code&gt; profile in mind. Switching to &lt;a href="https://github.com/ryao"&gt;Ryao&lt;/a&gt;'s gentoo-next branch thus makes more sense as &lt;a href="https://github.com/ryao"&gt;Ryao&lt;/a&gt; tightly follows &lt;code&gt;Grsecurity&lt;/code&gt; changes that could break ZFS.&lt;br /&gt;
These new ZFS packages are fixing the &lt;code&gt;failed user helper&lt;/code&gt; error introduced by the new restrictions in &lt;code&gt;Grsecurity&lt;/code&gt; 3.0. It still doesn't fix the ZFS snapshot automount functionnality though, but i did report it to &lt;a href="https://github.com/ryao"&gt;Ryao&lt;/a&gt; and hope to be able to quickly provide a fixed package.  &lt;/p&gt;
&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;  &lt;/p&gt;
&lt;p&gt;Changelog:
Grsecurity changelogs can be found here: &lt;a href="http://grsecurity.net/changelog-stable2.txt"&gt;stable&lt;/a&gt; and &lt;a href="http://grsecurity.net/changelog-test.txt"&gt;test&lt;/a&gt;&lt;br /&gt;
spl/zfs gentoo-next diff are there: &lt;a href="https://github.com/ryao/spl/compare/gentoo-next"&gt;spl&lt;/a&gt; and &lt;a href="https://github.com/ryao/zfs/compare/gentoo-next"&gt;zfs&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="kernel-test"></category><category term="el6"></category><category term="zfs"></category><category term="gradm"></category></entry><entry><title>Rudder agent configuration at node first boot</title><link href="http://www.mauras.ch/rudder-agent-configuration-at-node-first-boot.html" rel="alternate"></link><published>2014-01-24T00:00:00+01:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-01-24:/rudder-agent-configuration-at-node-first-boot.html</id><summary type="html">&lt;p&gt;After migrating all my rules from &lt;code&gt;Cfengine&lt;/code&gt; to &lt;code&gt;Rudder&lt;/code&gt;, i was still missing something. All my freshly kickstarted nodes weren't by default integrated to &lt;code&gt;Rudder&lt;/code&gt;.&lt;br /&gt;
While it was fairly easy on my &lt;code&gt;Cfengine&lt;/code&gt; installation to …&lt;/p&gt;</summary><content type="html">&lt;p&gt;After migrating all my rules from &lt;code&gt;Cfengine&lt;/code&gt; to &lt;code&gt;Rudder&lt;/code&gt;, i was still missing something. All my freshly kickstarted nodes weren't by default integrated to &lt;code&gt;Rudder&lt;/code&gt;.&lt;br /&gt;
While it was fairly easy on my &lt;code&gt;Cfengine&lt;/code&gt; installation to fetch rules for a new node during the kickstart phase, the fact that &lt;code&gt;Rudder&lt;/code&gt; requires the node to be accepted first, was kind of breaking my server provisioning workflow.  &lt;/p&gt;
&lt;p&gt;Hopefully &lt;code&gt;Rudder API&lt;/code&gt; provides everything's needed to programatically accept a new node on your &lt;code&gt;Rudder&lt;/code&gt; server.&lt;br /&gt;
The following init script is to be used at your node's first boot. It will send its inventory to the server, accept it from the pending nodes list and then fetch and apply the rules.  &lt;/p&gt;
&lt;p&gt;I consider that you've been able to install &lt;code&gt;rudder-agent&lt;/code&gt; and activate this script from you kickstart install prior to the node's first boot.  &lt;/p&gt;
&lt;p&gt;&lt;code&gt;rudder-installer&lt;/code&gt; init script:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="ch"&gt;#!/bin/bash&lt;/span&gt;
&lt;span class="c1"&gt;## BEGIN INIT INFO&lt;/span&gt;
&lt;span class="c1"&gt;# Provides: rudder-installer&lt;/span&gt;
&lt;span class="c1"&gt;# Default-Start: 3 4 5&lt;/span&gt;
&lt;span class="c1"&gt;# Default-Stop: 0 1 2 3 4 6&lt;/span&gt;
&lt;span class="c1"&gt;# Required-Start:&lt;/span&gt;
&lt;span class="c1"&gt;#&lt;/span&gt;
&lt;span class="c1"&gt;## END INIT INFO&lt;/span&gt;
&lt;span class="c1"&gt;# rudder-installer: Configure rudder agent&lt;/span&gt;
&lt;span class="c1"&gt;# chkconfig: 345 70 99&lt;/span&gt;
&lt;span class="c1"&gt;# description: Configure rudder agent&lt;/span&gt;

&lt;span class="c1"&gt;# Source function library.&lt;/span&gt;
.&lt;span class="w"&gt; &lt;/span&gt;/etc/init.d/functions

&lt;span class="c1"&gt;# Variables&lt;/span&gt;
&lt;span class="nv"&gt;PATH&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin
&lt;span class="nv"&gt;API_TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;lt;YOUR API TOKEN&amp;gt;&amp;quot;&lt;/span&gt;
&lt;span class="nv"&gt;RUDDER_SRV&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;lt;YOUR RUDDER SERVER URL&amp;gt;&amp;quot;&lt;/span&gt;
&lt;span class="nv"&gt;RUDDER_SRV_HOSTNAME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;lt;YOUR RUDDER SERVER HOSTNAME&amp;gt;&amp;quot;&lt;/span&gt;

&lt;span class="c1"&gt;# This will remove the script if configuration ended up correctly&lt;/span&gt;
clean&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-n&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Removing starting script&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;chkconfig&lt;span class="w"&gt; &lt;/span&gt;--del&lt;span class="w"&gt; &lt;/span&gt;rudder-installer
&lt;span class="w"&gt;    &lt;/span&gt;rm&lt;span class="w"&gt; &lt;/span&gt;-f&lt;span class="w"&gt; &lt;/span&gt;/etc/init.d/rudder-installer&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/dev/null
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;RETVAL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$RETVAL&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Configuration of agent&lt;/span&gt;
start&lt;span class="o"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Configuring rudder agent&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;# Configure server&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$RUDDER_SRV_HOSTNAME&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/var/rudder/cfengine-community/policy_server.dat

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;# Now declare host on server&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;    - Sending node inventory to the server - Can take up to 10mn please be patient...&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;/opt/rudder/bin/cf-agent&lt;span class="w"&gt; &lt;/span&gt;-KI&lt;span class="w"&gt; &lt;/span&gt;-D&lt;span class="w"&gt; &lt;/span&gt;force_inventory&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&amp;gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/root/rudder.log

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;# My inotify script will process the new inventory in far less than 10s, but better safe than sorry&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;    - Actually sleeps 10s as it&amp;#39;s the needed time to process inventory&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;sleep&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;10&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;    - Verify that node is now pending on the server&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;# Ask server using API&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;I&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;RESULT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;curl&lt;span class="w"&gt; &lt;/span&gt;-k&lt;span class="w"&gt; &lt;/span&gt;-X&lt;span class="w"&gt; &lt;/span&gt;GET&lt;span class="w"&gt; &lt;/span&gt;-H&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Content-Type: application/json&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-H&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;X-API-Token: &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;API_TOKEN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-H&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;X-API-Version: 2&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;RUDDER_SRV&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;/rudder/api/nodes/pending&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&amp;gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/root/rudder.log&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;sed&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;s/,/\n/g&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;grep&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$HOSTNAME&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-B&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;RET&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;# Looping to check if node is in pending list&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$RET&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;!&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;do&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;sleep&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nv"&gt;I&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$((&lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;I&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="k"&gt;))&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$I&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-lt&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;30&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nv"&gt;RESULT&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;curl&lt;span class="w"&gt; &lt;/span&gt;-k&lt;span class="w"&gt; &lt;/span&gt;-X&lt;span class="w"&gt; &lt;/span&gt;GET&lt;span class="w"&gt; &lt;/span&gt;-H&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;Content-Type: application/json&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-H&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;X-API-Token: &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;API_TOKEN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-H&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;X-API-Version: 2&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;RUDDER_SRV&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;/rudder/api/nodes/pending&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&amp;gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/root/rudder.log&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;sed&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;s/,/\n/g&amp;#39;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;grep&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$HOSTNAME&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-B&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nv"&gt;RET&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="c1"&gt;# We exit if the node is still not in pending list&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;!! Inventory discovery took too long, something must have fail - Exiting&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;sleep&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nb"&gt;exit&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;done&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;    - Get the node ID from the server&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;NODEID&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$RESULT&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;|&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;sed&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;s/.*id\&amp;quot;:\&amp;quot;//;s/\&amp;quot;.*//&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;RET&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;    - Auto accept node&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Accepting node&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/root/rudder.log
&lt;span class="w"&gt;    &lt;/span&gt;curl&lt;span class="w"&gt; &lt;/span&gt;-k&lt;span class="w"&gt; &lt;/span&gt;-X&lt;span class="w"&gt; &lt;/span&gt;POST&lt;span class="w"&gt; &lt;/span&gt;-H&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;X-API-Version: latest&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-H&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;X-API-Token: &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;API_TOKEN&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;RUDDER_SRV&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;/rudder/api/nodes/pending/&lt;span class="si"&gt;${&lt;/span&gt;&lt;span class="nv"&gt;NODEID&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-d&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;status=accepted&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&amp;gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/root/rudder.log

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;# At least should have :)&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;    - Node has been accepted!&amp;quot;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;# Yes 6mn is a safe waiting time on my server which takes ~4mn30 to process new server rules&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;    - Now that the node is accepted wait for 6 mn while Rudder server rebuilds rules&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;# Here&amp;#39;s the ugly &amp;quot;Make the user wait&amp;quot; timer&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;while&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-lt&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;360&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;do&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nv"&gt;i&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="k"&gt;$((&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="k"&gt;))&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;sleep&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;30&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-ne&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;elif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;60&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-ne&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;elif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;90&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-ne&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;elif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;120&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-ne&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;elif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;150&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-ne&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;elif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;180&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-ne&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;elif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;210&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-ne&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;elif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;240&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-ne&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;elif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;270&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-ne&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;elif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;300&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-ne&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;elif&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;330&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;then&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-ne&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$i&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-ne&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;.&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="k"&gt;fi&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;done&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;# Ok rules should be generated now let&amp;#39;s apply them on the node&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="c1"&gt;# I run two first command twice to ensure everything&amp;#39;s good - once should be sufficient&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;-e&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;\n    - Updating rules&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;### Ensure UUID is correctly detected by the node ###&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/root/rudder.log
&lt;span class="w"&gt;    &lt;/span&gt;/opt/rudder/bin/cf-agent&lt;span class="w"&gt; &lt;/span&gt;-KI&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&amp;gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/root/rudder.log
&lt;span class="w"&gt;    &lt;/span&gt;/opt/rudder/bin/cf-agent&lt;span class="w"&gt; &lt;/span&gt;-KI&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&amp;gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/root/rudder.log
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;### Update rules ###&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/root/rudder.log
&lt;span class="w"&gt;    &lt;/span&gt;/opt/rudder/bin/cf-agent&lt;span class="w"&gt; &lt;/span&gt;-KI&lt;span class="w"&gt; &lt;/span&gt;-b&lt;span class="w"&gt; &lt;/span&gt;update&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&amp;gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/root/rudder.log
&lt;span class="w"&gt;    &lt;/span&gt;/opt/rudder/bin/cf-agent&lt;span class="w"&gt; &lt;/span&gt;-KI&lt;span class="w"&gt; &lt;/span&gt;-b&lt;span class="w"&gt; &lt;/span&gt;update&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&amp;gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/root/rudder.log
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;### Now apply them ###&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&amp;gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/root/rudder.log
&lt;span class="w"&gt;    &lt;/span&gt;/opt/rudder/bin/cf-agent&lt;span class="w"&gt; &lt;/span&gt;-KI&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;&amp;gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;/root/rudder.log

&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;RETVAL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$RETVAL&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;# Init script parameters stuff&lt;/span&gt;
&lt;span class="k"&gt;case&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="nv"&gt;$1&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;in&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;start&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;start&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;success&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;||&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;failure
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="o"&gt;[[&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;$?&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;]]&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;clean&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;success&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;||&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;failure
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;*&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nb"&gt;echo&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;$&lt;span class="s2"&gt;&amp;quot;Usage: &lt;/span&gt;&lt;span class="nv"&gt;$0&lt;/span&gt;&lt;span class="s2"&gt; start&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="nb"&gt;exit&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="p"&gt;;;&lt;/span&gt;
&lt;span class="k"&gt;esac&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So upon completion, the script will remove itself from the init sequence and your freshly installed node should have all required rules applied. If not, consult &lt;code&gt;/root/rudder.log&lt;/code&gt; for details.&lt;br /&gt;
You have to use my &lt;a href="http://www.mauras.ch/speed-up-rudder-new-nodes-detection.html"&gt;inotify script&lt;/a&gt; on the server, as if you don't you will encounter the infamous "5mn delay" before your node appears in the &lt;code&gt;Rudder&lt;/code&gt; new nodes pending list which would render this init script completely useless as it would exit without applying any rules.  &lt;/p&gt;
&lt;p&gt;As usual, don't hesitate to &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; if you have any question.&lt;/p&gt;</content><category term="Rudder"></category><category term="bash"></category><category term="init"></category></entry><entry><title>What's using swap</title><link href="http://www.mauras.ch/whats-using-swap.html" rel="alternate"></link><published>2014-01-14T21:00:00+01:00</published><updated>2023-10-03T23:53:14+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2014-01-14:/whats-using-swap.html</id><summary type="html">&lt;p&gt;If like me you're bored of looping over all &lt;code&gt;/proc/&amp;lt;pid&amp;gt;/status&lt;/code&gt; files to find which application is actually using swap, here a tiny &lt;code&gt;python&lt;/code&gt; script to ease the task.  &lt;/p&gt;
&lt;p&gt;The script outputs a list …&lt;/p&gt;</summary><content type="html">&lt;p&gt;If like me you're bored of looping over all &lt;code&gt;/proc/&amp;lt;pid&amp;gt;/status&lt;/code&gt; files to find which application is actually using swap, here a tiny &lt;code&gt;python&lt;/code&gt; script to ease the task.  &lt;/p&gt;
&lt;p&gt;The script outputs a list of processes using swap with the following format: &lt;code&gt;&amp;lt;name&amp;gt; &amp;lt;uid&amp;gt; &amp;lt;swap usage&amp;gt;&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;Here's an example of what you can expect of the output of &lt;code&gt;vmswap.py | sort -nk3&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;pampd 501 4060kB
spampd 501 4100kB
spampd 501 4228kB
rsyslogd 0 4328kB
spampd 501 4368kB
spampd 501 7576kB
spampd 501 7612kB
httpd 48 10100kB
httpd 48 10140kB
httpd 48 10188kB
httpd 48 10216kB
httpd 48 10284kB
httpd 48 10308kB
httpd 48 10332kB
httpd 48 10388kB
httpd 48 10616kB
httpd 48 10628kB
httpd 48 10636kB
httpd 48 10848kB
httpd 48 10908kB
httpd 48 10916kB
httpd 48 10972kB
httpd 48 10980kB
httpd 48 11000kB
httpd 0 11084kB
httpd 48 11276kB
httpd 48 13056kB
httpd 48 14076kB
miniserv.pl 0 17412kB
memcached 496 23796kB
named 25 42388kB
mysqld 27 46292kB
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And here's &lt;code&gt;vmswap.py&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="ch"&gt;#!/bin/env python2&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;types&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;subprocess&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_command_output&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Get its output &lt;/span&gt;
    &lt;span class="n"&gt;process&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Popen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;PIPE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stderr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;shell&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;process&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;communicate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="c1"&gt;# Defaults ps command and arguments&lt;/span&gt;
    &lt;span class="n"&gt;ps_cmd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;ps&amp;#39;&lt;/span&gt;
    &lt;span class="n"&gt;ps_args&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;axcu&amp;#39;&lt;/span&gt;

    &lt;span class="c1"&gt;# Build ps command&lt;/span&gt;
    &lt;span class="n"&gt;ps_cmd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ps_cmd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ps_args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Get command output&lt;/span&gt;
    &lt;span class="n"&gt;plist&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;get_command_output&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ps_cmd&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Declare final list&lt;/span&gt;
    &lt;span class="n"&gt;flist&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
    &lt;span class="n"&gt;fadd&lt;/span&gt;  &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;flist&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;
    &lt;span class="n"&gt;proc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;

    &lt;span class="c1"&gt;# Loop on output list&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;pline&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;plist&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="c1"&gt;# Make a list out of each line&lt;/span&gt;
        &lt;span class="n"&gt;proc_list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pline&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;proc_list&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;/proc&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;proc_list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;status&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)):&lt;/span&gt;
            &lt;span class="n"&gt;proc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;proc_list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nb"&gt;open&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;/proc&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;proc_list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;status&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;rb&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
                &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;Name:&amp;#39;&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;pname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                    &lt;span class="n"&gt;pname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pname&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
                    &lt;span class="n"&gt;proc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;proc_list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]][&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pname&lt;/span&gt;
                &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;Uid:&amp;#39;&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;puid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
                    &lt;span class="n"&gt;proc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;proc_list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]][&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;uid&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;puid&lt;/span&gt;
                &lt;span class="k"&gt;elif&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;VmSwap:&amp;#39;&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;pswap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;line&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                    &lt;span class="n"&gt;pswap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pswap&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="se"&gt;\t&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
                    &lt;span class="n"&gt;proc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;proc_list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]][&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;swap&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pswap&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;pid&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;proc&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;swap&amp;#39;&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;proc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;pid&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;proc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;pid&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;swap&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;0 kB&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;&lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s1"&gt; &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;proc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;pid&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;name&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;proc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;pid&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;uid&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;proc&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;pid&lt;/span&gt;&lt;span class="p"&gt;][&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;swap&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot; &amp;quot;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
                &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="vm"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;__main__&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Don't hesitate to &lt;a href="http://www.mauras.ch/pages/contact.html"&gt;contact me&lt;/a&gt; if you have any question or suggestion.&lt;/p&gt;</content><category term="Code"></category><category term="system"></category><category term="python"></category></entry><entry><title>Grsecurity kernels update</title><link href="http://www.mauras.ch/grsecurity-kernels-update.html" rel="alternate"></link><published>2013-12-02T00:00:00+01:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2013-12-02:/grsecurity-kernels-update.html</id><summary type="html">&lt;p&gt;Second grsecurity patch in less than a week :)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Stable 3.2.53 kernel&lt;/li&gt;
&lt;li&gt;Test 3.12.2 kernel&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="warning"&gt;WARNING!&lt;/h4&gt;
&lt;p&gt;Please don't use 3.2.52 package. It was built without important &lt;code&gt;virtio&lt;/code&gt; drivers which would …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Second grsecurity patch in less than a week :)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Stable 3.2.53 kernel&lt;/li&gt;
&lt;li&gt;Test 3.12.2 kernel&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id="warning"&gt;WARNING!&lt;/h4&gt;
&lt;p&gt;Please don't use 3.2.52 package. It was built without important &lt;code&gt;virtio&lt;/code&gt; drivers which would make it kernel panic under a KVM guest.&lt;br /&gt;
Please also be aware that this Grsecurity patch enforcing kernel helpers in &lt;code&gt;/sbin&lt;/code&gt; will prevent &lt;code&gt;zfs&lt;/code&gt; automounting snapshots.  &lt;/p&gt;
&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;  &lt;/p&gt;
&lt;p&gt;Changelog:
Grsecurity changelogs can be found here: &lt;a href="http://grsecurity.net/changelog-stable2.txt"&gt;stable&lt;/a&gt; and &lt;a href="http://grsecurity.net/changelog-test.txt"&gt;test&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="kernel-test"></category><category term="el6"></category><category term="zfs"></category></entry><entry><title>Grsecurity update to latest 3.0 patch</title><link href="http://www.mauras.ch/grsecurity-update-to-latest-30-patch.html" rel="alternate"></link><published>2013-11-29T00:00:00+01:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2013-11-29:/grsecurity-update-to-latest-30-patch.html</id><summary type="html">&lt;p&gt;Here comes the new packages supporting the new Grsecurity patch version!&lt;br /&gt;
This mean:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Stable 3.2.52 kernel&lt;ul&gt;
&lt;li&gt;And its 0.6.2 ZFS modules&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Test 3.12.1 kernel&lt;ul&gt;
&lt;li&gt;ZFS modules has been updated …&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;Here comes the new packages supporting the new Grsecurity patch version!&lt;br /&gt;
This mean:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Stable 3.2.52 kernel&lt;ul&gt;
&lt;li&gt;And its 0.6.2 ZFS modules&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Test 3.12.1 kernel&lt;ul&gt;
&lt;li&gt;ZFS modules has been updated latest master git branch for 3.12 compatibility&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Gradm 3.0&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can note the return - if you ever noticed it was gone - of the stable kernel. Finally had time to catch up with the stable releases and add the configuration improvement made on the test kernels.  &lt;/p&gt;
&lt;h4 id="warning"&gt;WARNING!&lt;/h4&gt;
&lt;p&gt;Please note that size overflow plugin has been modified to have more coverage. This could mean that something working on a previous kernel could be broken on this new one - modules compilation etc...&lt;br /&gt;
It seems to impact only the stable 3.2.52 kernel though but &lt;strong&gt;USE AT YOUR OWN RISK!&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;As usual RPMs are available using the YUM &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;  &lt;/p&gt;
&lt;p&gt;Changelog:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;Kernel 3.12.1:
- Update to grsecurity-3.0-3.12.1-201311261522.patch
- Add option CONFIG_GRKERNSEC_JIT_HARDEN
- Add option CONFIG_GRKERNSEC_HARDEN_IPC

Kernel 3.2.52:
- Upgrade to grsecurity-3.0-3.2.52-201311261520.patch
- Add all options added to test
- Remove overlayfs patch
- Add option CONFIG_GRKERNSEC_JIT_HARDEN

ZFS/SPL modules - kernel-test only:
- Update to git master branch - 16_g30607d9

Gradm:
- Update to 3.0
- Remove management of /dev/grsec through the package
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Don't hesitate to &lt;a href="pages/contact.html"&gt;contact&lt;/a&gt; me if you find any issue.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel"></category><category term="kernel-test"></category><category term="el6"></category><category term="zfs"></category><category term="gradm"></category></entry><entry><title>Nginx package update</title><link href="http://www.mauras.ch/nginx-package-update.html" rel="alternate"></link><published>2013-11-19T20:25:00+01:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2013-11-19:/nginx-package-update.html</id><summary type="html">&lt;p&gt;I guess you've heard about &lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-4547"&gt;CVE-2013-4547&lt;/a&gt;, so &lt;a href="http://repos.mauras.ch/EL6/SRPMS/nginx-1.4.4-1.el6.src.rpm"&gt;here's&lt;/a&gt; version 1.4.4 of Nginx.&lt;br /&gt;
As usual it's available directly from my &lt;a href="http://repos.mauras.ch/EL6/el6_extras.repo"&gt;EL6 extras repository&lt;/a&gt; and you'll have to use the &lt;a href="http://repos.mauras.ch/RPM-GPG-KEY-build_at_mauras.ch"&gt;GPG public key&lt;/a&gt; to verify …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I guess you've heard about &lt;a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-4547"&gt;CVE-2013-4547&lt;/a&gt;, so &lt;a href="http://repos.mauras.ch/EL6/SRPMS/nginx-1.4.4-1.el6.src.rpm"&gt;here's&lt;/a&gt; version 1.4.4 of Nginx.&lt;br /&gt;
As usual it's available directly from my &lt;a href="http://repos.mauras.ch/EL6/el6_extras.repo"&gt;EL6 extras repository&lt;/a&gt; and you'll have to use the &lt;a href="http://repos.mauras.ch/RPM-GPG-KEY-build_at_mauras.ch"&gt;GPG public key&lt;/a&gt; to verify packages signature.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="nginx"></category></entry><entry><title>Easy git access control - Part 2 - more granularity</title><link href="http://www.mauras.ch/easy-git-access-control-part-2-more-granularity.html" rel="alternate"></link><published>2013-11-11T21:00:00+01:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2013-11-11:/easy-git-access-control-part-2-more-granularity.html</id><summary type="html">&lt;p&gt;In my &lt;a href="../easy-git-access-control.html"&gt;previous post&lt;/a&gt; i talked about how to easily manage write permissions on a &lt;code&gt;git&lt;/code&gt; repository.&lt;br /&gt;
As i said, the script could easily be extented to provide more granularity.&lt;br /&gt;
Here comes an improved version …&lt;/p&gt;</summary><content type="html">&lt;p&gt;In my &lt;a href="../easy-git-access-control.html"&gt;previous post&lt;/a&gt; i talked about how to easily manage write permissions on a &lt;code&gt;git&lt;/code&gt; repository.&lt;br /&gt;
As i said, the script could easily be extented to provide more granularity.&lt;br /&gt;
Here comes an improved version!&lt;/p&gt;
&lt;p&gt;Features:  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Support groups&lt;/li&gt;
&lt;li&gt;Support nested groups&lt;/li&gt;
&lt;li&gt;Let's you name the admin group&lt;/li&gt;
&lt;li&gt;Let's you give full rights to admin group&lt;/li&gt;
&lt;li&gt;Let's you give user the right to push to his/her own branch - branch named after user name&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here's an example &lt;code&gt;git.acl&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;global&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="c1"&gt;# Name of the admin group&lt;/span&gt;
&lt;span class="nv"&gt;admin_group&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;admin
&lt;span class="c1"&gt;# Is admin group able to push everything? 0|1&lt;/span&gt;
&lt;span class="nv"&gt;full_admin&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;span class="c1"&gt;# Is user able to push in his named branch? 0|1&lt;/span&gt;
&lt;span class="nv"&gt;owner_branch&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;

&lt;span class="o"&gt;[&lt;/span&gt;groups&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="nv"&gt;admin&lt;/span&gt;&lt;span class="w"&gt;       &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;olivier&lt;span class="w"&gt; &lt;/span&gt;joe
&lt;span class="nv"&gt;commiters&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;@admin&lt;span class="w"&gt; &lt;/span&gt;jane&lt;span class="w"&gt; &lt;/span&gt;jim
&lt;span class="nv"&gt;project1&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;@admin&lt;span class="w"&gt; &lt;/span&gt;@commiters&lt;span class="w"&gt; &lt;/span&gt;@project2
&lt;span class="nv"&gt;project2&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;@admin&lt;span class="w"&gt; &lt;/span&gt;john&lt;span class="w"&gt; &lt;/span&gt;mickael

&lt;span class="o"&gt;[&lt;/span&gt;branches&lt;span class="o"&gt;]&lt;/span&gt;
&lt;span class="nv"&gt;master&lt;/span&gt;&lt;span class="w"&gt;      &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;@admin
&lt;span class="nv"&gt;project1&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;@project1
&lt;span class="nv"&gt;test_branch&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;sam
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And here is the updated &lt;code&gt;update&lt;/code&gt; hook:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="ch"&gt;#!/bin/env python2&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;os&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;sys&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;subprocess&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;ConfigParser&lt;/span&gt;
&lt;span class="c1"&gt;#from pprint import pprint&lt;/span&gt;

&lt;span class="c1"&gt;# Exit on error&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;error_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;
    &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Exit on success&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;ok_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="n"&gt;string&lt;/span&gt;
    &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Recursively get all users from a group&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;expand_nested_groups&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;groups&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;group&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;parsed_groups&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[]):&lt;/span&gt;
    &lt;span class="n"&gt;parsed_groups&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;group&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;startswith&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;@&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;group_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:]&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;group_name&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;parsed_groups&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
        &lt;span class="n"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;set&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;u&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;groups&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;group_name&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
            &lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;expand_nested_groups&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="n"&gt;groups&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;group_name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;u&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;parsed_groups&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;res&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="c1"&gt;# Verify that acl_file exists before reading it&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_config&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="c1"&gt;# Fix acl file path if needed&lt;/span&gt;
    &lt;span class="n"&gt;exec_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getcwd&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;/hooks/&amp;#39;&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;exec_path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;acl_file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;./git.acl&amp;#39;&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;acl_file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;./hooks/git.acl&amp;#39;&lt;/span&gt;

    &lt;span class="c1"&gt;# Open and read acl file if exists&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;isfile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;acl_file&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ConfigParser&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RawConfigParser&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;acl_file&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;error_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;acl_file&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot; doesn&amp;#39;t seem to be a valid config file!&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;error_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;acl_file&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot; is missing!&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Returns global settings &lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_config_global&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;is_int&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="c1"&gt;# Verify if global section exists&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;has_section&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;global&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;has_option&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;global&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;is_int&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getint&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;global&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;global&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;error_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;option&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot; option doesn&amp;#39;t exists in &amp;#39;global&amp;#39; section!&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;error_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;#39;[global]&amp;#39; section not found in your acl file!&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Retuns a dict of groups&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_config_groups&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;has_section&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;groups&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;group_list&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;groups&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;group_list&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;group_dict&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;group_list&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="c1"&gt;#pprint(group_dict)&lt;/span&gt;

            &lt;span class="c1"&gt;# Let&amp;#39;s expand groups&lt;/span&gt;
            &lt;span class="n"&gt;expanded_groups&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
            &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;group&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;group_dict&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;iteritems&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
                &lt;span class="n"&gt;expanded_groups&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;group&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;set&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
                &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                    &lt;span class="n"&gt;expanded_users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;expand_nested_groups&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                        &lt;span class="n"&gt;group_dict&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="n"&gt;group&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                        &lt;span class="p"&gt;[])&lt;/span&gt;
                    &lt;span class="n"&gt;expanded_groups&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;group&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;expanded_users&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;expanded_groups&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;error_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;Your &amp;#39;[groups]&amp;#39; section seems to have no options...&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;error_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;#39;[groups]&amp;#39; section not found in your acl file!&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Returns a list of users allowed for a branch&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_config_branch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;branch&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;has_section&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;branches&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;has_option&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;branches&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;branch&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;branches&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;branch&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;error_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;This branch doesn&amp;#39;t have any right set!&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;error_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&amp;#39;[branches]&amp;#39; section not found in your acl file!&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="c1"&gt;# Get arguments&lt;/span&gt;
    &lt;span class="n"&gt;refname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;oldrev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;newrev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;gituser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;USER&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Declare object types&lt;/span&gt;
    &lt;span class="n"&gt;objtype&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;commit&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;delete&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;tag&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="c1"&gt;# Init acl file reading&lt;/span&gt;
    &lt;span class="n"&gt;acl_config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_config&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="c1"&gt;# Get global settings&lt;/span&gt;
    &lt;span class="n"&gt;admin_group&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_config_global&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;acl_config&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;admin_group&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;full_admin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_config_global&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;acl_config&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;full_admin&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;owner_branch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_config_global&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;acl_config&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;owner_branch&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Get group list&lt;/span&gt;
    &lt;span class="n"&gt;g&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_config_groups&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;acl_config&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="c1"&gt;#pprint(g)&lt;/span&gt;

    &lt;span class="c1"&gt;# Get branch name&lt;/span&gt;
    &lt;span class="n"&gt;exp_refname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;refname&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;/&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;branch_name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;exp_refname&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

    &lt;span class="c1"&gt;# Printing this only for information&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;branch=&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;branch_name&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;oldrev=&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;oldrev&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;newrev=&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;newrev&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;user=&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;gituser&lt;/span&gt;

    &lt;span class="c1"&gt;# Get object type&lt;/span&gt;
    &lt;span class="n"&gt;cmd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;git cat-file -t &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;newrev&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;process&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Popen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;PIPE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stderr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;shell&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;process&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;communicate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;thistype&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][:&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;object=&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;thistype&lt;/span&gt;

    &lt;span class="c1"&gt;# Reject unknown object types &lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;thistype&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;objtype&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;error_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;You can&amp;#39;t push this type of objects&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;### Access right checking ###&lt;/span&gt;
    &lt;span class="c1"&gt;# Admin processing&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;full_admin&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;gituser&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;admin_group&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
        &lt;span class="n"&gt;ok_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;ADMIN ACCESS GRANTED&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# user writes to his own branch&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;owner_branch&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;gituser&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="n"&gt;branch_name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;    
        &lt;span class="n"&gt;ok_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;BRANCH OWNER ACCESS GRANTED&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Not admin nor branch owner&lt;/span&gt;
    &lt;span class="c1"&gt;# Get branch access rights&lt;/span&gt;
    &lt;span class="n"&gt;branch_access&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_config_branch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;acl_config&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;branch_name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Branch exists in git.acl check if user has rights&lt;/span&gt;
    &lt;span class="c1"&gt;# Start with group&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;branch_access&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;@&amp;#39;&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;gituser&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;strip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;@&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)]:&lt;/span&gt;
            &lt;span class="n"&gt;ok_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;BRANCH ACCESS GRANTED&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Not in a group so do a basic check&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;gituser&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;branch_access&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;ok_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;BRANCH ACCESS GRANTED&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;error_exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;BRANCH ACCESS DENIED&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="c1"&gt;# Catchall exit, means we haven&amp;#39;t match any case...&lt;/span&gt;
    &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="vm"&gt;__name__&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;__main__&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;main&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Thanks to &lt;a href="http://www.linkedin.com/pub/steeve-chailloux/59/16a/480"&gt;Steeve Chailloux&lt;/a&gt; for his group expansion function which was way better than mine :)  &lt;/p&gt;
&lt;p&gt;Next time let's support rights on tags ;)&lt;/p&gt;</content><category term="Code"></category><category term="git"></category><category term="python"></category></entry><entry><title>Package addition in EL6 repo</title><link href="http://www.mauras.ch/package-addition-in-el6-repo.html" rel="alternate"></link><published>2013-10-25T15:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2013-10-25:/package-addition-in-el6-repo.html</id><summary type="html">&lt;p&gt;I've added some new packages in the &lt;a href="http://repos.mauras.ch/EL6/el6_extras.repo"&gt;EL6 extras repository&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GeoIP 1.5.1&lt;/li&gt;
&lt;li&gt;nginx 1.4.3&lt;/li&gt;
&lt;li&gt;libyaml 0.1.4&lt;/li&gt;
&lt;li&gt;PyYAML 3.10 &lt;/li&gt;
&lt;li&gt;uwsgi 1.9.18.2&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As usual please use the …&lt;/p&gt;</summary><content type="html">&lt;p&gt;I've added some new packages in the &lt;a href="http://repos.mauras.ch/EL6/el6_extras.repo"&gt;EL6 extras repository&lt;/a&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;GeoIP 1.5.1&lt;/li&gt;
&lt;li&gt;nginx 1.4.3&lt;/li&gt;
&lt;li&gt;libyaml 0.1.4&lt;/li&gt;
&lt;li&gt;PyYAML 3.10 &lt;/li&gt;
&lt;li&gt;uwsgi 1.9.18.2&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;As usual please use the &lt;a href="http://repos.mauras.ch/RPM-GPG-KEY-build_at_mauras.ch"&gt;GPG public key&lt;/a&gt; to verify packages signatures.&lt;/p&gt;</content><category term="Repositories"></category><category term="el6"></category><category term="nginx"></category><category term="python"></category></entry><entry><title>Easy git access control</title><link href="http://www.mauras.ch/easy-git-access-control.html" rel="alternate"></link><published>2013-10-21T09:25:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2013-10-21:/easy-git-access-control.html</id><summary type="html">&lt;p&gt;Basic access to a &lt;code&gt;git&lt;/code&gt; repository is fairly easy.&lt;br /&gt;
You specify &lt;code&gt;--shared&lt;/code&gt; when initializing your &lt;code&gt;bare&lt;/code&gt; repository, &lt;code&gt;chgrp &amp;lt;your group&amp;gt;&lt;/code&gt; to the repository directory and your done. Now everyone in &lt;code&gt;&amp;lt;your group&amp;gt;&lt;/code&gt; has read and …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Basic access to a &lt;code&gt;git&lt;/code&gt; repository is fairly easy.&lt;br /&gt;
You specify &lt;code&gt;--shared&lt;/code&gt; when initializing your &lt;code&gt;bare&lt;/code&gt; repository, &lt;code&gt;chgrp &amp;lt;your group&amp;gt;&lt;/code&gt; to the repository directory and your done. Now everyone in &lt;code&gt;&amp;lt;your group&amp;gt;&lt;/code&gt; has read and write access to the repository with their account.  &lt;/p&gt;
&lt;h4 id="so-what-do-i-need"&gt;So what do I need?&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;An easy way to tell which user can actually write or not&lt;/li&gt;
&lt;li&gt;A solution easy to integrate with my actual configuration manager - Here rudder/cfengine&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Gitolite - to name the widely used tool for this kind of case - requires to install a bunch of script files, set a common git user, and store all its settings in a specific &lt;code&gt;git&lt;/code&gt; repository. Definitely not practical to integrate in a configuration management tool.  &lt;/p&gt;
&lt;h4 id="how-to-do-it-then"&gt;How to do it then?&lt;/h4&gt;
&lt;p&gt;It is actually very easy to achieve these requirements with only basic linux settings and &lt;code&gt;git&lt;/code&gt; hooks.  &lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Read access:&lt;ul&gt;
&lt;li&gt;ssh + user group&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Write access:&lt;ul&gt;
&lt;li&gt;&lt;code&gt;git&lt;/code&gt; hook + acl file&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Create your new &lt;code&gt;git&lt;/code&gt; repository:  &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;git init --bare --shared &amp;lt;repo&amp;gt;
chgrp -R &amp;lt;your group&amp;gt; &amp;lt;repo&amp;gt;
chmod o-rx &amp;lt;repo&amp;gt;
ls -ld &amp;lt;repo&amp;gt;
drwxrws--- 7 root &amp;lt;your group&amp;gt; 10 Oct 21 09:40 &amp;lt;repo&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Replace &lt;code&gt;&amp;lt;repo&amp;gt;/hooks/update&lt;/code&gt; by the following &lt;code&gt;python&lt;/code&gt; script.&lt;br /&gt;
This script checks the type of command you're sending and validates if your username is listed in the &lt;code&gt;git.acl&lt;/code&gt; file and exits accordingly.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="ch"&gt;#!/bin/env python&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;os&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nn"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nn"&gt;subprocess&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nn"&gt;ConfigParser&lt;/span&gt;

&lt;span class="n"&gt;refname&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;oldrev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;newrev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;argv&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getenv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;USER&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;revtype&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;commit&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;delete&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;tag&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ConfigParser&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RawConfigParser&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;read&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;./git.acl&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;users&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;write&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;split&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;


&lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="n"&gt;refname&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;oldrev=&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;oldrev&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;newrev=&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="n"&gt;newrev&lt;/span&gt;
&lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;

&lt;span class="n"&gt;cmd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;git cat-file -t &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;newrev&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;process&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Popen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;PIPE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stderr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;shell&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;process&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;communicate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;thistype&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;][:&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt; &lt;span class="n"&gt;thistype&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;revtype&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;!!! You&amp;#39;re not authorized to push code to this repo&amp;quot;&lt;/span&gt;
    &lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;sys&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Here is &lt;code&gt;&amp;lt;repo&amp;gt;/hooks/git.acl&lt;/code&gt;&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;[users]
write = admin joe bob brad
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;The script could easily be extented to do more granular rights - allow pushing to branches but not to master, which branches a user could push to, etc... - while still being very easy to deploy using your favorite configuration management tool.  &lt;/p&gt;</content><category term="Code"></category><category term="git"></category><category term="python"></category></entry><entry><title>Grsecurity 3.11.6 kernel available</title><link href="http://www.mauras.ch/grsecurity-3116-kernel-available.html" rel="alternate"></link><published>2013-10-19T09:20:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2013-10-19:/grsecurity-3116-kernel-available.html</id><summary type="html">&lt;p&gt;Grsecurity test kernel is now available as RPM in the &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;&lt;br /&gt;
You can fetch the SRPM &lt;a href="http://repos.mauras.ch/grsecurity/kernel-test/SRPMS/kernel-3.11.6-1.el6.src.rpm"&gt;here&lt;/a&gt;  &lt;/p&gt;
&lt;p&gt;Changelog:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;- Update to kernel 3.11.6
- Update to grsecurity-2.9.1-3.11.6-201310191259.patch
- Add new grsec …&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;Grsecurity test kernel is now available as RPM in the &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;&lt;br /&gt;
You can fetch the SRPM &lt;a href="http://repos.mauras.ch/grsecurity/kernel-test/SRPMS/kernel-3.11.6-1.el6.src.rpm"&gt;here&lt;/a&gt;  &lt;/p&gt;
&lt;p&gt;Changelog:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;- Update to kernel 3.11.6
- Update to grsecurity-2.9.1-3.11.6-201310191259.patch
- Add new grsec option: CONFIG_GRKERNSEC_DENYUSB
- overlayfs patch is removed
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;At the same time, zfs modules have been recompiled for it.&lt;br /&gt;
You can also install them by using the yum repository.&lt;/p&gt;
&lt;p&gt;Please note that now all packages are signed using GPG. You can import the signing GPG public key from &lt;a href="http://repos.mauras.ch/RPM-GPG-KEY-build_at_mauras.ch"&gt;here&lt;/a&gt;&lt;br /&gt;
Until i create RPM packages to deploy my repository configs, you can import the key using:
&lt;code&gt;rpm --import http://repos.mauras.ch/RPM-GPG-KEY-build_at_mauras.ch&lt;/code&gt;&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel-test"></category><category term="el6"></category><category term="zfs"></category></entry><entry><title>Rudder: Migrate from cfengine</title><link href="http://www.mauras.ch/rudder-migrate-from-cfengine.html" rel="alternate"></link><published>2013-09-10T00:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2013-09-10:/rudder-migrate-from-cfengine.html</id><summary type="html">&lt;p&gt;The following standalone promise installs &lt;code&gt;rudder-agent&lt;/code&gt; on a currently managed &lt;code&gt;cfengine&lt;/code&gt; host.&lt;br /&gt;
The &lt;code&gt;container&lt;/code&gt; class is here only for me to identify &lt;code&gt;OpenVZ&lt;/code&gt; guests.  &lt;/p&gt;
&lt;p&gt;Use at your own risk and modify it at your convenience …&lt;/p&gt;</summary><content type="html">&lt;p&gt;The following standalone promise installs &lt;code&gt;rudder-agent&lt;/code&gt; on a currently managed &lt;code&gt;cfengine&lt;/code&gt; host.&lt;br /&gt;
The &lt;code&gt;container&lt;/code&gt; class is here only for me to identify &lt;code&gt;OpenVZ&lt;/code&gt; guests.  &lt;/p&gt;
&lt;p&gt;Use at your own risk and modify it at your convenience.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;bundle&lt;span class="w"&gt; &lt;/span&gt;agent&lt;span class="w"&gt; &lt;/span&gt;rudder_agent_install&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;vars:
&lt;span class="w"&gt;        &lt;/span&gt;container::
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;repo_content&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;string&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;[Rudder]&lt;/span&gt;
&lt;span class="s2"&gt;name=Rudder 2.7 Repository&lt;/span&gt;
&lt;span class="s2"&gt;baseurl=http://repos/rudder/test/RHEL_6/&lt;/span&gt;
&lt;span class="s2"&gt;gpgcheck=0&lt;/span&gt;
&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;files:
&lt;span class="w"&gt;        &lt;/span&gt;container::
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/etc/yum.repos.d/rudder.repo&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="nv"&gt;create&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;true&amp;quot;&lt;/span&gt;,
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="nv"&gt;edit_line&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;append_to_repo_file&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;repo_content&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;packages:
&lt;span class="w"&gt;        &lt;/span&gt;container::
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;rudder-agent&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="nv"&gt;package_policy&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;add&amp;quot;&lt;/span&gt;,
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="nv"&gt;package_method&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;yum_rpm_sta,
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="nv"&gt;classes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;repaired_&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;kick_inventory&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;methods:
&lt;span class="w"&gt;        &lt;/span&gt;kick_inventory::
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;any&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;usebundle&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;rudder_config&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="o"&gt;}&lt;/span&gt;

bundle&lt;span class="w"&gt; &lt;/span&gt;agent&lt;span class="w"&gt; &lt;/span&gt;rudder_config&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;files:
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/var/rudder/cfengine-community/policy_server.dat&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nv"&gt;create&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;true&amp;quot;&lt;/span&gt;,
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nv"&gt;edit_line&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;append_to_repo_file&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;rudder&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;commands:
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/opt/rudder/bin/cf-agent -KI -D force_inventory&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/etc/init.d/cf-serverd stop&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/etc/init.d/cf-execd stop&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

bundle&lt;span class="w"&gt; &lt;/span&gt;edit_line&lt;span class="w"&gt; &lt;/span&gt;append_to_repo_file&lt;span class="o"&gt;(&lt;/span&gt;list&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;insert_lines:
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;list&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

body&lt;span class="w"&gt; &lt;/span&gt;delete&lt;span class="w"&gt; &lt;/span&gt;tidyfiles_&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="nv"&gt;rmdirs&lt;/span&gt;&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;true&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;     &lt;/span&gt;&lt;span class="nv"&gt;dirlinks&lt;/span&gt;&lt;span class="w"&gt;   &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;delete&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

body&lt;span class="w"&gt; &lt;/span&gt;classes&lt;span class="w"&gt; &lt;/span&gt;repaired_&lt;span class="o"&gt;(&lt;/span&gt;new_class&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="nv"&gt;promise_repaired&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;new_class&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;

body&lt;span class="w"&gt; &lt;/span&gt;package_method&lt;span class="w"&gt; &lt;/span&gt;yum_rpm_sta&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_changes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;bulk&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_list_command&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/bin/rpm -qa --qf &amp;#39;%{name} %{version}-%{release} %{arch}\n&amp;#39;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_patch_list_command&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/usr/bin/yum --quiet check-update&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_list_name_regex&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;^(\S+?)\s\S+?\s\S+&lt;/span&gt;$&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_list_version_regex&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;^\S+?\s(\S+?)\s\S+&lt;/span&gt;$&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_list_arch_regex&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;^\S+?\s\S+?\s(\S+)&lt;/span&gt;$&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_installed_regex&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;.*&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_name_convention&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;name&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="c1"&gt;# set it to &amp;quot;0&amp;quot; to avoid caching of list during upgrade&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_list_update_command&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/usr/bin/yum --quiet check-update&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_list_update_ifelapsed&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;240&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_patch_installed_regex&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;^\s.*&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_patch_name_regex&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;([^.]+).*&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_patch_version_regex&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;[^\s]\s+([^\s]+).*&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_patch_arch_regex&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;[^.]+\.([^\s]+).*&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_add_command&lt;/span&gt;&lt;span class="w"&gt;    &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/usr/bin/yum -y install&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_update_command&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/usr/bin/yum -y update&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_patch_command&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/usr/bin/yum -y update&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_delete_command&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/bin/rpm -e --nodeps --allmatches&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;  &lt;/span&gt;&lt;span class="nv"&gt;package_verify_command&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/bin/rpm -V&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Let's see the code in details.  &lt;/p&gt;
&lt;p&gt;First install the repo file and install &lt;code&gt;rudder-agent&lt;/code&gt; package:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="w"&gt;    &lt;/span&gt;vars:
&lt;span class="w"&gt;        &lt;/span&gt;container::
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;repo_content&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;string&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;[Rudder]&lt;/span&gt;
&lt;span class="s2"&gt;name=Rudder 2.7 Repository&lt;/span&gt;
&lt;span class="s2"&gt;baseurl=http://repos/rudder/test/RHEL_6/&lt;/span&gt;
&lt;span class="s2"&gt;gpgcheck=0&lt;/span&gt;
&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;files:
&lt;span class="w"&gt;        &lt;/span&gt;container::
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/etc/yum.repos.d/rudder.repo&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="nv"&gt;create&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;true&amp;quot;&lt;/span&gt;,
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="nv"&gt;edit_line&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;append_to_repo_file&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;repo_content&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;packages:
&lt;span class="w"&gt;        &lt;/span&gt;container::
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;rudder-agent&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="nv"&gt;package_policy&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;add&amp;quot;&lt;/span&gt;,
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="nv"&gt;package_method&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;yum_rpm_sta,
&lt;span class="w"&gt;                &lt;/span&gt;&lt;span class="nv"&gt;classes&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;repaired_&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;kick_inventory&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Then if package has been installed, call the bundle &lt;code&gt;rudder_config&lt;/code&gt;:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;methods:
&lt;span class="w"&gt;        &lt;/span&gt;kick_inventory::
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;any&amp;quot;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nv"&gt;usebundle&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;rudder_config&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Populate &lt;code&gt;/var/rudder/cfengine-community/policy_server.dat&lt;/code&gt; with your Rudder server name &lt;code&gt;rudder&lt;/code&gt; then run the Rudder agent with &lt;code&gt;force_inventory&lt;/code&gt; class to force node to send its inventory to the server, then stop running &lt;code&gt;cfengine&lt;/code&gt; processes.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;bundle&lt;span class="w"&gt; &lt;/span&gt;agent&lt;span class="w"&gt; &lt;/span&gt;rudder_config&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;{&lt;/span&gt;
&lt;span class="w"&gt;    &lt;/span&gt;files:
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/var/rudder/cfengine-community/policy_server.dat&amp;quot;&lt;/span&gt;
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nv"&gt;create&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;true&amp;quot;&lt;/span&gt;,
&lt;span class="w"&gt;            &lt;/span&gt;&lt;span class="nv"&gt;edit_line&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;gt;&lt;span class="w"&gt; &lt;/span&gt;append_to_repo_file&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;rudder&amp;quot;&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="w"&gt;    &lt;/span&gt;commands:
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/opt/rudder/bin/cf-agent -KI -D force_inventory&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/etc/init.d/cf-serverd stop&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="w"&gt;        &lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;/etc/init.d/cf-execd stop&amp;quot;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Everything else is &lt;code&gt;cfengine&lt;/code&gt; functions to make all that work.&lt;br /&gt;
Finally use &lt;code&gt;cf-agent -b rudder_install -D container -f /path/to/the/promise.cf&lt;/code&gt; to actually run this promise.  &lt;/p&gt;
&lt;p&gt;Rudder agent sets a cron job in &lt;code&gt;/etc/cron.d/rudder-agent&lt;/code&gt; which should take care of starting itself in the following 5 minutes.  &lt;/p&gt;</content><category term="Rudder"></category><category term="cfengine"></category></entry><entry><title>Grsecurity 3.10.10 kernel available</title><link href="http://www.mauras.ch/grsecurity-31010-kernel-available.html" rel="alternate"></link><published>2013-09-01T00:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2013-09-01:/grsecurity-31010-kernel-available.html</id><summary type="html">&lt;p&gt;Grsecurity test kernel is now available as RPM in the &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;&lt;br /&gt;
You can fetch the SRPM &lt;a href="http://repos.mauras.ch/grsecurity/kernel-test/SRPMS/kernel-3.10.10-1.el6.src.rpm"&gt;here&lt;/a&gt;  &lt;/p&gt;
&lt;p&gt;Changelog:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;- Update to kernel 3.10.10
- Update to grsecurity-2.9.1-3.10.10-201309011630.patch
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;At the same …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Grsecurity test kernel is now available as RPM in the &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;&lt;br /&gt;
You can fetch the SRPM &lt;a href="http://repos.mauras.ch/grsecurity/kernel-test/SRPMS/kernel-3.10.10-1.el6.src.rpm"&gt;here&lt;/a&gt;  &lt;/p&gt;
&lt;p&gt;Changelog:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;- Update to kernel 3.10.10
- Update to grsecurity-2.9.1-3.10.10-201309011630.patch
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;At the same time, zfs modules have been recompiled for it.&lt;br /&gt;
You can also install them by using the yum repository.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel-test"></category><category term="el6"></category><category term="zfs"></category></entry><entry><title>Speed up Rudder new node's detection</title><link href="http://www.mauras.ch/speed-up-rudder-new-nodes-detection.html" rel="alternate"></link><published>2013-08-27T00:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2013-08-27:/speed-up-rudder-new-nodes-detection.html</id><summary type="html">&lt;p&gt;By default, a new node sending its inventory to the Rudder server, won't appear in the "Accept new nodes" menu before the next &lt;code&gt;cf-agent&lt;/code&gt; run on the server.&lt;br /&gt;
In the worst case scenario, you'll have …&lt;/p&gt;</summary><content type="html">&lt;p&gt;By default, a new node sending its inventory to the Rudder server, won't appear in the "Accept new nodes" menu before the next &lt;code&gt;cf-agent&lt;/code&gt; run on the server.&lt;br /&gt;
In the worst case scenario, you'll have to wait 5 minutes for the node to appear. My issue was that i needed this process to be as quick as possible as i'm deploying &lt;code&gt;rudder-agent&lt;/code&gt; through a kickstart post-install script, and i whished for the deployed node to have all the rudder rules applied before reboot.  &lt;/p&gt;
&lt;p&gt;As the inventory creation can be tracked in &lt;code&gt;/var/rudder/inventories/incoming&lt;/code&gt;, a small python script using pyinotify to the rescue. &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="ch"&gt;#!/usr/bin/python&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;os&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nn"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nn"&gt;subprocess&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nn"&gt;re&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nn"&gt;thread&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;pyinotify&lt;/span&gt;

&lt;span class="n"&gt;command&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;/opt/rudder/bin/cf-agent -K -b sendInventoryToCmdb -f /var/rudder/cfengine-community/inputs/promises.cf&amp;quot;&lt;/span&gt;
&lt;span class="n"&gt;report_re&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;re&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;compile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;R:.*&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;wm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pyinotify&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WatchManager&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="c1"&gt;# Watch Manager&lt;/span&gt;
&lt;span class="n"&gt;mask&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pyinotify&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IN_DELETE&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;pyinotify&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IN_CREATE&lt;/span&gt; &lt;span class="c1"&gt;# watched events&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;exec_proc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dummy1&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;process&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Popen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;command&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;PIPE&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;stderr&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;shell&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;output&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;process&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;communicate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;report_line&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;report_re&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;search&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt;: &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt; - &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt;&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;report_line&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;group&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;EventHandler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pyinotify&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ProcessEvent&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;process_IN_CREATE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt;: &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt; - &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt; created&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;incoming&amp;quot;&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;dummy_tup&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;&amp;#39;null&amp;#39;&lt;/span&gt;
            &lt;span class="n"&gt;thread&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;start_new_thread&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;exec_proc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dummy_tup&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;process_IN_DELETE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;now&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="nb"&gt;print&lt;/span&gt; &lt;span class="s2"&gt;&amp;quot;&lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt;: &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt; - &lt;/span&gt;&lt;span class="si"&gt;%s&lt;/span&gt;&lt;span class="s2"&gt; deleted&amp;quot;&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;event&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;


&lt;span class="n"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;EventHandler&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;notifier&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pyinotify&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Notifier&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;wm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;wdd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;wm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;add_watch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;&amp;#39;/var/rudder/inventories/&amp;#39;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rec&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;notifier&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;loop&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So what performance gain do we have ?&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;# python bin/rudder_inv_notify.py 
2013-08-27 17:26:51.051183: /var/rudder/inventories/incoming - itclient-01-2013-09-04-17-26-46.ocs created
2013-08-27 17:26:54.616183: p4itclient-01-2013-09-04-17-26-46.ocs - R: @@DistributePolicy@@result_success@@root-DP@@root-distributePolicy@@20@@Send inventories to CMDB@@None@@2013-09-04 17:26:54+02:00##root@#Incoming inventories were successfully added to Rudder
2013-08-27 17:26:54.932790: /var/rudder/inventories/historical - 9530ce39-6699-49bc-819e-d8b72ae35a55 created
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Around 3 seconds to have the node available in pending list. This let us use API to accept it ... I'll detail this further in another post.&lt;/p&gt;</content><category term="Rudder"></category><category term="python"></category><category term="inotify"></category></entry><entry><title>Grsecurity 3.10.9 kernel available</title><link href="http://www.mauras.ch/grsecurity-3109-kernel-available.html" rel="alternate"></link><published>2013-08-25T00:00:00+02:00</published><updated>2023-10-03T22:43:30+02:00</updated><author><name>Olivier Mauras</name></author><id>tag:www.mauras.ch,2013-08-25:/grsecurity-3109-kernel-available.html</id><summary type="html">&lt;p&gt;Grsecurity test kernel is now available as RPM in the &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;&lt;br /&gt;
You can fetch the SRPM &lt;a href="http://repos.mauras.ch/grsecurity/kernel-test/SRPMS/kernel-3.10.9-1.el6.src.rpm"&gt;here&lt;/a&gt;  &lt;/p&gt;
&lt;p&gt;Changelog:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;- Update to kernel 3.10.9
- Update to grsecurity-2.9.1-3.10.9-201308202015.patch
- Add variables for …&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</summary><content type="html">&lt;p&gt;Grsecurity test kernel is now available as RPM in the &lt;a href="http://repos.mauras.ch/grsecurity/grsecurity.repo"&gt;repository&lt;/a&gt;&lt;br /&gt;
You can fetch the SRPM &lt;a href="http://repos.mauras.ch/grsecurity/kernel-test/SRPMS/kernel-3.10.9-1.el6.src.rpm"&gt;here&lt;/a&gt;  &lt;/p&gt;
&lt;p&gt;Changelog:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;- Update to kernel 3.10.9
- Update to grsecurity-2.9.1-3.10.9-201308202015.patch
- Add variables for easier version update
- Add config CONFIG_SECCOMP
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;At the same time, zfs modules have been updated to 0.6.2.&lt;br /&gt;
You can also install them by using the yum repository.&lt;/p&gt;</content><category term="Grsecurity"></category><category term="kernel-test"></category><category term="el6"></category><category term="zfs"></category></entry></feed>