Created
March 16, 2023 14:03
-
-
Save MightyMirko/158a1f4418bf540ed44449da776f1b10 to your computer and use it in GitHub Desktop.
WPA_SUPPLICANT PFSENSE
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root@fwl01:/cf/conf # cat start_8021x.sh | |
#!/usr/bin/env sh | |
echo "lets go" | |
# is /conf/start_8021x.sh | |
mkdir -p /var/run/dhclient | |
chmod 755 /var/run/dhclient | |
INTERFACE="re0" | |
WPA_DAEMON_CMD="wpa_supplicant -D wired -c /conf/wpa_supplicant.conf -i ${INTERFACE} -B" | |
WPA_STATUS_CMD="wpa_cli status | grep 'suppPortStatus' | cut -d= -f2" | |
# Start the WPA supplicant. | |
if [ `eval pgrep wpa_supplicant` > 0 ]; | |
then | |
echo "WPA supplicant process is running." | |
else | |
echo "Starting WPA supplicant." | |
`eval ${WPA_DAEMON_CMD}` | |
fi | |
# Wait until wpa_cli has authenticated. | |
echo -n "Waiting for 802.1x on ${INTERFACE} to authorize." | |
while true; | |
do | |
WPA_STATUS=`eval ${WPA_STATUS_CMD}` | |
if [ X${WPA_STATUS} = X"Authorized" ]; | |
then | |
echo "" | |
echo "Interface ${INTERFACE} is ${WPA_STATUS}." | |
echo "Waiting 60 seconds." | |
sleep 20 | |
echo "Resetting ${INTERFACE}." | |
ifconfig $INTERFACE down | |
sleep 3 | |
ifconfig $INTERFACE up | |
break | |
else | |
echo -n "." | |
sleep 1 | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
One can use shellcmd to start this script during boot or edit in xml file