M nica Ram rez Arceda
I totally forgot it, but as the DPL elections are now done, we
have a winner for the #DPL game.
Of the (more or less) fifteen persons who participated to the
game (thank you!), only four received points for having at
least one of their Fantastic Four running for DPL:
I know it's been ages since I last blogged anything at all. To some degree I had a down phase, but I hope to get out of it. It's nice to see that there are people out there who give me a prod every now and then, and don't let me drown. Thanks, most of you probably know that I mean exactly you, and in case you are uncertain, you probably are meant if you contact me every now and then.
Anyway, if you remember that I blogged about Lindsey Stirling last year and you started to follow her you might have already stumbled upon the next band I'd like to present. I'm speaking of Pentatonix. These five humans have terrific voices that they use in a very special way that is quite unique.
I don't want to delay the songs I want to present to you any longer, so here they are:
this is freaking awesome.
Puppet is a nice tool but it has a significant problem with passwords:
node "mysqlserver"
package
["mysql-server",
"mysql-client",
"sekred"]:
ensure => installed;
service
"mysqld":
name => "mysql",
ensure => running,
hasrestart => true,
hasstatus => true;
exec
"mysql-set-root-password":
command => "mysqladmin -u root password $(sekred get root@mysql)",
onlyif => "mysql -u root", # Trigger only if password-less root account.
require => [Service["mysqld"], Package["mysql-client", "sekred"]];
And to get the root password for mysql, just login into the node "mysqlserver":
$> sekred get root@mysql Cie8iezaSetting password for SSH-only user This example is quite typical of the broken fully automated scenario with passwords: - you setup a remote host only accessible through SSH - you create a user and set its SSH public key to authorize access - your user cannot access its account because SSH prevent password-less account login! In other word, you need to login into the node, set a password for the user and mail him back.... That defeats a little bit the "automation" provided by puppet. Here is what I do with sekred:
define user::template ()
user
$name:
ensure => present,
membership => minimum,
shell => "/bin/bash",
....
include "ssh_keys::$name"
# Check password less account and set one, if required.
$user_passwd="$(sekred get --uid $name $name@login)"
exec
"user-set-default-password-$name":
command => "echo $name:$user_passwd chpasswd",
onlyif => "test \"$(getent shadow $name cut -f2 -d:)\" = \"!\"",
require => [User[$name], Package["sekred"]];
So the command "test \"$(getent shadow $name cut -f2 -d:)\" = \"!\"" test for a password-less account. If this is the case, it creates a password using sekred get --uid $name $name@login and set it through chpasswd.
Note that $user_passwd use a shell expansion that will be evaluated when running the command only, on the host. The --uid flag of sekred assign the ownership of the password to the given user id.
So now the user (foo) can login into the node and retrieve its password using sekred get foo@login.
Try it!
Sekred was a very short project but I am pretty happy with it. It solves a long standing problem and helps to cover an extra mile of automation when setting up new nodes.
The homepage is here and you can download it here. Feel free to send patches, bugs and feature requests (here, login required).
I've just pushed out the release files for Obnam version
1.4, my backup application, and Larch,
my B-tree library, which Obnam uses.
They are available via my home page (http://liw.fi/). Since Debian is
frozen, I am not uploading packages to Debian, but .deb files are
available from my personal apt repository
for intrepid explorers. (I will be uploading to Debian again after the
freeze. I am afraid I'm too lazy to upload to experimental, or do
backports. Help is welcome!)
From the Obnam NEWS file:
ls command now takes filenames as (optional) arguments, instead
of a list of generations. Based on patch by Damien Courouss .lru-size and upload-queue-size settings
have been reduced, to reduce the memory impact of Obnam.obnam restore now reports transfer statistics at the end, similarly
to what obnam backup does. Suggested by "S. B.".AttributeError: 'exceptions.OSError'
object has no attribute 'st_ino' in an error message or log file.add-key and remove-key subcommands. Reported by Lars Kruse.LDAP supports syntax and comparator methods. The syntax specifies how the entry should look. Usually this is some form of text, but numbers or stuff like telephone numbers are supported as well. The comparators specifies how the values are compared. Most of the text comparators are defined to apply the handling of insignificant spaces. Insignificant space handling normalizes the use of spaces. First all leading and trailing spaces are removed. All the internal spaces are normalized to at most two spaces. At the end all strings starts and ends with one space to allow proper sub-string matches. The resulting strings are used for comparisons. This behavior makes sense most of the time. If the user want to find something in the directory, he usually don't cares about spaces, but about content. But I found one occurrence where this produces some grieve. Postfix supports LDAP since some time. And lets say, it does not care about spaces in its queries. This is no problem as e-mail addresses do not contain spaces. Or do they?
Yes, e-mail addresses can contain spaces. This is not widely known, but still allowed. This addresses are quoted and the command looks like RCPT TO:<" test"@example.com>. The local part is quoted and contains a space at the beginning. And this is where the problem starts. Postfix sanitizes the address. It uses a simplified internal representation of the address for all lookups. So the address gets test@example.com. This form is used in all table lookups. The LDAP table uses the internal form of the address. This address is copied verbatim into the query. This query may look this way (mail= test@example.com). It is sent to the server this way. The LDAP server applies the insignificant space modifications. The query is now interpreted and the comparator specified modifications are applied. The query gets effectively changed to (mail=test@example.com). And this is where the fun starts. Postfix accepts undeliverable mails. Depending on the setup, such LDAP queries may be used to check for valid addresses. Because of the space handling, the sender can add spaces to the beginning of the address and it will still be considered valid. In later steps this addresses are not longer valid. Addresses starting with spaces are considered invalid in some locations of Postfix. What surprised me a bit is that virtual alias handling did not map them. The unmodified addressed showed up on the LMTP backend server. That's why they showed up my radar. I would say Postfix is wrong in this case. The LDAP server applies the spec correctly and defines spaces in e-mail addresses as insignificant. Postfix on the other side considers them significant. The easiest fix would be to not allow any spaces in the LDAP table.
Package: package-nameIt is fairly trivial to write code to find the relevant packages for a given modalias value using this file. An entry like this would suggest the video and picture application cheese for many USB web cameras (interface bus class 0E01):
Modaliases: module(modaliasglob, modaliasglob, modaliasglob)
Package: cheeseAn entry like this would suggest the pcmciautils package when a CardBus bridge (bus class 0607) PCI device is present:
Modaliases: cheese(usb:v*p*d*dc*dsc*dp*ic0Eisc01ip*)
Package: pcmciautilsAn entry like this would suggest the package colorhug-client when plugging in a ColorHug with USB IDs 04D8:F8DA:
Modaliases: pcmciautils(pci:v*d*sv*sd*bc06sc07i*)
Package: colorhug-clientI believe the format is compatible with the format of the Packages file in the Debian archive. Ubuntu already uses their Packages file to store their mappings from packages to hardware. By adding a XB-Modaliases: header in debian/control, any .deb can announce the hardware it support in a way my prototype understand. This allow those publishing packages in an APT source outside the Debian archive as well as those backporting packages to make sure the hardware mapping are included in the package meta information. I've tested such header in the pymissile package, and its modalias mapping is working as it should with my prototype. It even made it to Ubuntu Raring. To test if it was possible to look up supported hardware using only the shell tools available in the Debian installer, I wrote a shell implementation of the lookup code. The idea is to create files for each modalias and let the shell do the matching. Please check out and try the hw-support-lookup shell script. It run without any extra dependencies and fetch the hardware mappings from the Debian archive and the subversion repository where I currently work on my prototype. When I use it on a machine with a yubikey inserted, it suggest to install yubikey-personalization:
Modaliases: colorhug-client(usb:v04D8pF8DAd*)
% ./hw-support-lookupWhen I run it on my Thinkpad X40 with a PCMCIA/CardBus slot, it propose to install the pcmciautils package:
yubikey-personalization
%
% ./hw-support-lookupIf you know of any hardware-package mapping that should be added to my database, please tell me about it. It could be possible to generate several of the mappings between packages and hardware. One source would be to look at packages with kernel modules, ie packages with *.ko files in /lib/modules/, and extract their modalias information. Another would be to look at packages with udev rules, ie packages with files in /lib/udev/rules.d/, and extract their vendor/model information to generate a modalias matching rule. I have not tested any of these to see if it work. If you want to help implementing a system to let us propose what packages to install when new hardware is plugged into a Debian machine, please send me an email or talk to me on #debian-devel.
pcmciautils
%
![]() |
| Old NetSurf Preferences Dialog |
![]() |
| New NetSurf Preferences |
![]() |
| NetSurf with Preferences Dialog |
Relase 0.10.2 of Rcpp provides the second
update to the 0.10.* series, and has arrived on CRAN
and in Debian.
It brings another great set of enhancements and extensions, building on the recent
0.10.0 and
0.10.1 releases.
The new Rcpp attributes were rewritten to not require Rcpp modules
(as we encountered on issue with exceptions on Windows when built this way),
code was reorganized to significantly accelerate compilation and a
couple of new things such as more Rcpp sugar goodies, a new timer
class, and a new string class were added. See below for full details.
We also tested this fairly rigorously by checking about two thirds of the
over 90 CRAN packages depending on Rcpp (and the remainder required even more package
installs which we did not do as this was already taking about 12 total cpu hours
to test). We are quite confident that no changes are required (besides
one in our own RcppClassic package which we will update.
The complete NEWS
entry for 0.10.2 is below; more details are in the ChangeLog file in the package and on the
Rcpp Changelog page.
Changes in Rcpp version 0.10.2 (2012-12-21)Thanks to CRANberries, you can also look at a diff to the previous release 0.10.1. As always, even fuller details are on the Rcpp Changelog page and the Rcpp page which also leads to the downloads, the browseable doxygen docs and zip files of doxygen output for the standard formats. A local directory has source and documentation too. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page
- Changes in Rcpp API:
- Source and header files were reorganized and consolidated so that compile time are now significantly lower
- Added additional check in
Rstreambufdeletetion- Added support for
clang++when usinglibc++, and for ancicpcinstd=c++11mode, thanks to a patch by Yan Zhou- New class
Rcpp::Stringto facilitate working with a single element of a character vector- New utility class sugar::IndexHash inspired from Simon Urbanek's fastmatch package
- Implementation of the equality operator between two Rcomplex
RNGScopenow has an internal counter that enables it to be safely used multiple times in the same stack frame.- New class
Rcpp::Timerfor benchmarking- Changes in Rcpp sugar:
- More efficient version of
matchbased onIndexHash- More efficient version of
uniquebase onIndexHash- More efficient version of
inbase onIndexHash- More efficient version of
duplicatedbase onIndexHash- More efficient version of
self_matchbase onIndexHash- New function
collapsethat implements paste(., collapse= "" )- Changes in Rcpp attributes:
- Use code generation rather than modules to implement
sourceCppandcompileAttributes(eliminates problem with exceptions not being able to cross shared library boundaries on Windows)- Exported functions now automatically establish an
RNGScope- Functions exported by
sourceCppnow directly reference the external function pointer rather than rely on dynlib lookup- On Windows, Rtools is automatically added to the PATH during
sourceCppcompilations- Diagnostics are printed to the console if
sourceCppfails and C++ development tools are not installed- A warning is printed if when
compileAttributesdetectsRcpp::dependsattributes in source files that are not matched by Depends/LinkingTo entries in the package DESCRIPTION
Before we begin, everyone should read up on hashtables and what open
addressing / closed hashing is. The context is lines 111 190 of Python s
Objects/dictobject.c as of today (so we get the line numbers straight).
(I ve reworded this wlog entry a bit; I originally wrote it too late at
night for it to read coherent.) Basically, I ve got an application where
I d like to use a hashtable for a number of things not as generic as
Python, and with focus on small footprint. I d like to offer associative
arrays in a scripting language, where the keys are always arbitrary byte
strings excluding NUL. Also, I d like to use the hashtable as backend for
indexed arrays, where the keys are uint32_t and the usual use
case is sequential. Finally, I m using it for several internal tables,
such as a list of keywords, one of builtins, one of special variables,
etc. which is a reason for me to not use a self-balancing binary tree
as data structure (reading further below might suggest that, but getting
a sorted list of hashtable keys is not the focus, though not unimportant).
Why is the shift on perturb done after its first use? In my experiments (using 32-bit width everywhere), for the pathological case of an 8-element (i = 3) table with three entries 0, 0x40000000 and 0x800000000, the second round yields 1 for all three, so it cannot have to do with the upper bits. My lookup looks like:
mask = 2 - 1; j = perturb = hash(key); goto find_first_slot; find_next_slot: j = (j << 2) + j + perturb + 1; perturb >>= PERTURB_SHIFT; /* FALLTHROUGH */ find_first_slot: entry = table[j & mask]; if (!match(entry)) goto find_next_empty_slot;
This means that my first check is always the bare hash (so only do it if needed is no reason) and, since I m using gotos, I could just move the perturb >>= PERTURB_SHIFT; line before the line recalculating the next j to use. This seems to make more sense, even in the face of Python. (I actually looked at the Python file s comments again today because I thought to use a different resolution, but they have a good rationale for using the multiplication by 5.) Why can t we just use i as the PERTURB_SHIFT? Sure, this changes a shift-right by a constant, which can possibly be encoded as immediate value in assembly (unless you re on a pre-80186, which can only do SHR AX,1 and SHR AX,CL but not SHR AX,4, but that s outside of mksh s scope) into a right-shift by a variable, but i is already known, and I think the behaviour is better (it wouldn t eat any bits; assume the same 8-entry hashtable and pathologic keys 0, 8 and 16). Again: who do I think I am to go against the wisdom of the Python people, who seem to have shed more thought on this than everyone else I saw, asked, read about (including Spammipedia). That s why I m asking here. On that reference: I don t support spammers or people nagging for donations or premium accounts, like Xing and Groundspeak/Geocaching.COM, at all. In fact, I urge others to do the same, so it really hurts them; it may be their business model, but not if they spam me. Besides, OpenCaching.DE exists. Another thing is: to avoid CVE-2011-4815, I m randomising the hash used, with one seed value per hashtable, changed before a resize operation. I originally thought to seed it with nonzero, but then I have to rehash on hashtable resize, so I ll be XORing the final hash value instead (thanks ciruZ for the idea). I m thinking of omitting that for indexed arrays, as an attacker almost certainly cannot determine the keys there. (To directly use the indexed array keys, which are already uint32_t, as hashes makes using i from even more important.) The hash I m using is a modified Jenkins one-at-a-time called NZAAT: it s my new generic standard n n-cryptographic hash, and the changes are thus: while adding a byte, another increment of the hash is done (so NUL counts), and the finaliser got prefixed with the shift-left-add+shift-right-xor sequence of the adder (but not adding any value or the +1), to get best avalanche for all bytes. I actually compiled several versions of Hash.cs on a Windows VM at work to analyse the original one-at-a-time and all of my modifications; these turned out to be the simplest ones (I originally had added 0x100 instead of 1, but the effect was the same, and +1 is usually cheaper on most CPUs). Also, to avoid people being able to get to the seed, a user will always get only a sorted list of hashtable keys (numeric for indexed arrays, ASCIIbetically otherwise; see also my thoughts on JSON from the previous wlog entry). What algorithm do I use? For strings, comparisons are much more expensive, so I d like to keep them low. Memory use is also a factor; allocating one large(r) block is better than many small ones due to the pool allocator overhead and due to portability to ancient Unic s (which is another reason for me to use a hashtable which is a small struct plus an array of pointers, and then pass the list of keys as array of string pointers, instead of a tree). For both reasons, I m thinking a relatively simple MergeSort: I need to allocate the result array anyway, so I can just get two and free the one that isn t the end result, and it s AFAICT the cheapest on comparisons other than Tree Sort (which nobody really seems to use, and which would effect to using a balanced binary tree again). Since keys are unique, stability and duplicate handling is never an issue. I d like to use only one algorithm and one data structure, not a combination, as compactness is a design goal. Please drop your thoughts on Freenode, e.g. by /msg MemoServ send mirabilos your text here or per eMail to the domains debian, freewrt or mirbsd, which are organisations, with the localpart tg. Or just contact me as usual, if you re already acquainted. Or lookup 0xE99007E0. Thanks in advance! (Especially, Python Developers thoughts are welcome.)
The attendee was about 7 people, it s not so many men.
Today, I officially got approved by the Debian Account Managers as a Debian Developer (still waiting on keyring-maint and DSA). Over the years, I have seen many people complain about the New Member Process. The most common complaint was with regards to the (usually) long amount of time the process can take to complete. I am writing this blog post to provide one more perspective on this process. Hopefully, it will prove useful to people considering starting the New Member Process.
The most difficult part about the New Member Process for me had to do with getting my GPG key signed by Debian Developers. I have not been able to attend any large conferences, which are great places to get your key signed. I also have not been able to meet up with the few Debian Developers living in/around Chicago. As a result, I was forced to patiently wait to start the NM process. This waiting period lasted a couple of years. It wasn't until this October, at the [Association for Computing Machinery at Urbana-Champaign's Reflections Projections Conference], that this changed. Stefano Zacchiroli was present to give a talk about Debian. Asheesh Laroia was also present to lead an OpenHatch Workshop about contributing to open source projects. Both of these Developers were more than willing to sign my key when I asked. If you look at my key, you will see that these signatures were made on October 7 and October 9, 2012.
With the signatures out of the way, the next step in the process was to actually apply. Since I did not already have an account in the system, I had to send an email to the Front Desk and have them enter my information into the system. Details on this step, along with a sample email are available here.
Once I was in the system, the next step was to get some Debian Developers to serve as my advocates. Advocates should be Debian Developers you have worked closely with, and usually include your sponsor(s). If these people believe you are ready to become a Debian Developer, they write a message describing the work you have been doing with them and why they feel you are ready. Paul Tagliamonte had helped review and sponsor a number of my uploads. I had been working with him for a number of years, and he really helped encourage and help me to reach this milestone. He served as my first advocate. Gregor Herrmann is responsible for getting me started in contributing to Debian. When I first tried to get involved, I had a hard time finding sponsors for my uploads and bugs to work on. Eventually, I discovered the Debian Perl Group. This team collectively maintains most of the Perl modules that are included in the Debian repositories. Gregor and the other Debian Developers on the team were really good about reviewing and sponsoring uploads in a very timely manner. This allowed me to learn quickly and make a number of contributions to Debian. He served as my second advocate.
With my advocations taken care of, the next step in the process was for the Front Desk to assign me an Application Manager and for the Application Manager to accept the appointment. Thijs Kinkhorst was appointed as my Application Manager. He also agreed to take on this task. For those of you who might not know, the Application Manager is in charge of asking the applicant questions, collecting information, and ultimately making a recommendation to the Debian Account Managers about whether or not they should accept the applicant as a Developer. They can go about this in a variety of ways, but most choose to utilize a set of template questions that are adjusted slightly on a per-applicant basis.
Remember that period of waiting to get my GPG key signed? I had used that time to go through and prepare answers to most of the template questions. This served two purposes. First, it allowed me to prove to myself that I had the knowledge to become a Debian Developer. Second, it helped to greatly speed up the New Member process once I actually applied. There were some questions that were added/removed/modified, but by answering the template questions befrehoand, I had become quite familiar with documents such as the Debian Policy and the Debian Developer's Rerference. These documents are the basis for almost all questions that are asked. After several rounds of questions, testing my knowledge of Debian's philosophy and procedures as well as my technical knowledge and skills, some of my uploads were reviewed. This is a pretty standard step. Be prepared to explain any changes you made (or chose not to make) in your uploads. If you have any outstanding bugs or issues with your packages, you might also be asked to resolve them. Eventually, once your Application Manager has collected enough information to ensure you are capable of becoming a Debian Developer, they will send their recommendation and a brief biography about you to the debian-newmaint mailing list and forward all information and emails from you to the Debian Account Managers (after the Front Desk checks and confirms that all of the important information is present).
The Debian Account Managers have the actual authority to approve new Debian Developers. They will review all information sent to them and reach their own decision. If they approve your application, they will submit requests for your GPG key to be added to the Debian Keyring and for an account to be created for you in the Debian systems. At this point, the New Member process is complete. For me, it took exactly 1 month from the time I officially applied to become a Debian Developer until the time of my application being approved by the Debian Account Managers. Hopefully, it will not be long until my GPG key is added to the keyring and my account is created. I feel the entire process went by very quickly and was pain-free. Hopefully, this blog post will help to encourage more people to apply to become Debian Developers.
The goal of this article is to describe the setup I've made for my
home LAN behind a FreeBox (French ISP Free.fr).
192.168.0.x/24)
2a01:e35:1234:5678::/64 prefix below, to represent the IPv6 prefix provided by the FreeBox)
eth0
etherlink port.
Behind the DreamPlug, I have connected a switch (to its eth1
ethernet port), on which the LAN's machines will be connected, on a
dual IPv4/IPv6 network. The IPv4 will be on 192.168.4.0/24
(addresses for machines connected to the switch will be static) while
the IPv6 will use the addresses auto-generated on the FreeBox's
prefix.
The DreamPlug will also provide a wifi network (in master mode,
through its uap0 interface), only IPv4 on 192.168.3.0/24.
On the DreamPlug, the outgoing IPv4 traffic will be masqueraded, while
the IPv6 traffic will be bridged so that machines on the LAN can be
reached from the Internet directly, passing through the eth0 eth1
bridge.
The DreamPlug will also act as a filter/firewall to only allow
selected traffic to reach the LAN machines (in particular for the
IPv6, since the machines may be reached directly from the Internet
otherwise).
/etc/network/interfaces on the DreamPlug looks like the
following (kudos to Dag Bertelsen's
Setting up Dreamplug as a router with Shorewall firewall for the wifi configuration bits):
# Note: Order of the interfaces declarations matters
auto lo
iface lo inet loopback
auto uap0
iface uap0 inet static
post-up /usr/bin/uaputl sys_cfg_ssid dream-uAP-XXXX
# Modus WPA2
post-up /usr/bin/uaputl sys_cfg_protocol 32
# WLAN password
post-up /usr/bin/uaputl sys_cfg_wpa_passphrase "WHATEVER PASSWORD"
# Set the Cipher
post-up /usr/bin/uaputl sys_cfg_cipher 8 8
# automatic channel
post-up /usr/bin/uaputl sys_cfg_channel 0 1
post-up /usr/bin/uaputl bss_start
# we deliver addresses for the Wifi with DHCP
post-up /usr/sbin/service udhcpd start
address 192.168.3.1
netmask 255.255.255.0
# Only IP6 traffic passes through the router between the Freebox on eth0 and the LAN on eth1
auto br0
iface br0 inet manual
bridge_ports eth0 eth1
bridge_maxwait 0
pre-up ebtables -t broute -A BROUTING -p ! ipv6 -j DROP
down ebtables -t broute -F
# Connected to the FreeBox, with DHCP in IPv4, masquerading outgoing IPv4 traffic
auto eth0
iface eth0 inet dhcp
up iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
down iptables -t nat -F
post-up sysctl -q -w net.ipv4.ip_forward=1
iface eth0 inet6 auto
# Connected to the LAN with a static IPv4 address
auto eth1
iface eth1 inet static
address 192.168.4.1
netmask 255.255.255.0
udhcpd is as such (in /etc/udhcpd.conf):
start 192.168.3.100
end 192.168.3.200
interface uap0
opt lease 86400
opt router 192.168.3.1
opt subnet 255.255.255.0
opt dns 192.168.3.1
opt domain localdomain
max_leases 101
lease_file /var/lib/udhcpd.leases
auto_time 5
ferm.
Here's the /etc/ferm/ferm.conf configuration (YMMV). Thanks to Ren Garcia's R gles de firewall pour un pont IPv6 for inspiration :
2.4 DNS config## Interfaces of the router
# Our LAN on a switch
@def $DEV_PRIVATE = eth1;
# The ISP router
@def $DEV_WORLD = eth0;
# Our Wifi LAN
@def $DEV_WIFI = uap0;
## IP networks of our LAN
# IPv4 (includes ethernet switch and wifi)
@def $NET_PRIVATE = 192.168.0.0/16;
# IPv6 (the prefix granted by the ISP)
@def $NET6_PRIVATE = 2a01:e35:1234:5678::/64;
# IPv6 Local link
@def $LINK6 = fe80::/10;
# Specific machines on the LAN
@def $MACHINE_MYDESKTOP = 2a01:0e35:1234:5678:1234:5678:9abc:def0;
# Special function to log dropped packets
@def &DROP() =
mod limit limit 1/second limit-burst 10 LOG log-prefix "$DOMAIN-$CHAIN: ";
DROP;
# IPv4 iptables rules
table filter
chain INPUT
policy DROP;
# connection tracking
mod state state INVALID DROP;
mod state state (ESTABLISHED RELATED) ACCEPT;
# allow local packet
interface lo ACCEPT;
# respond to ping
#proto icmp ACCEPT;
proto icmp icmp-type echo-request ACCEPT;
# allow IPsec
proto udp dport 500 ACCEPT;
proto (esp ah) ACCEPT;
# allow SSH connections from the private network and from some
# well-known internet hosts
#saddr ($NET_PRIVATE 123.45.67.89) proto tcp dport ssh ACCEPT;
saddr $NET_PRIVATE proto tcp dport ssh ACCEPT;
# we provide DNS and SMTP services for the internal net
interface $DEV_PRIVATE saddr $NET_PRIVATE
proto (udp tcp) dport domain ACCEPT;
proto tcp dport smtp ACCEPT;
interface $DEV_WIFI
# DHCP
proto udp dport 67:68 ACCEPT;
proto (udp tcp) dport domain ACCEPT;
proto udp dport netbios-dgm DROP;
# LOG all dropped packets
proto (udp tcp) &DROP();
# outgoing connections are not limited
chain OUTPUT policy ACCEPT;
chain FORWARD
policy DROP;
# connection tracking
mod state state INVALID DROP;
mod state state (ESTABLISHED RELATED) ACCEPT;
# connections from the internal net to the internet or to other
# internal nets are allowed
interface $DEV_PRIVATE ACCEPT;
interface $DEV_WIFI ACCEPT;
# LOG all dropped packets
proto (udp tcp) &DROP();
# IPv4 masquerade / NAT support
table nat
chain POSTROUTING
# masquerade private IP addresses
saddr $NET_PRIVATE outerface $DEV_WORLD MASQUERADE;
## IPv6:
domain ip6
table filter
chain INPUT
policy DROP;
# Internal traffic authorized
saddr $NET6_PRIVATE ACCEPT;
saddr $LINK6 ACCEPT;
# accept multicast
daddr ff00::/8 ACCEPT;
interface lo ACCEPT;
# For public traffic
# Only DNS resolution + NTP acceped for UDP
interface br0
proto udp
sport domain ACCEPT;
dport ntp ACCEPT;
&DROP();
# TCP on ports < 1024 forbidden except for SSH
proto tcp
dport ssh ACCEPT;
dport 0:1023 DROP;
# Accepted established traffic
mod state state INVALID DROP;
mod state state (ESTABLISHED RELATED) ACCEPT;
# incoming connections forbidden
proto tcp syn DROP;
# Accept ping
proto icmpv6 ACCEPT;
proto (udp tcp) &DROP();
chain FORWARD
policy DROP;
# All local traffic accepted
saddr $LINK6 ACCEPT;
# All ping accepted unless coming from internet
saddr ! $NET6_PRIVATE proto icmpv6 icmp-type echo-request DROP;
proto icmpv6 ACCEPT;
# Allow SSH to specific machines
proto tcp daddr $MACHINE_MYDESKTOP dport ssh ACCEPT;
# Accept established traffic
mod state state INVALID DROP;
mod state state (ESTABLISHED RELATED) ACCEPT;
# Accept outgoing traffic
saddr $NET6_PRIVATE ACCEPT;
# Accept local outgoing traffic
saddr ::1 ACCEPT;
proto (udp tcp) &DROP();
# ebtables
domain eb chain FORWARD
policy DROP;
# Only accept bridged traffic for IPv6
logical-in br0 logical-out br0
#ebtables -t broute -A BROUTING -p ! ipv6 -j DROP
proto IPv6 ACCEPT;
bind9 to cache the DNS for the wifi network (default config is OK out of the box).
192.168.3.0/24 network. There's nothing to
be configured specifically.
192.168.4.1 as a
gateway, or with IPv6 auto config.
On wheezy, the /etc/network/interfaces will look like :
auto eth1
iface eth1 inet static
address 192.168.4.42
netmask 255.255.255.0
gateway 192.168.4.1
dns-nameservers 212.27.40.241 212.27.40.240
iface eth1 inet6 autoDate: 2012-11-09 16:30:34 CET
Next.