wiki:WikiStart

Version 75 (modified by walter, 11 years ago) ( diff )

test internal link

eduroam via Wireless Leiden

Het doel van dit project is het ontwikkelen en testen van een prototype accesspoint (en achterliggende infrastructuur) dat het mogelijk maakt: studenten (onderzoekers, docenten en overige medewerkers van een educatieve-instelling) "veilig" toegang tot het internet te bieden door naadloze integratie van eduroam op het "open" netwerk van Wireless Leiden. De betekenis van de eduroam roaming-infrastructuur laat zich in het hieronder volgende voorbeeld ophelderen!

Wat is eduroam?

Onderwijsinstelling 'X' wil al zijn studenten eenvoudig op hun "beveiligde en gesloten" draadloze netwerk aansluiten om hen toegang tot internet en printen te verschaffen. Dit draadloze netwerk dat met vele toegangspunten (AP=AccessPoints / Hotpots) door het hele complex dekkend is, word wel met een enkele generieke naam "X-hotspot" aangelegd, maar niet met een enkel generiek wachtwoord! De onderwijsinstelling heeft al zijn leden al geregistreerd in een personendatabase en heeft voor ieder herleidbaar persoon namelijk al een unieke accountnaam en wachtwoord aangemaakt. Door de authenticatie en autorisatie tot het "gesloten en beveiligde" draadloze netwerk via de inloggegevens uit de personendatabase te laten verlopen, weet ieder lid direct zijn eigen wachtwoord om direct toegang tot het draadloze netwerk te krijgen. Daarnaast weet de instelling een mogelijk wachtwoord lek te herleiden tot een uniek persoon.

In de gebruikelijke situatie wanneer een student van onderwijsinstelling X vanuit de kantine het eigen beveiligde en gesloten draadloze netwerk "X-hotspot" op wil, dan configureert deze eenmalig zijn laptop (tablet en of telefoon) en gebruikt hiervoor de voor hem of haar al bekende unieke inloggegevens. Iedere volgende keer wanneer deze student binnen het eigen complex wil werken (of loopt) is zijn apparaat automatisch verbonden met hetzelfde draadloze netwerk "X-hotspot" (al dan niet via een andere fysiek toegangspunt vanuit collegezaal of bibliotheek). Dit verschijnsel waarbij het apparaat van de gebruiker, zonder dat hij of zij het opmerkt of iets hoeft te configureren automatisch van toegangspunt naar toegangspunt verspringt, bereikbaar en bruikbaar blijft word "roaming" genoemd. Vergelijkbaar met mobiele telefoons die tijdens het telefoongesprek in een auto rit van stad A naar B diverse mobiele toegangspunten (Telefoon Cells) passeren, zonder dat de gebruiker merkt dat zijn verbinding overschakelt. Overigens is de wifi standard nooit opgezet met perfecte roaming mogelijkheden zoals bij mobiele telefonie /g.s.m. en blijft altijd een best effort.

Maar nu, onderwijsinstelling 'Y' heeft exact dezelfde infrastructuur als onderwijsinstelling X en heeft zijn draadloze netwerk natuurlijk "Y-hotspot" genoemd. Maar onderwijsinstelling Y merkt dat wanneer gastdocenten van X met hun laptop op bezoek komen bij Y, deze leden niet (automatisch) bij Y het internet op kunnen. Tevens is het voor de onderwijsinstelling en de gebruikers omslachtig om iedereen opnieuw te registreren, een tijdelijk wachtwoord te geven en of hun apparaten te herconfigureren voor (tijdelijke) gebruik van het beveiligde en gesloten netwerk.

Als oplossing draagt onderwijsinstelling Y eduroam aan. Hiervoor gaan beide onderwijsinstelling X en Y de naam van hun draadloze netwerk gelijkmaken aan de generieke naam "eduroam". Wanneer (gast)gebruikers van onderwijsinstelling X bij onderwijs instelling Y op bezoek zijn, gaan hun laptops, tablets of telefoons automatisch het gelijknamige netwerk van onderwijsinstelling Y op. Dit zou direct werken zou je denken, maar helaas nog niet om de volgende rede. Onderwijsinstelling Y heeft natuurlijk niet de personendatabase met inloggegevens van onderwijsinstelling X om gebruikers van X tegen te authenticeren, dus gebruikers van X op het netwerk bij Y krijgen alsnog de melding dat hun inloggegevens niet worden herkend omdat ze als X in de personendatabase van Y ontbreken, logisch toch! Wanneer onderwijsinstelling Y nu alleen de authenticatie "aanvragen" van gebruikers die ontbreken in zijn personendatabase, door stuurd via een "centrale radius proxy" op internet die op zijn beurt weer gekoppeld is aan de personendatabase van de eigen onderwijsinstelling (X in dit geval) en de autorisatie "goedkeuringen" via diezelfde route weer terug afleverd bij instelling Y waar de gebruiker X zich op het netwerk bevind, dan blijven de persoonsgegevens binnen de eigen onderwijsinstelling waar ze horen en kan de gebruiker na autorisatie bij de andere instelling direct het netwerk/internet op en gebruiken. Dit allemaal zonder dat gebruiker ook maar iets aan zijn of haar eigen apparaat en of instellingen hoeft te veranderen!

Dit eduroam systeem maakt het als onderwijsinstelling mogelijk om in een strikter wordend klimaat van beveiliging, geslotenheid en aansprakelijkheid toch verantwoordelijk een dienst dat open en toegankelijk is van karakter te bieden.

Kortom het begrip eduroam betekent voor "gebruikers" zoals studenten en medewerkers dat ze zonder poespas gebruik kunnen maken van het internet via het netwerk van hun eigen of gelieerde instelling. Het is voor hen niet meer dan de draadloze netwerknaam van de hotspot die ze aantreffen op hun laptop en of smartphone wanneer ze hiermee succesvol verbinden.

Betrokkenheid van Wireless Leiden?

De betekenis en werkwijze van eduroam voor dit Wireless Leiden project is vanuit een "aanbieders" perspectief. Daarbij zal voornamelijk de onderliggende technische werking van de infrastructuur om eduroam accesspoints (voor gebruikers) te realiseren ter sprake komen. Wireless Leiden neemt momenteel niet als eduroam idP (identity provider) deel, maar faciliteerd louter als eduraom SP (service provider) het doorgeven van de vereiste authenticatie "aanvragen" en autorisatie "goedkeuringen" via een grotendeels intern ontwikkeld prototype infrastructuur. Als partieel serviceprovider koppelt Wireless Leiden eduroam gebruikers automatisch en beveiligd door aan de daarvoor aangewezen (onderwijs)netwerken. Een onderwijsinstelling vervult vaak meerdere rollen binnen het eduroam project inclusief internet-gateway, maar Wireless Leiden beperkt zich puur tot de ondersteunende koppeling en integratie van deze diensten.

Het unieke aan dit project is niet het scheiden van de identity/service provider eigenschap, maar de integratie van de fysiek verdeelde en gescheiden diensten over het onafhankelijk en "open" netwerk van Wireless Leiden dat zich letterlijk buiten de deur huisvest. Het exploiteren op stadsniveau van eduroam toegang via het Wireless Leiden netwerk was niet alleen een uitdaging, maar is nu ook nog eens eenvoudig, flexibel en betaalbaar! De huidige implementatie is een win-win situatie voor betrokken partijen, door de huidige multi SSID techniek neemt zowel de dekking van het eduroam netwerk van een (sponserende) onderwijs-instelling als dekking van het netwerk van Wireless Leiden toe. Dit in tegenstelling tot de vaak beperkt inpandige en eenzijdige exploitatie door onderwijsinstellingen van hun eigen geisoleerde fysieke en gesloten infrastructuur, die zich gemakkelijk door het graven/leggen van dure kabelverbindingen laat uitstellen of zelfs afstellen.

De knowhow is de afgelopen paar jaar in samenwerking met Hogeschool Leiden uit diverse projecten tot stand gekomen waaronder:

  • het afstudeerverslag van Richard van Manson,
  • het C.U.G.A.R project van H.L. studenten (ondersteund door Stichting NLnet met externe begeleiders),
  • het parallel ontwikkelde prototype door Richard van Manson als vrijwilliger bij Wireless Leiden (uitgangspunt voor huidige opzet),

Met tenslotte een succesvolle testcase van het prototype met dank aan Surfnet dat heeft geresulteerd in de "bijna" alles omvattende en sluitende handleiding door Walter Sonius (die u nu leest) voor het op grote schaal implementeren en uitrollen van de eduroam infrastructuur op het Wireless Leiden netwerk.

*Ontwikkelaars van Wireless Leiden zelf kunnen de roaming eigenschap van deze infrastuctuur alleen gebruiken, testen en ontwikkelen wanneer ze beschikken over een geldig eduroam accounts -naam en -wachtwoord. Dit dient geleverd te zijn door een aan eduroam/surf foundation gelieerde identity provider. Als voorbeeld beschikken studenten/scholieren en mederwerkers van Universiteit Leiden of Hogeschool Leiden hierover. Het aanvragen van een eduroam test-account voor een ontwikkelaar van wireless-leiden bij de Surffoundation behoort tot de mogelijkheden. Via een eigen interne idP met de realm @wleiden.net kunnen wirelessleiden ontwikkelaars alleen op hun eigen eduroam netwerk geauthenticeerd worden om te testen. Dit account zal niet op andere eduroam hotspots fungeren!

Benodigdheden waaronder technisch en organisatorisch?

Voor het aanbieden van de eduroam infrastructuur op het Wireless Leiden netwerk is gekozen voor twee verschillende type installaties met idem verschillende functionaliteit namelijk:

  1. "!AccesPoints" meerdere (types) die als "eduroam" multiSSID hotspot zullen fungeren met OpenWRT/Airos.
  2. "Radius-Server/Proxy & gateway" een enkele centraal gepositioneerde server met DEBIAN of FREEBSD.

