Advertisement
shokti

ubuntu 13.04 - coovachilli and daloradius captive portal

Dec 4th, 2013
778
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.05 KB | None | 0 0
  1. configure your public network interface(use 2 nic and do not configure eth1 or private nic):
  2. edit /etc/network/interfaces:
  3. sudo nano /etc/network/interfaces
  4.  
  5. # public network interface
  6. auto eth0
  7. iface eth0 inet dhcp
  8.  
  9. Install freeradius:
  10. sudo apt-get install freeradius freeradius-mysql
  11.  
  12. download daloradius:
  13. cd /var/www/
  14. sudo wget http://sourceforge.net/projects/daloradius/files/latest/download
  15. sudo tar zxvf daloradius-0.9-9.tar.gz
  16. sudo mv /var/www/daloradius-0.9-9 /var/www/daloradius
  17. cd /var/www/daloradius/contrib/db
  18.  
  19. create radiusdb database:
  20. mysql -u root -p
  21. create database radiusdb;
  22. quit
  23.  
  24. mysql -u root -p radiusdb < fr2-mysql-daloradius-and-freeradius.sql
  25.  
  26. mysql -u root -p
  27. CREATE USER 'raddbuser'@'localhost';
  28. SET PASSWORD FOR 'raddbuser'@'localhost' = PASSWORD('raddbpass');
  29. GRANT ALL ON radiusdb.* to 'raddbuser'@'localhost';
  30. quit
  31.  
  32. test freeradius:
  33. The default FreeRadius setup authorize's usernames and passwords from a "file" found in /etc/freeradius/users.
  34. We should test the default FreeRadius setup before we change the authorization link from "file" to "sql" (mysql).
  35.  
  36. edit /etc/freeradius/users:
  37. sudo nano /etc/freeradius/users
  38.  
  39. uncomment:
  40. "John Doe" Auth-Type := Local, User-Password == "hello"
  41. Reply-Message = "Hello, %u"
  42.  
  43. reboot ubuntu:
  44. sudo reboot
  45.  
  46. Check FreeRadius config files:
  47. sudo service freeradius stop
  48. sudo freeradius -XXX
  49.  
  50. If all goes well the last line should display:
  51. Mon Jun 29 15:24:34 2009 : Debug: Ready to process requests.
  52.  
  53. Ctrl+C to exit.
  54.  
  55. NOTE: If you get error “Error binding to port for 0.0.0.0 port 1812”, it means freeradius is already running.
  56. Stop it by doing the following:
  57. sudo ps –A | grep freeradius
  58. sudo kill -9 freeradius-PID
  59.  
  60. Start FreeRadius again:
  61. sudo service freeradius start
  62.  
  63. Test password authorization to "file"
  64. sudo radtest "John Doe" hello 127.0.0.1 0 testing123
  65.  
  66. If all goes well you should get a reply:
  67.  
  68. Sending Access-Request of id 136 to 127.0.0.1 port 1812
  69. User-Name = "John Doe"
  70. User-Password = "hello"
  71. NAS-IP-Address = 255.255.255.255
  72. NAS-Port = 0
  73. rad_recv: Access-Accept packet from host 127.0.0.1:1812, id=136, length=37
  74. Reply-Message = "Hello, John Doe"
  75.  
  76. Change authorization to sql:
  77. edit /etc/freeradius/radiusd.conf:
  78. sudo nano -c /etc/freeradius/radiusd.conf
  79.  
  80. uncomment items around line 700 and line 712:
  81.  
  82. modules{
  83. $INCLUDE sql.conf
  84. $INCLUDE sql/mysql/counter.conf
  85. }
  86.  
  87. make sure that the following are present around line 765:
  88.  
  89. instantiate{
  90. chillispot_max_bytes
  91. noresetcounter
  92. }
  93.  
  94. edit /etc/freeradius/sites-available/default:
  95. sudo nano -c /etc/freeradius/sites-available/default
  96.  
  97. make sure that the item are the same:
  98. comment "file" line item around line 170 and uncomment "sql" line item around 179 and the two line items if not present:
  99.  
  100. authorize{
  101. #file
  102. sql
  103. chillispot_max_bytes
  104. noresetcounter
  105. }
  106.  
  107. uncomment "sql" line item around line 407:
  108.  
  109. accounting{
  110. sql
  111. }
  112.  
  113. uncomment "sql" line item around line 455:
  114.  
  115. session{
  116. sql
  117. }
  118.  
  119.  
  120. Edit the /etc/freeradius/sql/mysql/counter.conf:
  121. To match the radcheck and radgroupchecks we use then you also need to add two matching counter.conf checks as follows:
  122. add at the end if not present:
  123.  
  124. sqlcounter noresetcounter {
  125. counter-name = Session-Timeout
  126. check-name = Session-Timeout
  127. reply-name = Session-Timeout
  128. sqlmod-inst = sql
  129. key = User-Name
  130. reset = never
  131. query = "SELECT SUM(Acctsessiontime) FROM radacct WHERE UserName='%{%k}'"
  132. }
  133.  
  134. sqlcounter chillispot_max_bytes {
  135. counter-name = ChilliSpot-Max-Total-Octets
  136. check-name = ChilliSpot-Max-Total-Octets
  137. reply-name = ChilliSpot-Max-Total-Octets
  138. sqlmod-inst = sql
  139. key = User-Name
  140. reset = never
  141. query = "SELECT SUM(AcctInputOctets) + SUM(AcctOutputOctets) FROM radacct WHERE UserName='%{%k}'"
  142. }
  143.  
  144.  
  145. edit the /etc/freeradius/sql.conf:
  146. sudo nano -c /etc/freeradius/sql.conf
  147.  
  148. change values it accordingly :
  149.  
  150. server = "localhost"
  151. login = "raddbuser"
  152. password = "raddbpass"
  153. radius_db = "radiusdb"
  154.  
  155. install Daloradius Web Interface Pre-requisites:
  156. sudo apt-get install php-pear php5-gd php-db
  157.  
  158. Test apache configuration:
  159. sudo apachectl configtest
  160.  
  161. Restart apache:
  162. apachectl restart
  163.  
  164. download coova-chilli:
  165. sudo wget http://coova-chilli.s3.amazonaws.com/coova-chilli-1.2.9.tar.gz
  166.  
  167. install pre-requisites:
  168. sudo apt-get install build-essential linux-headers-server libssl-dev
  169.  
  170. extract coova-chilli:
  171. sudo tar zxvf coova-chilli-1.2.9.tar.gz
  172.  
  173. go to coova-chilli folder:
  174. cd coova-chilli-1.2.9/
  175.  
  176. Install Coova-Chilli:
  177. sudo ./configure --prefix= --enable-miniportal --with-openssl
  178. sudo make
  179. sudo make install
  180.  
  181. return home folder:
  182. cd
  183.  
  184. download and install haserl:
  185. sudo wget http://dfn.dl.sourceforge.net/project/haserl/haserl-devel/haserl-0.9.29.tar.gz
  186. sudo tar zxvf haserl-0.9.29.tar.gz
  187. cd haserl-0.9.29/
  188. sudo ./configure --prefix=
  189. sudo make
  190. sudo make install
  191.  
  192. create chilli user:
  193. sudo useradd chilli
  194.  
  195. Set freeradius and Chilli to start at boot time:
  196. sudo update-rc.d freeradius defaults
  197. sudo update-rc.d chilli defaults
  198.  
  199. to fix the rebooting time problem and to connect clients to internet:
  200. sudo nano -c /etc/rc.local
  201.  
  202. add the following before exit 0:
  203. /etc/init.d/freeradius restart
  204. /etc/init.d/chilli restart
  205.  
  206. /sbin/iptables -P FORWARD ACCEPT
  207. /sbin/iptables --table nat -A POSTROUTING -o eth0 -j MASQUERADE
  208.  
  209. enable ip forwarding:
  210. edit /etc/sysctl.conf:
  211. sudo nano /etc/sysctl.conf
  212.  
  213. uncomment:
  214. net.ipv4.ip_forward=1
  215.  
  216. copy chilli default file to config file:
  217. sudo cp /etc/chilli/defaults /etc/chilli/config
  218.  
  219. restart ubuntu:
  220. sudo reboot
  221.  
  222. Daloradius Database connection settings:
  223. sudo nano -c /var/www/daloradius/library/daloradius.conf.php
  224.  
  225. change values below:
  226.  
  227. $configValues['CONFIG_DB_ENGINE'] = 'mysql';
  228. $configValues['CONFIG_DB_HOST'] = 'localhost';
  229. $configValues['CONFIG_DB_USER'] = 'raddbuser';
  230. $configValues['CONFIG_DB_PASS'] = 'raddbpass';
  231. $configValues['CONFIG_DB_NAME'] = 'radiusdb';
  232.  
  233. create daloradius log file:
  234. sudo touch /var/log/daloradius.log
  235.  
  236. to access daloradius web management console:
  237.  
  238. http://<ubuntu server's ip>/daloradius/login.php
  239. username: administrator
  240. password: radius
  241.  
  242. Create Profiles – Time Based Profile
  243. Go to Management tab > Select Profiles > Create New Profiles >Add Profile Attributes
  244. Type Profile Name, e.g. 60Mins
  245.  
  246. Add attributes
  247. Check Attributes
  248. Simultaneous-Use = 1
  249. Max-All-Session = 3600
  250. [this is in seconds, for 60mins = 3600seconds]
  251. Session-Timeout = 3600
  252. Reply Attributes
  253. Session-Timeout = 3600
  254. Idle-Timeout = 60
  255. Acct-Interim-Interval = 120
  256.  
  257.  
  258. Billing Plans – Time Based
  259. Go to Billing Tab> Select Plans > New Plan
  260. 1. Enter Plan Information details from Plan Name to Plan Active
  261. 2. Enter Time Settings details
  262. 3. Select Profile from the drop-down
  263.  
  264.  
  265. Add Hotspot
  266. Go to Management Tab > Hotspots > Click New Hotspot
  267. Enter Hotspot Name and MAC Address of interface connected to clients, Click Apply
  268.  
  269.  
  270. Add NAS
  271. Go to Management > Nas > Click New NAS
  272. Enter NAS Info, IP, NAS secret (e.g. testing123), NAS type, Other and NAS shortname. Set NAS Ports to 3997, Click Apply
  273.  
  274. Create Pre-paid Vouchers – Batch Users – Walk-In
  275. Go to Management > Batch Users > Click Batch Add Users
  276. Enter Account Info, Batch Id/Name, e.g. 60Mins_12_11_12, a Batch Description, Select Hotspot.
  277. I use Create Random Users, with default username/password length of 8, and set number of instances to create (number of vouchers).
  278. Select Group, e.g. 60Mins for 1 hour vouchers, Group Priority 0 or 1 is fine and then the Plan name for 1 hour. Click Apply
  279. You can print the vouchers/tickets.
  280.  
  281. Create Member User Accounts
  282. Go to Management > Users > Click New User
  283. Enter Account Info, username, password and select Group. You can also enter User Info First/Last names, email, etc. Click Apply
  284.  
  285. Testing Login
  286. Using a client connected to the same interface as the eth1, open a web browser. You should get an IP in this range 10.1.0.X.
  287. Go to www.google.com. You will be redirected to the Coova login page.
  288. Login in to the Hotspot using either a Batch User or a Member User
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement