Showing posts with label slackware. Show all posts
Showing posts with label slackware. Show all posts

NTP Client on Slackware 13

NTP berguna untuk menyesuaikan waktu pada pc atau server dengan waktu setempat, dan untuk menghidupkan ntp client daemon pada slackware ada 2 cara yaitu:

dengan mengetikkan

# chmod +x /etc/rc.d/rc.ntpd

atau mengisi pada /etc/rc.d/rc.local dengan

# Start the NTP daemon
#
if [ -x /etc/rc.d/rc.ntpd ]
then
/etc/rc.d/rc.ntpd start
fi

setelah itu kita lakukan membackup dan mengedit pada ntp.conf

# mv /etc/ntp.conf /etc/ntp.conf.bk
# touch /etc/ntp.conf
# pico /etc/ntp.conf

isi dengan (googling... ntp server indonesia)

server 2.id.pool.ntp.org
server 1.asia.pool.ntp.org
server 0.asia.pool.ntp.org

untuk menjalankan pertama kali daemon ntp

# /etc/rc.d/rc.ntpd start
Starting NTP daemon: /usr/sbin/ntpd -g

cek apakah ntp telah berjalan

# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
shakira.uii.net 207.171.7.152 3 u 33 64 3 24.529 -27.175 5.916
221.139.48.11 115.139.9.150 2 u 31 64 3 231.443 20.659 0.397
158.108.7.157 158.108.212.149 2 u 30 64 3 228.053 56.289 3.025

Sarg 2.2.7.1

Coming soon...

squid.conf

Isi squid.conf

acl manager proto cache_object
acl localhost src 127.0.0.1/32
acl to_localhost dst 127.0.0.0/8
# acl all src 0.0.0.0/0.0.0.0
acl terserahnetwork src xxx.xxx.xxx.xxx/xx
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 CONNECT method CONNECT
acl purge method PURGE
acl QUERY urlpath_regex cgi-bin \? .js .jsp .cgi
# acl blacklist url_regex -i "/etc/squid/blacklist.txt"
# acl snmppublic snmp_community public
# acl ym req_mime_type ^appication/x-msn-messenger$
# acl ymmime req_mime_type -i ^appication/x-msn-messenger$
# acl ymmime rep_mime_type ^appication/x-msn-messenger$
http_access deny !Safe_ports
http_access deny CONNECT !SSL_ports
# http_access deny to_localhost
http_access allow purge localhost
http_access deny purge
# icp_access allow allnetwork
icp_access allow terserahnetwork
icp_access deny all
# htcp_access allow allnetwork
htcp_access deny all
# http_access allow all
http_access allow terserahnetwork
# http_access deny ymmime
# http_access deny blacklist
http_access deny all
http_port 3128 transparent
# http_port 8080 transparent
hierarchy_stoplist cgi-bin ? .js .jsp .cgi
cache_mem 256 MB
# maximum_object_size_in_memory 8 KB
# memory_replacement_policy lru
cache_dir ufs /var/log/squid/cache 18432 16 256
# minimum_object_size 0 KB
maximum_object_size 128 MB
cache_replacement_policy lru
cache_swap_low 90
cache_swap_high 95
access_log /var/log/squid/logs/access.log
cache_log /var/log/squid/logs/cache.log
cache_store_log /var/log/squid/logs/store.log
logfile_rotate 5
emulate_httpd_log on
# redirect_children 5
mime_table /etc/squid/mime.conf
pid_filename /var/log/squid/logs/squid.pid
log_fqdn on
refresh_pattern ^ftp: 1440 20% 10080
refresh_pattern ^gopher: 1440 0% 1440
refresh_pattern (cgi-bin|\?) 0 0% 0
refresh_pattern . 0 20% 4320
cache_mgr admin@domain.com
cache_effective_user squid
cache_effective_group squid
visible_hostname localhost.domain.com
# snmp_access allow snmppublic localhost
# snmp_access deny all
icp_port 3130
# cache_dns_program /usr/libexec/dnsserver
dns_nameservers xxx.xxx.xxx.xxx xxx.xxx.xxx.xxx
# hosts_file /etc/hosts
# dns_testnames netscape.com internic.net nlanr.net microsoft.com
cachemgr_passwd terserahaja
coredump_dir /var/log/squid/cache