De AP's kunnen vrij en verspreid door de stad op de Wireless Leiden infrastructuur aangekoppeld worden, bij voorkeur direct op een node van Wireless Leiden! De "Radius-Server/Proxy & gateway" kan het best bij een onderwijs instelling geplaatst worden waar deze enerzijds gekoppeld is aan een internet gateway en anderzijds aan de infrastructuur van Wireless Leiden. De verbinding tussen deze twee typen installaties word via OpenVPN tunnels beveiligd en geencrypt opgezet waardoor het mogelijk onveilige karakter van het open Wireless Leiden netwerk vervalt. Naast de twee eerder genoemde type installaties zijn er nog een vijftal organisatorische eisen waaronder:

  1. toegang/inlog-gegevens tot de centrale eduroam/surfnet/surf-foundation identity-provider radiusproxy.
  2. ip whitelisting voor toegang tot die radiusproxy.
  3. certnode die het creeeren van certificaten en config bestanden voor de openvpn server "radius-server/proxy" en afgeleide clients "eduroam AP's" faciliteert.
  4. inlog/account/gebruiker-gegevens om als gebruiker op het "eduroam" netwerk in te loggen (aanvragen bij identityprovider).
  5. build/test/flash-machines voor config en firmware (ssh scp sshpass telnet etc)

Met deze middelen en een compleet voor zover mogelijk lineaire stap voor stap handleiding is een plug en play exploitatie van eduroam toegangspunten waar dan ook binnen het Wireless Leiden netwerk snel en eenvoudig te realiseren. De procedure is als volgt:

  1. AccessPoint(s): eenmalig template aanmaken, (meervoudig) configureren en (batch) flashen
  2. "Radius-Server/Proxy & gateway": eenmalig installeren en configureren
  3. Certnode: eenmalig easy-rsa opzetten voor benodige keys/certificaten voor 1 en 2
  4. Batch-Flash scripts

Voor het opleveren van veel AP's (batches) met unieke instelligen zal er uiteindelijk een configuratie script volgen waarmee op basis van het MAC-adres van het AP een aantal unieke parameters meegegeven kunnen worden voor de configuratie: MultiSSID, hostname, kanaal, ipadres(bedraad/draadloos), etc... in een simpel csv text bestand dat in een keer geflashed kan worden. vergeet de unieke openvpn client certificaten niet, tevens zouden er per AP unieke client gegevens om met de radius-proxy/server te communiceren gemaakt kunnen worden.

Door het gebruik van het opensource software OpenWRT, FREEBSD/Debian en gerelateerde software projecten (isc-dhcp-server/freeradius/openvpn/syslog-ng), is deze setup niet gelimiteerd aan een enkel merk en of type hardware. Een kleine aanpassing aan de configuratie bestanden zou een vereiste kunnen zijn voordat het op ander hardware platvorm werkt. Deze handleiding zal overigens alleen toegespitst zijn op Ubiquiti AP's zoals Bullet m2 HP/ Nano station/loco m2 en X86 based via-epia-m/alixboard als radiusproxy/server & gateway. Als uitgangssituatie om deze handleiding uit te voeren word ubuntu 12.04LTS AMD64 gebruikt!

1 setup eduroam AccessPoints

1.1 hardware & software

Het AccessPoint zal met multiSSID ingesteld worden en bridged al het wireless verkeer van de beveiligde SSID "eduroam" SSID via een openvpn tunnel naar de "radius-server/proxy & gateway". Het wireless verkeer van de tweede virtuele open SSID "ap.wlgst-bridge.wleiden.net" zal in het volgende configuratie voorbeeld "1.2a" via bridging direct een Wireless Leiden node ingaan die reeds zelf al met DHCP, DNS, routing en natuurlijk captive portal is uitgerust. Voor de configuratie zonder bridging van het tweede virtuele SSID, maar met een eigen interne nat/routing word in 1.2b de wijzigingen t.o.v. 1.2a aangegeven. In 1.2c word uitgelegd hoe je direct op AirOS zelf een eduroam hotspot kan realiseren.

In tegenstelling tot de oude handleiding(onderaan deze pagina) word momenteel gebruik gemaakt van een "fixed" OpenWRT releases waaronder Backfire 10.03.1 of zelfs Atitude Adjustment 12.0.9 final. Dit niet alleen omdat het bouwen van een custombuild onnodig is geworden omdat "openvpn" inmiddels als pakket direct gebruiksklaar en beschikbaar is voor de 10.03.1 en 12.09 releases. Maar vooral omdat compileren van een openwrt image & build omgeving erg veel tijd, moeite en veel variabelen introduceert in een al/nog experimentele infrastructuur. Met fixed releases kan in minder dan 5 minuten direct een werkend accesspoint prototype gerealiseerd worden en dat zelfs voor verschillende type architecturen accesspoints (arm/mips/x86/etc, mits daar openwrt images voor zijn)! Wel zou via custom gecompileerde releases het geheugen gebruik en processor belasting geoptimaliseerd kunnen worden door het weglaten van ongebruikte pakketten. *Update, inmiddels is het ook al direct mogelijk om via AirOS software dat standaard al op Ubiquiti AP's aanwezig een "eduroam" hotspot met wpa2 enterprise en radiusclient functie te maken (enkel openvpn ontbreekt)!

Met deze flexibele fundering is het doel om accesspoints die maar in sumiere opzichten van elkaar hoeven te verschillen zo gemakkelijk en snel mogelijk in grote hoeveelheden geautomatiseerd te kunnen configureren. Het verschil tussen de accesspoints komt deels uit hoek van beveiliging, deels uit de hoek van locatie en natuurlijk de toepassing. Als een enkel accesspoint gehackt is kan deze los van de andere accesspoint toegang tot de radius proxy ontzegt worden, (door zijn openvpn sleutel in te trekken) daardoor zijn de andere accesspoints nog operationeel. Als toepassing is het handig dat het eduroam accesspoint op de burcht in Leiden als multi-SSID "ap.burcht.wleiden.net" heet en de eduroam accesspoint bij de Hortus Botanicus als multi-SSID "ap.hortusbotanicus.wleiden.net". Als toepassing kan het wenselijk zijn kleine / goedkopere AP's te monteren op plaatsen waar grote AP's met losse sector antennes niet mogelijk zijn en natuurlijk niet te vergeten de beschikbare wifi kanalen 1,6,11. Voor ieder AP zullen unieke openvpn certifacten gebruikt worden. Deze voorbeelden duiden erop dat er toch kleine specifieke wijzigingen tussen de AccessPoints configuratie bestanden wenselijk zijn. Samengevat, er zal eerst handmatig een work-template opgezet worden waarmee een eduroam AP ingericht kan worden. Dit vormt dan de generieke basis voor een gescripte en automatische configuratie van veel AP's tegelijk die onderling kleine specifieke aanpassingen kunnen bevatten.

1.2a fixed OpenWRT release bridged

The following shell commands will first locally download the OpenWRT "Backfire" image and its packages, than flash the image, configure its packages, backup original config files so you must use them as a work-template for your own custom deployment! This work-template will form the generic base of a possible batch configure/deploy script to allow huge amount of AP's to be configured in one instance, with each little specific customisations. Instead of the Backfire 10.03.1 release also Attitude Adjustment 12.09 can be used, just change the download links for the image and packages you need!

### prepare a workfolder to setup all software and config files
mkdir ap-bullet
cd ap-bullet

## download openwrt bullet firmware image
wget http://downloads.openwrt.org/backfire/10.03.1/ar71xx/openwrt-ar71xx-ubnt-bullet-m-squashfs-factory.bin

### openwrt bullet packages
mkdir packages

## download wpad since included wpad-mini does not support EAP!
wget http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/wpad_20111103-2_ar71xx.ipk -P packages/

## download openvpn packages
wget http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/openvpn_2.1.4-3_ar71xx.ipk -P packages/
wget http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/kmod-tun_2.6.32.27-1_ar71xx.ipk -P packages/
wget http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/libopenssl_0.9.8r-1_ar71xx.ipk -P packages/
wget http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/zlib_1.2.3-5_ar71xx.ipk -P packages/
wget http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/liblzo_2.04-1_ar71xx.ipk -P packages/

# download optional packages
wget http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/nano_2.2.6-1_ar71xx.ipk -P packages/
wget http://downloads.openwrt.org/backfire/10.03.1/ar71xx/packages/libncurses_5.7-2_ar71xx.ipk -P packages/
#!wget http://downloads.openwrt.org/attitude_adjustment/12.09/ar71xx/generic/packages/terminfo_5.7-5_ar71xx.ipk -P packages/ #aa only! 

### flash firmware
# put Ubiquiti device in tftp recover mode
# unplug/poweroff the device
# power on "while keeping the reset button pressed" for atleast 8/15 sec!
# when blinking red/green the reset button can be released
# the device is now in tftp mode
# todo get in tftp without reset button... via triggering mtd in AirOS?

## use tftpclient utility to flash the openwrt image
tftp 192.168.1.20
	binary
        trace
        put openwrt-ar71xx-ubnt-bullet-m-squashfs-factory.bin
        quit

## use telnet to setup a password for the ssh session 
telnet 192.168.1.1
        passwd #type a new password
        exit

## use scp to upload all packages for install
#type yes/enter password
scp -r packages root@192.168.1.1:/tmp/

## use ssh to uninstall wpad and install other packages
ssh root@192.168.1.1 "opkg remove wpad-mini;opkg install /tmp/packages/*.ipk;exit"

## use scp to backup current config files to local pc for use as template
mkdir backup
scp -r root@192.168.1.1:/etc backup/

