Difference between revisions of "PeerGuardian Linux"

From ArchWiki
Jump to: navigation, search
(Firewall: better example)
(Information on how to ensure pgl protects specific daemons.)
(5 intermediate revisions by 2 users not shown)
Line 10: Line 10:
  
 
== Configuration ==
 
== Configuration ==
All the configuration files are located in {{ic|/etc/pgl}}:
+
* {{ic|/etc/pgl/blocklists.list}} contains a list of URL for retrieving the various block lists.
* {{ic|blocklists.list}} contains a list of URL for retrieving the various block lists,
+
* {{ic|/etc/pgl/pglcmd.conf}}, empty by default, overrides the default settings present in {{ic|/usr/lib/pgl/pglcmd.defaults}}.
* {{ic|pglcmd.conf}}, empty by default, overrides the default settings present in {{ic|/usr/lib/pgl/pglcmd.defaults}},
+
* {{ic|/etc/pgl/allow.p2p}} lists custom IP ranges that will not be filtered.
* {{ic|allow.p2p}} lists custom IP ranges that will not be filtered.
+
  
 
The default lists in {{ic|/etc/pgl/blocklists.list}} block many potentially legitimate IP address.  Users are encouraged to exercise best judgment and the information available at [http://www.iblocklist.com/ I-Blocklist].
 
The default lists in {{ic|/etc/pgl/blocklists.list}} block many potentially legitimate IP address.  Users are encouraged to exercise best judgment and the information available at [http://www.iblocklist.com/ I-Blocklist].
Line 25: Line 24:
 
{{hc|/etc/pgl/pglcmd.conf|2=<nowiki>WHITE_TCP_OUT="http https msnp"</nowiki>}}
 
{{hc|/etc/pgl/pglcmd.conf|2=<nowiki>WHITE_TCP_OUT="http https msnp"</nowiki>}}
  
Conversely, onecould white list all the ports except the ones used by the program to be blocked. The following example only use the block lists to stop incoming traffic on ports 53 (DNS) and 80 (HTTP):
+
Conversely, one could white list all the ports except the ones used by the program to be blocked. The following example only use the block lists to stop incoming traffic on ports 53 (DNS) and 80 (HTTP):
  
 
{{hc|/etc/pgl/pglcmd.conf|2=<nowiki>WHITE_TCP_IN="0:79 81:65535"
 
{{hc|/etc/pgl/pglcmd.conf|2=<nowiki>WHITE_TCP_IN="0:79 81:65535"
Line 31: Line 30:
  
 
=== Firewall ===
 
=== Firewall ===
 
+
Create {{ic|/etc/systemd/system/pgl.service}} pasting the following to ensure that ''pgl'' only starts '''after''' all the rules have been properly set up. This example must be adapted to work with other firewalls (ufw, shorewall, etc.):
It is best to start ''pgl'' after an iptables based firewall.  Users should create an override for pgl.service by creating {{ic|/etc/systemd/system/pgl.service}} and adding a "Requires=" argument. This will ensure that ''pgl'' only starts '''after''' all the rules have been properly set up.
+
 
+
Here is an example when using the [[Uncomplicated Firewall]]:
+
  
 
{{hc|/etc/systemd/system/pgl.service|2=<nowiki>
 
{{hc|/etc/systemd/system/pgl.service|2=<nowiki>
 +
.include /usr/lib/systemd/system/pgl.service
  
 
[Unit]
 
[Unit]
Description=PeerGuardian Linux - an IP Blocker
+
After=iptables.service</nowiki>}}
Requires=ufw.service
+
After=network.target ufw.service
+
  
[Service]
+
=== Server ===
BusName=org.netfilter.pgl
+
[[systemd]] initialization of the system means that it's quite possible for a server to be briefly unprotected, prior to ''pgl'' launch. To ensure adequate protection, create a service file named after the original server (i.e. {{ic|/etc/systemd/system/httpd.service}} and paste the following:
ExecStart=/usr/bin/pglcmd start
+
ExecStop=/usr/bin/pglcmd stop
+
PIDFile=/run/pgld.pid
+
  
[Install]
+
{{hc|/etc/systemd/system/httpd.service|2=<nowiki>
WantedBy=multi-user.target</nowiki>}}
+
.include /usr/lib/systemd/system/httpd.service
 +
 
 +
[Unit]
 +
Wants=pgl.service
 +
After=pgl.service</nowiki>}}
  
 
=== LAN ===
 
=== LAN ===

Revision as of 15:04, 23 May 2013

Template:Article summary start Template:Article summary text Template:Article summary end

Installation

There are two AUR packages to choose from: pgl-cli includes only the daemon and CLI tools, while pgl comes complete with a GUI (written using Qt).

Configuration

  • /etc/pgl/blocklists.list contains a list of URL for retrieving the various block lists.
  • /etc/pgl/pglcmd.conf, empty by default, overrides the default settings present in /usr/lib/pgl/pglcmd.defaults.
  • /etc/pgl/allow.p2p lists custom IP ranges that will not be filtered.

The default lists in /etc/pgl/blocklists.list block many potentially legitimate IP address. Users are encouraged to exercise best judgment and the information available at I-Blocklist.

It is recommended to disable the filtering of HTTP connections by adding the following to /etc/pgl/pglcmd.conf:

/etc/pgl/pglcmd.conf
WHITE_TCP_OUT="http https"

Some program might not be able to reach the outside world. For instance, users of MSN for instant messaging, will need to add port 1863 to the white list:

/etc/pgl/pglcmd.conf
WHITE_TCP_OUT="http https msnp"

Conversely, one could white list all the ports except the ones used by the program to be blocked. The following example only use the block lists to stop incoming traffic on ports 53 (DNS) and 80 (HTTP):

/etc/pgl/pglcmd.conf
WHITE_TCP_IN="0:79 81:65535"
WHITE_UDP_IN="0:52 54:65535"

Firewall

Create /etc/systemd/system/pgl.service pasting the following to ensure that pgl only starts after all the rules have been properly set up. This example must be adapted to work with other firewalls (ufw, shorewall, etc.):

/etc/systemd/system/pgl.service
.include /usr/lib/systemd/system/pgl.service

[Unit]
After=iptables.service

Server

systemd initialization of the system means that it's quite possible for a server to be briefly unprotected, prior to pgl launch. To ensure adequate protection, create a service file named after the original server (i.e. /etc/systemd/system/httpd.service and paste the following:

/etc/systemd/system/httpd.service
.include /usr/lib/systemd/system/httpd.service

[Unit]
Wants=pgl.service
After=pgl.service

LAN

By default, pgl blocks traffic on the local IPv4 addresses. To disable this behavior, edit /etc/pgl/pglcmd.conf to add an exception using the WHITE_IP_* setting:

/etc/pgl/pglcmd.conf
WHITE_IP_OUT="192.168.0.0/24"
/etc/pgl/pglcmd.conf
WHITE_IP_IN="192.168.0.0/24"

For further information, please refer to the # Whitelist IPs # section of /usr/lib/pgl/pglcmd.defaults.

Starting up

Once comfortable with the configuration of both the daemon and lists, type in:

# systemctl start pgl.service

To make sure that pgl works as intended, issue this command:

# pglcmd test

To start pgl automatically, use the following syntax to activate it:

# systemctl enable pgl.service