Skip to content

Commit 0515934

Browse files
author
Ritwick DSouza
committed
[raspbian] Added tests for WPA Enterprise
1 parent 33ec6dc commit 0515934

1 file changed

Lines changed: 66 additions & 0 deletions

File tree

tests/raspbian/test_hostapd.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,72 @@ def test_wpa_personal(self):
127127
'''
128128
self.assertEqual(o.render(), expected)
129129

130+
def test_wpa2_enterprise_ap(self):
131+
o = Raspbian({
132+
"radios": [
133+
{
134+
"name": "radio0",
135+
"phy": "phy0",
136+
"driver": "mac80211",
137+
"protocol": "802.11n",
138+
"channel": 3,
139+
"channel_width": 20,
140+
},
141+
],
142+
"interfaces": [
143+
{
144+
"type": "wireless",
145+
"name": "wlan0",
146+
"mac": "de:9f:db:30:c9:c5",
147+
"wireless": {
148+
"radio": "radio0",
149+
"mode": "access_point",
150+
"ssid": "ap-ssid-example",
151+
"encryption": {
152+
"protocol": "wpa2_enterprise",
153+
"server": "radius.example.com",
154+
"key": "the-shared-key",
155+
},
156+
},
157+
}
158+
]
159+
})
160+
161+
expected = '''# config: /etc/hostapd/hostapd.conf
162+
163+
interface=wlan0
164+
driver=nl80211
165+
hw_mode=g
166+
channel=3
167+
ieee80211n=1
168+
ssid=ap-ssid-example
169+
auth_algs=1
170+
wpa=2
171+
wpa_key_mgmt=WPA-EAP
172+
ieee8021x=1
173+
eap_server=1
174+
eapol_version=1
175+
auth_server_addr=radius.example.com
176+
auth_server_port=1812
177+
auth_server_shared_secret=the-shared-key
178+
179+
# config: /etc/network/interfaces
180+
181+
auto wlan0
182+
iface wlan0 inet manual
183+
184+
# script: /scripts/ipv4_forwarding.sh
185+
186+
sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
187+
sudo iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
188+
sudo iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
189+
sudo iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT
190+
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
191+
192+
'''
193+
194+
self.assertEqual(o.render(), expected)
195+
130196
@unittest.skip('Test skipping')
131197
def test_wep_open(self):
132198
o = Raspbian({

0 commit comments

Comments
 (0)