For deploying huge quantity (batch(es)) of AP's most of the following settings are general but some may differ among AccesPoints like: multiSSID, ipadress(wired/wireless), wifichannel, band(a/bg), hostname, etc. In the following example config files those parts that needs to be customized will be commented in the following style "#! <---" so its easier to identify and customize. Use the files from the backup you just made as a template for your own custom config, since the example config files which will follow after this paragraph are hardware-type/image specific! That means that my example config files are specific for the Ubiquiti bullet2m hp 2,4ghz b/g, and for instance will not work on linksys broadcom based AP hardware (because wifi interfaces are configured using different names and parameters)! So only copy/paste change the needed parts, that differ with your templates! Remember the AP can be configured as internal nat or bridge for the wlgst-bridge multiSSID!

## create folder structure for customized config files!
mkdir -p customize/etc/openvpn
mkdir -p customize/etc/config
mkdir -p customize/etc/init.d
mkdir -p customize/sbin
mkdir -p customize/usr/sbin

##copy/make files to use as template!
cp backup/etc/config/dhcp customize/etc/config/
cp backup/etc/config/firewall customize/etc/config/
cp backup/etc/config/network customize/etc/config/
cp backup/etc/config/system customize/etc/config/
cp backup/etc/config/wireless customize/etc/config/

cp backup/etc/init.d/openvpn customize/etc/init.d/
cp backup/etc/init.d/sysntpd customize/etc/init.d/

cp backup/etc/firewall.user customize/etc/
cp backup/etc/inittab customize/etc/
cp backup/etc/rc.local customize/etc/

touch customize/sbin/wifi-update
touch customize/sbin/openvpn-update
touch customize/usr/sbin/iopenvpn

## adjust your template files using the following examples!

#example code# /etc/config/dhcp

config dnsmasq
	option domainneeded	1
	option boguspriv	1
	option filterwin2k	0  # enable for dial on demand
	option localise_queries	1
	option rebind_protection 1  #! change to 0 if local dns "wleiden.net" won't resolve <---
	option rebind_localhost 1  # enable for RBL checking and similar services
	#list rebind_domain example.lan  # whitelist RFC1918 responses for domains
	option local	'/lan/'
	option domain	'lan'
	option expandhosts	1
	option nonegcache	0
	option authoritative	1
	option readethers	1
	option leasefile	'/tmp/dhcp.leases'
	option resolvfile	'/tmp/resolv.conf.auto'
	#list server		'/mycompany.local/1.2.3.4'
	#option nonwildcard	1
	#list interface		br-lan
	#list notinterface	lo
	#list bogusnxdomain     '64.94.110.11'

config dhcp lan 
	option interface	lan
	option ignore	1 #! I doubt this one is even used... <---
#!	option start 	100
#!	option limit	150
#!	option leasetime	12h

config dhcp wan
	option interface	wan
	option ignore	1

#example code# /etc/config/firewall

config defaults
	option syn_flood	1
	option input		ACCEPT
	option output		ACCEPT 
	option forward		REJECT
# Uncomment this line to disable ipv6 rules
#	option disable_ipv6	1

config zone
	option name		lan
	option network		'lan'
	option input		ACCEPT 
	option output		ACCEPT 
	option forward		REJECT

config zone
	option name		wan
	option network		'wan' #!was eth0 for bullet <---
	option input		REJECT
	option output		ACCEPT 
	option forward		REJECT
	option masq		1 
	option mtu_fix		1

#! Allow SSH <---
config rule
        option src              wan
        option proto            tcp
        option dest_port        ssh
        option target           ACCEPT

config forwarding
        option src              lan
        option dest             wan

# We need to accept udp packets on port 68,
# see https://dev.openwrt.org/ticket/4108
config rule
	option name		Allow-DHCP-Renew
	option src		wan
	option proto		udp
	option dest_port	68
	option target		ACCEPT
	option family		ipv4

# Allow IPv4 ping
config rule
	option name		Allow-Ping
	option src		wan
	option proto		icmp
	option icmp_type	echo-request
	option family		ipv4
	option target		ACCEPT

# Allow DHCPv6 replies
# see https://dev.openwrt.org/ticket/10381
config rule
	option name		Allow-DHCPv6
	option src		wan
	option proto		udp
	option src_ip		fe80::/10
	option src_port		547
	option dest_ip		fe80::/10
	option dest_port	546
	option family		ipv6
	option target		ACCEPT

# Allow essential incoming IPv6 ICMP traffic
config rule
	option name		Allow-ICMPv6-Input
	option src		wan
	option proto	icmp
	list icmp_type		echo-request
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	list icmp_type		router-solicitation
	list icmp_type		neighbour-solicitation
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

# Allow essential forwarded IPv6 ICMP traffic
config rule                                   
	option name		Allow-ICMPv6-Forward
	option src		wan
	option dest		*
	option proto		icmp
	list icmp_type		echo-request
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

# include a file with users custom iptables rules
config include
	option path /etc/firewall.user

#example code# /etc/config/network

# Copyright (C) 2006 OpenWrt.org

config interface loopback
	option ifname	lo
	option proto	static
	option ipaddr	127.0.0.1
	option netmask	255.0.0.0

#!this interface is wired to the Wireless Leiden infrastructure!
config interface wan #!interface name wan vs eth0 applies /etc/config/firewall rules <---
	option ifname	eth0
	option type 	bridge #! use bridge to forward DHCP,DNS,captive portal,etc from Wireless Leiden node to 2nd multiSSID <--- 
	option proto	dhcp
#	option peerdns	172.16.6.9 #! if dhcp is used, local dns wleiden.net resolve fix?<---
#	option proto	static #! Unique static ip vs dhcp! <---
#	option ipaddr	172.16.6.13 #! Unique ip settings differ! <---
#	option netmask 	255.255.255.248 #! Unique ip settings differ! <---
#	option gateway	172.16.6.9 #! Unique ip settings differ! <--- 
#	option dns	172.16.6.9 #! Unique ip settings differ! <--- do you run a dns server? otherwise 8.8.8.8	 
	
config interface lan
	option ifname 	wlan0
	option type 	bridge
#!       option proto    dhcp #!This makes the AP openvpn interface get a dhcp lease also uncomment the gateway option <--- 
#!       option gateway  0.0.0.0 #!0.0.0.0 protects the default route of getting replaced by dhcpserver behind openvpn tunnel <---        

#example code# /etc/config/system

config  system
	option  hostname  eduroam-bullet #!Unique name differ! <---
	option  timezone  CET-1CEST,M3.5.0,M10.5.0/3 #!correct timezone Amsterdam Netherlands <---
        option  log_ip    192.168.4.1 #! destination of syslog-ng server <---
        option  log_port  514        

config  timeserver ntp
	list server     pool.ntp.wleiden.net #! Wireless Leiden local ntp server <---
	list server     1.openwrt.pool.ntp.org
	list server     2.openwrt.pool.ntp.org
	list server     3.openwrt.pool.ntp.org

#example code# /etc/config/wireless

config wifi-device  radio0 #! names and config parameters are different for wifi architectures, ar71xx,brcm47xx,x86,etc <---
	option type     mac80211 
	option channel  5 #! Unique channels must be set since multiple AP's at one site differs 1,6,11! <---
	option macaddr	MACADDRESS # this will be set by another script, leave it alone!!! <---
	option hwmode	11ng #when using 5ghz vs 2,4ghz '11na' must be set! <--- 
	option htmode	HT20
	list ht_capab	SHORT-GI-40
	list ht_capab	TX-STBC
	list ht_capab	RX-STBC1
	list ht_capab	DSSS_CCK-40

#! this interface is bridged to the vpn tunnel!
#! option server/key are credentials for radius client 
config wifi-iface
	option device   radio0
	option network	lan
	option bridge	br-lan
	option mode	ap
	option ssid	eduroam #! its all about this one!!!<---
	option encryption wpa2
        option auth_server   192.168.4.1 #! Location of radius-server/proxy behind the tunnel 1812/1813 <---
        option auth_port 1812        
        option auth_secret	testsecret #! Radius client password to connect to the radiusserver <---
        #option acct_server   192.168.4.1 #! Location of radius-server/proxy behind the tunnel 1812/1813 <---
        #option acct_port 1813        
        #option acct_secret testsecret #!
	option isolate	1 #! wifi clients cannot connect to each other <---
        
config wifi-iface
        option device   radio0
        option network  wan #! this is for bridging <---
	option bridge	br-wan #! this is for bridging <---
        option mode     ap
        option ssid     ap.wlgst-bridge.wleiden.test #! Unique 2nd/virtual multiSSID! <---
        option encryption none

#example code# /etc/init.d/openvpn

#!/bin/sh /etc/rc.common

CONFIG=/etc/openvpn/client.conf
ACTION=$1
START=99

f_start() {
  /usr/sbin/iopenvpn --config ${CONFIG} --daemon &
  echo ${START}
}

case $ACTION in
  *)    f_start ;;
esac

#example code# /etc/init.d/sysntpd

#!/bin/sh /etc/rc.common
# Copyright (C) 2011 OpenWrt.org

START=98

BIN=/usr/sbin/ntpd
PID=/var/run/sysntpd.pid

#! werkt niet achter een nat see dns binding, dirty fix /etc/rc.local ? <---
GATEWAY=$(netstat -rn | awk '/(0.0.0.0.*G)/ { print $2 }')
MAINSER="172.16.4.46"

peers="$GATEWAY"

start() {
	[ -x $BIN ] || exit 0

	if [ -n "$peers" ]; then
		local peer
		local args="-n"
		for peer in $peers; do
			append args "-p $peer"
		done

		start-stop-daemon -x $BIN -m -p $PID -b -S -- $args
	fi
}

