nano /etc/network/interfaces |
auto eth0
iface eth0 inet static
address 10.10.10.3
netmask 255.255.255.240
gateway 10.10.10.1
auto eth1
nano /etc/sysctl.conf |
apt-get install freeradius freeradius-mysql |
ผมเอา ตัว backup มาใช้แล้วใช้งานไม่ได้ เพราะtable ที่ชื่อว่า nas เป็นสาเหตุ ผมจึง Drop tables ทิ้งแล้ว import nas.sql เข้าไปใหม่
mysqladmin -p create radius mysql -u root -p radius < /home/XXXXX/backup.mysql mysql -u root -p; use radius; drop tables nas; mysql -u root -p radius |
cp /etc/freeradius/sql.conf /etc/freeradius/sql.conf.bak nano -w /etc/freeradius/sql.conf |
server = "localhost"
login = "radius"
password = "xxxxxxxx"
แล้วเอา # หน้า readclient =yes ออก
cp /etc/freeradius/radiusd.conf /etc/freeradius/radiusd.conf.bak nano /etc/freeradius/radiusd.conf |
….
$INCLUDE sql.conf
$INCLUDE sql/mysql/counter.conf
cp /etc/freeradius/clients.conf /etc/freeradius/clients.conf-old nano -w /etc/freeradius/clients.conf |
secret = xxxxxxxx
}
cp /etc/freeradius/sites-available/default /etc/freeradius/sites-available/default.bak nano -w /etc/freeradius/sites-available/default |
authorize {
#file เติม # เข้าไป
sql เอา # ออก
daily เอา # ออก และเพิ่ม 3 บรรทัดข้างล่างต่อท้าย
noresetcounter
dailycounter
monthlycounter
}
ต่อมาก็หาคำว่า accounting { แล้วเอา # หน้า sql ออก
accounting {
sradutmp เอา # ออก เพื่อสามารถใช้คำสั่ง radwho
sql # uncomment
}
ต่อมาก็หาคำว่า session { แล้วเอา # หน้า sql ออก
session {
sql #uncomment
}
chown freerad:freerad /var/log/freeradius chown freerad:freerad /var/log/freeradius/sradutmp chmod 777 /var/log/freeradius nano /etc/freeradius/modules/detail |
cd /var/log/freeradius mkdir radacct mkdir radacct/127.0.0.1 chown freerad:freerad /var/log/freeradius/radacct/ chown freerad:freerad /var/log/freeradius/radacct/127.0.0.1 /etc/init.d/freeradius restart radtest guest guest 127.0.0.1 0 xxxxxxxx --ต้องไปเพิ่ม guest account นี้ก่อนใน Database freeradius -X --เช็คว่ามี Error ไหม |
aptitude --assume-yes install dpkg-dev debhelper libssl-dev cd /tmp wget -c http://ap.coova.org/chilli/coova-chilli-1.2.4.tar.gz tar xzf coova-chilli*.tar.gz cd coova-chilli* dpkg-buildpackage -rfakeroot cd .. dpkg -i coova-chilli_*_i386.deb cp /etc/chilli/defaults /etc/chilli/config mkdir /var/www/hotspot cd /var/www/hotspot cp /etc/chilli/www/* /var/www/hotspot sed -i 's/1.0.0.1/192.168.0.1/g' /etc/chilli/www/ChilliLibrary.js sed -i 's/1.0.0.1/192.168.0.1/g' /var/www/hotspot/ChilliLibrary.js nano -w /etc/default/chilli |
nano /etc/chilli/config |
HS_NETWORK=192.168.0.0 # HotSpot Network (must include HS_UAMLISTEN)
HS_NETMASK=255.255.255.0 # HotSpot Network Netmask
HS_UAMLISTEN=192.168.0.1 # HotSpot IP Address (on subscriber network)
HS_UAMPORT=3990 # HotSpot Port (on subscriber network)
HS_NASID=nas01
HS_UAMSECRET=uamsecret
HS_RADIUS=127.0.0.1
HS_RADIUS2=127.0.0.1
HS_RADSECRET=xxxxxxxx
HS_UAMALLOW=www.google.com,192.168.0.0/24
HS_UAMSERVER=192.168.0.1
HS_UAMFORMAT=https://\$HS_UAMSERVER/uam/
HS_UAMHOMEPAGE=http://\$HS_UAMLISTEN:\$HS_UAMPORT/www/coova.html
HS_UAMSERVICE=https://192.168.0.1/cgi-bin/hotspotlogin.cgi
HS_ANYIP=on # Allow any IP address on subscriber LAN
#
HS_MACAUTH=on # To turn on MAC Authentication
HS_MACPASSWD=XXXXXX #รหัสผ่านต้องเหมือนกับทีแก้ไขในไพล์/etc/chilli/functions
nano /etc/chilli/up.sh |
iptables -I POSTROUTING -t nat -o $HS_WANIF -j MASQUERADE
iptables -P INPUT DROP
iptables -I INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -I INPUT -p icmp --icmp-type 8 -s 0/0 -d 192.168.0.1 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -I OUTPUT -p icmp --icmp-type 0 -s 192.168.0.1 -d 0/0 -m state --state ESTABLISHED,RELATED -j ACCEPT
#SSH Accept from tun0
iptables -I INPUT -i tun0 -p tcp -m tcp --dport 22222 --dst 192.168.0.1 -j ACCEPT
iptables -I INPUT -i eth0 -s 10.10.10.3 -p tcp -m tcp --dport 22222 --dst 10.10.10.4 -j ACCEPT
#SNMP
iptables -I INPUT -p udp -s 0/0 --sport 1024:65535 -d 192.168.0.1 --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -I INPUT -p udp -i tun0 -d 192.168.0.1 --dport 161 -j ACCEPT
#NTP update
iptables -I INPUT -p udp -i tun0 -d 192.168.0.1 --dport 123 -j ACCEPT
iptables -t nat -I PREROUTING -i tun0 -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 3128
iptables -I INPUT -i tun0 -p tcp -m tcp --dport 3128 --syn -j ACCEPT
iptables -t nat -I PREROUTING -p tcp -m tcp --dport 3128 -j DROP
iptables -t nat -I PREROUTING -p tcp -m tcp --dport 8080 -j DROP
iptables -t nat -I PREROUTING -p tcp -m tcp --dport 2121 -j DROP
iptables -t nat -I POSROUTING -o eth0 -j LOG
#squid Log
iptables -t nat -N logging
iptables -t nat -A PREROUTING -j logging
#iptables -t nat -A POSTROUTING -j logging
iptables -A INPUT -j LOG --log-level info --log-prefix "INPUT "
#iptables -A OUTPUT -j LOG --log-level info --log-prefix "OUTPUT "
iptables -A FORWARD -j LOG --log-level info --log-prefix "FORWARD "
# HTTP:
iptables -t nat -A logging -p tcp --dport 80 -j LOG --log-prefix "HTTP: " \
--log-level info
# HTTPS:
iptables -t nat -A logging -p tcp --dport 443 -j LOG --log-prefix "HTTPS: " \
--log-level info
# SMTP:
iptables -t nat -A logging -p tcp --dport 25 -j LOG --log-prefix "SMTP: " \
--log-level info
# FTP:
iptables -t nat -A logging -p tcp --dport 21 -j LOG --log-prefix "FTP: " \
--log-level info
# IMAP:
iptables -t nat -A logging -p tcp --dport 143 -j LOG --log-prefix "IMAP: " \
--log-level info
# POP3:
iptables -t nat -A logging -p tcp --dport 110 -j LOG --log-prefix "POP3: " \
--log-level info
# MSN:
iptables -t nat -A logging -p tcp --dport 1863 -j LOG --log-prefix "MSN: " \
--log-level info
# JABBER:
iptables -t nat -A logging -p tcp --dport 5222 -j LOG --log-prefix "JABBER: " \
--log-level info
JABBERS
iptables -t nat -A logging -p tcp --dport 5223 -j LOG --log-prefix "JABBERS: " \
--log-level info
# ICQ/AIM
iptables -t nat -A logging -p tcp --dport 5190 -j LOG --log-prefix "ICQ/AIM: " \
--log-level info
# Yahoo
iptables -t nat -A logging -p tcp --dport 5050 -j LOG --log-prefix "YAHOO: " \
--log-level info
# IRC
iptables -t nat -A logging -p tcp --dport 6667 -j LOG --log-prefix "IRC: " \
--log-level info
# Gadu-Gadu
iptables -t nat -A logging -p tcp --dport 8074 -j LOG --log-prefix "GADU-GADU: " \
--log-level info
iptables -I INPUT -i lo -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 443 --syn -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 3990 --syn -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 4990 --syn -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 80 --syn -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 53 --syn -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 67:68 --syn -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 3306 --syn -j ACCEPT
iptables -A INPUT -i tun0 -j DROP
update-rc.d chilli defaults |
apt-get install libapache2-mod-auth-mysql apt-get install ssl-cert mkdir /etc/apache2/ssl hostname -f #ดูชื่อเครื่อง make-ssl-cert /usr/share/ssl-cert/ssleay.cnf /etc/apache2/ssl/apache.pem a2enmod ssl /etc/init.d/apache2 force-reload nano /etc/hosts |
127.0.1.1 Authen.local Authen
192.168.0.1 Authen.local Authen
nano -w /etc/apache2/sites-available/hotspot |
<.VirtualHost 192.168.0.1:443>
ServerAdmin webmaster@domain.org
DocumentRoot "/var/www/hotspot"
ServerName "192.168.0.1"
<.Directory "/var/www/hotspot/">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
<./Directory>
Alias "/dialupadmin/" "/usr/share/freeradius-dialupadmin/htdocs/"
<.Directory "/usr/share/freeradius-dialupadmin/htdocs/">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
<./Directory>
<.Directory "/var/www/hotspot/cgi-bin/">
AllowOverride None
Options ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
<./Directory>
ErrorLog /var/log/apache2/hotspot-error.log
LogLevel warn
CustomLog /var/log/apache2/hotspot-access.log combined
ServerSignature On
SSLEngine on
SSLCertificateFile /etc/apache2/ssl/apache.pem
<./VirtualHost>
a2ensite hotspot nano -w /etc/apache2/ports.conf |
Listen 443
Listen 80
nano -w /etc/apache2/apache2.conf |
nano -w /etc/apache2/sites-available/default |
cd /var/www/hotspot/ wget http://www.truesoft.co.th/wifi/uam.tgz tar xvf uam.tgz |
cd /tmp wget http://downloads.sourceforge.net/project/daloradius/daloradius/daloradius-0.9-8/daloradius-0.9-8.tar.gz tar zxvf daloradius-0.9-8.tar.gz |
mv daloradius-0.9-8 /var/www nano /var/www/daloradius-0.9-8/library/daloradius.conf.php chown www-data:www-data /var/www/daloradius-0.9-8 chmod 644 /var/www/daloradius-0.9-8/library/daloradius.conf.php apt-get install php5-common php5-gd php-pear php-db libapache2-mod-php5 touch /var/log/freeradius/radacct/sql-relay touch /var/log/freeradius/radutmp touch /var/log/daloradius.log nano /etc/apache2/sites-available/default chown www-data:www-data daloradius.log |
DocumentRoot /var/www/daloradius-0.9-8
apt-get install squid cp /etc/squid/squid.conf /etc/squid/squid.conf.bak nano /etc/squid/squid.conf |
maximum_object_size 0 KB
minimum_object_size 0 KB
# specify uncachable requests
acl all src 0.0.0.0/0.0.0.0
no_cache deny all
cache_dir null /null
# http_port 3128 comment
acl chillispot src 192.168.0.0/255.255.255.0
http_port 192.168.0.1:3128 transparent
http_access allow chillispot
บรรทัดล่างสุดเพิ่มข้อความ
visible_hostname administrator-desktop
คำอธิบาย
# http_port 3128 เป็นการยกเลิกการทำงานของโปรแกรมแบบไม่ทำ transparent
visible_hostname ต้องกำหนดชื่อเครื่องให้กับระบบหากไม่ใส่จะทำให้ไมสามารถสตาร์ตเซอร์วิสได้
acl chillispot src เป็นการกำหนดค่าเน็ตเวร์คของเครื่องขายคอมพิวเตอร์ที่จะอนุญาตให้ใช้งานผ่านโปรแกรม squid
http_port x.x.x.x.3128 transparent เป็นการกำหนดให้พอร์ต 3128 เป็น transparent proxy
http_access allow กำหนดค่า access control ให้เน็ตเวร์ควง chillispot สามารถใชงานผ่าน transparent proxy squid ได้
/etc/init.d/squid start สั่งให้โปรแกรม squid ทำงาน
netstat -lnt ตรวจสอบเซอร์วิสของ squid ว่าทำงานหรือไม่
cd /home/benze mkdir logs nano /etc/squid/squid.conf |
...
nano /etc/logrotate.d/squid |
/var/log/squid/access.log {
daily
rotate 1
copytruncate
notifempty
ifempty
missingok
postrotate
#!/bin/sh
LIMIT=90
timeaccess=`date +%Y-%m-%d`
tar -zcvpf /home/benze/logs/$timeaccess-access.tar.gz /var/log/squid/access.log.1
#cp /var/log/squid/access.log.1 /home/benze/logs/$timeaccess-access.log
find /home/benze/logs -maxdepth 1 -type f \( -ctime $LIMIT \) -print \-exec rm {} \; > /dev/null
endscript
}
nano /etc/logrotate.d/iptables |
/var/log/messages {
daily
rotate 1
copytruncate
notifempty
ifempty
missingok
postrotate
#!/bin/sh
LIMIT=90
timeaccess=`date +%Y-%m-%d`
tar -zcvpf /home/benze/logs/$timeaccess-messages.tar.gz /var/log/messages.1
#cp /var/log/messages.1 /home/benze/logs/$timeaccess-messages.log
find /home/benze/logs -maxdepth 1 -type f \( -ctime $LIMIT \) -print \-exec rm {} \; > /dev/null
endscript
}
nano /etc/logrotate.d/login |
/var/log/freeradius/radacct/127.0.0.1/details {
daily
rotate 1
copytruncate
notifempty
ifempty
missingok
postrotate
#!/bin/sh
LIMIT=90
timeaccess=`date +%Y-%m-%d`
tar -zcvpf /home/benze/logs/$timeaccess-details.tar.gz /var/log/freeradius/radacct/127.0.0.1/details.1
#cp /var/log/freeradius/radacct/127.0.0.1/details.1 /home/benze/logs/$timeaccess-details
find /home/benze/logs -maxdepth 1 -type f \( -ctime $LIMIT \) -print \-exec rm {} \; > /dev/null
endscript
}
touch /var/log/cron.log /usr/sbin/logrotate -d /etc/logrotate.conf /usr/sbin/logrotate -f /etc/logrotate.conf |
apt-get install ntp cp /etc/ntp.conf /etc/ntp.conf.bak nano /etc/ntp.conf |
restrict -4 default kod notrap nomodify nopeer noquery
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable
driftfile /var/lib/ntp/ntp.drift
server 203.185.69.60 dynamic
server time.navy.mi.th dynamic
server time.nist.gov dynamic
server 127.127.1.0 # local clock
fudge 127.127.1.0 stratum 10
restrict 192.168.0.0 mask 255.255.255.0 nomodify notrap
restrict 127.0.0.1
restrict ::1
driftfile /var/lib/ntp/ntp.drift
broadcastdelay 0.008
keys /etc/ntp/keys
ไม่มีความคิดเห็น:
แสดงความคิดเห็น