hs20-osu-server.txt 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. Hotspot 2.0 OSU server
  2. ======================
  3. The information in this document is based on the assumption that Ubuntu
  4. 12.04 server (64-bit) distribution is used and the web server is
  5. Apache2. Neither of these are requirements for the installation, but if
  6. other combinations are used, the package names and configuration
  7. parameters may need to be adjusted.
  8. NOTE: This implementation and the example configuration here is meant
  9. only for testing purposes in a lab environment. This design is not
  10. secure to be installed in a publicly available Internet server without
  11. considerable amount of modification and review for security issues.
  12. NOTE: While this describes use on Ubuntu 12.04, the version of Apache2
  13. included in that distribution is not new enough to support all OSU
  14. server validation steps. In other words, it may be most adapt the steps
  15. described here to Ubuntu 13.10.
  16. Build dependencies
  17. ------------------
  18. Ubuntu 12.04 server
  19. - default installation
  20. - upgraded to latest package versions
  21. sudo apt-get update
  22. sudo apt-get upgrade
  23. Packages needed for running the service:
  24. sudo apt-get install sqlite3
  25. sudo apt-get install apache2
  26. sudo apt-get install php5-sqlite libapache2-mod-php5
  27. Additional packages needed for building the components:
  28. sudo apt-get install build-essential
  29. sudo apt-get install libsqlite3-dev
  30. sudo apt-get install libssl-dev
  31. sudo apt-get install libxml2-dev
  32. Installation location
  33. ---------------------
  34. Select a location for the installation root directory. The example here
  35. assumes /home/user/hs20-server to be used, but this can be changed by
  36. editing couple of files as indicated below.
  37. sudo mkdir -p /home/user/hs20-server
  38. sudo chown $USER /home/user/hs20-server
  39. mkdir -p /home/user/hs20-server/spp
  40. mkdir -p /home/user/hs20-server/AS
  41. Build
  42. -----
  43. # hostapd as RADIUS server
  44. cd hostapd
  45. #example build configuration
  46. cat > .config <<EOF
  47. CONFIG_DRIVER_NONE=y
  48. CONFIG_PKCS12=y
  49. CONFIG_RADIUS_SERVER=y
  50. CONFIG_EAP=y
  51. CONFIG_EAP_TLS=y
  52. CONFIG_EAP_MSCHAPV2=y
  53. CONFIG_EAP_PEAP=y
  54. CONFIG_EAP_GTC=y
  55. CONFIG_EAP_TTLS=y
  56. CONFIG_EAP_SIM=y
  57. CONFIG_EAP_AKA=y
  58. CONFIG_EAP_AKA_PRIME=y
  59. CONFIG_SQLITE=y
  60. CONFIG_HS20=y
  61. EOF
  62. make hostapd hlr_auc_gw
  63. cp hostapd hlr_auc_gw /home/user/hs20-server/AS
  64. # build hs20_spp_server
  65. cd ../hs20/server
  66. make clean
  67. make
  68. cp hs20_spp_server /home/user/hs20-server/spp
  69. # prepare database (web server user/group needs to have write access)
  70. mkdir -p /home/user/hs20-server/AS/DB
  71. sudo chgrp www-data /home/user/hs20-server/AS/DB
  72. sudo chmod g+w /home/user/hs20-server/AS/DB
  73. sqlite3 /home/user/hs20-server/AS/DB/eap_user.db < sql.txt
  74. sudo chgrp www-data /home/user/hs20-server/AS/DB/eap_user.db
  75. sudo chmod g+w /home/user/hs20-server/AS/DB/eap_user.db
  76. # add example configuration (note: need to update URLs to match the system)
  77. sqlite3 /home/user/hs20-server/AS/DB/eap_user.db < sql-example.txt
  78. # copy PHP scripts
  79. # Modify config.php if different installation directory is used.
  80. # Modify PHP scripts to get the desired behavior for user interaction (or use
  81. # the examples as-is for initial testing).
  82. cp -r www /home/user/hs20-server
  83. # Build local keys and certs
  84. cd ca
  85. # Display help options.
  86. ./setup.sh -h
  87. # Remove old keys, fill in appropriate values, and generate your keys.
  88. # For instance:
  89. ./clean.sh
  90. rm -fr rootCA"
  91. old_hostname=myserver.local
  92. ./setup.sh -C "Hotspot 2.0 Trust Root CA - CT" \
  93. -o $old_hostname-osu-client \
  94. -O $old_hostname-oscp -p lanforge -S $old_hostname \
  95. -V $old_hostname-osu-revoked \
  96. -m local -u http://$old_hostname:8888/
  97. # Configure subscription policies
  98. mkdir -p /home/user/hs20-server/spp/policy
  99. cat > /home/user/hs20-server/spp/policy/default.xml <<EOF
  100. <Policy>
  101. <PolicyUpdate>
  102. <UpdateInterval>30</UpdateInterval>
  103. <UpdateMethod>ClientInitiated</UpdateMethod>
  104. <Restriction>Unrestricted</Restriction>
  105. <URI>https://policy-server.osu.example.com/hs20/spp.php</URI>
  106. </PolicyUpdate>
  107. </Policy>
  108. EOF
  109. # Install Hotspot 2.0 SPP and OMA DM XML schema/DTD files
  110. # XML schema for SPP
  111. # Copy the latest XML schema into /home/user/hs20-server/spp/spp.xsd
  112. # OMA DM Device Description Framework DTD
  113. # Copy into /home/user/hs20-server/spp/dm_ddf-v1_2.dtd
  114. # http://www.openmobilealliance.org/tech/DTD/dm_ddf-v1_2.dtd
  115. # Configure RADIUS authentication service
  116. # Note: Change the URL to match the setup
  117. # Note: Install AAA server key/certificate and root CA in Key directory
  118. cat > /home/user/hs20-server/AS/as-sql.conf <<EOF
  119. driver=none
  120. radius_server_clients=as.radius_clients
  121. eap_server=1
  122. eap_user_file=sqlite:DB/eap_user.db
  123. ca_cert=Key/ca.pem
  124. server_cert=Key/server.pem
  125. private_key=Key/server.key
  126. private_key_passwd=passphrase
  127. eap_sim_db=unix:/tmp/hlr_auc_gw.sock db=eap_sim.db
  128. subscr_remediation_url=https://subscription-server.osu.example.com/hs20/spp.php
  129. EOF
  130. # Set RADIUS passphrase for the APs
  131. # Note: Modify to match the setup
  132. cat > /home/user/hs20-server/AS/as.radius_clients <<EOF
  133. 0.0.0.0/0 radius
  134. EOF
  135. Start RADIUS authentication server
  136. ----------------------------------
  137. cd /home/user/hs20-server/AS
  138. ./hostapd -B as-sql.conf
  139. OSEN RADIUS server configuration notes
  140. The OSEN RADIUS server config file should have the 'ocsp_stapling_response'
  141. configuration in it. For example:
  142. # hostapd-radius config for the radius used by the OSEN AP
  143. interface=eth0#0
  144. driver=none
  145. logger_syslog=-1
  146. logger_syslog_level=2
  147. logger_stdout=-1
  148. logger_stdout_level=2
  149. ctrl_interface=/var/run/hostapd
  150. ctrl_interface_group=0
  151. eap_server=1
  152. eap_user_file=/home/user/hs20-server/AS/hostapd-osen.eap_user
  153. server_id=ben-ota-2-osen
  154. radius_server_auth_port=1811
  155. radius_server_clients=/home/user/hs20-server/AS/hostap.radius_clients
  156. ca_cert=/home/user/hs20-server/ca/ca.pem
  157. server_cert=/home/user/hs20-server/ca/server.pem
  158. private_key=/home/user/hs20-server/ca/server.key
  159. private_key_passwd=whatever
  160. ocsp_stapling_response=/home/user/hs20-server/ca/ocsp-server-cache.der
  161. The /home/user/hs20-server/AS/hostapd-osen.eap_user file should look
  162. similar to this, and should coorelate with the osu_nai entry in
  163. the non-OSEN VAP config file. For instance:
  164. # cat hostapd-osen.eap_user
  165. # For OSEN authentication (Hotspot 2.0 Release 2)
  166. "osen@w1.fi" WFA-UNAUTH-TLS
  167. # Run OCSP server:
  168. cd /home/user/hs20-server/ca
  169. ./ocsp-responder.sh&
  170. # Update cache (This should be run periodically)
  171. ./ocsp-update-cache.sh
  172. Configure web server
  173. --------------------
  174. Edit /etc/apache2/sites-available/default-ssl
  175. Add following block just before "SSL Engine Switch" line":
  176. Alias /hs20/ "/home/user/hs20-server/www/"
  177. <Directory "/home/user/hs20-server/www/">
  178. Options Indexes MultiViews FollowSymLinks
  179. AllowOverride None
  180. Order allow,deny
  181. Allow from all
  182. </Directory>
  183. Update SSL configuration to use the OSU server certificate/key.
  184. They keys and certs are called 'server.key' and 'server.pem' from
  185. ca/setup.sh.
  186. Enable default-ssl site and restart Apache2:
  187. sudo a2ensite default-ssl
  188. sudo a2enmod ssl
  189. sudo service apache2 restart
  190. Management UI
  191. -------------
  192. The sample PHP scripts include a management UI for testing
  193. purposes. That is available at https://<server>/hs20/users.php
  194. AP configuration
  195. ----------------
  196. APs can now be configured to use the OSU server as the RADIUS
  197. authentication server. In addition, the OSU Provider List ANQP element
  198. should be configured to use the SPP (SOAP+XML) option and with the
  199. following Server URL:
  200. https://<server>/hs20/spp.php/signup?realm=example.com