-
Notifications
You must be signed in to change notification settings - Fork 0
/
802-1x_att.sh
executable file
·44 lines (39 loc) · 1.11 KB
/
802-1x_att.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh
# ATT 802.1x Bridge Adapter Setup Script
# Created: 2024-04-20
###
## Stage 0: Set Variables
###
export OPENSSL_CONF=/opt/att/openssl.cnf
WPA_CONF_PATH=
PORT_ISP=
PORT_1=
PORT_2=
BRIDGE_NAME=br0
###
# Stage 1: Enable 802.1x Redirection on WAN Port
###
ebtables -t nat -A PREROUTING -i $PORT_ISP -p 0x888e --log-level 6 -j redirect
ebtables -t nat -A POSTROUTING -o $PORT_ISP -p 0x888e --log-level 6 -j snat --to-src `awk --field-separator '["#]' '/identity=/ { print $2}' "$WPA_CONF_PATH/wpa_supplicant.conf"`
###
# Stage 2: Configure Bridge and enable WAN port
###
ip link add name $BRIDGE_NAME type bridge group_fwd_mask 8
ip link set $BRIDGE_NAME multicast off
ip link set $PORT_ISP master $BRIDGE_NAME
ip link set $PORT_1 master $BRIDGE_NAME
ip link set $PORT_2 master $BRIDGE_NAME
ip link set $PORT_ISP up
ip link set $BRIDGE_NAME up
###
# Stage 3: 802.1x Authentication
###
wpa_supplicant -B -Dwired -i $BRIDGE_NAME -c "$WPA_CONF_PATH/wpa_supplicant.conf" -P/var/run/wpa_supplicant.pid
sleep 10
wpa_cli logon
sleep 3
###
# Stage 4: Enable additional ports
###
ip link set dev $PORT_1 up
ip link set dev $PORT_2 up