chillispot server Made-EASY
ที่มา : http://mamboeasy.psu.ac.th/~wiboon.w/content/view/29/40/
วิบูลย์ วราสิทธิชัย [email protected]
This email address is being protected from spam bots, you need Javascript enabled to view it
เวบไซต์ที่เกี่ยวข้อง http://www.opensource.psu.ac.th
แหล่งข้อมูลต้นฉบับ chillispot คือ http://www.chillispot.info
ประวัติการปรับปรุง
ครั้งที่ 1 16-01-2550 โดย: วิบูลย์ วราสิทธิชัย
ครั้งที่ 2 23-01-2550 โดย: วิบูลย์ วราสิทธิชัย
ครั้งที่ 3 24-01-2550 โดย: วิบูลย์ วราสิทธิชัย
ครั้งที่ 4 10-07-2550 โดย: วิบูลย์ วราสิทธิชัย
แก้ไขเรื่อง การปรับแต่งระบบลินุกซ์หลังการติดตั้ง
ครั้งที่ 5 29-11-2550 โดย: วิบูลย์ วราสิทธิชัย
ตรวจทานขั้นตอนและเพิ่มคำอธิบาย ตัดส่วนที่ไม่จำเป็นนักออกไปเช่น apache รองรับภาษาไทย หาอ่านได้จากเว็บไซต์ที่อ้างอิง
เอกสารนี้มีไว้เพื่อ
เป็นคำแนะนำติดตั้งจัดการปรับแต่ง Linux server เป็น Wireless LAN Access
Point Controller ด้วยโปรแกรม chillispot แบบ web login
หากต้องการทำครบชุด โปรดอ่าน
การทำ Wireless LAN Controller ด้วย Chillispot แบบ web login + freeradius + mysql + transparent proxy
และ
การติดตั้ง phpmyprepaid 0.4b3 ใช้ร่วมกับ chillispot
ข้อมูลเครือข่าย
การคอนฟิกระบบจะง่ายขึ้น ให้ใช้การ copy และ paste จากเอกสารที่กำลังอ่านอยู่นี้ หากหน้าจอเป็น text mode ให้เปลี่ยนเป็นกราฟฟิคโหมด ด้วยคำสั่ง startx
เปิดวินโดวชื่อ terminal เพื่อใช้ในการปรับแต่งและรันคำสั่ง ดังนี้
คลิก Application, Accessories, Terminal
โปรแกรม editor ที่ใช้ในการแก้ไขค่าคือ gedit
gedit /etc/selinux/config
เปลี่ยนจาก enforcing เป็น disabled ดังผลลัพธ์# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced. (default)
# permissive - SELinux prints warnings instead of enforcing.
# disabled - SELinux is fully disabled.
SELINUX=disabled
# SELINUXTYPE= type of policy in use. Possible values are:
# targeted - Only targeted network daemons are protected.
# strict - Full SELinux protection.
SELINUXTYPE=targeted
หมายเหตุ สำหรับ
ข้อ ค. การ update packages
ใช้ในกรณีที่ติดตั้งเครื่องในมหาวิทยาลัยสงขลานครินทร์ หากอยู่ที่อื่น
ไม่ต้องแก้ไขใด ๆ ให้อัปเดตด้วย 2 คำสั่งคือ adduser chilli passwd chilli ผลลัพธ์ New UNIX password: BAD PASSWORD: it is too simplistic/systematic Retype new UNIX password: passwd: all authentication tokens updated successfully. เมื่อให้ radiusd ทำงานแล้ว เริ่มขั้นตอนทดสอบระบบโดยป้อนตัวอย่างคำสั่งดังนี้ เนื่องจาก chillispot จะเป็น dhcp server เอง ดังนี้นจะต้องเช็คว่าในเครื่องไม่มี dhcp server รันอยู่ ถ้ามีอยู่ก็หยุดดังนี้ แก้ไขแฟ้ม /etc/sysctl.conf ให้มีค่าดังตัวอย่างนี้ รันคำสั่ง echo "1" > /proc/sys/net/ipv4/ip_forward
yum check-update
yum updateค. การ update packages ด้วยโปรแกรม Yum สำหรับมหาวิทยาลัยสงขลานครินทร์
ลบแฟ้มใน directory /etc/yum.repos.d ทิ้งทั้งหมด
เพราะต้นฉบับ yum ที่ติดตั้งมีข้อมูลระบุให้ชี้ไปที่ server ต่างประเทศ ด้วยคำสั่ง
rm -f /etc/yum.repos.d/*
แล้วสร้างแฟ้ม 3 แฟ้มขึ้นมาใหม่ โดยระบุ repository server เป็น ftp.psu.ac.th
สร้างแฟ้ม /etc/yum.repos.d/psu-fedora.repo ให้มีข้อมูลดังนี้
[base]
name=Fedora Core $releasever - $basearch - Base
baseurl=ftp://ftp.psu.ac.th/pub/yum/fedora/core/6/base
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
สร้างแฟ้ม /etc/yum.repos.d/psu-fedora-extras.repo ให้มีข้อมูลดังนี้
[extras]
name=Fedora Extras $releasever - $basearch
baseurl=ftp://ftp.psu.ac.th/pub/yum/fedora/core/6/extras
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-extras
gpgcheck=1
สร้างแฟ้ม /etc/yum.repos.d/psu-fedora-updates.repo ให้มีข้อมูลดังนี้
[updates]
name=Fedora Updates $releasever - $basearch
baseurl=ftp://ftp.psu.ac.th/pub/yum/fedora/updates/6/i386
enabled=1
gpgcheck=0
สั่งปรับปรุงรายชื่อ package ให้ทันสมัยตามแหล่งข้อมูลต้นทาง
yum check-update
สั่งปรับปรุง/ติดตั้ง package ให้ทันสมัย
yum update
ง. การติดตั้ง web server ด้วยโปรแกรม Apache
yum install httpd
yum install httpd-manual
yum install mod_ssl
chkconfig httpd on
service httpd start
การติดตั้ง web server ด้วยโปรแกรม Apache
http://rd.cc.psu.ac.th/content/view/19/46/
จ. การติดตั้ง radius server ด้วยโปรแกรม freeradius
yum install freeradius
chkconfig radiusd on
service radiusd start
/var/log/radius/radius.log ดู error
/etc/raddb/radiusd.conf คือ แฟ้มที่เป็นค่าคอนฟิก
/etc/raddb/clients.conf คือ แฟ้มที่อนุญาตเครื่อง IP ใดให้ใช้ radius ได้
Changing password for user chilli.
radtest chilli abcd1234 localhost 0 testing123
จะมีการแจ้งว่า Access-Reject
เป็นสาเหตุเนื่องจากไม่มีสิทธิในการอ่านแฟ้ม /etc/shadow ของระบบ
โดยแก้ไขแฟ้ม /etc/raddb/radiusd.conf
ใช้คำสั่ง
gedit /etc/raddb/radiusd.conf
ทำการ comment ยกเลิกบรรทัดข้อความจากเดิม
user = radiusd
group = radiusd
ให้เป็น
#user = radiusd
#group = radiusd
เสร็จแล้วให้ restart ระบบ radiusd ใหม่ด้วยคำสั่ง service radiusd restart
radtest chilli abcd1234 localhost 0 testing123
จะมีการแจ้งว่า Access-Accept ถูกต้องตามต้องการ
ให้แก้ไขแฟ้ม /etc/raddb/clients.conf ของโปรแกรม freeradius ให้มีค่าดังตัวอย่างนี้
client 127.0.0.1 {
...
บรรทัดที่ 35 เดิม secret = testing123
แก้ไขเป็น secret = mytestkey
...
}
เสร็จแล้วให้ restart ระบบ radiusd ใหม่ด้วยคำสั่ง
service radiusd restart
ทดสอบ radius อีกครั้งด้วย secret อันใหม่ ดังนี้
radtest chilli abcd1234 localhost 0 mytestkey
*** หมายเหตุ จะใช้ secret = mytestkey ในการติดตั้ง chillispot ***
ขั้นตอนติดตั้ง Chillispot server สำหรับ WIFI แบบ web login
service dhcpd stop
chkconfig dhcpd off
บรรทัดที่ 7 เดิม net.ipv4.ip_forward = 0
แก้ไขเป็น net.ipv4.ip_forward = 1
เพื่อให้มีผลทันที ให้ forward packet ทำตัวเป็นเราเตอร์ได้
DEVICE=eth1
ONBOOT=yes
BOOTPROTO=none
ftp://ftp.psu.ac.th/pub/chillispot/chillispot-1.1.0.i386.rpm
หรือ
ดาวน์โหลดด้วยคำสั่ง wget ดังนี้
wget ftp://ftp.psu.ac.th/pub/chillispot/chillispot-1.1.0.i386.rpm
แล้วติดตั้ง package rpm ด้วยคำสั่งดังนี้
rpm -Uvh chillispot-1.1.0.i386.rpm
[หัวข้อ TUN parameters]
บรรทัดที่ 38 เดิม net 192.168.182.0/24
แก้ไขเป็น net 10.0.1.0/24
[หัวข้อ Radius parameters]
บรรทัดที่ 113 เดิม radiusserver1 rad01.chillispot.org
แก้ไขเป็น radiusserver1 127.0.0.1
บรรทัดที่ 120 เดิม radiusserver2 rad02.chillispot.org
แก้ไขเป็น radiusserver2 127.0.0.1
บรรทัดที่ 139 เดิม #radiussecret testing123
แก้ไขเป็น radiussecret mytestkey
(ตรงกับ radius secret ในแฟ้ม /etc/raddb/clients.conf ของ freeradius)
[หัวข้อ Universal access method (UAM) parameters]
บรรทัดที่ 237 เดิม #uamserver https://radius.chillispot.org/hotspotlogin
แก้ไขเป็น uamserver https://10.0.1.1/cgi-bin/hotspotlogin.cgi
บรรทัดที่ 244 เดิม #uamhomepage http://192.168.182.1/welcome.html
แก้ไขเป็น uamhomepage http://10.0.1.1/welcome.html
บรรทัดที่ 248 เดิม #uamsecret ht2eb8ej6s4et3rg1ulp
แก้ไขโดยให้เอาเครื่องหมาย# ออก เป็น uamsecret ht2eb8ej6s4et3rg1ulp
(หรือแก้ไขเป็นรหัสใหม่ แต่ต้องเหมือนกับในแฟ้ม hotspotlogin.cgi ในข้อถัดไป)
บรรทัดที่ 253 เดิม #uamlisten 192.168.182.1
แก้ไขเป็น uamlisten 10.0.1.1
cp /usr/share/doc/chillispot-1.1.0/firewall.iptables /etc
cp /usr/share/doc/chillispot-1.1.0/hotspotlogin.cgi /var/www/cgi-bin/
บรรทัดที่ 27 เดิม #$uamsecret = "ht2eb8ej6s4et3rg1ulp";
แก้ไขโดยให้เอาเครื่องหมาย# ออก เป็น $uamsecret = "ht2eb8ej6s4et3rg1ulp";
บรรทัดที่ 31 เดิม #$userpassword=1;
แก้ไขโดยให้เอาเครื่องหมาย# ออก เป็น $userpassword=1;
<html>
<head>
<title>Welcome to Our Hotspot, Wireless Network.</title>
</head>
<body>
<center>
<H1><font color="red">TESTING ONLY</font></H1>
<img src="chillispot.png">
<H3><font color="blue">Welcome to Our Hotspot, Wireless Network.</font></H3>
<p>You are connected to an authentication and restricted network access point.
<H3><a href="http://10.0.1.1:3990/prelogin">Click here to login</a></H3>
<p>
<p>Enjoy.
</center>
</body>
</html>
ถ้าต้องการรูป chillispot.png ให้ดาวน์โหลดได้จาก ที่นี่ แล้วคัดลอกแฟ้มนี้ไปไว้ใน /var/www/html ด้วยคำสั่งดังนี้
wget http://mamboeasy.psu.ac.th/~wiboon.w/images/stories/chillispot/chillispot.png
cp chillispot.png /var/www/html
sh /etc/firewall.iptables
service chilli start
Starting chilli: [ OK ]
รันคำสั่ง ifconfig จะได้ผลลัพธ์ดังนี้
eth0 Link encap:Ethernet HWaddr 00:04:E2:24:DE:32
inet addr:192.168.2.52 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::204:e2ff:fe24:de32/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:847253 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:89766 dropped:0 overruns:0 carrier:169976
collisions:0 txqueuelen:1000
RX bytes:495145717 (472.2 MiB) TX bytes:0 (0.0 b)
Interrupt:11 Base address:0x8000
eth1 Link encap:Ethernet HWaddr 00:50:04:B8:6A:4A
inet6 addr: fe80::250:4ff:feb8:6a4a/64 Scope:Link
UP BROADCAST RUNNING MTU:1500 Metric:1
RX packets:381 errors:0 dropped:0 overruns:0 frame:0
TX packets:381 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:48850 (47.7 KiB) TX bytes:184386 (180.0 KiB)
Interrupt:10 Base address:0xe000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:95 errors:0 dropped:0 overruns:0 frame:0
TX packets:95 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:23879 (23.3 KiB) TX bytes:23879 (23.3 KiB)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.0.1.1 P-t-P:10.0.1.1 Mask:255.255.255.0
UP POINTOPOINT RUNNING MTU:1500 Metric:1
RX packets:319 errors:0 dropped:0 overruns:0 frame:0
TX packets:369 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:33964 (33.1 KiB) TX bytes:175949 (171.8 KiB)
และรันคำสั่งตรวจสอบว่าโน้ตบุ๊คได้ IP Address จาก chillispot ดังนี้
tail -f /var/log/messages
จะได้ผลลัพธ์แสดงคล้าย ๆ ตังอย่างข้างล่างนี้
Jan 24 11:12:38 localhost chillispot[12822]: ChilliSpot 1.1.0. Copyright 2002-2005 Mondru AB. Licensed under GPL. See http://www.chillispot.org for credits.
Jan 24 11:12:38 localhost kernel: ADDRCONF(NETDEV_CHANGE): tun0: link becomes ready
Jan 24 11:12:38 localhost kernel: eth1: setting full-duplex.
Jan 24 11:12:47 localhost chillispot[12822]: chilli.c: 3509: New DHCP request from MAC=00-0D-ED-56-13-96
Jan 24 11:12:47 localhost chillispot[12822]: chilli.c: 3479: Client MAC=00-0D-ED-56-13-96 assigned IP 10.0.1.2
Jan 24 11:14:42 localhost chillispot[12822]: chilli.c: 3509: New DHCP request from MAC=00-13-02-69-41-FA
Jan 24 11:14:42 localhost chillispot[12822]: chilli.c: 3479: Client MAC=00-13-02-69-41-FA assigned IP 10.0.1.3
Jan 24 11:15:12 localhost chillispot[12822]: chilli.c: 3759: Successful UAM login from username=chilli IP=10.0.1.3
โดยที่ 10.0.1.2 จะเป็น IP ของแอคเซสพอยน์ และ 10.0.1.3 จะเป็น IP ของโน้ตบุ๊คตัวแรกที่เชื่อมต่อ
เริ่มทำการคอนเนค WIFI
คลิกที่นี่เพื่อดูรูป
ที่บราวเซอร์ให้ยกเลิกการเซ็ตพร็อกซี่เซิร์ฟเวอร์
ที่บราวเซอร์ที่มีการเซ็ตหน้าโฮมเพจไว้ จะถูก redirect ไปยัง welcome.html ทันทีเมื่อเรียกโปรแกรม คลิกที่นี่เพื่อดูรูป
คลิกที่ข้อความ Click here to login แล้วจะมีหน้าต่างเพื่อให้ใส่ username และ password
คลิกที่นี่เพื่อดูรูป
เมื่อ login เข้าได้สำเร็จจะมีหน้าต่าง logged in พร้อมเวลาเริ่มนับ และเอาไว้ใช้สำหรับ logout
คลิกที่นี่เพื่อดูรูป
เพิ่มบรรทัด
sh /etc/firewall.iptables
service chilli start
ไม่มีความเห็น