stop() {
	service_kill ${BIN##*/} $PID
	rm -f $PID
}

#example code# /etc/firewall.user

# This file is interpreted as shell script.
# Put your custom iptables rules here, they will
# be executed with each firewall (re-)start.


iptables -I INPUT -i tap+ -j ACCEPT
iptables -I FORWARD -i tap+ -j ACCEPT
iptables -I OUTPUT -o tap+ -j ACCEPT
iptables -I FORWARD -o tap+ -j ACCEPT

iptables -I INPUT -i br-lan -j ACCEPT 	#! old 'br+' wildcard was to general? 
iptables -I FORWARD -i br-lan -j ACCEPT 
iptables -I OUTPUT -o br-lan -j ACCEPT 	
iptables -I FORWARD -o br-lan -j ACCEPT 

iptables -t nat -A POSTROUTING -o br-lan -j MASQUERADE

#example code# /etc/inittab

::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K stop
#tts/0::askfirst:/bin/ash --login #!richard commented these 3...
#ttyS0::askfirst:/bin/ash --login
#tty1::askfirst:/bin/ash --login

#example code# /etc/rc.local

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.
#! This fixed the entropy not enough error for wpa/openvpn key? <---
if [ -L "/dev/random" ];
then
        echo 'Random-Link already OK'
else
        echo 'Random-Link not existing, creating,...'
        rm -f /dev/random 2> /dev/null
        ln -s /dev/urandom /dev/random
fi
/bin/sleep 5
#! This fixed date&time to resolve behind nat? <---
/usr/sbin/ntpd -q -p pool.ntp.wleiden.net
exit 0

#example code# /sbin/wifi-update

#!/bin/sh

MAC=$(/sbin/wifi detect | /usr/bin/awk '/macaddr/ { print $3 }')

/bin/sed -i "s/MACADDRESS/$MAC/g" /etc/config/wireless

#example code# /sbin/openvpn-update

#!/bin/sh

MAC=$(/sbin/wifi detect | /usr/bin/awk '/macaddr/ { print $3 }')

/bin/sed -i "s/MACADDRESS/$MAC/g" /etc/openvpn/client.conf

#example code# /usr/sbin/iopenvpn

#!/bin/sh

pid() {
  echo $(ps | awk '/\/usr\/sbin\/openvpn/ { print $5 }')
}
 
while [ true ]; do
  if [ -z "$(pid)" ]; then
    ifconfig br-wan | grep -q inet\  || udhcpc #! use eth0 if interface wan not a bridge, reason still not understood! <---
    /etc/init.d/sysntpd start > /dev/null
    /usr/sbin/openvpn $@
  fi
  sleep 10
done

#example code# /etc/openvpn/up.sh

#!/bin/sh
#tap interface in openvpn/kernel generates unique new MAC address!!!
#TODO don't understand how ip of AP for the tunnel is created/assigned?
#Multiple AP devices work, but may conflict with dhcplease range of wireless clients?
#remove ${IP} in here and uncomment proto dhcp to lan see /etc/config/network

FROM=3
TO=4

brctl addif br-lan $1
IP=$(echo $4 | sed "s/\.$FROM\./\.$TO\./g" )
ifconfig br-lan ${IP} up
echo "Using: $IP"

Setup openvpn key/certificates/config for the AP, skip to section 3.2 of this howto when you don't have a *.tar file with keys&config for your individual unique AP, comeback if you have a *.tar and continue.

## put openvpn config and keys in customize folder!
tar -xf $nameofyour.tar
cp keys/* customize/etc/openvpn/

Fix file permissions!

chmod +x customize/usr/sbin/iopenvpn
chmod +x customize/sbin/wifi-update
chmod +x customize/sbin/openvpn-update
chmod +x customize/etc/init.d/sysntpd
chmod +x customize/etc/init.d/openvpn
chmod +x customize/etc/openvpn/up.sh
chmod +x customize/etc/rc.local
chmod +x customize/etc/firewall.user
chmod +x customize/etc/inittab

Finally use scp to upload config files/keys and ssh to finish setting up the eduroam AP.

## copy/install customized template to AP 
scp -r customize/* root@192.168.1.1:/

## login
ssh root@192.168.1.20

## enable / activate at boottime openvpn
/etc/init.d/openvpn enable

## activate wifi to add MACadress to /etc/config/wireless file
#/sbin/wifi stop
#/sbin/wifi start
#/bin/sleep 5
/sbin/wifi detect
/bin/sleep 10
/sbin/wifi-update
#/bin/sleep 5
reboot;exit

## done
#check your working "eduroam" accesspoint!

1.2b fixed OpenWRT release nat/routed

Use these configuration examples as a replacement to the examples from the previous 1.2a configuration to replace bridging by internal nat/routing for the second virtual open SSID "ap.wlgst-bridge.wleiden.net".

#example code# /etc/config/dhcp

config dnsmasq
	option domainneeded	1
	option boguspriv	1
	option filterwin2k	0  # enable for dial on demand
	option localise_queries	1
	option rebind_protection 1  #! change to 0 if local dns "wleiden.net" won't resolve <---
	option rebind_localhost 1  # enable for RBL checking and similar services
	#list rebind_domain example.lan  # whitelist RFC1918 responses for domains
	option local	'/lan/'
	option domain	'lan'
	option expandhosts	1
	option nonegcache	0
	option authoritative	1
	option readethers	1
	option leasefile	'/tmp/dhcp.leases'
	option resolvfile	'/tmp/resolv.conf.auto'
	#list server		'/mycompany.local/1.2.3.4'
	#option nonwildcard	1
	#list interface		br-lan
	#list notinterface	lo
	#list bogusnxdomain     '64.94.110.11'

config dhcp lan 
	option interface	lan
	option ignore	1 #! I doubt this one is even used... <---
#!	option start 	100
#!	option limit	150
#!	option leasetime	12h

config dhcp wan
	option interface	wan
	option ignore	1

#! Add extra dhcp-server for multiSSID hotspot when using nat <--- 
config dhcp wlgst
        option interface        wlgst
        option start	5
	option limit	252
	option leasetime	1h

#example code# /etc/config/firewall

config defaults
	option syn_flood	1
	option input		ACCEPT
	option output		ACCEPT 
	option forward		REJECT
# Uncomment this line to disable ipv6 rules
#	option disable_ipv6	1

config zone
	option name		lan
	option network		'lan'
	option input		ACCEPT 
	option output		ACCEPT 
	option forward		REJECT

config zone
	option name		wan
	option network		'wan' #!was eth0 for bullet <---
	option input		REJECT
	option output		ACCEPT 
	option forward		REJECT
	option masq		1 
	option mtu_fix		1

#! Allow SSH <---
config rule
        option src              wan
        option proto            tcp
        option dest_port        ssh
        option target           ACCEPT

config forwarding
        option src              lan
        option dest             wan

#! Allow multiSSID wlgst zone if not bridging <---
config zone
	option name		wlgst
	option input		REJECT
	option forward		REJECT
	option output		ACCEPT

#! Allow multiSSID wlgst to internet on wan <---
config	forwarding
	option src	wlgst
	option dest	wan

#! Allow multiSSID wlgst to DNS <---
#! Client DNS queries ordinate from dynamic UDP ports (>1023) 
config 	rule 
	option src 		wlgst 
	option dest_port 	53 
	option proto 		tcpudp 
	option target 		ACCEPT

#! Allow multiSSID wlgst to DHCP -> Router <---
#! DHCP communication uses UDP ports 67-68 
config 	rule 
	option src	wlgst 
	option src_port 67-68 
	option dest_port	67-68 
	option proto	udp 
	option target 	ACCEPT

# We need to accept udp packets on port 68,
# see https://dev.openwrt.org/ticket/4108
config rule
	option name		Allow-DHCP-Renew
	option src		wan
	option proto		udp
	option dest_port	68
	option target		ACCEPT
	option family		ipv4

# Allow IPv4 ping
config rule
	option name		Allow-Ping
	option src		wan
	option proto		icmp
	option icmp_type	echo-request
	option family		ipv4
	option target		ACCEPT

# Allow DHCPv6 replies
# see https://dev.openwrt.org/ticket/10381
config rule
	option name		Allow-DHCPv6
	option src		wan
	option proto		udp
	option src_ip		fe80::/10
	option src_port		547
	option dest_ip		fe80::/10
	option dest_port	546
	option family		ipv6
	option target		ACCEPT

# Allow essential incoming IPv6 ICMP traffic
config rule
	option name		Allow-ICMPv6-Input
	option src		wan
	option proto	icmp
	list icmp_type		echo-request
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	list icmp_type		router-solicitation
	list icmp_type		neighbour-solicitation
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

# Allow essential forwarded IPv6 ICMP traffic
config rule                                   
	option name		Allow-ICMPv6-Forward
	option src		wan
	option dest		*
	option proto		icmp
	list icmp_type		echo-request
	list icmp_type		destination-unreachable
	list icmp_type		packet-too-big
	list icmp_type		time-exceeded
	list icmp_type		bad-header
	list icmp_type		unknown-header-type
	option limit		1000/sec
	option family		ipv6
	option target		ACCEPT

# include a file with users custom iptables rules
config include
	option path /etc/firewall.user

#example code# /etc/config/network

# Copyright (C) 2006 OpenWrt.org

config interface loopback
	option ifname	lo
	option proto	static
	option ipaddr	127.0.0.1
	option netmask	255.0.0.0

#!this interface is wired to the Wireless Leiden infrastructure!
config interface wan #!interface name wan vs eth0 applies /etc/config/firewall rules <---
	option ifname	eth0
	option type 	bridge #! use bridge to forward DHCP,DNS,captive portal,etc from Wireless Leiden node to 2nd multiSSID <--- 
	option proto	dhcp
#	option peerdns	172.16.6.9 #! if dhcp is used, local dns wleiden.net resolve fix?<---
#	option proto	static #! Unique static ip vs dhcp! <---
#	option ipaddr	172.16.6.13 #! Unique ip settings differ! <---
#	option netmask 	255.255.255.248 #! Unique ip settings differ! <---
#	option gateway	172.16.6.9 #! Unique ip settings differ! <--- 
#	option dns	172.16.6.9 #! Unique ip settings differ! <--- do you run your own dns server? otherwise 8.8.8.8	 
	
config interface lan
	option ifname 	wlan0
	option type 	bridge
#!       option proto    dhcp #!This makes the AP openvpn interface get a dhcp lease also uncomment the gateway option <--- 
#!       option gateway  0.0.0.0 #!0.0.0.0 protects the default route of getting replaced by dhcpserver behind openvpn tunnel <---             

#!Add this interface if you internally NAT/Route the 2nd multiSSID <---
config interface wlgst
	#option ifname	wlgst
	#option type	bridge
	option proto	static
	option ipaddr	192.168.5.1
	option netmask	255.255.255.0

#example code# /etc/config/wireless

config wifi-device  radio0 #! names and config parameters are different for wifi architectures, ar71xx,brcm47xx,x86,etc <---
	option type     mac80211 
	option channel  5 #! Unique channels must be set since multiple AP's at one site differs 1,6,11! <---
	option macaddr	MACADDRESS # this will be set by another script, leave it alone!!! <---
	option hwmode	11ng #when using 5ghz vs 2,4ghz '11na' must be set! <--- 
	option htmode	HT20
	list ht_capab	SHORT-GI-40
	list ht_capab	TX-STBC
	list ht_capab	RX-STBC1
	list ht_capab	DSSS_CCK-40

#! this interface is bridged to the vpn tunnel!
#! option server/key are credentials for radius client 
config wifi-iface
	option device   radio0
	option network	lan
	option bridge	br-lan
	option mode	ap
	option ssid	eduroam #! its all about this one!!!<---
	option encryption wpa2
        option server   192.168.4.1 #! Location of radius-server/proxy behind the tunnel 1812/1813 <---
        option key	testsecret #! Radius client password to connect to the radiusserver <---
	option isolate	1 #! wifi clients cannot connect to each other <---

config wifi-iface
        option device   radio0
        option network  wlgst #! use 'wlgst' for nat <---
        option mode     ap
        option ssid     ap.wlgst-bridge.wleiden.test #! Unique 2nd/virtual multiSSID! <---
        option encryption none

1.2c default Ubiquiti AirOS

De huidige 5.5.4 Ubiquiti AirOS software maakt het mogelijk het AP direct als radius "client" te laten fungeren. Dit is handig voor snel testen of uitrollen van inpandige afgeschermde infrastructuur waarbij het encrypten van het radius en internet verkeer via openvpn niet nodig is! Het is zo eenvoudig dat je enkel na het resetten van het apparaat, hem als normaal AP configureert(vergeet Airmax niet uit te zetten!) dan geef je bij Wireless security geen WPA2-"PSK" maar juist WPA2-"EAP" op. Direct verschijnt er een optie om een Authenticating/Accounting radius server/proxy op te geven met IP:PORT:SECRET, wanneer deze ingevuld worden is er direct al een werkend wpa2 enterprise AP oftwel eduroam hotspot! Verder is 'ntpclient' handig indien tijdsverschil te groot word om certificaat geldigheid te checken. Het remote sysloggen werkt ook. TODO SNMP client Verdere setup met NAT/Bridging/VLAN is wel aan te bevelen maar moet nog uitgezocht worden.

2 setup "Radius-Server/Proxy & gateway"

De rol van deze machine is het centraal afhandelen/doorzetten van het radius verkeer van verschillende eduroam AP's uit het wireless Leiden netwerk, daarnaast functioneert deze machine als internet gateway/concentrator van het verkeer van diezelfde eduroam AP's. De verbinding(en) tussen de eduroam AP's en deze centrale machine worden met openvpn tunnels over het Wireless Leiden netwerk tot stand gebracht. Als hardware gebruiken we een via-epia m met twee bedraade netwerk interfaces. De eerste netwerk interface is gekoppeld aan de gateway waarvan het externe ip gewhitelist moet zijn voor contact met de eduroam Surf Foundation radius proxy. De tweede netwerk interface hangt aan de Wireless Leiden infrastructuur. De plaatsing van deze machine komt het meest tot z'n recht op een locatie waar al het eduroam gerelateerde internetverkeer een daarvoor aangewezen internet verbinding van een educatieve i.s.p. (Surfnet) in kan. De surfnet aansluiting van Universiteit Leiden in de Pieterskerk is daarvoor uitstekend geschikt en geoorloofd! Na de installatie van het OS FREEBSD/DEBIAN, word de benodigde software freeradius, isc-dhcp-server, openvpn en syslog-ng geladen en geconfigureerd. Tenslotte moet er een nat/gateway met bijbehorende firewall rules worden opgezet en heeft het pakket openvpn keys/certificates nodig zie 3 certnode van deze handleiding!

2.1a Install & configure FreeBSD 8.3

TODO:Ligt een kant en klare FREEBSD 8.3 disk klaar hoe verder te configureren?

2.1b Install & configure debian 7 wheezy

Voor het OS is debian 7 wheezy i386 gekozen, dit omdat de VIA-EPIA-m geen 5/686 cmov cpu instructieset ondersteunt! De definitieve setup zal op ubuntu 12.04 lts server of freebsd draaien. Met een minimale install inclusief "SSH server" en "standaard tools" word deze debian 7 installatie later uitgebouwd en geconfigureerd. Installeer eerst debian op betreffende machine, download hiervoor de cd/usb image, plaats deze op usbstick en start de installatie. Opmerking, onthoud dat de machine tijdens de installatie en daarna toegang tot internet nodig heeft om alle pakketten te installeren en dus de configuratie te voltooien!

## prepare install media
# download mini.iso
wget http://ftp.nl.debian.org/debian/dists/wheezy/main/installer-i386/current/images/netboot/mini.iso
# put image on usb stick
sudo dd if=mini.iso of=/dev/sdstick

Boot the usb-stick with the debian installation and pay attention to the devicename of the internal harddisk you are installing debian onto, aka "/dev/sdb". During "tasksel" choose "SSH server" and "Standard system utilities". When reaching the end of the installation, mind that "Grub2" might install to the usb-stick /dev/sda while while the debian install is on /dev/sdb, therefor you have to manually install Grub to /dev/sdb otherwise install might fail. After the install (postinstall) the following packages freeradius, isc-dhcp-server, openvpn and syslog-ng will be installed and configured. To finish local nat/routing and firewall rules are needed and completing openvpn setup needs keys/certifactes made in 3 certnode of this howto.

## postinstall
cd /etc
cp rc.local rc.local.ori
nano rc.local #put before exit0
        setterm -blength 0 #kills annoying pc speaker after reboot!!!

## enlarge bash_history
nano /root/.bashrc
        export HISTFILESIZE=10000 #enlarges bash history!

## update/install packages
apt-get update
apt-get install subversion openvpn freeradius isc-dhcp-server syslog-ng vlan tcpdump ipcalc memtest86+

## backup original config files/folders
cp -r openvpn openvpn.ori
cp -r freeradius freeradius.ori
#rm -r freeradius/*  #--depth-empty svn?
cp -r dhcp dhcp.ori
cp -r syslog-ng syslog-ng.ori

## setup network interfaces
cp /etc/network/interfaces /etc/network/interfaces.ori
nano /etc/network/interfaces

#example code# /etc/network/interfaces

#The loopback network interface
auto lo
iface lo inet dhcp

# The primary network interface to internet
allow-hotplug eth0
iface eth0 inet dhcp

# The secondary network to Wireless Leiden
allow-hotplug eth1
iface eth1 inet static
        address 172.17.169.67 #! depends on where machine is located in Wireless Leiden network <---
        netmask 255.255.255.0
#       network
#       broadcast
#       gateway

# The openvpn interface
allow-hotplug tap0
iface tap0 inet static
        address 192.168.4.1
        netmask 255.255.255.0 #! bigger subnet for more clients/AP's? <---

Continue setting up freeradius. See following 5 example config files for eduroam SP + idP setup.

#example code# /etc/freeradius/radiusd.conf

prefix = /usr
exec_prefix = /usr
sysconfdir = /etc
localstatedir = /var
sbindir = ${exec_prefix}/sbin
logdir = /var/log/freeradius
raddbdir = /etc/freeradius
radacctdir = ${logdir}/radacct
name = freeradius
confdir = ${raddbdir}
run_dir = ${localstatedir}/run/${name}
db_dir = ${raddbdir}
libdir = /usr/lib/freeradius
pidfile = ${run_dir}/${name}.pid
user = freerad
group = freerad
max_request_time = 40
cleanup_delay = 5
max_requests = 4096
listen {
	type = auth
	ipaddr = *
	port = 1812
}
listen {
	type = acct
	ipaddr = 0
	port = 1813
}
hostname_lookups = no
allow_core_dumps = no #yes is for debugging! <---
regular_expressions	= yes
extended_expressions	= yes
log {
	destination = files
	file = ${logdir}/radius.log
	syslog_facility = daemon
	stripped_names = no
	auth = yes
	auth_badpass = yes
	auth_goodpass = yes
}
checkrad = ${sbindir}/checkrad
security {
	max_attributes = 200
	reject_delay = 0 # cleanup delay ?
	status_server = yes # zombie ? 
}
$INCLUDE ${raddbdir}/clients.conf
$INCLUDE ${raddbdir}/sites-enabled/eduroam
$INCLUDE ${raddbdir}/sites-enabled/eduroam-inner-tunnel
thread pool {
	start_servers = 5
	max_servers = 32
	min_spare_servers = 3
	max_spare_servers = 10
	max_requests_per_server = 0
}
modules {
	$INCLUDE ${raddbdir}/eap.conf
	$INCLUDE ${raddbdir}/modules/
#	$INCLUDE ${raddbdir}/modules/preprocess
#	$INCLUDE ${raddbdir}/modules/mschap
#	$INCLUDE ${raddbdir}/modules/chap
#	$INCLUDE ${raddbdir}/modules/digest
#	$INCLUDE ${raddbdir}/modules/files
#	$INCLUDE ${raddbdir}/modules/expiration
#	$INCLUDE ${raddbdir}/modules/logintime
#	$INCLUDE ${raddbdir}/modules/pap
#	$INCLUDE ${raddbdir}/modules/unix
#	$INCLUDE ${raddbdir}/modules/acct_unique
#	$INCLUDE ${raddbdir}/modules/attr_filter
#	$INCLUDE ${raddbdir}/modules/detail
#	$INCLUDE ${raddbdir}/modules/detail.log
#	$INCLUDE ${raddbdir}/modules/radutmp
#	$INCLUDE ${raddbdir}/modules/exec
#	$INCLUDE ${raddbdir}/modules/realm
}
proxy_requests  = yes
$INCLUDE ${raddbdir}/proxy.conf

#example code# /etc/freeradius/clients.conf

#clients are Accesspoints not users!

#as idP requests from other eduroam institutions to 
#authenticate your users for realm wleiden.net go here
client antarctica-flr-1 {
        ipaddr                          = 145.100.x.x
        netmask                         = 32
        secret                          = secretstuff
        require_message_authenticator   = no
        shortname                       = antarctica-flr-1
        nastype                         = other
        virtual_server                  = eduroam
}

#from uu surfnet eyof (accesspoins)
client 131.211.0.0/16 {
  secret    = testsecret
  shortname = testsecret
  virtual_server = eduroam
}

#from the openvpn tunnel (accesspoints)
client 192.168.4.0/24 {
  secret    = testsecret
  shortname = testsecret
  virtual_server = eduroam
}

#direct local eth1 test client without openvpn
client 172.17.169.66 {
  secret    = testsecret
  shortname = testsecret
  virtual_server = eduroam
}

#example code# /etc/freeradius/proxy.conf

#as eduroam idP this is for authenticating your local user realm locally
realm wleiden.net {
        nostrip
}

#as eduraom SP this is for forwarding user authenticate request
#via surfnet to their local institutions central
realm DEFAULT {
        authhost =  radius.showcase.surfnet.nl:1812
#       accthost =  radius.showcase.surfnet.nl:1813
        secret = foutjebedankt
        nostrip
        response_window = 20
        zombie_period = 40
        revive_interval = 60
        status_check = status-server
        check_interval = 30
        num_answers_to_alive = 3
}

#example code# /etc/freeradius/eap.conf

eap {
                default_eap_type = peap
                timer_expire     = 60
                ignore_unknown_eap_types = no
                cisco_accounting_username_bug = no

                tls {
                        certdir = ${confdir}/certs
                        cadir = ${confdir}/certs
                        private_key_password = whatever
                        private_key_file = ${certdir}/server.key
                        certificate_file = ${certdir}/server.pem
                        CA_file = ${cadir}/ca.pem
                        dh_file = ${certdir}/dh
                        random_file = /dev/urandom
                        fragment_size = 2048
                        include_length = yes
                        check_crl = no
                        cipher_list = "DEFAULT"
                }

                ttls {
                        default_eap_type = mschapv2
                        copy_request_to_tunnel = yes
                        use_tunneled_reply = yes
                        virtual_server = eduroam-inner-tunnel
                }

                peap {
                        default_eap_type = mschapv2
                        copy_request_to_tunnel = yes
                        use_tunneled_reply = yes
                        virtual_server = eduroam-inner-tunnel
                }

                mschapv2 {
                }

}

#example code# /etc/freeradius/sites-enabled/eduroam

server eduroam {

authorize {
	#preprocess
	#chap
	#mschap
	#digest
	#DEFAULT
        auth_log
	suffix
        eap {
		ok = return
	}
	#files
	#pap
        }

authenticate {
	#Auth-Type PAP {
	#	pap
	#}
	#Auth-Type CHAP {
	#	chap
	#}
	#Auth-Type MS-CHAP {
	#	mschap
	#}
	#digest
	#unix
	eap
	#pap
        }

preacct {
                suffix
        }

accounting {
        }



session {
	radutmp
}

post-auth {
        reply_log
        Post-Auth-Type REJECT {
                reply_log
        }
}

pre-proxy {
        pre_proxy_log
        if (pre-proxy:Packet-Type != Accounting-Request) {
                attr_filter.pre-proxy
        }
}

post-proxy {
                post_proxy_log
                attr_filter.post-proxy
	   }
}

#example code# /etc/freeradius/sites-enabled/eduroam-inner-tunnel

server eduroam-inner-tunnel {

authorize {
        auth_log
        eap
        files
        mschap
        pap
}

authenticate {
        Auth-Type PAP {
                pap
        }
        Auth-Type MS-CHAP {
                mschap
        }
        eap
}

post-auth {
        reply_log
        Post-Auth-Type REJECT {
               reply_log
        }
}

}

#example code# /etc/freeradius/users

radiustest@wleiden.net               Cleartext-Password := "abcdefg123"
2.1bb Freeradius TTLS/PEAP certificates

During install of freeradius, certificates are probably auto generated see "/etc/freeradius/certs" folder. These are needed for the eduroam idP part to allow local authentication of the users we created with a "@wleiden.net" realm. However these certificates are made with a common/default credentials like "Freeradius CA etc" but they can also be customized "Wireless Leiden CA department et " by editing the *.cnf (ca, client, server)files and running the ./bootstrap command. See /usr/share/doc/freeradius/examples/certs/. Probably there is still some parameter in one of the *.cnf file that is common between the ca client and server, therefor it also writes the private key into the public certificate?

  • Bootstrap will probably not run for a second time so move/delete all other files excepts these: bootstrap ca.cnf client.cnf README server.cnf xpextensions.
  • For editing/customizing the *.cnf files make sure the "server.cnf" and "client.cnf" have a different "commonname" at the end of their files otherwise database TXTDB 2 error.
  • Warning the *.pem file we will deploy among users needs to be stripped of bag attributes and PRIVATEKEY!!!!

*Mac/Linux

The "server.pem" file is the one that needs to be distributed/deployed among the eduroam users to correctly setup their supplicants for safely logging in, for Mac and Linux. For Mac it works, only validating the origin of the certificate !ITSELF! gives a warning (red* mark), since we didn't use/bought a known verified root CA so Mac OSX cannot Validate the "WirelessLeiden CA department" with the certificates it already has from verizon/thawte/etc. We can buy a certificate or we need to supply our own ROOT CA in our case "ca.pem" file. Than the Mac operating systems thinks everything is fine and the red mark about a certificate from a possible unknown provider will be gone. After importing this "root" "ca.pem" it can be easily converted by Mac OSX to "ca.cer" to be usable by Windows XP-8, since windows systems only allows Root (dutch=basis) certificates "ca.cer" to match its radius supplicant instead of "server.pem".

*Windows

In Windows double click the ca.cer file and import it into the ROOT store! Than you will be able to select it in the PEAP / supplicant option when you setup the eduroam window in network settings! Freeradius by default creates a ca.der file which can be renamed to cer to be used by windows. If Freeradius/certs/ folder also contains a ca.cer it can be automatically be pushed to windows clients for installing!

Convert a DER file (.crt .cer .der) to PEM openssl x509 -inform der -in certificate.cer -out certificate.pem

Convert a PEM file to DER openssl x509 -outform der -in certificate.pem -out certificate.der

## prepare folder to regenerate certificates
cd /usr/share/doc/freeradius/examples/certs/
mkdir oldcertsconfig
mkdir configbackup
cp * oldcertsconfig
cp bootstrap ca.cnf client.cnf README server.cnf xpextensions configbackup
rm *
cp configbackup/* . #now you have a fresh template to start from!

## edit certificate template, make common name differ 
ca.cnf client.cnf server.cnf

## generate new certificates
./bootstrap

## copy/overwrite certificates to freeradius folder
sudo cp dh ca.pem server.pem server.key server.crt /etc/freeradius/certs/

Continue setting up isc-dhcp-server. Besides editing the conf file, the service also needs to be removed from its default boot routine because it starts to early before its openvpn interface is online!

#example code# /etc/dhcp/dhcpd.conf

option domain-name "eduroam.org";
option domain-name-servers 8.8.8.8; #! since no local dns server is running on this machine specify a correct one! <---
default-lease-time 600;
max-lease-time 7200;
#subnet 192.168.4.0 netmask 255.255.255.0 {
#	range 192.168.4.100 192.168.4.150;
#	option routers 192.168.4.1;

#ap's different lease
class "ubntaps" {
	match if (substring (hardware, 1, 3) = DC:9F:DB);
}

class "eduroamusers" {
	match if not (substring (hardware, 1, 3) = DC:9F:DB);
}

subnet 192.168.4.0 netmask 255.255.255.0 {
	option routers 192.168.4.1;

pool {
	allow members of "ubntaps";
        range 192.168.4.3 192.168.4.66;
}

pool {
	allow members of "eduroamusers";
	range 192.168.4.150 192.168.4.250;
}

}


}

Remove isc-dhcp-server from its normal startup instance!

update-rc.d isc-dhcp-server disable

Continue setting up openvpn. Remember that the openvpn server needs:'openvpn.conf', 'up.sh' (script that will initiate the isc-dhcp-server as soon as the openvpn tap0 interface is available) and offcourse server-certificate files (created in part 3.1 of this howto)!

#example code# /etc/openvpn/openvpn.conf

port 1194 
proto tcp #udp 
dev tap0
ca /etc/openvpn/ca.crt
cert /etc/openvpn/eduradprox.crt #!check name <---
key /etc/openvpn/eduradprox.key #!check name <---
dh /etc/openvpn/dh1024.pem
server-bridge 192.168.3.1 255.255.255.0 192.168.3.100 192.168.3.150 #! still not understood? <---
mode server
persist-key
persist-tun
verb 4
log /var/log/openvpn.log
script-security 2 #! Allows isc-dhcp-server as external program to be started by up.sh <---
up /etc/openvpn/up.sh
#duplicate-cn #! allowing this lowers security<---
status /var/db/openvpn-status.log
keepalive 10 180

#example code# /etc/openvpn/up.sh

#!/bin/sh
ifup tap0 >/dev/null 2>&1 #allow-hotplug takes care of this?
#/sbin/ifconfig $1 192.168.4.1/24 up | exit 0
/bin/sleep 7
service isc-dhcp-server restart >/dev/null 2>&1
#/sbin/ifconfig bridge0 addm $1 | exit 0

Flag the up.sh script as executable other wise openvpn cannot run!

chmod +x /etc/openvpn/up.sh

Copy the following server/eduradprox files made on the certnode /etc/openvpn/ to the openvpn server directory.

cp eduradprox.key eduradprox.crt ca.crt dh1024.pem /etc/openvpn/

Setup syslog-ng, this will sort remote log files by hostname and day!

#example code# /etc/syslog-ng/conf.d/00load-remote.conf

source s_net { udp(); };
destination df_remote { file("/var/log/remote-log/AP$HOST/$DAY$MONTH$YEAR.log" owner(root) group(adm) perm(0600) create_dirs(yes) dir_perm(0700)); };
log { source(s_net); destination(df_remote); };

To allow nat/routing and function as a local gateway/concentrator for the tunneld traffic from eduroam accesspoints (openvpn clients) the following config must be set every boot.

## add the following firewall masquerade code "quick and dirty" at the end of the rc.local file before exit0!
nano /etc/rc.local

#example code# /etc/rc.local

#enable forwarding at ip level
echo "1" > /proc/sys/net/ipv4/ip_forward

#enable nat/routing from eth0
/sbin/iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

#enable nat/routing to eth0 directly
/sbin/iptables -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i eth1 -o eth0 -j ACCEPT

#enable nat/routing to tap0 openvpn
/sbin/iptables -A FORWARD -i eth0 -o tap0 -m state --state RELATED,ESTABLISHED -j ACCEPT
/sbin/iptables -A FORWARD -i tap0 -o eth0 -j ACCEPT

#before exit 0

TODO firewall rules Lokaal netwerk nog afschermen!!! zodat eduroam alleen internet op kan en niet netwerk van anywi/katzy/radiusverkeer, wellicht bepaalde porten filteren eduroamcookbook?

3 certnode & easy-rsa

Voor het functioneren van openvpn waaronder beveiligen en herkennen van server en unieke clients word easy-rsa gebruikt. Het idee is om op een vertrouwde permanente machine "certnode" eenmalig een blijvende opzet te maken met een openvpn "server" certificate voor de "radius-server/proxy", waarvan weer afgeleide client certificaten voor de verschillende accesspoints gemaakt kan worden. Het eerste gebeurt eenmalig en zal lokaal op de certnode bewaart moeten blijven. Het tweede gebeurt iedere keer wanneer er een "eduroam" AP bij komt aan het Wireless Leiden netwerk. Het generieke server certificaat + openvpn settings zal eenmalig van de certnode op de radius-server/proxy geplaatst moeten worden. De unieke client certificaten en config moeten voor ieder nieuwe/extra "eduroam" AP apart op de certnode aangemaakt worden en eenmalig per uniek AP geconfigureerd! Hierdoor zijn de eduroam AP's individueel te volgen, te beheren en mogelijk toegang te ontzeggen tot de"radius-server/proxy & gateway" wanneer dat nodig is. Het opzetten van de certnode word bij stap 3.1 behandeld, het aanmaken van afgeleide client certifcaten bij 3.2. Let op, leden van Wireless Leiden kunnen de eerste twee stappen overslaan aangezien zij de certnode "sunfire" moeten gebruiken (mits deze geconfigureerd is) en kunnen direct naar stap 3.3.

3.1 setup certnode

Op een ubuntu 12.04LTS installatie of livecd moet je het easy-rsa pakket dat met "openvpn" komt installeren. Opmerking, houd er rekening mee dat wanneer dit op een livecd gedraait word natuurlijk het permanente karakter verloren gaat! De inhoud van de /etc/openvpn map moet dan natuurlijk bewaard worden anders zal er per livecd sessie, opnieuw server certificaten gegenereerd moeten worden waardoor de afgeleide client certificaten en key's met de server certifcaten uit eerdere/oudere livecd sessie natuurlijk incompatible zijn!

Setup openvpn easy-rsa certnode

## install openvpn in ubuntu 12.04
sudo apt-get install openvpn

## copy easy-rsa files for use
sudo mkdir -p /etc/openvpn/easy-rsa/keys/packages
sudo cp -r /usr/share/doc/openvpn/examples/easy-rsa/2.0/* /etc/openvpn/easy-rsa/

## setup openvpn easy-rsa "server"
# edit the end of the vars file to reflect the example code 
sudo nano /etc/openvpn/easy-rsa/vars

#example code# /etc/openvpn/easy-rsa/vars

export KEY_COUNTRY="NL"
export KEY_PROVINCE="ZH"
export KEY_CITY="Leiden"
export KEY_ORG="Stichting Wireless Leiden"
export KEY_EMAIL="$me@Wireless Leiden.nl"

Continue setup

## continue setup openvpn easy-rsa "server"
cd /etc/openvpn/easy-rsa/
sudo chown -R root:sudo .
sudo chmod g+w . #include the dot "."
source ./vars
./clean-all
./build-dh
sudo ln -s openssl-1.0.0.cnf openssl.cnf
./pkitool --initca
./pkitool --server $servername/eduradprox

## create and copy server keys for usage
cd keys
openvpn --genkey --secret ta.key #tls key goed genoeg???
sudo cp eduradprox.crt eduradprox.key ca.crt dh1024.pem ta.key ../../ #! copy these to the "radius-server/proxy & gatewat" made in step 2.1b <---

## setup script for easy client certificate/key genereting individuel AP's
sudo touch /usr/local/bin/eduroam-openvpn-client-cert

#example code# /usr/local/bin/eduroam-ap-openvpn-client-cert

#!/bin/sh
# put me in /usr/local/bin
# use me as sudo file nameofnewap

FROMBASE=./keys
TOBASE=./keys/packages
COMMON=$1
TAR=$TOBASE/$COMMON.tar
USER=$SUDO_USER
CLIENT=client

if [ ! $1 ]; then
  echo "no name for AP  given"
  exit 1
fi 

if [ ! -f $TAR ]; then

  cd /etc/openvpn/easy-rsa

  . ./vars
  KEY_CN=$COMMON ./pkitool $COMMON

  mv $FROMBASE/$COMMON.key $FROMBASE/$CLIENT.key
  mv $FROMBASE/$COMMON.crt $FROMBASE/$CLIENT.crt

  tar -cf $TAR \
  $FROMBASE/ca.crt \
  $FROMBASE/$CLIENT.key \
  $FROMBASE/$CLIENT.crt \
  $FROMBASE/client.conf \
  $FROMBASE/up.sh

  cp $TAR /home/$USER/$COMMON.tar
  chown $USER /home/$USER/$COMMON.tar
  
else

  echo "$TAR was already created"
  exit 1

fi

Continue setup

## flag executable
sudo chmod +x /usr/local/bin/eduroam-ap-openvpn-client-cert

## fix /etc/openvpn/easy-rsa-/keys/packages permissions?
#sudo chmod -R 755 /etc/openvpn/easy-rsa-/keys/packages #!????

## setup openvpn client config see example
sudo touch /etc/openvpn/easy-rsa/keys/client.conf

#example code# /etc/openvpn/easy-rsa/keys/client.conf

client
dev tap0
proto tcp #! for flappering/instable routing on W.L. use tcp instead of udp <---
remote 172.17.169.67 1194 #! 53 location of openvpn server(radius-server/proxy & gateway) on the Wireless Leiden network! <---
resolv-retry infinite
persist-key
persist-tun
ca /etc/openvpn/ca.crt
cert /etc/openvpn/client.crt
key /etc/openvpn/client.key
verb 3
log /var/log/openvpn.log
up /etc/openvpn/up.sh
script-security 2
keepalive 10 180 #! these settings keep the tunnel alive on the W.L. network <---
#! run /bin/openvpnupdate update before uncommenting lladdress
#! lladdr MACADDRESS #! overides random MAC adress of the br-lan interface for controlled dhcp lease! <---

The permanent and single setup instance for the openvpn "certnode" is done! For creating subsequent client keys/certificates see 3.2/3.3.

3.2 certnode client

When adding new/extra "eduroam" AP's to the network, generate a *.tar with unique set of keys/config for each AP running the following command on the certnode. The resulting tar file will end up in the ~/ user home folder.

## replace $unique-ap-name with the name of your AP
sudo /usr/local/bin/eduroam-ap-openvpn-client-cert $unique-ap-name

3.3 certnode client@sunfire

Wireless Leiden leden die toegang hebben tot certnode "sunfire" kunnen daar inloggen en met sudo rechten het commando "eduroam-ap-openvpn-client" uitvoeren. Dat zal in hun ~/. home folder een *.tar bestand genereren dat certificaten/keys/config voor het op te zetten AP bevat.

sudo /usr/local/bin/eduroam-ap-openvpn-client-cert $unique-ap-name

4 batch-flash scripts

Op basis van een vaste lijst mac addressen en aanvullende parameters kan er geflashed worden. De files moeten nog gemaakt worden.

https://confluence.terena.org/display/H2eduroam/freeradius-idp https://confluence.terena.org/display/H2eduroam/freeradius-sp https://support.ssl.com/index.php?/Knowledgebase/Article/View/19 http://serverfault.com/questions/9708/what-is-a-pem-file-and-how-does-it-differ-from-other-openssl-generated-key-file

Old HOWTO

A. Achtergrond informatie

De afgelopen jaren is een technische oplossing ontwikkeld, in samenwerking met de Hogeschool Leiden, om Eduroam mogelijk te maken over een open netwerk zoals dat van Wireless Leiden.

We willen nu een test doen met een prototype. Hiervoor is een openvpn-server geinstalleerd in het kantoor van Prof. Katzy, verbonden aan NodePlantsoen2, met een verbinding naar een authenticatieserver van Surfnet. De resultaten van dit project worden hier gerapporteerd.

Configureren van benodigde apparatuur

De procedure is als volgt:

  • bouw een keer de OpenWRT-image
  • upload de image naar de Bullet2HP
  • aanmaken individuele vpn info
  • upload deze info naar bullet (dus niet openwrt opnieuw bouwen)
  • bouw een keer een "RadiusServer/Proxy"

B Opzetten van een host machine voor OpenWRT-images

De hostmachine is een PC met Ubuntu 11.10 waarbij de packages subversion, build-essential, flex, gettext, libz-dev, gawk, ncurses, libncurses5-dev en ncurses-term en tftp.

  1. Checkout the files we need
      svn co svn://svn.openwrt.org/openwrt/branches/backfire eduroam
      svn co http://svn.Wireless Leiden.nl/svn/code/eduroam-bullet/trunk/openwrt-package/post/ eduroam/package/post/
    
  2. cd into the build directory
      cd eduroam
    
  3. update Feeds
     ./scripts/feeds update
     ./scripts/feeds install -a
    
  4. Copy build config
      cp package/post/config .config
    
  5. BUILD
      make
    

B.1 upload custom OpenWRT-images naar bullet

Volgende stappen nog niet getest

  1. A. If you have a fresh new Air OS install you can upload the following image to

your bullet. You will get a message that this is not a ubnt image, you can ignore this message. Just in case be ready to use method B (recovery mode) with a ubnt image. bin/ar71xx/openwrt-ar71xx-ubnt-bullet-m-squashfs-factory.bin

  1. You need a tftp client for this, tested on Ubuntu 10.10
    1. First of all, power off the device
    2. Set your laptop in the 192.168.1.0/24 range, not being 192.168.1.20
    3. Connect the Bullet to your computer via a utp cable
    4. Begin by pressing the reset button. Keep holding it, then power the unit on. Wait 8 seconds then release the button. Signal LEDs will be lit indicating that the device is ready for recovery.
    5. On your computer go to the location of the OpenWRT build for your platform
      cd bin/ar71xx/
      
    6. tftp 192.168.1.20
      
    7. bin
      trace
      put openwrt-ar71xx-ubnt-bullet-m-squashfs-factory.bin
      quit
      
    8. Wait for a couple of minutes, your bullet will be reachable on 192.168.1.1 as openwrt
  1. Default password: Edur0@m

B.2 aanmaken individuele vpn info voor iedere bullet

  1. Creating unique vpn info:
  1. Make up a fancy name, in this manual it will be 'name' or <name>
  2. Login into a certnode (For wl:sunfire)
  3. Execute from your own user: sudo eduroam-cert <name>
  4. Output will look like:
    sunfire% sudo eduroam-cert name
    NOTE: If you run ./clean-all, I will be doing a rm -rf on /usr/local/share/doc/openvpn/easy-rsa/2.0/keys
    Generating a 1024 bit RSA private key
    .....++++++
    .....................++++++
    writing new private key to 'name.key'
    -----
    Using configuration from /usr/local/share/doc/openvpn/easy-rsa/2.0/openssl-0.9.8.cnf
    Check that the request matches the signature
    Signature ok
    The Subject's Distinguished Name is as follows
    countryName           :PRINTABLE:'NL'
    stateOrProvinceName   :PRINTABLE:'ZH'
    localityName          :PRINTABLE:'Leiden'
    organizationName      :PRINTABLE:'WL'
    organizationalUnitName:PRINTABLE:'Techniek'
    commonName            :PRINTABLE:'name'
    name                  :PRINTABLE:'WL'
    emailAddress          :IA5STRING:'noreply@Wireless Leiden.nl'
    Certificate is to be certified until Feb 27 13:32:30 2022 GMT (3650 days)
    
    Write out database with 1 new entries
    Data Base Updated
    
  1. in you home directory "on cert node sunfire itself" there will be a file called <name>.tar, copy this file to a network reachable the bullet locally

B.3 upload individuele openvpn info naar iedere bullet

  1. untar it:
    tar -xf <name>.tar
    
  2. In the current directory there will now be a folder called keys, cd in to it
  3. execeute:
    sh upload <local ip of bullet>
    
  4. Enter the root password twice, after which your bullet will reboot
  1. You bullet can be connected to the network an will build a vpn connection according to the data in the tar file. Mind de default password and security flaws.

To add: If something goes wrong I need the output of the following commands:

ls -l /usr/sbin/
cat /var/log/openvpn.log
ifconfig -a
iwconfig

Terug flashen van de oorspronkelijke ubiquity firmware op dezelfde wijze als boven omschreven, m.b.v. tftp. Dit moet in 'recovery modus': tijdens het opstarten de reset knop ingedrukt houden; het ip-adres van de bullet2 is dan weer 192.168.1.20.

C. Opzetten van een Radius proxy

De Authenticatieserver is een Radiusserver. De gebruikersaccounts van een Eduroam-instelling zijn niet beschikbaar bij andere instellingen (dus ook niet bij Wireless Leiden). Om 802.1x/Eduroam op het Wireless Leiden netwerk te laten werken zijn geen gebruikersaccounts nodig, de authenticatieverzoeken kunnen doorgezet worden naar de Surfnet-Radiusserver (proxy). De Surfnet-Radiusserver stuurt het verzoek op zijn beurt door naar de Radiusserver van de deelnemende instelling waaraan de gebruiker verbonden is. De Radiusserver van deze deelnemende instelling bevat de gebruikersaccounts. De Accept of de Reject op het authenticatieverzoek wordt via het zelfde pad teruggestuurd, waarna de node toegang verschaft (of niet).

Uitgangspunt: (embedded) pc met Freebsd 8.3(i386), minimal install

  1. Installeer de volgende software, niet alleen "portsnap" maar ook "make" heeft een werkende internetverbinding nodig!!! (log in als root)

fetch ports

 $ portsnap fetch extract

installeer subversion

 $ make -C /usr/ports/devel/subversion install clean BATCH=yes

installeer openvpn

 $ make -C /usr/ports/security/openvpn-devel install clean BATCH=yes

installeer freeradius

 $ make -C /usr/ports/net/freeradius2 install clean BATCH=yes

installeer isc-dhcp42-server

 $ make -C /usr/ports/*/isc-dhcp42-server install clean BATCH=yes

Installed programms/binaries need to be defined as global? svn command not found /usr/local/bin/svn #does exist!!!

checkout openvpn-wl

mkdir /usr/local/etc/openvpn #folder niet aanwezig
/usr/local/bin/svn co http://svn.Wireless Leiden.nl/svn/code/eduroam-bullet/trunk/openvpn-wl/ /usr/local/etc/openvpn

checkout freeradius

rm -R /usr/local/etc/raddb
svn co http://svn.Wireless Leiden.nl/svn/code/eduroam-bullet/trunk/radius-wl/ /usr/local/etc/raddb
chown -R freeradius:freeradius /usr/local/etc/raddb 

setup final config files and scripts

/usr/local/bin/svn checkout http://svn.Wireless Leiden.nl/svn/code/eduroam-bullet/trunk/files/ /usr/local/etc/ --depth empty
cd /usr/local/etc/
svn up dhcpd.conf

#add to# /etc/rc.conf

# enable: Freeradius
radiusd_enable="YES"

# enable: openvpn en tap
openvpn_enable="YES"
openvpn_if="tap"
ifconfig_tap0="192.168.4.1/24 up"

# We want to route the traffic
gateway_enable="YES"

# not described but exist in svn config

# Nodig voor bridges
cloned_interfaces="bridge0"

#gateway related
pf_enable="YES" #??? Firewall rules
dhcpd_enable="YES" #??? DHCP server 
ntpd_enable="YES" #??? Network Time for certificate validity

TODO: iptables uitzoeken en lease time for eduroam wireless clients i.v.t. ap's aanpassen dan test klaar!!!

1.1a openwrt country code setting? nanostation 5ghz /etc/config/wireless

11na channel 32-140

scripted easy password for quick flash and hashed new password in config file for permanent config? dnsmasq klaagt over niet kunnen verwerken van dhcp-request op de br-lan

TFTP scripted TFTP without 15sec pen reset

default AIROS reboot into tftp mode parameter 5.5.4 mtd cat /proc/mtd

DHCP range for openwrt AP's fixen classes mac prefix?

DHCPD.conf hoeft alleen nog een aanpassing voor andere lease time per klasse! op ieder ap, moet het openvpn fake mac address op dezelfde manier als het wifi-update script vervangen worden anders weet de dhcp server niet het juiste mac prefix te herkennen om de ap's in een andere interface te doen. ook een vraag is of die interface uberhaubt wel een ip hoeft te hebben?

TODO Verzin leuke manier om dit in een batch workflow voor veel AP's clients in te passen... denken we vanuit dit concept met tar bestand of moeten we iets maken dat meteen meedere parameters zoals multiSSID ip-adres hostname wifichannel etc meeneemt op basis van MAC adres? Nog uitzoeken welk deel er naar de server moet 4 bestanden ca dh1024 server.crt/key?

1/2 openvpn geen down.sh script voor server en client? testen broadcast AP's onderling onmogelijk? Filteren / dhcp bdup/stp requests WARNING: No server certificate verification method has been enabled.

Veiligheid aspect, VLAN/ radius authenticatie over zelfde tunnels als de clients... isolation tussen openvpn clients de AP's zelf is actief maar isolate van de wireless users op de client nog teste?

AIROS cli fw update /tmp/fwupdate.bin /usr/sbin/fwupdate -m #-d paramter?

AIROS vlan in cfg, lan0 1212 managment lan0 3131 brigge naar wireless bridge0 -remove wlan0 bridge1 add lan 3131 add wlan0

Proxy client to client ping???

2.1b radius-server/proxy bij katzy opnieuw opzetten en configureren

test draaien met meerdere AP's verspreid over het wireless leiden netwerk

Radius request lijken te worden gecached gebeurt dat op proxy met freeradius of in het ap met hostap? HOSTAPd op de accesspoints blijft caches bewaren!!! Force Reathorization

Attachments (1)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.