TL;DR: fqdn, "jabber.die-welt.net" .
So, how many servers do you have, that are still running Squeeze? I count one, mostly because I did not figure out a proper upgrade path from OpenVZ to something else yet, but this is a different story.
This post is about the upgrade of my communication machine, dengon.die-welt.net. It runs my private XMPP and IRC servers. I upgraded it to Wheezy, checked that my irssi and my BitlBee still could connect and left for work. There I noticed, that Pidgin could only connect to one of the two XMPP accounts I have on that server. sargentd@jabber.die-welt.net worked just fine, while evgeni@golov.de failed to connect.
ejabberd was logging a failed authentication:I(<0.1604.0>:ejabberd_c2s:802) : ( socket_state,tls, tlssock,#Port<0.5130>,#Port<0.5132> ,<0.1603.0> ) Failed authentication for evgeni@golov.de
anything@jabber.die-welt.net worked, nothing@golov.de did not and somethingdifferent@jabber.<censored>.de worked too. So where was the difference between the three vhosts? jabber.die-welt.net and jabber.<censored>.de point directly (A/CNAME) to dengon.die-welt.net. golov.de has SRV records for XMPP pointing to jabber.die-welt.net.
Let s ask Google about ejabberd pidgin srv . There are some bugs. But they are marked as fixed in Wheezy.
Mhh Let s read again Okay, I have to set fqdn, "<my_srv_record_name>" . when this does not match my hostname. Edit /etc/ejabberd/ejabberd.cfg, add fqdn, "jabber.die-welt.net" . (do not forget the dot at the end) and restart the ejabberd. Pidgin can connect again. Yeah.
I've been working on TPMs lately. It turns out that they're moderately awful, but what's significantly more awful is basically all the existing documentation. So here's some of what I've learned, presented in the hope that it saves someone else some amount of misery.
Last Saturday, I was invited to talk about Debian to Hackerspace DF, a group that is starting to work at a very nice place together with other collectives, in a quite centric place (Colonia Obrera). I know several of the people in the group (visited them a couple of times in the space's previous incarnation), and wish them great luck in this new hackerspace!
Anyway I was invited to give an informal talk about Debian. And of course, I was there. And so was Alfredo, who recorded (most of) it.
So, in case you want to see me talking about how Debian works, mostly on a social organization level (but also regarding some technical details). Of course, given the talk was completely informal (it started by me standing there, asking, "OK, any questions?"), I managed to mix up some names and stuff... But I hope that, in the end, the participants understood better what Debian means than when we started.
Oh, and by the end of the talk, we were all much happier. Not only because I was about to shut up, but because during my talk, we got notice that Debian 7.0 "Wheezy" was released.
Anyway If you want to see me talking for ~1hr, you can download the video or watch it on YouTube.
Ordinarily, I m a big believer that it is important to keep up to date with what every piece of software which competes with yours is doing, to remain educated on the latest concepts. Sometimes, there are concepts that get added which are definitely worth ripping off. We ve ripped off plenty of the better design choices from Windows or Mac OS, over the years, for use in the Free Desktop.
So, what about Windows 8, the hip new OS on everyone s lips?
Well, here s the thing I ve been using it on and off for a few months now for running legacy apps, and I can t for the life of me find anything worth stealing.
Let s take the key change Windows 8 has apps built with a new design paradigm which definitely isn t called Metro. Metro apps don t really have windows in the traditional sense they re more modeled on full-screen apps from smartphones or tablets than on Windows 1.0 -> 7. Which is fine, really, if you re running Windows 8 on a tablet or touchscreen device. But what if you re not? What about the normal PC user?
As Microsoft themselves ask:
The answer to that is, well, you sorta don t.
Metro apps can exist in three states fullscreen, almost fullscreen, or vertical stripe. You re allowed to have two apps at most at the same time one mostly full screen, and one vertical stripe. So what happens if you try to *use* that? Let s take a fairly common thing I do watch a video and play Minesweeper. In this example, the video player is the current replacement for Windows Media Player, and ships by default. The Minesweeper game isn t installed by default, but is the only Minesweeper game in the Windows 8 app store which is gratis and by Microsoft Game Studios.
Here s option A:
And for contrast, here s option B:
Which of these does a better job of letting me play Minesweeper and watch a video at the same time?
Oh, here s option C, dumping Microsoft s own software, and using a third-party video player and third party Minesweeper implementation:
It s magical almost as if picking my own window sizes makes the experience better.
So, as you can see above, the old OS is still hiding there, in the form of a Windows 8 app called Desktop . Oh, sorry, didn t I say? Metro apps, and non-Metro apps, are segregated. You can run both (the Desktop app can also be almost-fullscreen or a vertical strip), but they get their own lists of apps when multitasking. Compare the list on the left with the list at the bottom:
And it s even more fun for apps like Internet Explorer, which can be started in both modes (and you often need both modes). Oh, and notice how the Ribbon interface from Office 2007 has invaded Explorer, filling the view with large buttons to do things you never want to do under normal circumstances.
So, that s a short primer on why Windows 8 is terrible.
Is there really nothing here worth stealing? Actually, yes, there is! After much research, I have discovered Windows 8 s shining jewel:
The new Task Manager is lovely. I want it on my Linux systems. But that s it.
As you may have noticed, Debian 7.0
wheezy was released yesterday.
And, well, for the first time ever, I upgraded my main server
(kheops....running Debian since buzz is out) to the finest and latest
release the same day it was released.
I didn't run into many problems, just a few glitches (some of them
might still get some of our users angry, though).
Most noticeably, I couldn't easily update two key packages on this
serveer (where I receive all my incoming mail) : roundcube and dovecot.
Roundcube indeed lost support for SQLite backend and that was probably
the reason for which I falled into the "Could not perform immediat
econfiguration" trap for it. The workarounds mentioned in the release
notes did not work and the only solution was to remove the Roundcobe
packages then re-add them later on. Not a big deal, as Roundcube is
only used by my son (who will attend Debconf again, by the way) for
the few mail he still receives on kheops.
Dovecot was more tricky and my mail server temporarily stopped working
for my lapto pto grab mail from it. OK, admitedly, I should have read
NEWS.Debian that was explaining all problems one might have,
particularly problems related to SSL certificates and the use of the
"mail" group. But, indeed, that
should have deserved a note in the release notes. After all, we're
talking there about an obscure php5-suhosin package, right? :-)
Finally, it took me less than 3 hours to upgrade everything with no
service interruption for users on my local network, except a 30-minute
stop of the IMAP server.
I still have to reboot to get the new kernel in operation and voil .
Let's now go on our way to jessie!
Debian 7.0 "wheezy" has been released this weekend!
(It took me a while to come up with new CDBS packaging series post not
because I stopped using CDBS just because I was procrastinating myself
as busy)
This is the second post in the CDBS packaging series. In this series
I'm going to talk about package relationship management.
The better example where this feature is useful is packages where
build-depends and run-time dependencies overlap. Most of the Perl
modules which have test suites have build-depend and run-time
dependency intersection. So let me take example of a Perl module.
First lets see control file of a Perl package which is not using CDBS
and then let me explain how CDBS can help you improve the situation. I
choose libxml-libxml-perl lets see part of control file which includes
Build-Depends Depends Suggests Recommends.
Source: libxml-libxml-perl
Maintainer: Debian Perl Group <pkg-perl-maintainers@lists.alioth.debian.org>
Uploaders: Jonathan Yu <jawnsy@cpan.org>,
gregor herrmann <gregoa@debian.org>,
Chris Butler <chrisb@debian.org>
Section: perl
Priority: optional
Build-Depends: perl (>= 5.12),
debhelper (>= 9.20120312),
libtest-pod-perl,
libxml2-dev,
libxml-namespacesupport-perl,
libxml-sax-perl,
zlib1g-dev
Standards-Version: 3.9.4
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-perl/packages/libxml-libxml-perl.git
Vcs-Git: git://anonscm.debian.org/pkg-perl/packages/libxml-libxml-perl.git
Homepage: https://metacpan.org/release/XML-LibXML/
Package: libxml-libxml-perl
Architecture: any
Depends: $ shlibs:Depends , $ misc:Depends , $ perl:Depends ,
libxml-namespacesupport-perl,
libxml-sax-perl
Breaks: libxml-libxml-common-perl
Replaces: libxml-libxml-common-perl
Description: Perl interface to the libxml2 library
XML::LibXML is a Perl interface to the GNOME libxml2 library, which provides
interfaces for parsing and manipulating XML files. This module allows Perl
programmers to make use of the highly capable validating XML parser and the
high performance Document Object Model (DOM) implementation. Additionally, it
supports using the XML Path Language (XPath) to find and extract information.
--- debian/control 2013-04-28 23:08:11.930082600 +0530
+++ debian/control.in 2013-05-04 20:51:18.849680419 +0530
@@ -5,13 +5,7 @@
Chris Butler <chrisb@debian.org>
Section: perl
Priority: optional
-Build-Depends: perl (>= 5.12),
- debhelper (>= 9.20120312),
- libtest-pod-perl,
- libxml2-dev,
- libxml-namespacesupport-perl,
- libxml-sax-perl,
- zlib1g-dev
+Build-Depends: @cdbs@
Standards-Version: 3.9.4
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-perl/packages/libxml-libxml-perl.git
Vcs-Git: git://anonscm.debian.org/pkg-perl/packages/libxml-libxml-perl.git
@@ -20,8 +14,7 @@
Package: libxml-libxml-perl
Architecture: any
Depends: $ shlibs:Depends , $ misc:Depends , $ perl:Depends ,
- libxml-namespacesupport-perl,
- libxml-sax-perl
+ $ cdbs:Depends
Breaks: libxml-libxml-common-perl
Replaces: libxml-libxml-common-perl
Description: Perl interface to the libxml2 library
@@ -30,4 +23,3 @@
programmers to make use of the highly capable validating XML parser and the
high performance Document Object Model (DOM) implementation. Additionally, it
supports using the XML Path Language (XPath) to find and extract information.
-
#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/cdbs/1/rules/upstream-tarball.mk
include /usr/share/cdbs/1/class/perl-makemaker.mk
pkg = $(DEB_SOURCE_PACKAGE)
deps = libxml-libxml-perl libxml-sax-perl
deps-test = libtest-pod-perl
CDBS_BUILD_DEPENDS +=, $(deps), $(deps-test)
CDBS_BUILD_DEPENDS +=, zlib1g-dev, libxml2-dev, perl (>= 5.12)
CDBS_DEPENDS_$(pkg) = , $(deps)
DEB_MAINTAINER_MODE=1 fakeroot debian/rules debian/control
NMUs need not (but are encouraged to) make special use of these tools. In particular, the debian/control.in file can be completely ignored.Before closing down the post, If you find some mistake in the post please let me know either through comments or through the email. Soon I will be back with new CDBS recipes till then cya.
| Publisher: | Haymarket |
| Copyright: | 2012 |
| ISBN: | 1-60846-247-1 |
| Format: | Kindle |
| Pages: | 220 |
| Week | Squeeze | Wheezy | Diff |
|---|---|---|---|
| 43 | 284 (213+71) | 468 (332+136) | +184 (+119/+65) |
| 44 | 261 (201+60) | 408 (265+143) | +147 (+64/+83) |
| 45 | 261 (205+56) | 425 (291+134) | +164 (+86/+78) |
| 46 | 271 (200+71) | 401 (258+143) | +130 (+58/+72) |
| 47 | 283 (209+74) | 366 (221+145) | +83 (+12/+71) |
| 48 | 256 (177+79) | 378 (230+148) | +122 (+53/+69) |
| 49 | 256 (180+76) | 360 (216+155) | +104 (+36/+79) |
| 50 | 204 (148+56) | 339 (195+144) | +135 (+47/+90) |
| 51 | 178 (124+54) | 323 (190+133) | +145 (+66/+79) |
| 52 | 115 (78+37) | 289 (190+99) | +174 (+112/+62) |
| 1 | 93 (60+33) | 287 (171+116) | +194 (+111/+83) |
| 2 | 82 (46+36) | 271 (162+109) | +189 (+116/+73) |
| 3 | 25 (15+10) | 249 (165+84) | +224 (+150/+74) |
| 4 | 14 (8+6) | 244 (176+68) | +230 (+168/+62) |
| 5 | 2 (0+2) | 224 (132+92) | +222 (+132/+90) |
| 6 | release! | 212 (129+83) | +212 (+129/+83) |
| 7 | release+1 | 194 (128+66) | +194 (+128/+66) |
| 8 | release+2 | 206 (144+62) | +206 (+144/+62) |
| 9 | release+3 | 174 (105+69) | +174 (+105/+69) |
| 10 | release+4 | 120 (72+48) | +120 (+72/+48) |
| 11 | release+5 | 115 (74+41) | +115 (+74/+41) |
| 12 | release+6 | 93 (47+46) | +93 (+47/+46) |
| 13 | release+7 | 50 (24+26) | +50 (+24/+26) |
| 14 | release+8 | 51 (32+19) | +51 (+32/+19) |
| 15 | release+9 | 39 (32+7) | +39 (+32/+7) |
| 16 | release+10 | 20 (12+8) | +20 (+12/+8) |
| 17 | release+11 | 24 (19+5) | +24 (+19/+5) |
| 18 | release+12 | 2 (2+0) | +2 (+2/+0) |
Following up on the #newinwheezy game: Debian/wheezy is the first Debian release which ships packages from the Grml system. Grml became an official Debian Derivative and I m very happy that three major projects of Grml found their official way into Debian:
dd if=grml.iso of=/dev/sdX ) just isn t flexible enough.
grml-debootstrap provides a decent way to install Debian systems from the command line. As its author I might be biased but I ve to mention that it s working so nice that it is in use at several of my customers for automated roll-outs without any worries at all, and I got reports from other companies that they are very happy users of it as well.
Finally the grml-rescueboot packages provides a very simple and nice way to boot a rescue system from within GRUB (short version: throw a Grml ISO to /boot/grml/, run update-grub and be done).
PS: Thanks everyone for joining the #newinwheezy game over at planet.debian.org. | Series: | The Baroque Cycle #3 |
| Publisher: | William Morrow |
| Copyright: | 2004 |
| ISBN: | 0-06-052387-5 |
| Format: | Hardcover |
| Pages: | 892 |
| Publisher: | Subterranean |
| Copyright: | 2005 |
| Printing: | 2012 |
| ISBN: | 1-59606-468-4 |
| Format: | Kindle |
| Pages: | 28 |
Excuse me for the rush and lack of organization... But this kind of things don't always allow for proper planning. So, please bear with my chaos ;-)
What is the Trans-Pacific Partnership?
Yet another secretely negotiated international agreement that, among many chapters, aims at pushing a free-market based economy, as defined by a very select few Most important to me, and to many of my readers: It includes important chapters on intellectual property and online rights.
Hundreds of thousands of us along the world took part in different ways on the (online and "meat-space") demonstrations against the SOPA/PIPA laws back in February 2012. We knew back then that a similar project would attempt to bite us back: Well, here it is. Only this time, it's not only covering copyright, patents, trademark, reverse engineering, etc. TPP is basically a large-scale free trade agreement on steroids. The issue that we care about now is just one of its aspects. Thus, it's way less probable we can get a full stop for TPP as we got for SOPA. But we have to get it on the minds of as many people as possible!
Learn more with this infography distributed by the EFF.
Which countries?
The countries currently part of TPP are Chile, Peru, New Zealand, Australia, Malaysia, Brunei, Singapore, Vietnam And, of course, the USA.
Mexico, Canada and Japan are in the process of joining the partnership. A group of Mexican senators are travelling to Lima to take part of this round.
What are we doing about it?
As much as possible!
I tried to tune in with Peru's much more organized call The next round of negotiations will be in Lima, Peru, between May 14 and 24. Their activities are wildly more organized than ours: They are planning a weekend-long Camping for Internet freedom, with 28 hours worth of activities.
As for us, our activities will be far more limited, but I still hope to have an interesting session:
This Friday, we will have Aula Magna, Facultad de Ingenier a, UNAM, M xico DF, from 10AM and until 3PM. We do not have a clear speakers program, as the organization was quite rushed. I have invited several people who I know will be interesting to hear, and I expect a good part of the discussion to be a round table. I expect we will:
| Attachment | Size |
|---|---|
| Poster. Desgin by Gacela Thanks! | 457.49 KB |
| Infography about TPP distributed by the EFF | 392.45 KB |
| "Here, let me sign this for you". Image by Colin Beardon. | 27.08 KB |
Excuse me for the rush and lack of organization... But this kind of things don't always allow for proper planning. So, please bear with my chaos ;-)
What is the Trans-Pacific Partnership?
Yet another secretely negotiated international agreement that, among many chapters, aims at pushing a free-market based economy, as defined by a very select few Most important to me, and to many of my readers: It includes important chapters on intellectual property and online rights.
Hundreds of thousands of us along the world took part in different ways on the (online and "meat-space") demonstrations against the SOPA/PIPA laws back in February 2012. We knew back then that a similar project would attempt to bite us back: Well, here it is. Only this time, it's not only covering copyright, patents, trademark, reverse engineering, etc. TPP is basically a large-scale free trade agreement on steroids. The issue that we care about now is just one of its aspects. Thus, it's way less probable we can get a full stop for TPP as we got for SOPA. But we have to get it on the minds of as many people as possible!
Learn more with this infography distributed by the EFF.
Which countries?
The countries currently part of TPP are Chile, Peru, New Zealand, Australia, Malaysia, Brunei, Singapore, Vietnam And, of course, the USA.
Mexico, Canada and Japan are in the process of joining the partnership. A group of Mexican senators are travelling to Lima to take part of this round.
What are we doing about it?
As much as possible!
I tried to tune in with Peru's much more organized call The next round of negotiations will be in Lima, Peru, between May 14 and 24. Their activities are wildly more organized than ours: They are planning a weekend-long Camping for Internet freedom, with 28 hours worth of activities.
As for us, our activities will be far more limited, but I still hope to have an interesting session:
This Friday, we will have Aula Magna, Facultad de Ingenier a, UNAM, M xico DF, from 10AM and until 3PM. We do not have a clear speakers program, as the organization was quite rushed. I have invited several people who I know will be interesting to hear, and I expect a good part of the discussion to be a round table. I expect we will:
| Attachment | Size |
|---|---|
| Poster. Design by Gacela Thanks! | 457.49 KB |
| Infography about TPP distributed by the EFF | 392.45 KB |
| "Here, let me sign this for you". Image by Colin Beardon. | 27.08 KB |
The below is written in the hope it will be helpful for my fellow DDs.
Why using build after push ?
Simple answer: to save time, to always use a clean build environment, to automate more tests.
Real answer: because you are lazy, and tired of always having to type these build commands, and that watching the IRC channel is more fun than watching the build process.
Other less important answers: building takes some CPU time, and makes your computer run slower for other tasks. It is really nice that building doesn t consume CPU cycles on your workstation/laptop, and that a server does the work, not disturbing you while you are working. It is also super nice that it can maintain a Debian repository for you after a successful build, available for everyone to use and test, which would be harder to achieve on your work machine (which may be behind a router doing NAT, or even sometimes turned off, etc.). It s also kind of fun to have an IRC robot telling everyone when a build is successful, so that you don t have to tell them, they can see it and start testing your work.
Install a SID box that can build with cowbuilderhttp://<ip-of-your-server>:8080/There is no auth by default, so anyone will be able to access your jenkins web GUI and start any script under the jenkins user (sic!). Jenkins auth
ProxyPass / http://localhost:8080/ ProxyPassReverse / http://localhost:8080/ ProxyRequests OffThen perform the following commands on the shell:
htpasswd -c /etc/apache2/jenkins_htpasswd <your-jenkins-username> a2enmod proxy a2enmod proxy_http a2enmod ssl a2ensite default-ssl a2dissite default apache2ctl restartThen disable access to the port 8080 of jenkins from outside:
iptables -I INPUT -d <ip-of-your-server> -p tcp --dport 8080 -j REJECTOf course, this doesn t mean you shouldn t take the steps to activate Jenkins own authentication, which is disabled by default (sic!). Build a script to build packages in a cowbuilder I thought it was hard. In fact it was not. All together, this was kind of fun to hack. Yes hack. What I did yet another kind of 10km ugly shell script. The way to use it is simply: build-openstack-pkg <package-name>. On my build server, I have put that script in /usr/bin, so that it is accessible from the default path.Ugly, but it does the job! Jenkins build script for openstack At the end of the script, scan_repo() generates the necessary files for a Debian repository to work under /home/ftp. I use pure-ftpd to serve it. /home/ftp must be owned by jenkins:jenkins so that the build script can copy packages in it. This build script is by no mean state of the art, and in fact, it s quite hack-ish (so I m not particularly proud of it, but it does its job ). If I am showing it in this blog post, it is just to show an example of what can be done. It is left as an exercise to the reader to create another build script adapted to its own needs, and write something cleaner and more modular. Dependency building Let s say that you are using the Built-Using: field, and that package B needs to be built if package A changes. Well, Jenkins can be configured to do that. Simply edit the configuration of project B (you will find it, it s easy ). My use case: In my case, for building Glance, Heat, Keystone, Nova, Quantum, Cinder and Ceilometer, which are all components of Openstack, I have written a small (about 500 lines) library of shell functions, and an also small (90 lines) Makefile, which are packaged in openstack-pkg-tools (so Nova, Glance, etc. all build-depends on openstack-pkg-tools). The shell functions are included in each maintainer scripts (debian/*.config and debian/*.postinst mainly) to avoid having some pre-depends that would break debconf flow. The Makefile of openstack-pkg-tools is included in debian/rules of each packages. In such a case, trying to manage the build process by hand is boring and time consuming (spending your time watching the build process of package A, so that you can manually start the build of package B, then wait again ). But it is also error prone: it is easy to do a mistakes in the build order, you can forget to dpkg -i the new version of package A, etc. But that s not it. Probably at some point, you will want Jenkins to rebuild everything. Well, that s easy to do. Simply create a dummy project, and have other project to build after that one. The build steps could simply be: echo Dummy project as a shell script (I m not even sure that s needed ). Configuring git to start a build on each push In Jenkins, pass your mouse over the Build now URL. Well, we just need to wget that URL in your Alioth repository. A small drawing is better than long explanation:
for i in ls /git/openstack ; do
echo "wget -q --no-check-certificate \
https://<ip-of-your-server>/job/$ PROJ_NAME /build?delay=0sec \
-O /dev/null" >/git/openstack/$ i /hooks/post-receive \
&& chmod 0770 /git/openstack/$ i /hooks/post-receive;
done
The chmod 0770 is necessary if you don t want every Alioth users to have access to your Jenkins server web interface and see an eventual htpassword protection that you can add to your jenkins box (I m not covering that, but it is fairly easy to add such protection). Note that all of the members of your Alioth group will then have access to this post-receive hook, containing the password of your htaccess, so you must trust everyone in your Alioth group to not do nasty things with your Jenkins.
Bonus point: IRC robot
If you would like to see the result of your build published on IRC, Jenkins can do that. Click on Manage Jenkins , then on Manage Plugins . Then click on available and check the box in front of IRC plugin . Go at the bottom of the screen and click on Add . Then check the box to restart Jenkins automatically. Once it is restarted, go again under Manage jenkins then Configure system . Select the IRC Notification and configure it to join the network and the channel you want. Click on Advanced to select the IRC nick name of your bot, and make sure you change the port (by default jenkins has 194, when IRC normally uses 6667). Be patient when waiting for the IRC robot to connect / disconnect, this can take some time.
Now, for each jenkins Job, you can tick the IRC Notification option.
Doing piuparts after build
One nice thing with automated builds, is that most of the time, you don t need to wait starring at them. So you can add as many tests as you want, the Jenkins IRC robot will anyway let you know sooner or later the result of your build. So adding piuparts tests in the build script seems the correct thing to do. Though that is still on my todo, so maybe that will be for my next blog post.
I was going to start this series with explaining how I did the remote set-up, but instead I will share something that happened today.
One of the first things you want to do when putting a server directly connected to the Internet is some filtering. You don't want to have an application listening on the network by mistake, so a simple netfilter firewall is a good way to ensure you are only accepting connections on ports you explicitly allowed.
I have been a long-time user of ferm, a simple tool that will read a configuration file written in a special structured syntax, and generates iptables commands from it. I have used it successfully to build very complex firewalls in previous jobs, and it had the huge benefit of keeping your firewall description readable and easy to modify by other people.
This time I thought I may go with something simpler, as I only wanted a handful of very simple netfilter rules. I looked at Shorewall, and browsed a bit a few others. But in the end I decided against them: there was the need to learn the tools' concepts about different parts of the network, or there were more slanted towards command-line commands, so your actual configuration will be some files in /var/lib, totally managed by the tool. With ferm, I just need to write a very small configuration file, which reads almost like iptables commands, and that's it.
In fact, the default configuration placed by the Debian package, already did 90% of what I wanted: accept incoming SSH connections, ICMP packets, and reject everything else. I took the example IPv6 configuration from /usr/share/doc/ferm/examples/ipv6.ferm and in 10 minutes it was ready:
table filter
chain INPUT
policy DROP;
mod state state INVALID DROP;
mod state state (ESTABLISHED RELATED) ACCEPT;
interface lo ACCEPT;
proto icmp ACCEPT;
# allow IPsec
proto udp dport 500 ACCEPT;
proto (esp ah) ACCEPT;
proto tcp dport ssh ACCEPT;
proto tcp dport (http https) ACCEPT;
chain OUTPUT policy ACCEPT;
chain FORWARD policy DROP;
domain ip6 table filter
chain INPUT
policy DROP;
mod state state INVALID DROP;
mod state state (ESTABLISHED RELATED) ACCEPT;
interface lo ACCEPT;
proto ipv6-icmp ACCEPT;
proto tcp dport ssh ACCEPT;
proto tcp dport (http https) ACCEPT;
chain OUTPUT policy ACCEPT;
chain FORWARD policy DROP;
It is important to note than when doing this kind of thing on a remote machine, you want to make sure you don't get locked out by accident. My method is that before activating any dangerous change, I drop an at job to disable the firewall in a few minutes:
# echo /etc/init.d/ferm stop at now +10min
warning: commands will be executed using /bin/sh
job 4 at Mon Apr 29 02:47:00 2013
And if everything goes well, I just remove the job:
# atrm 4
Update: As paravoid pointed out in the comments, now (read: since many years ago, but I've never noticed) ferm has a --interactive mode which will revert the changes if you get locked out, much like the screen resolution changing dialog in Gnome.
PermitRootLogin=no setting, there are a couple of popular methods to stop people probing random username/password combinations (I am assuming here that you actually have sensible passwords, or no passwords at all): running SSH in a non-standard port, and the great fail2ban daemon.
Since I don't like non-standard stuff, I installed fail2ban, which by default it will inspect /var/log/auth.log for SSH login failures and insert netfilter rules to block the offenders.
Problem is, I don't like much how fail2ban inserts rules and chains into my very tidy netfilter configuration which I had just created. So, I added an "action" to do things my way: only create a service-related chain and insert rules there, I will call that chain from my main ferm.conf. Ferm runs early in the boot sequence, so this won't be a problem during normal operation. The only caveat is that after changing a configuration in ferm, I need to restart fail2ban so it will recreate the netfilter chains and rules, which were wiped by ferm.
This is my configuration, note that I am ignoring the port and protocol: the whole IP is blocked for a few minutes.
# cat /etc/fail2ban/jail.local
[DEFAULT]
action = iptables-fixed[name=%(__name__)s]
# cat /etc/fail2ban/action.d/iptables-fixed.conf
[Definition]
actionstart = iptables -N fail2ban-<name>
iptables -I fail2ban -j fail2ban-<name>
actionstop = iptables -D fail2ban -j fail2ban-<name>
iptables -F fail2ban-<name>
iptables -X fail2ban-<name>
actioncheck = iptables -n -L grep -q fail2ban-<name>
actionban = iptables -I fail2ban-<name> 1 -s <ip> -j DROP
actionunban = iptables -D fail2ban-<name> -s <ip> -j DROP
[Init]
name = default
TL;DR version: I want to get rid of the small server running at home, I tell you here about the service I've chosen, and why I like it. In following posts, I'll explain how did I set it up remotely. Disclaimer: I am in now way affiliated with the companies I mention here (except for Picasa, as I am a Google employee), and don't get any bonuses for this post. I am only sharing this because I think it might be useful information for other people.Being a frequent migrant means possessions are a burden. In my previous place of residence (in France), I originally intended to only stay for 6 months, and so I arrived with just a couple of suitcases, and in the end that was enough for me to live for almost 2 years. The last time, on the other hand, I was removing my stuff completely from Argentina. I emptied my house, gave away some stuff, send some boxes to my parents' place, and carried the rest with me. That was a lot of stuff, but since the company was paying for the relocation, it was not much of a problem. Later I realised my mistake, and knowing that my time in Ireland is limited, I started to try and get rid of stuff I don't need. I know I will just sell or give away much of my stuff when I finally leave, but there are some things that are not so easy to part with. The main one being my home server, which hosts this website, my VCS repositories, pictures, and many other things I need to have on the net. This all used to be located in a home-made PC tucked in a data centre, co-located by a friendly company. But that computer died almost 2 years ago, and so
canterville became abhean, and my stuff started being hosted with my aDSL connection. It worked well for some time, but now I realised I had to revert that change.
With this in mind I set off to find a cheap place to host my stuff. I had a few requirements:
debootstrap.
The virtual KVM is a very interesting trick. It is a netboot image that runs some tests, and fires up a web browser. You get an email with the URL and a password to access it, and then you open a page that offers you what is basically a Qemu connected to a VNC server which will boot from your real hard drive.
It is super slow, but that allows you to get console access to your server, which can be very handy to debug booting problems, unless it is some issue with the real hardware. It also offers the possibility of downloading an ISO image off the network and booting that, so it can be used to run a stock installer CD too.
In another post I'll describe how I reinstalled my server remotely, and some of the pitfalls that I've encountered in the process.
It seems that I didn't send any update to my international friends for
quite a while, at least when it comes at my running activities.
So, in short, I ran A LOT during the first months of April 2013. I
mean it. As of now (April 28th), I cumulated 1424 kilometers, with a
peak in March up to 375 kilometers. So, that's an average 12
kilometers per day.
How did I achieve this? Among many other things, by doing part of my
commute to work by running, which means 14 kilometers in one day, with
a backpack containing everything needed to be dressed "normally" while
working, plus my laptop, my rain jacket, etc....so up to 4 kilograms
on my shoulders. And, yes, I can use a shower at work and I don't
stink all day long!
This alone already makes a fairly good training. Of course, all alone,
it wouldn't be really funny, so I, of course, add some runs during the
week-end, mostly trail running, enjoying the nature around our place.
Official races have been mostly trail races during these months. The
only road race has been an half-marathon in Bullion, back in February
(4th year in a row I'm running this one, which is traditionnaly the
"resume road races" competition in the area). I completed it in 1h39,
quite close to my PB, even if....that was meant to be a training only.
In February, still as a preparation race for Paris Ecotrail, I ran a
20km trail in Auffargis (a neat small village in the neighbourhood of
our place), again completing it with great success, with a big
negative split (for non hard-core runners, a negative split happens
when one runs the second half of a race faster than the first one).
All this was in preparation for Paris Ecotrail race, my second time on
this 80km race that ends up at Eiffel Tower. Last year, being my first
attempt on such distance,, I completed it in 11 hours 5 minutes. To make it
short, this year, I finished 579th out of more than 2000 runners, in
9h36. That was indeed a really great result, in line with my 8h15
time back in November for the 70km "Le Puy-Firminy" night race.
Moreover, I could indeed recover very quickly : the race was run on a
Saturday and I resumed my "commute runs" on Wednesday.
The next target were two trail races in April : I originally planned a
44km race on April 21st and finally ended up adding to it a 35km trail
race on April 7th (the day of Paris Marathon), only 3 weeks after
Ecotrail..:-)
And I completed both these with a huge success. Indeed my best trail
races ever, again with two negative splits and also a very good place.
Indeed, I now usually complete races close to the very first
women...:-).
So, on April 7th, the trail du Josas (35km, 800m positive climb...
which means about the equivalent of a marathon) was completed in 3h40....and last
Sunday, the trail des
Lavoirs (44km, 1100m positive climb) was
completed in 4h40, with the last 2 kilometers being run above 13km/h.
Describing how one can feel when "flying" in the very last kilometers
of such a long run is just....impossible. Great, great, great memories.
Then, during the week following the trail des Lavoirs, I ran 101km in
6 days, confirming that recovery is perfect.
So, definitely, I am stunned by what I could achieve during these
months, without injury, without big pain. Just good training and good
results, without suffering and a giant pleasure.
Yes, running is definitely a drug and I'm deeply addicted. Well, the
result is, in short, that I feel good and well, so I think I won't
stop soon...:-)
Next challenge : Mont-Blanc marathon,
in Chamonix : 42.195km....and 2500meters positive climb, with 1500
meters negative. Start in Chamonix at 1050m high and end at Planpraz
(2050m), facing the Mont-Blanc, with a maximum altitude of 2267m
during the race. Quite an interesting "marathon", isn't it?
That will be my first race in real mountains...and, I guess not the
last one. Target time: 6 hours. Secret wish: 5h30.
During summer, I will mostly be preparing for the second part of the
year....but I'll certainly enjoy the neighbourhood of Vaumarcus,
Switzerland, where I'll attend DebConf. Challenge : combine running,
hacking, cheese eating and fit all this in 24 hours every day.
For the end of the year, challenges should peak between October and
December:
Shared Memory Fences
In our last adventure, dri3k first steps, one of the future work
items was to deal with synchronization between the direct rendering
application and the X server. DRI2 handles this by performing a
round trip each time the application starts using a buffer that was
being used by the X server.
As DRI3 manages buffer allocation within the application, there s
really no reason to talk to the server, so this implicit
serialization point just isn t available to us. As I mentioned last
time, James Jones and Aaron Plattner added an explicit GPU
serialization system to the Sync extension. These SyncFences
serializing rendering between two X clients, but within the server
there are hooks provided for the driver to use hardware-specific
serialization primitives.
The existing Linux DRM interfaces queue rendering to the GPU in the
order requests are made to the kernel, so we don t need the ability to
serialize within the GPU, we just need to serialize requests to the
kernel. Simple CPU-based serialization gating access to the GPU will
suffice here, at least for the current set of drivers. GPU access
which is not mediated by the kernel will presumably require
serialization that involves the GPU itself. We ll leave that for a
future adventure though; the goal today is to build something that
works with the current Linux DRM interfaces.
SyncFence Semantics
The semantics required by SyncFences is for multiple clients to block
on a fence which a single client then triggers. All of the blocked
clients start executing requests immediately after the trigger fires.
There are four basic operations on SyncFences:
static inline long sys_futex(void *addr1, int op, int val1,
struct timespec *timeout, void *addr2, int val3)
return syscall(SYS_futex, addr1, op, val1, timeout, addr2, val3);
For this little exercise, I created two simple wrappers, one to block
on a futex:
static inline int futex_wait(int32_t *addr, int32_t value)
return sys_futex(addr, FUTEX_WAIT, value, NULL, NULL, 0);
and one to wake up all futex waiters:
static inline int futex_wake(int32_t *addr)
return sys_futex(addr, FUTEX_WAKE, MAXINT, NULL, NULL, 0);
Atomic Memory Operations
I need atomic memory operations to keep separate cores from seeing
different values of the fence value, GCC defines a few such primitives
and I picked _syncboolcompareandswap and
_syncvalcompareandswap. I also need fetch and store operations
that the compiler won t shuffle around:
#define barrier() __asm__ __volatile__("": : :"memory")
static inline void atomic_store(int32_t *f, int32_t v)
barrier();
*f = v;
barrier();
static inline int32_t atomic_fetch(int32_t *a)
int32_t v;
barrier();
v = *a;
barrier();
return v;
If your machine doesn t make these two operations atomic, then you
would redefine these as needed.
Futex-based Fences
These wake-all semantics of Fences greatly simplify reasoning about
the operation as there s no need to ensure that only a single thread
runs past Await, the only requirement is that no threads pass the
Await operation until the fence is triggered.
A Fence is defined by a single 32-bit integer which can take one of
three values:
int fence_await(int32_t *f)
while (__sync_val_compare_and_swap(f, 0, -1) != 1)
if (futex_wait(f, -1))
if (errno != EWOULDBLOCK)
return -1;
return 0;
The basic requirement that the thread not run until the fence is
triggered is met by fetching the current value of the fence and
comparing it with 1. Until it is signaled, that comparison will return
false.
The compareandswap operation makes sure the fence is -1
before the thread calls futex_wait, either it was already -1 in the
case where there were other waiters, or it was 0 before and is now -1
in the case where there were no waiters before. This needs to be an
atomic operation so that the fence value will be seen as -1 by the
trigger operation if there are any threads in the syscall.
The futex_wait call will return once the value is no longer -1, it
also ensures that the thread won t block if the trigger occurs
between the swap and the syscall.
Here s the Trigger function:
int fence_trigger(int32_t *f)
if (__sync_val_compare_and_swap(f, 0, 1) == -1)
atomic_store(f, 1);
if (futex_wake(f) < 0)
return -1;
return 0;
The atomic compareandswap operation will make sure that no Await
thread swaps the 0 for a -1 while the trigger is changing the value
from 0 to 1; either the Await switches from 0 to -1 or the Trigger
switches from 0 to 1.
If the value before the compareandswap was -1, then there may be
threads waiting on the Fence. An atomic store, constructed with two
memory barriers and a regular store operation, to mark the Fence
triggered is followed by the futex_wake call to unblock all Awaiting
threads.
The Query function is just an atomic fetch:
int fence_query(int32_t *f)
return atomic_fetch(f) == 1;
Reset requires a compareandswap so that it doesn t disturb things if
the fence has already been reset and there are threads waiting on it:
void fence_reset(int32_t *f)
__sync_bool_compare_and_swap(f, 1, 0);
A Request for Review
Ok, so we ve all tried to create synchronization primitives only to
find that our obvious implementations were full of holes. I d love
to hear from you if you ve identified any problems in the above code,
or if you can figure out how to use the existing glibc primitives for
this operation.
Next.