个人工具

“UbuntuHelp:MoBlock”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第3行: 第3行:
 
[[UbuntuHelp:MoBlock|MoBlock]] is an application that enables you to block internet traffic based on large lists of IP address ranges in order to protect your privacy. It uses a file in PeerGuardian format (guarding.p2p) or an ipfilter.dat.
 
[[UbuntuHelp:MoBlock|MoBlock]] is an application that enables you to block internet traffic based on large lists of IP address ranges in order to protect your privacy. It uses a file in PeerGuardian format (guarding.p2p) or an ipfilter.dat.
 
There are plans to make it the official PeerGuardian for Linux.
 
There are plans to make it the official PeerGuardian for Linux.
Note: Firestarter and most iptables firewalls do not work with [[UbuntuHelp:MoBlock|MoBlock]]. If you want a firewall that works with [[UbuntuHelp:MoBlock|MoBlock]], you can try FireHOL. See the '''[http://ubuntuforums.org/showpost.php?p=1114891&postcount=1 instructions for FireHOL users]''' (scroll down). You may also try '''[http://iplist.sourceforge.net/ iplist]''' by '''[http://forums.phoenixlabs.org/member.php?u=8022 uljanow]'''.  Also consider that routers can make software firewalls on your computer redundant.
+
Note: Since version 0.9 [[UbuntuHelp:MoBlock|MoBlock]] does no more conflict with other firewalls. But you have to make sure that [[UbuntuHelp:MoBlock|MoBlock]] is started after them and the iptables rules don't get changed later. You may also try '''[[http://iplist.sourceforge.net/|iplist]]''' by '''[[http://forums.phoenixlabs.org/member.php?u=8022|uljanow]]'''.  Also consider that routers can make software firewalls on your computer redundant.
 
== Add Repository ==
 
== Add Repository ==
 
=== Add the correct gpg key to the apt keyring ===
 
=== Add the correct gpg key to the apt keyring ===
第12行: 第12行:
 
</nowiki></pre>
 
</nowiki></pre>
 
=== Add specific repository for release ===
 
=== Add specific repository for release ===
You must use a repository for your specific release (i.e. Ubuntu 7.10)
+
You have to add the repository sources to your /etc/apt/sources.list:
==== Ubuntu 8.04 ("Hardy Heron") 32-bit ====
+
<pre><nowiki>
Add to /etc/apt/sources.list
+
gksu gedit /etc/apt/sources.list
 +
</nowiki></pre>
 +
In Kubuntu, replace gksu with kdesu.
 +
Add the two lines for your specific release (i.e. Ubuntu 7.10):
 +
==== Ubuntu ("Intrepid Ibex") 32-bit and 64-bit ====
 +
<pre><nowiki>
 +
deb http://moblock-deb.sourceforge.net/debian intrepid main
 +
deb-src http://moblock-deb.sourceforge.net/debian intrepid main
 +
</nowiki></pre>
 +
==== Ubuntu 8.04 ("Hardy Heron") 32-bit and 64-bit ====
 
<pre><nowiki>
 
<pre><nowiki>
 
deb http://moblock-deb.sourceforge.net/debian hardy main
 
deb http://moblock-deb.sourceforge.net/debian hardy main
 
deb-src http://moblock-deb.sourceforge.net/debian hardy main
 
deb-src http://moblock-deb.sourceforge.net/debian hardy main
 
</nowiki></pre>
 
</nowiki></pre>
==== Ubuntu 7.10 ("Gutsy Gibbon") 32-bit ====
+
==== Ubuntu 7.10 ("Gutsy Gibbon") 32-bit 64-bit ====
Add to /etc/apt/sources.list
+
 
<pre><nowiki>
 
<pre><nowiki>
 
deb http://moblock-deb.sourceforge.net/debian gutsy main
 
deb http://moblock-deb.sourceforge.net/debian gutsy main
 
deb-src http://moblock-deb.sourceforge.net/debian gutsy main
 
deb-src http://moblock-deb.sourceforge.net/debian gutsy main
 
</nowiki></pre>
 
</nowiki></pre>
====  Ubuntu 7.04 ("Feisty Fawn") 32-bit ====
+
====  Ubuntu 7.04 ("Feisty Fawn") 32-bit 64-bit ====
Add to /etc/apt/sources.list
+
 
<pre><nowiki>
 
<pre><nowiki>
 
deb http://moblock-deb.sourceforge.net/debian feisty main
 
deb http://moblock-deb.sourceforge.net/debian feisty main
 
deb-src http://moblock-deb.sourceforge.net/debian feisty main
 
deb-src http://moblock-deb.sourceforge.net/debian feisty main
 
</nowiki></pre>
 
</nowiki></pre>
==== 64-bit packages ====
 
These repositories do not contain 64-bit packages. You can either create your own from source or use a user-built packages.
 
===== Ubuntu 7.10 ("Gutsy Gibbon") =====
 
Ubuntu 7.10 64-bit '''[http://ubuntuforums.org/attachment.php?attachmentid=53445&d=1197850896 moblock-nfq package]''' 0.8-39 (hosted by ubuntuforums.org).
 
 
== Package Installation ==
 
== Package Installation ==
=== Using Repositories ===
+
Install the packages moblock and moblock-control. If you want a graphical interface you can also install mobloquer (not on Ubuntu Feisty). There is also another package (moblock-ipq) - this is an deprecated version for older kernel versions (< 2.6.14).
[[UbuntuHelp:MoBlock|MoBlock]] checks traffic that is sent to the iptables QUEUE (deprecated) or NFQUEUE (new) target. So there are two packages, moblock-ipq and moblock-nfq. Depending on your package of choice you need either the ip_queue or xt_NFQUEUE kernel module loaded. Unless you have a Linux kernel older than 2.6.14, you should use the moblock-nfq package with the new target.
+
* Via '''[[Synaptic|Synaptic Package Manager]]'''
==== Ubuntu (development) ("Hardy Heron"), Ubuntu 7.10 ("Gutsy Gibbon") and Ubuntu 7.04 ("Feisty Fawn") ====
+
* Via aptitude
Add the repositories using the above instructions.
+
* Via '''[[UbuntuHelp:Synaptic|Synaptic Package Manager]]'''
+
* Via apt-get
+
 
<pre><nowiki>
 
<pre><nowiki>
sudo apt-get update
+
sudo aptitude update
sudo apt-get install moblock-nfq
+
sudo aptitude install moblock moblock-control
</nowiki></pre>
+
==== Ubuntu 6.10 ("Edgy Eft") ====
+
These instructions are currently broken, most likely due to a bug in lsb init-functions (lsb-base). Note: there's a working "init-functions" on '''[http://moblock-deb.svn.sourceforge.net/viewvc/moblock-deb/stuff/init-functions?view=log moblock-deb.sf.net]'''
+
Add the repositories using the above instructions.
+
Then, you need to install two netfilter lib packages.
+
'''[http://www.ubuntuforums.org/attachment.php?attachmentid=20162&stc=1&d=1164741758 libnfnetlink]''' (Hosted by Ubuntu Forums)
+
'''[http://www.ubuntuforums.org/attachment.php?attachmentid=20163&stc=1&d=1164741758 libnetfilter-queue]''' (Hosted by Ubuntu Forums)
+
Finally, install the moblock-nfq package from the repository.
+
* Via '''[[UbuntuHelp:Synaptic|Synaptic Package Manager]]'''
+
* Via apt-get
+
<pre><nowiki>
+
sudo apt-get install moblock-nfq
+
</nowiki></pre>
+
==== Ubuntu 6.06 ("Dapper Drake") ====
+
These instructions have not been confirmed to work. Please report in '''[http://ubuntuforums.org/showthread.php?t=192559 this thread]''' if they are valid.
+
Add the repositories using the above instructions.
+
Then, you need to install two netfilter lib packages.
+
'''[http://www.ubuntuforums.org/attachment.php?attachmentid=20165&stc=1&d=1164742172 libnfnetlink]''' (Hosted by Ubuntu Forums)
+
'''[http://www.ubuntuforums.org/attachment.php?attachmentid=20166&stc=1&d=1164742172 libnetfilter-queue]''' (Hosted by Ubuntu Forums)
+
Finally, install the moblock-nfq package from the repository.
+
* Via '''[[UbuntuHelp:Synaptic|Synaptic Package Manager]]'''
+
* Via apt-get
+
<pre><nowiki>
+
sudo apt-get install moblock-nfq
+
 
</nowiki></pre>
 
</nowiki></pre>
 
=== Compile a package ===
 
=== Compile a package ===
If you want to make your own [[UbuntuHelp:MoBlock|MoBlock]] binary package from source and install it, you can use the following instructions. Most users will not need to compile a package, but this can be used for 64-bit packages (although user-built packages are provided above), or for an older release (you will also have to compile netfilter lib packages).
+
If you want to make your own [[UbuntuHelp:MoBlock|MoBlock]] binary package from source and install it, you can use the following instructions. Most users will not need to compile a package, but this can be used for unsupported architectures or for an older release (you will also have to compile netfilter lib packages).
 
First, make sure you have added a source repository for your release. Then, run the following in terminal.
 
First, make sure you have added a source repository for your release. Then, run the following in terminal.
 
<pre><nowiki>
 
<pre><nowiki>
sudo apt-get update
+
sudo aptitude update
sudo apt-get install fakeroot
+
sudo aptitude install fakeroot
 
mkdir moblock
 
mkdir moblock
 
cd moblock
 
cd moblock
第83行: 第59行:
 
dpkg-buildpackage -rfakeroot
 
dpkg-buildpackage -rfakeroot
 
cd ..
 
cd ..
sudo dpkg -i moblock-nfq*.deb
+
sudo dpkg -i moblock*.deb
sudo apt-get purge -y build-essential debhelper dpatch dpkg-dev g++ g++-4.1 gettext html2text intltool-debian iptables-dev libc6-dev libnetfilter-queue-dev libnfnetlink-dev libstdc++6-4.1-dev linux-libc-dev patch po-debconf
+
 
sudo apt-get install -f
 
sudo apt-get install -f
 
</nowiki></pre>
 
</nowiki></pre>
 
Some of these commands can be combined into one, but this lets you make changes like adding a patch if necessary and explains the process better.
 
Some of these commands can be combined into one, but this lets you make changes like adding a patch if necessary and explains the process better.
Explanation: the directory moblock is created and the current working directory is changed to it. Moblock's development dependencies are then installed. The [[UbuntuHelp:MoBlock|MoBlock]] source package is downloaded and the current working directory is changed to it. The source and binary packages are built and the working directory is moved one directory up. Then the moblock-nfq*.deb is installed and its dependencies are installed. Finally, the development dependencies (including configuration files) are removed.
+
Explanation: the directory moblock is created and the current working directory is changed to it. Moblock's development dependencies are then installed. The moblock source package is downloaded and the current working directory is changed to it. The source and binary packages are built and the working directory is moved one directory up. Then the moblock*.deb is installed and its dependencies are installed.
You can also use this '''[http://ubuntuforums.org/attachment.php?attachmentid=50325&d=1195170638 shell script]''' (hosted by Ubuntu Forums). Make sure it is executable. In Ubuntu, you can right click it and click on properties. In the tab Permissions make sure Allow executing this file as program is checked. Then close and double click on the file. Click the button Run in Terminal.
+
Now, repeat these steps for moblock-control.
 
=== Install a package ===
 
=== Install a package ===
Use the instructions at the '''[[UbuntuHelp:InstallingSoftware]''' page under '''[|InstallingSoftware#head-c0628aa246e0b55ea2009705d1b5a84ede8736b5:Installing downloaded packages]]'''
+
Use the instructions at the '''[[InstallingSoftware]]''' page under '''[[InstallingSoftware#head-c0628aa246e0b55ea2009705d1b5a84ede8736b5|Installing downloaded packages]]'''
 
== Configuration and Usage ==
 
== Configuration and Usage ==
The packages contain a moblock-control script with the following features:
+
moblock-control features include:
 
* start and stop [[UbuntuHelp:MoBlock|MoBlock]] (including handling of the iptables rules if desired)
 
* start and stop [[UbuntuHelp:MoBlock|MoBlock]] (including handling of the iptables rules if desired)
 
* update the specified blocklists from online sources
 
* update the specified blocklists from online sources
第100行: 第75行:
 
The logfiles are rotated daily.
 
The logfiles are rotated daily.
 
In the default configuration [[UbuntuHelp:MoBlock|MoBlock]] starts at system boot and some preconfigured blocklists are updated once a day. You can specify the blocklists to use in /etc/moblock/blocklists.list. Everything else (automatic start and update, iptables handling, IP and port whitelisting) is configured in /etc/moblock/moblock.conf. This is important especially if [[UbuntuHelp:MoBlock|MoBlock]] blocks sites that it should not block.
 
In the default configuration [[UbuntuHelp:MoBlock|MoBlock]] starts at system boot and some preconfigured blocklists are updated once a day. You can specify the blocklists to use in /etc/moblock/blocklists.list. Everything else (automatic start and update, iptables handling, IP and port whitelisting) is configured in /etc/moblock/moblock.conf. This is important especially if [[UbuntuHelp:MoBlock|MoBlock]] blocks sites that it should not block.
 +
Don't edit /etc/moblock/moblock.conf directly, but put your changes in /etc/default/moblock. Then updates will be easier. Configuration values in the latter file overwrite those in the first.
 
=== Start [[UbuntuHelp:MoBlock|MoBlock]] ===
 
=== Start [[UbuntuHelp:MoBlock|MoBlock]] ===
 
<pre><nowiki>
 
<pre><nowiki>
第136行: 第112行:
 
</nowiki></pre>
 
</nowiki></pre>
 
== Frequently Asked Questions (FAQ) ==
 
== Frequently Asked Questions (FAQ) ==
=== Some applications cannot connect to the internet any more! ===
+
=== I cannot connect to the internet any more! ===
No ports are whitelisted by default. So, if the IP address your application is trying to reach, is in the blocklist, it is blocked.
+
EDIT: LAN traffic is now whitelisted automatically., but this features is still experimental. If you have problems follow these instructions:
To change that, locate line 68 in /etc/moblock/moblock.conf
+
[[UbuntuHelp:MoBlock|MoBlock]] often blocks your complete LAN, including your router. So you have to whitelist your LAN. If you don't know your local IP check it with "sudo ifconfig". It's the value after "inet addr:" of the interface that you use for networking. For wired connections this might be "eth0", for wireless connections "wlan0".
 +
Example: You found out that your IP is 192.168.0.39. Then your LAN will most probably cover the IP range 192.168.0.1-192.168.0.255. Then you need to whitelist this range for incoming and outgoing connections.
 +
Edit /etc/default/moblock (in Kubuntu, replace gksu with kdesu)
 
<pre><nowiki>
 
<pre><nowiki>
gksu gedit /etc/moblock/moblock.conf
+
gksu gedit /etc/default/moblock
 
</nowiki></pre>
 
</nowiki></pre>
In Kubuntu, replace gksu with kdesu.
+
and add these lines:
 +
<pre><nowiki>
 +
WHITE_IP_IN="192.168.0.0/24"
 +
WHITE_IP_OUT="192.168.0.0/24"
 +
</nowiki></pre>
 +
Do a
 +
<pre><nowiki>
 +
moblock-control restart
 +
</nowiki></pre>
 +
when you have changed these settings.
 +
=== Some applications cannot connect to the internet any more! ===
 +
If the IP address that your application is trying to reach is in the blocklist, it will be blocked. But you can allow traffic for specific ports. The ports 80 (http) and 443 (https) are whitelisted by default.
 +
To allow traffic also on other ports edit /etc/default/moblock (in Kubuntu, replace gksu with kdesu)
 
<pre><nowiki>
 
<pre><nowiki>
#WHITE_TCP_OUT="http https"
+
gksu gedit /etc/default/moblock
 
</nowiki></pre>
 
</nowiki></pre>
Uncomment the code, that is, remove the hash (#).
+
and add/edit this line:
 
<pre><nowiki>
 
<pre><nowiki>
 
WHITE_TCP_OUT="http https"
 
WHITE_TCP_OUT="http https"
 
</nowiki></pre>
 
</nowiki></pre>
 +
Do a
 +
<pre><nowiki>
 +
moblock-control restart
 +
</nowiki></pre>
 +
when you have changed these settings.
 
See? By default port 80 and 443 (also called http and https) is configured, for outgoing connections.
 
See? By default port 80 and 443 (also called http and https) is configured, for outgoing connections.
In effect, you can now browse blocked ips, with firefox/konqueror or any other browser.
+
In effect, you can browse blocked ips, with firefox/konqueror or any other browser.
 
If you know the port number of an application you use, then this is the place to put it. If you want to put a range of ports, use the format "startport:endport".
 
If you know the port number of an application you use, then this is the place to put it. If you want to put a range of ports, use the format "startport:endport".
 
=== But why can I not just remove the IP address from the blocklist instead? ===
 
=== But why can I not just remove the IP address from the blocklist instead? ===
第158行: 第153行:
 
tail -f /var/log/moblock.log
 
tail -f /var/log/moblock.log
 
</nowiki></pre>
 
</nowiki></pre>
Then, edit /etc/moblock/moblock.conf
+
There are different ways.
 +
For one, edit /etc/moblock/allow.p2p (in Kubuntu, replace gksu with kdesu)
 
<pre><nowiki>
 
<pre><nowiki>
gksu gedit /etc/moblock/moblock.conf
+
gksu gedit /etc/moblock/allow.p2p
 
</nowiki></pre>
 
</nowiki></pre>
In Kubuntu, replace gksu with kdesu.
+
If you want to whitelist the IP range "192.168.178.1 -  192.168.178.255 and the IP 123.123.123.123 add this:
To whitelist IPs, edit the following part.
+
<pre><nowiki>
 +
192.168.178.1-192168.178.255
 +
123.123.123.123-123.123.123.123
 +
</nowiki></pre>
 +
Do a
 +
<pre><nowiki>
 +
moblock-control restart
 +
</nowiki></pre>
 +
when you have changed these settings.
 +
For the old method, edit /etc/moblock/allow.p2p (in Kubuntu, replace gksu with kdesu)
 +
<pre><nowiki>
 +
gksu gedit /etc/moblock/allow.p2p
 +
</nowiki></pre>
 +
To whitelist IPs add the following variables:
 
<pre><nowiki>
 
<pre><nowiki>
# Do a "moblock-control restart" when you have changed these settings.
 
 
WHITE_IP_IN=""
 
WHITE_IP_IN=""
 
WHITE_IP_OUT=""
 
WHITE_IP_OUT=""
第173行: 第181行:
 
or e.g. "192.168.178.0/24" to whitelist an IP range (192.168.178.0 - 192.168.178.255)
 
or e.g. "192.168.178.0/24" to whitelist an IP range (192.168.178.0 - 192.168.178.255)
 
or e.g. "192.168.0.0/16" to whitelist a bigger IP range (192.168.0.0 - 192.168.255.255)
 
or e.g. "192.168.0.0/16" to whitelist a bigger IP range (192.168.0.0 - 192.168.255.255)
Separate IP addresses with a whitespace.
+
Separate IP addresses with a whitespace. So you might have an entry like this:
You can also use a search phrase, such as Google, Hotmail, or an actual IP address range (as specified in the blocklists). Edit the following part.
+
<pre><nowiki>
 +
WHITE_IP_IN="192.168.0.0/24"
 +
WHITE_IP_OUT="192.168.0.0/24 123.123.123.123 234.234.234.234"
 +
</nowiki></pre>
 +
Do a
 +
<pre><nowiki>
 +
moblock-control restart
 +
</nowiki></pre>
 +
when you have changed these settings.
 +
You can also use a search phrase, such as Google, Hotmail, or an actual IP address range (as specified in the blocklists). Add the following variable to /etc/default/moblock:
 
<pre><nowiki>
 
<pre><nowiki>
# Do a "moblock-control reload" when you have changed these settings.
 
 
IP_REMOVE=""
 
IP_REMOVE=""
 
</nowiki></pre>
 
</nowiki></pre>
Separate phrases with a semicolon.
+
Separate phrases with a semicolon. So you might have an entry like this:
 +
<pre><nowiki>
 +
IP_REMOVE="google;yahoo;altavista"
 +
</nowiki></pre>
 +
Do a
 +
<pre><nowiki>
 +
moblock-control reload
 +
</nowiki></pre>
 +
when you have changed these settings.
 
Remember to reload or restart [[UbuntuHelp:MoBlock|MoBlock]] after modifying the configuration.
 
Remember to reload or restart [[UbuntuHelp:MoBlock|MoBlock]] after modifying the configuration.
 
=== How do I choose what blocklists to include in the update function? ===
 
=== How do I choose what blocklists to include in the update function? ===
第188行: 第212行:
 
In Kubuntu, replace gksu with kdesu.
 
In Kubuntu, replace gksu with kdesu.
 
Uncomment the blocklists, that is, remove the hash (#) to enable certain blocklists or comment them out by adding a hash before the blocklists to disable them.
 
Uncomment the blocklists, that is, remove the hash (#) to enable certain blocklists or comment them out by adding a hash before the blocklists to disable them.
 +
Do a
 +
<pre><nowiki>
 +
moblock-control update
 +
</nowiki></pre>
 +
when you have changed these settings.
 
=== How do I keep it installed, without having it run at startup? ===
 
=== How do I keep it installed, without having it run at startup? ===
Edit /etc/moblock/moblock.conf.
+
Edit /etc/default/moblock.
 
<pre><nowiki>
 
<pre><nowiki>
gksu gedit /etc/moblock/moblock.conf
+
gksu gedit /etc/default/moblock
 
</nowiki></pre>
 
</nowiki></pre>
 
In Kubuntu, replace gksu with kdesu.
 
In Kubuntu, replace gksu with kdesu.
Set the following.
+
Set the following:
 
<pre><nowiki>
 
<pre><nowiki>
 
MOBLOCK_INIT="0"
 
MOBLOCK_INIT="0"
第201行: 第230行:
 
It will download a new blocklist for you during installation, and start it as a deamon. In other words, it will start automatically everytime you boot up.
 
It will download a new blocklist for you during installation, and start it as a deamon. In other words, it will start automatically everytime you boot up.
 
=== I have a custom compiled kernel. Moblock does not work. ===
 
=== I have a custom compiled kernel. Moblock does not work. ===
 +
[[UbuntuHelp:MoBlock|MoBlock]] depends on netfilter support in the kernel. There are two possibilities:
 +
'''Netfilter support as kernel modules (recommended):'''
 +
Enable netfilter support in xconfig, or in the kernel source config file as modules.
 +
'''Netfilter support built-in directly in the kernel:'''
 
Enable netfilter support in xconfig, or in the kernel source config file.
 
Enable netfilter support in xconfig, or in the kernel source config file.
 +
moblock-control will then make sure that the netfilter support is available to [[UbuntuHelp:MoBlock|MoBlock]].
 
=== How do I change automatic updating? ===
 
=== How do I change automatic updating? ===
[[UbuntuHelp:MoBlock|MoBlock]] automatically updates its blocklists everyday. To configure automatic updating, edit /etc/moblock/moblock.conf.
+
[[UbuntuHelp:MoBlock|MoBlock]] automatically updates its blocklists everyday. To configure automatic updating, edit /etc/default/moblock.
 
<pre><nowiki>
 
<pre><nowiki>
gksu gedit /etc/moblock/moblock.conf
+
gksu gedit /etc/default/moblock
 
</nowiki></pre>
 
</nowiki></pre>
 
The number in the following setting enables (1) or disables (2) automatic updating.
 
The number in the following setting enables (1) or disables (2) automatic updating.
第214行: 第248行:
 
<pre><nowiki>
 
<pre><nowiki>
 
MOBLOCK_CRON="0"
 
MOBLOCK_CRON="0"
 +
</nowiki></pre>
 +
=== [[UbuntuHelp:MoBlock|MoBlock]] fails to start or stop ===
 +
Have a look at /var/log/moblock-control.log and /var/log/moblock.log. In most cases an incorrect configuration option is the reason. If you don't understand the logfiles post them at the forum (please do this in CODE tags).
 +
If you think you messed thinks up you can make a clean reinstall:
 +
<pre><nowiki>
 +
aptitude purge moblock
 +
aptitude install moblock
 
</nowiki></pre>
 
</nowiki></pre>
 
== Credits ==
 
== Credits ==
Special thanks to '''[http://ubuntuforums.org/member.php?u=50108 pelle.k]''' for the Ubuntu Forums '''[http://ubuntuforums.org/showthread.php?p=1114891 thread]''' this is derived from, the [[UbuntuHelp:MoBlock|MoBlock]] Debian Packages maintainer '''[http://ubuntuforums.org/member.php?u=228584 jre]''', and the contributors to [[UbuntuHelp:MoBlock|MoBlock]]. The Ubuntu 7.10 64-bit package and source page shell script were provided by '''[http://ubuntuforums.org/member.php?u=182332 daradib]'''. The Ubuntu 7.04 64-bit package  was provided by '''[http://ubuntuforums.org/member.php?u=58418 minijoe]'''. The Ubuntu 6.06 netfilter lib packages were provided by '''[http://ubuntuforums.org/member.php?u=14921 foxy123]'''.
+
Special thanks to '''[[http://ubuntuforums.org/member.php?u=50108|pelle.k]]''' for the Ubuntu Forums '''[[http://ubuntuforums.org/showthread.php?p=1114891|thread]]''' this is derived from, the [[UbuntuHelp:MoBlock|MoBlock]] Debian Packages maintainer '''[[http://ubuntuforums.org/member.php?u=228584|jre]]''', and the contributors to [[UbuntuHelp:MoBlock|MoBlock]]. The Ubuntu 7.10 64-bit package and source page shell script were provided by '''[[http://ubuntuforums.org/member.php?u=182332|daradib]]'''. The Ubuntu 7.04 64-bit package  was provided by '''[[http://ubuntuforums.org/member.php?u=58418|minijoe]]'''. The Ubuntu 6.06 netfilter lib packages were provided by '''[[http://ubuntuforums.org/member.php?u=14921|foxy123]]'''.
 
== Further Reading ==
 
== Further Reading ==
* '''[http://ubuntuforums.org/showthread.php?t=192559 MoBlock thread where people have asked questions]'''
+
* '''[[http://ubuntuforums.org/showthread.php?t=803183|MoBlock thread where people have asked questions]]'''
* '''[http://moblock.berlios.de/ MoBlock Homepage]'''
+
* '''[[http://moblock.berlios.de/|MoBlock Homepage]]'''
* '''[http://moblock-deb.sourceforge.net/ MoBlock Debian Packages]'''
+
* '''[[http://moblock-deb.sourceforge.net/|MoBlock Debian Packages]]'''
* '''[http://phoenixlabs.org/ Phoenix Labs (PeerGuardian)]'''
+
* '''[[http://phoenixlabs.org/|Phoenix Labs (PeerGuardian)]]'''
* '''[http://ubuntuforums.org/showpost.php?p=1114891&postcount=1 Instructions for FireHOL users (scroll down)]'''
+
* '''[[http://ubuntuforums.org/showpost.php?p=1114891&postcount=1|Instructions for FireHOL users (scroll down)]]'''
 
----
 
----
[[category:CategoryDocumentation]]
+
[[category:CategoryInternet]] [[category:CategoryNetworking]]
  
 
[[category:UbuntuHelp]]
 
[[category:UbuntuHelp]]

2008年10月19日 (日) 12:54的版本

MoBlock is an application that enables you to block internet traffic based on large lists of IP address ranges in order to protect your privacy. It uses a file in PeerGuardian format (guarding.p2p) or an ipfilter.dat. There are plans to make it the official PeerGuardian for Linux. Note: Since version 0.9 MoBlock does no more conflict with other firewalls. But you have to make sure that MoBlock is started after them and the iptables rules don't get changed later. You may also try [[1]] by [[2]]. Also consider that routers can make software firewalls on your computer redundant.

Add Repository

Add the correct gpg key to the apt keyring

All repositories use this. In terminal, type the following.

gpg --keyserver wwwkeys.eu.pgp.net --recv 9072870B
gpg --export --armor 9072870B | sudo apt-key add -

Add specific repository for release

You have to add the repository sources to your /etc/apt/sources.list:

gksu gedit /etc/apt/sources.list

In Kubuntu, replace gksu with kdesu. Add the two lines for your specific release (i.e. Ubuntu 7.10):

Ubuntu ("Intrepid Ibex") 32-bit and 64-bit

deb http://moblock-deb.sourceforge.net/debian intrepid main
deb-src http://moblock-deb.sourceforge.net/debian intrepid main

Ubuntu 8.04 ("Hardy Heron") 32-bit and 64-bit

deb http://moblock-deb.sourceforge.net/debian hardy main
deb-src http://moblock-deb.sourceforge.net/debian hardy main

Ubuntu 7.10 ("Gutsy Gibbon") 32-bit 64-bit

deb http://moblock-deb.sourceforge.net/debian gutsy main
deb-src http://moblock-deb.sourceforge.net/debian gutsy main

Ubuntu 7.04 ("Feisty Fawn") 32-bit 64-bit

deb http://moblock-deb.sourceforge.net/debian feisty main
deb-src http://moblock-deb.sourceforge.net/debian feisty main

Package Installation

Install the packages moblock and moblock-control. If you want a graphical interface you can also install mobloquer (not on Ubuntu Feisty). There is also another package (moblock-ipq) - this is an deprecated version for older kernel versions (< 2.6.14).

sudo aptitude update
sudo aptitude install moblock moblock-control

Compile a package

If you want to make your own MoBlock binary package from source and install it, you can use the following instructions. Most users will not need to compile a package, but this can be used for unsupported architectures or for an older release (you will also have to compile netfilter lib packages). First, make sure you have added a source repository for your release. Then, run the following in terminal.

sudo aptitude update
sudo aptitude install fakeroot
mkdir moblock
cd moblock
sudo apt-get build-dep -y moblock
apt-get source moblock
cd moblock-*
dpkg-buildpackage -rfakeroot
cd ..
sudo dpkg -i moblock*.deb
sudo apt-get install -f

Some of these commands can be combined into one, but this lets you make changes like adding a patch if necessary and explains the process better. Explanation: the directory moblock is created and the current working directory is changed to it. Moblock's development dependencies are then installed. The moblock source package is downloaded and the current working directory is changed to it. The source and binary packages are built and the working directory is moved one directory up. Then the moblock*.deb is installed and its dependencies are installed. Now, repeat these steps for moblock-control.

Install a package

Use the instructions at the InstallingSoftware page under Installing downloaded packages

Configuration and Usage

moblock-control features include:

  • start and stop MoBlock (including handling of the iptables rules if desired)
  • update the specified blocklists from online sources
  • use local blocklists
  • modify the blocklist and whitelist IPs and ports

The logfiles are rotated daily. In the default configuration MoBlock starts at system boot and some preconfigured blocklists are updated once a day. You can specify the blocklists to use in /etc/moblock/blocklists.list. Everything else (automatic start and update, iptables handling, IP and port whitelisting) is configured in /etc/moblock/moblock.conf. This is important especially if MoBlock blocks sites that it should not block. Don't edit /etc/moblock/moblock.conf directly, but put your changes in /etc/default/moblock. Then updates will be easier. Configuration values in the latter file overwrite those in the first.

Start MoBlock

sudo moblock-control start

Stop MoBlock

sudo moblock-control stop

Restart MoBlock

sudo moblock-control restart

Rebuild Blocklist

sudo moblock-control reload

Moblock is then reloaded.

Update Blocklists

sudo moblock-control update

Moblock is then reloaded.

MoBlock Status

sudo moblock-control status

It receives the iptables settings and the status of the MoBlock daemon.

Test MoBlock

sudo moblock-control test

The test has been known to have problems in older versions of MoBlock. Look at the log to check if you are unsure. This can be done interactively (this command will show you the log in real-time).

tail -f /var/log/moblock.log

Frequently Asked Questions (FAQ)

I cannot connect to the internet any more!

EDIT: LAN traffic is now whitelisted automatically., but this features is still experimental. If you have problems follow these instructions: MoBlock often blocks your complete LAN, including your router. So you have to whitelist your LAN. If you don't know your local IP check it with "sudo ifconfig". It's the value after "inet addr:" of the interface that you use for networking. For wired connections this might be "eth0", for wireless connections "wlan0". Example: You found out that your IP is 192.168.0.39. Then your LAN will most probably cover the IP range 192.168.0.1-192.168.0.255. Then you need to whitelist this range for incoming and outgoing connections. Edit /etc/default/moblock (in Kubuntu, replace gksu with kdesu)

gksu gedit /etc/default/moblock

and add these lines:

WHITE_IP_IN="192.168.0.0/24"
WHITE_IP_OUT="192.168.0.0/24"

Do a

moblock-control restart

when you have changed these settings.

Some applications cannot connect to the internet any more!

If the IP address that your application is trying to reach is in the blocklist, it will be blocked. But you can allow traffic for specific ports. The ports 80 (http) and 443 (https) are whitelisted by default. To allow traffic also on other ports edit /etc/default/moblock (in Kubuntu, replace gksu with kdesu)

gksu gedit /etc/default/moblock

and add/edit this line:

WHITE_TCP_OUT="http https"

Do a

moblock-control restart

when you have changed these settings. See? By default port 80 and 443 (also called http and https) is configured, for outgoing connections. In effect, you can browse blocked ips, with firefox/konqueror or any other browser. If you know the port number of an application you use, then this is the place to put it. If you want to put a range of ports, use the format "startport:endport".

But why can I not just remove the IP address from the blocklist instead?

You can. Find out what you want to whitelist by checking /var/log/moblock.log. This can be done interactively (this command will show you the log in real-time).

tail -f /var/log/moblock.log

There are different ways. For one, edit /etc/moblock/allow.p2p (in Kubuntu, replace gksu with kdesu)

gksu gedit /etc/moblock/allow.p2p

If you want to whitelist the IP range "192.168.178.1 - 192.168.178.255 and the IP 123.123.123.123 add this:

192.168.178.1-192168.178.255
123.123.123.123-123.123.123.123

Do a

moblock-control restart

when you have changed these settings. For the old method, edit /etc/moblock/allow.p2p (in Kubuntu, replace gksu with kdesu)

gksu gedit /etc/moblock/allow.p2p

To whitelist IPs add the following variables:

WHITE_IP_IN=""
WHITE_IP_OUT=""
WHITE_IP_FORWARD=""

Insert e.g. "192.168.178.1" to whitelist a single IP, or e.g. "192.168.178.0/24" to whitelist an IP range (192.168.178.0 - 192.168.178.255) or e.g. "192.168.0.0/16" to whitelist a bigger IP range (192.168.0.0 - 192.168.255.255) Separate IP addresses with a whitespace. So you might have an entry like this:

WHITE_IP_IN="192.168.0.0/24"
WHITE_IP_OUT="192.168.0.0/24 123.123.123.123 234.234.234.234"

Do a

moblock-control restart

when you have changed these settings. You can also use a search phrase, such as Google, Hotmail, or an actual IP address range (as specified in the blocklists). Add the following variable to /etc/default/moblock:

IP_REMOVE=""

Separate phrases with a semicolon. So you might have an entry like this:

IP_REMOVE="google;yahoo;altavista"

Do a

moblock-control reload

when you have changed these settings. Remember to reload or restart MoBlock after modifying the configuration.

How do I choose what blocklists to include in the update function?

Edit /etc/moblock/blocklists.list

gksu gedit /etc/moblock/blocklists.list

In Kubuntu, replace gksu with kdesu. Uncomment the blocklists, that is, remove the hash (#) to enable certain blocklists or comment them out by adding a hash before the blocklists to disable them. Do a

moblock-control update

when you have changed these settings.

How do I keep it installed, without having it run at startup?

Edit /etc/default/moblock.

gksu gedit /etc/default/moblock

In Kubuntu, replace gksu with kdesu. Set the following:

MOBLOCK_INIT="0"

What happens when I install MoBlock the first time?

It will download a new blocklist for you during installation, and start it as a deamon. In other words, it will start automatically everytime you boot up.

I have a custom compiled kernel. Moblock does not work.

MoBlock depends on netfilter support in the kernel. There are two possibilities: Netfilter support as kernel modules (recommended): Enable netfilter support in xconfig, or in the kernel source config file as modules. Netfilter support built-in directly in the kernel: Enable netfilter support in xconfig, or in the kernel source config file. moblock-control will then make sure that the netfilter support is available to MoBlock.

How do I change automatic updating?

MoBlock automatically updates its blocklists everyday. To configure automatic updating, edit /etc/default/moblock.

gksu gedit /etc/default/moblock

The number in the following setting enables (1) or disables (2) automatic updating.

MOBLOCK_CRON="1"

To disable automatic updating, set the following.

MOBLOCK_CRON="0"

MoBlock fails to start or stop

Have a look at /var/log/moblock-control.log and /var/log/moblock.log. In most cases an incorrect configuration option is the reason. If you don't understand the logfiles post them at the forum (please do this in CODE tags). If you think you messed thinks up you can make a clean reinstall:

aptitude purge moblock
aptitude install moblock

Credits

Special thanks to [[3]] for the Ubuntu Forums [[4]] this is derived from, the MoBlock Debian Packages maintainer [[5]], and the contributors to MoBlock. The Ubuntu 7.10 64-bit package and source page shell script were provided by [[6]]. The Ubuntu 7.04 64-bit package was provided by [[7]]. The Ubuntu 6.06 netfilter lib packages were provided by [[8]].

Further Reading