Monday, November 9, 2009

Instalasi Squid Proxy Server dan SARG di Ubuntu

Install Squid Proxy Server

$sudo apt-get update
$sudo apt-get install squid
Backup File squid.conf terlebih dahulu
$sudo cp /etc/squid/squid.conf /etc/squid/squid.conf.original
Edit File squid.conf
$sudo nano /etc/squid/squid.conf

# WELCOME TO SQUID 2.7.STABLE3
# ----------------------------
#
# This is the default Squid configuration file. You may wish
# to look at the Squid home page (http://www.squid-cache.org/)
# for the FAQ and other documentation.
#
# The default Squid config file shows what the defaults for
# various options happen to be. If you don't need to change the
# default, you shouldn't uncomment the line. Doing so may cause
# run-time problems. In some cases "none" refers to no default
# setting at all, while in other cases it refers to a valid
# option - the comments for that keyword indicate if this is the
# case.
#


# Configuration options can be included using the "include" directive.
# Include takes a list of files to include. Quoting and wildcards is
# supported.
#
# For example,
#
# include /path/to/included/file/squid.acl.config
#
# Includes can be nested up to a hard-coded depth of 16 levels.
# This arbitrary restriction is to prevent recursive include references
# from causing Squid entering an infinite loop whilst trying to load
# configuration files.


# # General Setup
# General options, these should all be left as-is (except the hostname) unless you know what you are doing.
http_port 8080 #port yang digunakan untuk squid
icp_port 3130
htcp_port 4827
visible_hostname syahroni-desktop #Replace "server_hostname" with the hostname of your Ubuntu machine

cache_mem 16 MB
refresh_pattern . 0 20% 8640
hierarchy_stoplist cgi-bin ?
acl QUERY urlpath_regex cgi-bin \?
no_cache deny QUERY

# snews 563
# gopher 70
# wais 210

#acl www_ports src 80 443
acl apache rep_header Server ^Apache
broken_vary_encoding allow apache
access_log /var/log/squid/access.log squid
hosts_file /etc/hosts
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern . 0 20% 4320
acl SSL_ports port 443
acl Safe_ports port 80 # http
acl Safe_ports port 21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl ftp_ports src 21
acl localhost src 127.0.0.1/32
acl all src 0.0.0.0/0.0.0.0
acl manager proto cache_object
acl CONNECT method CONNECT
acl PURGE method PURGE

acl badsites dstdomain "/usr/local/etc/restricted-sites.squid"
acl goodsites dstdomain "/usr/local/etc/allowed-sites.squid"




### added by squish (begin)
# acl's for squish - autodetected, sometimes
# acl SQUISHLOC dst syahroni-desktop
# acl SQUISHED1 proxy_auth -i "/etc/squid/squished"
# acl SQUISHED2 ident "/etc/squid/squished"
# acl SQUISHED3 src "/etc/squid/squished"
# Error info that says you're squished
deny_info http://syahroni-desktop/squish/?squished& SQUISHED1
# deny_info http://syahroni-desktop/squish/?squished& SQUISHED2
deny_info http://syahroni-desktop/squish/?squished& SQUISHED3
# HTTP access controls for squish
# http_access allow SQUISHLOC
# http_access allow password !SQUISHED1
# http_access deny SQUISHED1
# http_access deny SQUISHED2
# http_access deny SQUISHED3
### added by squish (end)

http_access allow goodsites
http_access deny badsites


http_access allow manager localhost
http_access deny manager
http_access allow PURGE localhost
http_access deny PURGE

# HTTP Access
# Allows access to HTTP(S) webpages. Comment these lines out if you don't want to allow access to HTTP(S) webpages.
acl wwwusers src 0.0.0.0/0.0.0.0
http_access allow all

# FTP Access
# Allows FTP Access, comment these lines out if you don't want to allow FTP Access
#ftp_user Squid@domain1.com
#ftp_passive off
#acl ftpusers src 0.0.0.0/0.0.0.0
#http_access allow ftpusers ftp_ports

# Deny All Statements
# These are here mostly for reference, but you may want to use them depending on your setup.
# If you don't know what these are, leave them alone.
#never_direct allow all
#always_direct deny all
#http_access deny all
#icp_access allow all
#miss_access allow al
http_reply_access allow all

Buat Structure Cache Directory
$sudo squid -z
Test Squid
$sudo squid -d 1 -D
Menjalankan Squid
$sudo squid -sYD





Install SARG (Squid Analisys Report Generator)

Sebelum menginstall SARG anda diharuskan menginstall apache terlebih dahulu
$sudo apt-get install apache2 sarg
Edit file sarg.conf dan pastikan ada baris ini
access_log /var/log/squid/access.log

$sudo nano /etc/squid/sarg.conf
Jalankan sarg
$sudo sarg

SARG dapat diakses di http://ipaddresskomputeranda/squid-reports

Friday, November 6, 2009

Bridging Network Connection di Ubuntu

Bridging Network Connection di Ubuntu


1.Install bridge-utils ,
$ sudo apt-get update ; sudo apt-get install bridge-utils
2.Sekarang waktunya Setting Bridging, disini diasumsikan saya mempunyai interface “eth0” dan nama untuk bridgingnya adalah mybridge
$ sudo ifconfig eth0 0.0.0.0
$ sudo brctl addbr mybridge
$ sudo addif mybridge eth0
$ sudo ifconfig mybridge up
3.Setelah itu anda perlu setting Bridge pada saat startup
Edit file /etc/network/interfaces
$ sudo nano /etc/network/interfaces

auto lo
iface lo inet loopback

#bridge
iface mybridge inet static
address 10.1.99.205
netmask 255.255.255.0
network 10.1.99.0
gateway 10.1.99.11
dns-nameservers 10.1.99.2
preup ifconfig eth0 down
pre-up brctl addbr mybridge
pre-up brctl addif mybridge eth0
pre-up ifconfig eth0 0.0.0.0
post-down ifconfig eth0 down
post-down ifconfig mybridge down
post-down brctl delif mybridge eth0
post-down brctl delbr mybridge



Tekan Ctrl + O untuk menyimpan, Ctrl + X untuk keluar dari editor.
Restart networking
$ sudo /etc/init.d/networking restart
$ sudo shutdown -r now