SquidGuard: Instalasi di Ubuntu 16.04

From OnnoWiki
Jump to navigation Jump to search

Squid

sudo su
locale-gen id_ID.UTF-8
apt update
apt install squid3

Konfigurasi squid

Edit

vi /etc/squid/squid.conf

Tuning konfigurasi

# visible_hostname your-machines-hostname
# http_port 3128
# cache_dir ufs /var/spool/squid 1000 16 256
# cache_access_log /var/log/squid/access.log
# ijinkan localnet
acl localnet 192.168.0.0/16
http_access allow localnet
sudo service squid restart
/etc/init.d/squid restart

Squid bisa digunakan pada port 3128

Instalasi SquidGuard

sudo su
apt install squidguard

Sumber blacklist

http://urlblacklist.com/ RECOMMENDED, tapi bayar:)'
http://www.shallalist.de

Download

sudo su
cd /usr/local/src
wget http://www.shallalist.de/Downloads/shallalist.tar.gz
tar zxvf shallalist.tar.gz
cp -a BL/porn /var/lib/squidguard/db
cp -a BL/adv /var/lib/squidguard/db
cp -a BL/spyware /var/lib/squidguard/db

Edit squid.conf

vi /etc/squid/squid.conf

Tambahkan

url_rewrite_program /usr/bin/squidGuard

Cek

sudo squidGuard -C all
chown -R proxy:proxy /var/lib/squidguard/db
sudo ls -l /var/lib/squidguard/db*

Konfigurasi

Edit squidguard.conf

sudo su
cp /etc/squidguard/squidGuard.conf /etc/squidguard/squidGuard.conf.asli
vi /etc/squidguard/squidGuard.conf

Pastikan

dbhome /var/lib/squidguard/db
logdir /var/log/squidguard

src bar-clients {
        ip              192.168.0.0/16
}

dest porn {
        domainlist      porn/domains
        urllist         porn/urls
#       expressionlist  porn/expressions
}

acl {
        default {
                pass     local none !porn
                redirect http://admin.foo.bar.de/cgi-bin/blocked.cgi?clientaddr=%a&clientname=%n&clientuser=%i&clientgroup=%s&targetgroup=%t&url=%u
        }
}

Restart

squidGuard -c /etc/squidguard/squidGuard.conf -d
2017-06-23 10:28:56 [3410] INFO: New setting: dbhome: /var/lib/squidguard/db
2017-06-23 10:28:56 [3410] INFO: New setting: logdir: /var/log/squidguard
2017-06-23 10:28:56 [3410] Added User: root
2017-06-23 10:28:56 [3410] Added User: foo
2017-06-23 10:28:56 [3410] Added User: bar
2017-06-23 10:28:56 [3410] destblock good missing active content, set inactive
2017-06-23 10:28:56 [3410] destblock local missing active content, set inactive
2017-06-23 10:28:56 [3410] init domainlist /var/lib/squidguard/db/porn/domains
2017-06-23 10:29:23 [3410] init urllist /var/lib/squidguard/db/porn/urls
2017-06-23 10:29:23 [3410] INFO: squidGuard 1.5 started (1498188536.439)
2017-06-23 10:29:23 [3410] INFO: squidGuard ready for requests (1498188563.660)
/etc/init.d/squid restart

Test

Test squidguard, jalankan

sudo echo "http://www.pornhub.com 10.50.55.10/- - GET" | squidGuard -c /etc/squidguard/squidGuard.conf –d

Akan terlihat,

squidGuard ready for requests 
squidGuard stopped

Referensi