<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-GB">
	<id>https://wiki.chappell-family.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=2001%3A470%3A1F08%3A185C%3A0%3A0%3A0%3A2</id>
	<title>timswiki - User contributions [en-gb]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.chappell-family.com/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=2001%3A470%3A1F08%3A185C%3A0%3A0%3A0%3A2"/>
	<link rel="alternate" type="text/html" href="https://wiki.chappell-family.com/wiki/index.php?title=Special:Contributions/2001:470:1F08:185C:0:0:0:2"/>
	<updated>2026-04-18T20:34:19Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.35.6</generator>
	<entry>
		<id>https://wiki.chappell-family.com/wiki/index.php?title=Raspberry_Pi_IPv6_firewall_tester_installation&amp;diff=206</id>
		<title>Raspberry Pi IPv6 firewall tester installation</title>
		<link rel="alternate" type="text/html" href="https://wiki.chappell-family.com/wiki/index.php?title=Raspberry_Pi_IPv6_firewall_tester_installation&amp;diff=206"/>
		<updated>2012-12-31T15:59:17Z</updated>

		<summary type="html">&lt;p&gt;2001:470:1F08:185C:0:0:0:2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=== Suggested Reading ===&lt;br /&gt;
&lt;br /&gt;
Before you begin please read the excellent [https://wiki.archlinux.org/index.php/Beginners%27_Guide Arch Linux Beginners&amp;#039; Guide].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Arch Linux Download and CF card creation ===&lt;br /&gt;
&lt;br /&gt;
Fetch the Arch Linux download from [http://www.raspberrypi.org/downloads RaspberryPi Downloads]&lt;br /&gt;
&lt;br /&gt;
If using [http://www.softpedia.com/get/CD-DVD-Tools/Data-CD-DVD-Burning/Win32-Disk-Imager.shtml win32 disk imager] then please be aware that the image file needs to be extracted onto a local physical drive (e.g. C: ) rather than a network/remote drive.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Login, Change the root password and Create a plain user ===&lt;br /&gt;
&lt;br /&gt;
Having logged in as root, then make sure you change the default password:&lt;br /&gt;
  &lt;br /&gt;
  # passwd&lt;br /&gt;
  &lt;br /&gt;
Then add a user, using a non-obvious username, e.g. &amp;#039;&amp;#039;&amp;#039;PlnUsr456&amp;#039;&amp;#039;&amp;#039; : (follow the prompts)&lt;br /&gt;
  &lt;br /&gt;
  # adduser&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Update your System and Install the Required Packages ===&lt;br /&gt;
  &lt;br /&gt;
Then update your system:&lt;br /&gt;
  &lt;br /&gt;
  # pacman -Syu&lt;br /&gt;
  &lt;br /&gt;
Which is likely to update pacman itself – just follow the prompts and once this is complete then re-attempt the complete upgrade:&lt;br /&gt;
  &lt;br /&gt;
  # pacman -Syu&lt;br /&gt;
  :: Synchronizing package databases...&lt;br /&gt;
   core is up to date&lt;br /&gt;
   extra is up to date&lt;br /&gt;
   community is up to date&lt;br /&gt;
   alarm is up to date&lt;br /&gt;
   aur is up to date&lt;br /&gt;
  :: Starting full system upgrade...&lt;br /&gt;
  resolving dependencies...&lt;br /&gt;
  looking for inter-conflicts...&lt;br /&gt;
  &lt;br /&gt;
  Proceed with installation? [Y/n]&lt;br /&gt;
  :: Retrieving packages from core...&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Simplistic IPv6 Firewall ===&lt;br /&gt;
&lt;br /&gt;
As a general starting point please read the [https://wiki.archlinux.org/index.php/Iptables ArchLinux IPtables documentation]. &lt;br /&gt;
&lt;br /&gt;
You will need to install the iptables modules and scripts using the following command:&lt;br /&gt;
&lt;br /&gt;
  # pacman -S iptables&lt;br /&gt;
&lt;br /&gt;
The following IPv6 firewall is a very simplistic example, where SLAAC IPv6 address allocation is in place. &amp;#039;&amp;#039;&amp;#039;You will want to add additional source address and/or packet arrival rate checking on an internet-facing Raspberry Pi.&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
  *filter&lt;br /&gt;
  :INPUT DROP [0:0]&lt;br /&gt;
  :FORWARD DROP [0:0]&lt;br /&gt;
  :OUTPUT ACCEPT [0:0]&lt;br /&gt;
  :ICMP6FLTR - [0:0]&lt;br /&gt;
  :LOGIDROP - [0:0]&lt;br /&gt;
  -A LOGIDROP -m limit --limit 20/m --limit-burst 10 -j LOG --log-prefix &amp;quot;IPV6_INPUT_DROP &amp;quot; --log-ip-options --log-tcp-options --log-tcp-sequence&lt;br /&gt;
  -A LOGIDROP -j DROP&lt;br /&gt;
  #&lt;br /&gt;
  # ICMPv6 filter chain&lt;br /&gt;
  #&lt;br /&gt;
  # Allow ping of this host to aid debug - comment out if not required&lt;br /&gt;
  -A ICMP6FLTR -p ipv6-icmp --icmpv6-type echo-request -j ACCEPT&lt;br /&gt;
  -A ICMP6FLTR -m state -p ipv6-icmp --state ESTABLISHED,RELATED --icmpv6-type echo-reply -j ACCEPT&lt;br /&gt;
  -A ICMP6FLTR -m state -p ipv6-icmp --state ESTABLISHED,RELATED --icmpv6-type destination-unreachable -j ACCEPT&lt;br /&gt;
  -A ICMP6FLTR -m state -p ipv6-icmp --state ESTABLISHED,RELATED --icmpv6-type packet-too-big -j ACCEPT&lt;br /&gt;
  -A ICMP6FLTR -m state -p ipv6-icmp --state ESTABLISHED,RELATED --icmpv6-type unknown-header-type -j ACCEPT&lt;br /&gt;
  -A ICMP6FLTR -m state -p ipv6-icmp --state ESTABLISHED,RELATED --icmpv6-type unknown-option -j ACCEPT&lt;br /&gt;
  -A ICMP6FLTR -p ipv6-icmp --icmpv6-type ttl-zero-during-reassembly -j ACCEPT&lt;br /&gt;
  -A ICMP6FLTR -p ipv6-icmp --icmpv6-type bad-header -j ACCEPT&lt;br /&gt;
  #&lt;br /&gt;
  # Allow router advertisements to support SLAAC address allocation&lt;br /&gt;
  # ensure hop-limit (hl) is 255&lt;br /&gt;
  -A ICMP6FLTR -p ipv6-icmp --icmpv6-type router-advertisement --source fe80::/10 --match hl --hl-eq 255 -j ACCEPT&lt;br /&gt;
  -A ICMP6FLTR -p ipv6-icmp --icmpv6-type router-solicitation --match hl --hl-eq 255 -j ACCEPT&lt;br /&gt;
  #&lt;br /&gt;
  # Allow neighbour adv/sol so we can talk to our neighbouts (IPv6 ARP equivalent)&lt;br /&gt;
  # ensure hop-limit (hl) is 255&lt;br /&gt;
  -A ICMP6FLTR -p ipv6-icmp --icmpv6-type neighbour-advertisement --match hl --hl-eq 255 -j ACCEPT&lt;br /&gt;
  -A ICMP6FLTR -p ipv6-icmp --icmpv6-type neighbour-solicitation  --match hl --hl-eq 255 -j ACCEPT&lt;br /&gt;
  #&lt;br /&gt;
  # Allow inverse neighbour discovery solicitation (141) / advertisement (142)&lt;br /&gt;
  # ensure hop-limit (hl) is 255&lt;br /&gt;
  -A ICMP6FLTR -p ipv6-icmp --icmpv6-type 141 --match hl --hl-eq 255 -j ACCEPT&lt;br /&gt;
  -A ICMP6FLTR -p ipv6-icmp --icmpv6-type 142 --match hl --hl-eq 255 -j ACCEPT&lt;br /&gt;
  #&lt;br /&gt;
  # Allow certificate path solicitation (148) / advertisement (149)&lt;br /&gt;
  # ensure hop-limit (hl) is 255&lt;br /&gt;
  -A ICMP6FLTR -p ipv6-icmp --icmpv6-type 148 --match hl --hl-eq 255 -j ACCEPT&lt;br /&gt;
  -A ICMP6FLTR -p ipv6-icmp --icmpv6-type 149 --match hl --hl-eq 255 -j ACCEPT&lt;br /&gt;
  ##&lt;br /&gt;
  ## Allow ICMPv6 with link local addresses for multicast listener query (130), report (131), done (132) and report v2 (143)&lt;br /&gt;
  ## Likely unused, but uncomment if required&lt;br /&gt;
  #-A ICMP6FLTR -p ipv6-icmp --icmpv6-type 130 --source fe80::/10 -j ACCEPT&lt;br /&gt;
  #-A ICMP6FLTR -p ipv6-icmp --icmpv6-type 131 --source fe80::/10 -j ACCEPT&lt;br /&gt;
  #-A ICMP6FLTR -p ipv6-icmp --icmpv6-type 132 --source fe80::/10 -j ACCEPT&lt;br /&gt;
  #-A ICMP6FLTR -p ipv6-icmp --icmpv6-type 143 --source fe80::/10 -j ACCEPT&lt;br /&gt;
  ## Allow ICMPv6 with link local addresses and hop limit == 1 for multicast router advertisement (151), solicitation (152) and termination (153)&lt;br /&gt;
  #-A ICMP6FLTR -p ipv6-icmp --icmpv6-type 151 --source fe80::/10 --match hl --hl-eq 1 -j ACCEPT&lt;br /&gt;
  #-A ICMP6FLTR -p ipv6-icmp --icmpv6-type 152 --source fe80::/10 --match hl --hl-eq 1 -j ACCEPT&lt;br /&gt;
  #-A ICMP6FLTR -p ipv6-icmp --icmpv6-type 153 --source fe80::/10 --match hl --hl-eq 1 -j ACCEPT&lt;br /&gt;
  #&lt;br /&gt;
  # Drop everything else&lt;br /&gt;
  -A ICMP6FLTR -j LOGIDROP&lt;br /&gt;
  #&lt;br /&gt;
  # Main INPUT chain&lt;br /&gt;
  #&lt;br /&gt;
  # Allow all loopback traffic&lt;br /&gt;
  -A INPUT -i lo -j ACCEPT&lt;br /&gt;
  # Drop all routing header traffic (change if supporting mobile IPv6)&lt;br /&gt;
  -A INPUT -m rt --rt-type 0 -j LOGIDROP&lt;br /&gt;
  -A INPUT -m rt --rt-type 1 -j LOGIDROP&lt;br /&gt;
  -A INPUT -m rt --rt-type 2 -j LOGIDROP&lt;br /&gt;
  # Call ICMPv6 filter&lt;br /&gt;
  -A INPUT -p ipv6-icmp -j ICMP6FLTR&lt;br /&gt;
  # Allow all traffic related to, or part of an established stream&lt;br /&gt;
  -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT&lt;br /&gt;
  # Allow SSH and HTTP traffic&lt;br /&gt;
  -A INPUT -p tcp --dport 22 -j ACCEPT&lt;br /&gt;
  -A INPUT -p tcp --dport 80 -j ACCEPT&lt;br /&gt;
  # Drop, but log, everything else&lt;br /&gt;
  -A INPUT -j LOGIDROP&lt;br /&gt;
  COMMIT  &lt;br /&gt;
&lt;br /&gt;
Assuming your desired ruleset is stored in a file called simple_firewall6.rules then you can import the firewall rules using:&lt;br /&gt;
&lt;br /&gt;
  # &amp;#039;&amp;#039;&amp;#039;ip6tables-restore &amp;lt; simple_firewall6.rules&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
You can view the active firewall rules, and determine the number of packets being processed by each rule using:&lt;br /&gt;
&lt;br /&gt;
  # &amp;#039;&amp;#039;&amp;#039;ip6tables -v -n -L&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
  &lt;br /&gt;
  Chain INPUT (policy DROP 0 packets, 0 bytes)&lt;br /&gt;
   pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
      0     0 ACCEPT     all      lo     any     anywhere             anywhere&lt;br /&gt;
      6   480 LOGIDROP   all      any    any     anywhere             anywhere             rt type:0 segsleft:0&lt;br /&gt;
      0     0 LOGIDROP   all      any    any     anywhere             anywhere             rt type:1 segsleft:0&lt;br /&gt;
      0     0 LOGIDROP   all      any    any     anywhere             anywhere             rt type:2 segsleft:0&lt;br /&gt;
     94 14928 ICMP6FLTR  ipv6-icmp    any    any     anywhere             anywhere&lt;br /&gt;
    687 64315 ACCEPT     all      any    any     anywhere             anywhere             state RELATED,ESTABLISHED&lt;br /&gt;
     24  1892 ACCEPT     tcp      any    any     anywhere             anywhere             tcp dpt:ssh&lt;br /&gt;
      3   192 ACCEPT     tcp      any    any     anywhere             anywhere             tcp dpt:http&lt;br /&gt;
   2002  130K LOGIDROP   all      any    any     anywhere             anywhere&lt;br /&gt;
  &lt;br /&gt;
  Chain FORWARD (policy DROP 0 packets, 0 bytes)&lt;br /&gt;
   pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  &lt;br /&gt;
  Chain OUTPUT (policy ACCEPT 680 packets, 336K bytes)&lt;br /&gt;
   pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
  &lt;br /&gt;
  Chain ICMP6FLTR (1 references)&lt;br /&gt;
   pkts bytes target     prot opt     in     out     source               destination&lt;br /&gt;
      1   176 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             ipv6-icmp echo-request&lt;br /&gt;
      0     0 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             state RELATED,ESTABLISHED ipv6-icmp echo-reply&lt;br /&gt;
      0     0 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             state RELATED,ESTABLISHED ipv6-icmp destination-unreachable&lt;br /&gt;
      0     0 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             state RELATED,ESTABLISHED ipv6-icmp packet-too-big&lt;br /&gt;
      0     0 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             state RELATED,ESTABLISHED ipv6-icmp unknown-header-type&lt;br /&gt;
      0     0 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             state RELATED,ESTABLISHED ipv6-icmp unknown-option&lt;br /&gt;
      0     0 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             ipv6-icmp ttl-zero-during-reassembly&lt;br /&gt;
      0     0 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             ipv6-icmp bad-header&lt;br /&gt;
     85 14280 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             ipv6-icmp router-advertisement HL match HL == 255&lt;br /&gt;
      0     0 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             ipv6-icmp router-solicitation HL match HL == 255&lt;br /&gt;
      0     0 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             ipv6-icmp neighbour-advertisement HL match HL == 255&lt;br /&gt;
      2   136 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             ipv6-icmp neighbour-solicitation HL match HL == 255&lt;br /&gt;
      0     0 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             ipv6-icmptype 141 HL match HL == 255&lt;br /&gt;
      0     0 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             ipv6-icmptype 142 HL match HL == 255&lt;br /&gt;
      0     0 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             ipv6-icmptype 148 HL match HL == 255&lt;br /&gt;
      0     0 ACCEPT     ipv6-icmp    any    any     anywhere             anywhere             ipv6-icmptype 149 HL match HL == 255&lt;br /&gt;
      6   336 LOGIDROP   all          any    any     anywhere             anywhere&lt;br /&gt;
  &lt;br /&gt;
  Chain LOGIDROP (5 references)&lt;br /&gt;
   pkts bytes target     prot opt in     out     source               destination&lt;br /&gt;
     12   784 LOG        all      any    any     anywhere             anywhere             limit: avg 20/min burst 10 LOG level warning tcp-sequence tcp-options ip-options prefix &amp;quot;IPV6_INPUT_DROP &amp;quot;&lt;br /&gt;
   2014  131K DROP       all      any    any     anywhere             anywhere&lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
Once you&amp;#039;re satisfied that the IPv6 firewall rules are performing correctly then they can be saved using the following command:&lt;br /&gt;
&lt;br /&gt;
  # rc.d save ip6tables&lt;br /&gt;
&lt;br /&gt;
Note that if you&amp;#039;re also using IPv4 then don&amp;#039;t forget to setup a similar IPv4 firewall ruleset. Again this example is only suitable for use in a trusted environment and needs further consideration for an internet facing machine.&lt;br /&gt;
&lt;br /&gt;
  *filter&lt;br /&gt;
  :INPUT DROP [0:0]&lt;br /&gt;
  :FORWARD DROP [0:0]&lt;br /&gt;
  :OUTPUT ACCEPT [0:0]&lt;br /&gt;
  :LOGI4DROP - [0:0]&lt;br /&gt;
  -A LOGI4DROP -m limit --limit 10/m --limit-burst 5 -j LOG --log-prefix &amp;quot;IPV4_INPUT_DROP &amp;quot; --log-ip-options --log-tcp-options --log-tcp-sequence&lt;br /&gt;
  -A LOGI4DROP -j DROP&lt;br /&gt;
  # Allow all loopback traffic&lt;br /&gt;
  -A INPUT -i lo -j ACCEPT&lt;br /&gt;
  # Allow all traffic related to, or part of an established session&lt;br /&gt;
  -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT&lt;br /&gt;
  # Allow ping of this host to aid debug - comment out if not required&lt;br /&gt;
  -A INPUT -p icmp --icmp-type echo-request -j ACCEPT&lt;br /&gt;
  # Allow SSH and HTTP traffic&lt;br /&gt;
  -A INPUT -p tcp --dport 22 -j ACCEPT&lt;br /&gt;
  -A INPUT -p tcp --dport 80 -j ACCEPT&lt;br /&gt;
  # Allow DHCP related traffic&lt;br /&gt;
  -A INPUT -p udp --dport 67:68 -j ACCEPT&lt;br /&gt;
  # Drop everything else&lt;br /&gt;
  -A INPUT -j LOGI4DROP&lt;br /&gt;
  COMMIT&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This time import can be performed using:&lt;br /&gt;
&lt;br /&gt;
  # iptables-restore &amp;lt; simple_firewall.rules&lt;br /&gt;
&lt;br /&gt;
Once you&amp;#039;re happy with your IPv4 firewall then you can save the active rules using the following command:&lt;br /&gt;
&lt;br /&gt;
  # rc.d save iptables&lt;br /&gt;
&lt;br /&gt;
Note that it is import to check full functionality still exists with your firewall in place - this particularly applies to address allocation (e.g. DHCP and SLAAC) procedures which may mean that a misconfigured firewall makes your Raspberry Pi unreachable. This is one reason why it is useful to develop the two rulesets (IPv4 and IPv6) separately, since if you misconfigure one firewall and lose connectivity then you can fall back to the working protocol version to correct your mistake. Once you&amp;#039;re happy that both firewall sets are correct then you can insert &amp;#039;&amp;#039;both&amp;#039;&amp;#039; sets into &amp;#039;&amp;#039;&amp;#039;/etc/rc.conf&amp;#039;&amp;#039;&amp;#039; DAEMONS statement before the network module is called:&lt;br /&gt;
&lt;br /&gt;
  DAEMONS=(!hwclock syslog-ng &amp;#039;&amp;#039;&amp;#039;iptables&amp;#039;&amp;#039;&amp;#039; &amp;#039;&amp;#039;&amp;#039;ip6tables&amp;#039;&amp;#039;&amp;#039; network openntpd @netfs @crond @sshd @mysqld @httpd)&lt;br /&gt;
&lt;br /&gt;
You can check for dropped/logged packets (in the examples above logging is included for the IPv6 packet filter) using the following command:&lt;br /&gt;
&lt;br /&gt;
  # tailf /var/log/iptables.log&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Installing LAMP ===&lt;br /&gt;
&lt;br /&gt;
Install LAMP by following the excellent [https://wiki.archlinux.org/index.php/LAMP Arch Linux LAMP guide].&lt;br /&gt;
  &lt;br /&gt;
  # pacman -S apache php php-apache mysql&lt;br /&gt;
    &lt;br /&gt;
  # rc.d start mysqld &lt;br /&gt;
  &lt;br /&gt;
Don&amp;#039;t forget to add a MySQL password:&lt;br /&gt;
  &lt;br /&gt;
  # mysqladmin -u root password ‘password’&lt;br /&gt;
  # mysql -u root -p&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
Then Edit /etc/rc.conf (to start MySQL at boot): &lt;br /&gt;
  &lt;br /&gt;
   DAEMONS=(... mysqld ...)&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
Read and follow the Apache section - I suggest that you adjust the default DocumentRoot directory by inserting an additional directory level (e.g. htdocs) under /srv/http so that you can place other directories at this same level without them all being under the Document root:&lt;br /&gt;
&lt;br /&gt;
  /srv/http/&lt;br /&gt;
            htdocs/ - DocumentRoot directory for storage of your served web pages (e.g. index.php discussed below)&lt;br /&gt;
            cgi-bin6/ - directory for the ipscan cgi executables&lt;br /&gt;
  &lt;br /&gt;
If you follow this suggestion then don&amp;#039;t forget to modify the DocumentRoot setting in the apache configuration file! Having followed the php installation guide then you&amp;#039;ll also need to update php&amp;#039;s base directory to match Apache inside &amp;#039;&amp;#039;&amp;#039;/etc/php/php.ini&amp;#039;&amp;#039;&amp;#039;:&lt;br /&gt;
&lt;br /&gt;
  open_basedir = /srv/http/htdocs:/home/:/tmp/:/usr/share/pear/&lt;br /&gt;
&lt;br /&gt;
And also define the timezone appropriately for your system:&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;&lt;br /&gt;
  [Date]&lt;br /&gt;
  ; Defines the default timezone used by the date functions&lt;br /&gt;
  ; http://php.net/date.timezone&lt;br /&gt;
  date.timezone = &amp;quot;Europe/London&amp;quot;&lt;br /&gt;
  &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Once Apache and PHP start successfully:&lt;br /&gt;
&lt;br /&gt;
  # rc.d start httpd&lt;br /&gt;
&lt;br /&gt;
then edit /etc/rc.conf (to start Apache at boot): &lt;br /&gt;
  &lt;br /&gt;
  DAEMONS=(... httpd ...)&lt;br /&gt;
  &lt;br /&gt;
Then install the basic development tools (provides gcc, etc.)&lt;br /&gt;
&lt;br /&gt;
  # pacman -S base-devel&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And perl and the associated MySQL interface modules:&lt;br /&gt;
  &lt;br /&gt;
  # pacman -S perl-dbi perl-dbd-mysql&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
You may also wish to include spoken sound support:&lt;br /&gt;
&lt;br /&gt;
  # pacman -S festival festival-english alsa-utils&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
And update your festivalrc file:&lt;br /&gt;
&lt;br /&gt;
  # cat /root/.festivalrc&lt;br /&gt;
    &lt;br /&gt;
    (Parameter.set &amp;#039;Audio_Command &amp;quot;/usr/bin/aplay -R1000 -q -c 1 -t raw -f s16 -r $SR $FILE&amp;quot;)&lt;br /&gt;
    (Parameter.set &amp;#039;Audio_Method &amp;#039;Audio_Command)&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
And add a sound.conf file under /etc/modules-load.d to ensure the Broadcom sound module is loaded at boot. &lt;br /&gt;
The file needs to contain a single statement shown below:&lt;br /&gt;
  &lt;br /&gt;
  # cat /etc/modules-load.d/sound.conf&lt;br /&gt;
&lt;br /&gt;
  snd_bcm2835&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Install git, download and build ipscan ===&lt;br /&gt;
&lt;br /&gt;
Then install git and download the ipscan source:&lt;br /&gt;
&lt;br /&gt;
  # pacman -S git&lt;br /&gt;
  &lt;br /&gt;
Then clone the ipscan source into a directory under your root user account:&lt;br /&gt;
&lt;br /&gt;
  [root@alarmpi ~]# git clone https://github.com/timsgit/ipscan ipscan&lt;br /&gt;
  Cloning into &amp;#039;ipscan&amp;#039;...&lt;br /&gt;
  remote: Counting objects: 221, done.&lt;br /&gt;
  remote: Compressing objects: 100% (200/200), done.&lt;br /&gt;
  remote: Total 221 (delta 156), reused 85 (delta 20)&lt;br /&gt;
  Receiving objects: 100% (221/221), 102.97 KiB, done.&lt;br /&gt;
  Resolving deltas: 100% (156/156), done.&lt;br /&gt;
  [root@alarmpi ~]# ls ipscan&lt;br /&gt;
  COPYING  ipscan.c  ipscan_checks.c  ipscan_db.c  ipscan.h  ipscan_portlist.h  ipscan_web.c  Makefile  README  sqltidy.pl&lt;br /&gt;
  [root@alarmpi ~]#&lt;br /&gt;
  &lt;br /&gt;
Now follow the instructions in the [https://github.com/timsgit/ipscan/blob/master/README README file] within ipscan&amp;#039;s github repository.&lt;br /&gt;
&lt;br /&gt;
It&amp;#039;s necessary to change the Makefile to reflect your Apache server&amp;#039;s  cgi-bin directory mapping:&lt;br /&gt;
&lt;br /&gt;
Assuming your Apache configuration file (/etc/httpd/conf/httpd.conf) contains:&lt;br /&gt;
&lt;br /&gt;
  DocumentRoot &amp;quot;/srv/http/htdocs&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and ...&lt;br /&gt;
  &lt;br /&gt;
  ScriptAlias /cgi-bin6/ &amp;quot;/srv/http/cgi-bin6/&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and ...&lt;br /&gt;
&lt;br /&gt;
  &amp;lt;Directory &amp;quot;/srv/http/cgi-bin6&amp;quot;&amp;gt;&lt;br /&gt;
    AllowOverride None&lt;br /&gt;
    Options +ExecCGI -Includes&lt;br /&gt;
    Order allow,deny&lt;br /&gt;
    Allow from all&lt;br /&gt;
  &amp;lt;/Directory&amp;gt;&lt;br /&gt;
&lt;br /&gt;
then modify your ipscan Makefile to reflect this:&lt;br /&gt;
&lt;br /&gt;
  # Install location for the CGI files&lt;br /&gt;
  TARGETDIR=/srv/http/cgi-bin6&lt;br /&gt;
  &lt;br /&gt;
  # HTTP URI PATH by which external hosts will access the CGI files.&lt;br /&gt;
  # This may well be unrelated to the installation path if Apache is configured&lt;br /&gt;
  # to provide CGI access via an alias.&lt;br /&gt;
  # NB : the path should begin with a / but must NOT end with one ....&lt;br /&gt;
  URIPATH=/cgi-bin6&lt;br /&gt;
&lt;br /&gt;
Make sure you have created the /srv/http/cgi-bin6 directory (or whatever you have chosen) before attempting to build ipscan. Also make sure that your MySQL database is created following the instructions in the github repository. You will need to login to mysql using the root password you previously defined (above):&lt;br /&gt;
&lt;br /&gt;
  # mysql -u root -p&lt;br /&gt;
  &lt;br /&gt;
  mysql&amp;gt; create database ipscan;&lt;br /&gt;
       Query OK, 1 row affected (0.00 sec)&lt;br /&gt;
       &lt;br /&gt;
  mysql&amp;gt; create user &amp;#039;ipscan-user&amp;#039;@&amp;#039;localhost&amp;#039; identified by &amp;#039;ipscan-passwd&amp;#039;;&lt;br /&gt;
       Query OK, 0 rows affected (0.01 sec)&lt;br /&gt;
  &lt;br /&gt;
  mysql&amp;gt; grant all privileges on ipscan.* to &amp;#039;ipscan-user&amp;#039;@&amp;#039;localhost&amp;#039; identified by &amp;#039;ipscan-passwd&amp;#039;;&lt;br /&gt;
       Query OK, 0 rows affected (0.01 sec)&lt;br /&gt;
  &lt;br /&gt;
  mysql&amp;gt; exit&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
Modify the ipscan-user and ipscan-passwd entries to use your preferences (different to the ones that you chose for root!) and enter the same credentials into the ipscan.h include file:&lt;br /&gt;
&lt;br /&gt;
  // MySQL database-related globals&lt;br /&gt;
  &lt;br /&gt;
  #define MYSQL_HOST &amp;quot;localhost&amp;quot;&lt;br /&gt;
  #define MYSQL_USER &amp;quot;ipscan-user&amp;quot;&lt;br /&gt;
  #define MYSQL_PASSWD &amp;quot;ipscan-passwd&amp;quot;&lt;br /&gt;
  #define MYSQL_DBNAME &amp;quot;ipscan&amp;quot;&lt;br /&gt;
  #define MYSQL_TBLNAME &amp;quot;results&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Then you should be able to make ipscan as &amp;#039;&amp;#039;&amp;#039;root&amp;#039;&amp;#039;&amp;#039; user and perform the install to transfer the necessary cgi files into your preferred cgi-bin directory:&lt;br /&gt;
&lt;br /&gt;
  # make &amp;amp;&amp;amp; make install&lt;br /&gt;
&lt;br /&gt;
Prior to running the ipscan tester it is advisable to add a cron job which will execute the sqltidy.pl script to remove the completed scan results to protect your users&amp;#039; security and minimise the size of your database:&lt;br /&gt;
&lt;br /&gt;
First install the necessary perl mysql data base interface modules:&lt;br /&gt;
&lt;br /&gt;
  # pacman -S perl-dbi-mysql perl-mysql  &lt;br /&gt;
  &lt;br /&gt;
Then modify the MySQL related entries in the sqltidy.pl script to match your chosen user, password, etc. and then ensure that the script runs standalone without any perl errors:&lt;br /&gt;
&lt;br /&gt;
  # /root/ipscan/sqltidy.pl&lt;br /&gt;
  &lt;br /&gt;
And finally edit the root cron job to insert the line shown below (modified to reflect your ipscan source directory):&lt;br /&gt;
&lt;br /&gt;
  # crontab -e&lt;br /&gt;
  &lt;br /&gt;
You may wish to move sqltidy.pl to another location, but ensure its permissions prevent ordinary users from reading or executing the file:&lt;br /&gt;
&lt;br /&gt;
  */5 * * * * /root/ipscan/sqltidy.pl 2&amp;gt;&amp;amp;1&lt;br /&gt;
&lt;br /&gt;
=== Check your Services and IPv6 address allocation ===&lt;br /&gt;
  &lt;br /&gt;
Now it is suggested that you check your Apache service is running using lsof:&lt;br /&gt;
&lt;br /&gt;
  # pacman -S lsof&lt;br /&gt;
  &lt;br /&gt;
  # lsof -i -n -P |grep http&lt;br /&gt;
  httpd     712     root    4u  IPv6   1457      0t0  TCP *:80 (LISTEN)&lt;br /&gt;
  httpd   16107     http    4u  IPv6   1457      0t0  TCP *:80 (LISTEN)&lt;br /&gt;
  ...&lt;br /&gt;
&lt;br /&gt;
And for MySQL:&lt;br /&gt;
&lt;br /&gt;
  # ps -ef |grep -i mysql&lt;br /&gt;
  root       392     1  0 Aug25 ?        00:00:00 /bin/sh /usr/bin/mysqld_safe --user=mysql&lt;br /&gt;
  mysql      688   392  0 Aug25 ?        01:47:48 /usr/bin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib/mysql/plugin &lt;br /&gt;
                                                  --user=mysql --log-error=/var/lib/mysql/alarmpi.err --pid-file=/var/lib/mysql/alarmpi.pid &lt;br /&gt;
                                                  --socket=/var/run/mysqld/mysqld.sock --port=3306&lt;br /&gt;
  &lt;br /&gt;
It is now worth checking that your Raspberry Pi has been correctly allocated an IPv6 address, using ifconfig:&lt;br /&gt;
&lt;br /&gt;
  # ifconfig eth0&lt;br /&gt;
  eth0: flags=4163&amp;lt;UP,BROADCAST,RUNNING,MULTICAST&amp;gt;  mtu 1500&lt;br /&gt;
        inet AA.BB.C.DD  netmask 255.255.255.0  broadcast AA.BB.C.255&lt;br /&gt;
        inet6 &amp;#039;&amp;#039;&amp;#039;2001:470:971f:3:ba27:ebff:fecc:dc7c&amp;#039;&amp;#039;&amp;#039;  prefixlen 64  scopeid 0x0&amp;lt;global&amp;gt;&lt;br /&gt;
        inet6 fe80::ba27:ebff:fecc:dc7c  prefixlen 64  scopeid 0x20&amp;lt;link&amp;gt;&lt;br /&gt;
        ether b8:27:eb:cc:dc:7c  txqueuelen 1000  (Ethernet)&lt;br /&gt;
        RX packets 721789  bytes 103366589 (98.5 MiB)&lt;br /&gt;
        RX errors 0  dropped 48  overruns 0  frame 0&lt;br /&gt;
        TX packets 231210  bytes 130480722 (124.4 MiB)&lt;br /&gt;
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Assuming that your Raspberry Pi has a valid IPv6 address and that your Apache and MySQL services are correctly running then you should be able to point a web browser to your cgi file:&lt;br /&gt;
&lt;br /&gt;
e.g. towards &amp;#039;&amp;#039;&amp;#039;http://[2001:470:971f:3:ba27:ebff:fecc:dc7c]/cgi-bin6/ipscan-txt.cgi&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
=== Restrict SSH Logins ===&lt;br /&gt;
&lt;br /&gt;
In general it is recommended that you apply all the standard SSH hardening approaches. You can also restrict logins to your newly created plain user (above) with the addition of the following line to your ssh configuration file (&amp;#039;&amp;#039;&amp;#039;/etc/ssh/sshd_config&amp;#039;&amp;#039;&amp;#039;). I&amp;#039;d also recommend that you choose an username which isn&amp;#039;t a simple shortening of your own name:&lt;br /&gt;
&lt;br /&gt;
  AllowUsers &amp;#039;&amp;#039;&amp;#039;PlnUsr456&amp;#039;&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Example PHP landing page ===&lt;br /&gt;
&lt;br /&gt;
An example PHP landing page can be found by following the link [[Raspberry_Pi_IPv6_firewall_tester_landingpage]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This website publishes a [http://ipv6.chappell-family.com/html/privacy_policy.html Privacy Policy.] Continued use of this website implies your consent to the storage of data outlined in the policy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;adsense&amp;gt;1&amp;lt;/adsense&amp;gt;&lt;/div&gt;</summary>
		<author><name>2001:470:1F08:185C:0:0:0:2</name></author>
	</entry>
	<entry>
		<id>https://wiki.chappell-family.com/wiki/index.php?title=IPv6_Firewalls&amp;diff=198</id>
		<title>IPv6 Firewalls</title>
		<link rel="alternate" type="text/html" href="https://wiki.chappell-family.com/wiki/index.php?title=IPv6_Firewalls&amp;diff=198"/>
		<updated>2012-12-09T15:52:04Z</updated>

		<summary type="html">&lt;p&gt;2001:470:1F08:185C:0:0:0:2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==IPv6 Firewalls==&lt;br /&gt;
&lt;br /&gt;
===General Observations===&lt;br /&gt;
&lt;br /&gt;
IPv6 firewalls are separate from, and often control network traffic in different ways, to current IPv4 firewalls. IPv4 has evolved from its original flat architecture to involve multiple layers of hierarchy in order to support the burgeoning number of nodes that make up the internet. Not only can the imposed hierarchy offer some security in itself but clients have often relied on their online visibility and security being provided by another node (e.g. an ADSL router). This assumed protection, and the likelihood that it is missing if you connect your client to a foreign (non-home) network, is behind the frequently reported incidents of &amp;quot;coffee shop&amp;quot; wifi attacks.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
IPv6 intends to revert the network hierarchy back towards a flat structure, where any node can talk directly to any other IPv6 node. In line with this approach routers &amp;#039;&amp;#039;&amp;#039;may&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;may not&amp;#039;&amp;#039;&amp;#039; firewall IPv6 traffic for clients that operate behind them. This has several implications for the clients:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Clients may have globally routable IPv6 addresses&lt;br /&gt;
* Clients may be solely responsible for their own security/firewall protection (safest to assume this is the case for both IPv6 and IPv4)&lt;br /&gt;
* Clients may have more than one active IPv6 address&lt;br /&gt;
* Clients may frequently change their IPv6 address if using privacy addresses, as per [http://tools.ietf.org/html/rfc4941 RFC4941]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In response to this many of the current IPv6-enabled client devices (e.g. iOS and Android devices) include their own IPv6 firewalls, which are usually enabled by default.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
IPv6 brings two other scenarios that mobile clients (i.e. those connecting to more than one network) need to consider:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* Currently shipping operating systems have IPv6 enabled by default&lt;br /&gt;
* Even if your home network doesn&amp;#039;t have IPv6 enabled, you can&amp;#039;t assume other networks won&amp;#039;t have&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
As a consequence of all of the above changes it is imperative that you &amp;#039;&amp;#039;&amp;#039;ensure that your IPv6-enabled client devices have their IPv6 firewall enabled&amp;#039;&amp;#039;&amp;#039;, and it is protecting the services running on your client. It is also advisable to disable any IPv6 services that you do not require (e.g. tunneling protocols that you are not actively using - this is especially applicable to Windows 7 clients).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
One other change IPv6 introduces compared to IPv4 is that additional ICMP traffic flows are necessary for normal protocol signalling whereas it was predominantly used for error-case reporting in IPv4 networks. This requires IPv6 firewalls to admit certain [[ICMPv6_Types_Codes]] in order to handle IPv6 address allocation, neighbour discovery (IPv6 replacement for ARP) and several other IPv6 processes. For many client devices this will be handled directly by the firewall itself, but if you are developing your own IPv6 firewall then you need to ensure you follow the recommendations in [http://www.ietf.org/rfc/rfc4890.txt RFC4890] which includes an ip6tables packet filter example.&lt;br /&gt;
&lt;br /&gt;
===IPv6 Addresses===&lt;br /&gt;
&lt;br /&gt;
One other observation relates to the selection of an IPv6 address for your host. There are three main IPv6 address allocation approaches:&lt;br /&gt;
&lt;br /&gt;
* Static unicast address allocation&lt;br /&gt;
* Stateless Address Autoconfiguration (SLAAC)&lt;br /&gt;
* DHCPv6&lt;br /&gt;
&lt;br /&gt;
A full IPv6 address is composed of a network address part (perhaps 64 bits) and a host address part (often 64 bits).&lt;br /&gt;
http://ipv6.chappell-family.com/timswiki/skins/common/images/button_extlink.png&lt;br /&gt;
Dependant upon the scheme that your host uses you &amp;#039;&amp;#039;&amp;#039;may&amp;#039;&amp;#039;&amp;#039; be able to freely select the host address part - e.g. when using static address allocation. Despite what you may find written elsewhere you are only safe from IPv6 port scans if the address of your machine is not easily discoverable within its IPv6 subnet. On this basis I suggest that you fight the urge to allocate easy to type/remember addresses (e.g. &amp;lt;network-address-part&amp;gt;::1 and any that use a mix of frequently used hexadecimal addresses that spell words - i.e. 0xdead, 0xbeef, 0xface). Many machines appear to use such allocations in their host address part and if you were writing an IPv6 port scanner then surely addresses using such choices would be the place that you would start scanning? A DNS with suitable Quad-A entries is your friend in this situation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Other useful links:&lt;br /&gt;
&lt;br /&gt;
* [http://www.h-online.com/nettools/rfc/drafts/draft-gont-opsec-ipv6-host-scanning-02.shtml draft-gont-opsec-ipv6-host-scanning-02:Network Reconnaissance in IPv6 Networks]&lt;br /&gt;
* [http://www.h-online.com/nettools/rfc/drafts/draft-vyncke-opsec-v6-01.shtml draft-vyncke-opsec-v6-01:Operational Security Considerations for IPv6 Networks]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Testing your IPv6 Firewall===&lt;br /&gt;
&lt;br /&gt;
As well as ensuring that your IPv6 firewall is enabled it is &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;strongly recommended&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; that you actively test that it is correctly protecting your host. I have received feedback from several disgruntled users detailing how their default firewall settings either weren&amp;#039;t blocking any IPv6 traffic at all (e.g. some DLINK IPv6 enabled products and certain UK ISP-provided firewalls) or were leaving critical services open for remote access. That is not to say that any of these products are necessarily &amp;quot;broken&amp;quot;, or &amp;quot;unfit for purpose&amp;quot;, merely that they don&amp;#039;t necessarily perform in the same way for IPv6 traffic as they did for IPv4 traffic. &lt;br /&gt;
&lt;br /&gt;
If you wish to verify the operation of your IPv6 firewall then try my [http://ipv6.chappell-family.com/ipv6tcptest/ IPv6 firewall checker] which checks your IPv6 Ping response and scans a set of user-defined TCP ports.&lt;br /&gt;
&lt;br /&gt;
A &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;starting point&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039; for an IPv6 iptables-based firewall can be found in my [[Raspberry_Pi_IPv6_firewall_tester_installation]].&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This website publishes a [http://ipv6.chappell-family.com/html/privacy_policy.html Privacy Policy.] Continued use of this website implies your consent to the storage of data outlined in the policy.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&amp;lt;adsense&amp;gt;1&amp;lt;/adsense&amp;gt;&lt;/div&gt;</summary>
		<author><name>2001:470:1F08:185C:0:0:0:2</name></author>
	</entry>
</feed>