Instalasi squid-3.0.stable19 di Slackware 13

Setelah mencari dan mencoba... akhirnya saya memberanikan diri untuk menulis tutorial ini...

Menambah user dan group

# groupadd squid
# useradd squid -g squid -d /bin/false -s /nonexistent

Unduh file squid

#wget - b http://repository.slacky.eu/slackware-13.0/network/squid/3.0.STABLE19/squid-3.0.stable19-i486-1sl.txz

Instalsi squid

# installpkg squid-3.0.stable19-i486-1sl.txz

Memberikan permission agar squid dapat diesksekusi

# chmod +x /etc/rc.d/rc.squid

Supaya squid berjalan dengan automatis setelah komputer hidup maka ditambahkan pada # /etc/rc.d/rc.inet2

# Start SQUID (Squid proxy 3.0):
if [ -x /etc/rc.d/rc.squid ]; then
. /etc/rc.d/rc.squid start
fi

Mengubah kepemilikan

access_log:

# touch /var/log/squid/logs/access.log
# chown -R squid.squid /var/log/squid/logs/access.log

cache_log:

# touch /var/log/squid/logs/cache.log
# chown -R squid.squid /var/log/squid/logs/cache.log

cache_store_log:

# touch /var/log/squid/logs/store.log
# chown -R squid.squid /var/log/squid/logs/store.log

pid_filename:

# touch /var/log/squid/logs/squid.pid
# chown -R squid.squid /var/log/squid/logs/squid.pid

squid cache:

# mkdir /var/log/squid/cache/
# chown -R squid.squid /var/log/squid/cache/

Sebelum membuat swap direktori, isi ubah dahulu isi dari /etc/squid/squid.conf

# mv /etc/squid/squid.conf /etc/squid/squid.conf.bk
# touch /etc/squid/squid.conf
# pico /etc/squid/squid.conf

Membuat swap direktori

# /usr/sbin/squid -z
2010/05/05 10:24:31| Creating Swap Directories
2010/05/05 10:24:31| /var/log/squid/cache exists
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/00
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/01
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/02
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/03
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/04
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/05
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/06
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/07
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/08
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/09
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/0A
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/0B
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/0C
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/0D
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/0E
2010/05/05 10:24:31| Making directories in /var/log/squid/cache/0F

Cek konfigurasi squid sudah benar atau belum

# /usr/sbin/squid -k parse
2010/05/05 10:25:38| Processing Configuration File: /etc/squid/squid.conf (depth 0)
2010/05/05 10:25:38| Starting Authentication on port 0.0.0.0:14348
2010/05/05 10:25:38| Disabling Authentication on port 0.0.0.0:14348 (interception enabled)
2010/05/05 10:25:38| Initializing https proxy context

Menjalankan squid pertamakali

# /usr/sbin/squid -sYD

Melihat perintah yg telah dijalankan

# tail -f /var/log/messages
May 5 10:26:11 cumigoreng squid[3251]: 0 Objects expired.
May 5 10:26:11 cumigoreng squid[3251]: 0 Objects cancelled.
May 5 10:26:11 cumigoreng squid[3251]: 0 Duplicate URLs purged.
May 5 10:26:11 cumigoreng squid[3251]: 0 Swapfile clashes avoided.
May 5 10:26:11 cumigoreng squid[3251]: Took 0.82 seconds ( 0.00 objects/sec).
May 5 10:26:11 cumigoreng squid[3251]: Beginning Validation Procedure
May 5 10:26:11 cumigoreng squid[3251]: Completed Validation Procedure
May 5 10:26:11 cumigoreng squid[3251]: Validated 25 Entries
May 5 10:26:11 cumigoreng squid[3251]: store_swap_size = 0
May 5 10:26:11 cumigoreng squid[3251]: storeLateRelease: released 0 objects

Menjalankan proxy squid

# /etc/rc.d/rc.squid start
Starting Squid: /usr/sbin/squid -DF

Agar dapat diakses melalui Mikrotik sebagai external proxy

#pkgtool
- Pilih setup
- check services
- check rc.ip_forward

Pada /etc/rc.d/rc.local

# iptable squid
iptables -t nat -A POSTROUTING -j MASQUERADE

# transparent proxy
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 3128

Reboot pc-proxynya... dan selamat mencoba...