Refreshed supplicant mode #44
1 changed files with 13 additions and 14 deletions
27
bin/pfatt.sh
27
bin/pfatt.sh
|
@ -28,8 +28,7 @@ getTimestamp(){
|
||||||
echo -n "$(getTimestamp) creating vlan node and interface... "
|
echo -n "$(getTimestamp) creating vlan node and interface... "
|
||||||
/usr/sbin/ngctl mkpeer $ONT_IF: vlan lower downstream
|
/usr/sbin/ngctl mkpeer $ONT_IF: vlan lower downstream
|
||||||
/usr/sbin/ngctl name $ONT_IF:lower vlan0
|
/usr/sbin/ngctl name $ONT_IF:lower vlan0
|
||||||
/usr/sbin/ngctl mkpeer vlan0: eiface vlan0 ether
|
/usr/sbin/ngctl mkpeer vlan0: eiface vlan0 ether
|
||||||
|
|
||||||
/usr/sbin/ngctl msg vlan0: 'addfilter { vlan=0 hook="vlan0" }'
|
/usr/sbin/ngctl msg vlan0: 'addfilter { vlan=0 hook="vlan0" }'
|
||||||
/usr/sbin/ngctl msg ngeth0: set $RG_ETHER_ADDR
|
/usr/sbin/ngctl msg ngeth0: set $RG_ETHER_ADDR
|
||||||
echo "OK!"
|
echo "OK!"
|
||||||
|
@ -47,14 +46,8 @@ getTimestamp(){
|
||||||
# /sbin/ifconfig $ONT_IF ether $RG_ETHER_ADDR
|
# /sbin/ifconfig $ONT_IF ether $RG_ETHER_ADDR
|
||||||
# echo "OK!"
|
# echo "OK!"
|
||||||
|
|
||||||
echo "$(getTimestamp) ngeth0 should now be available to configure as your pfSense WAN"
|
|
||||||
echo "$(getTimestamp) done!"
|
|
||||||
} >> $LOG
|
|
||||||
|
|
||||||
|
|
||||||
## Added code
|
## Added code
|
||||||
|
|
||||||
{
|
|
||||||
echo "$(getTimestamp) starting wpa_supplicant..."
|
echo "$(getTimestamp) starting wpa_supplicant..."
|
||||||
|
|
||||||
WPA_PARAMS="\
|
WPA_PARAMS="\
|
||||||
|
@ -77,34 +70,39 @@ getTimestamp(){
|
||||||
# if the above doesn't work try: WPA_DAEMON_CMD="/usr/sbin/wpa_supplicant -Dwired -i$ONT_IF -B -C /var/run/wpa_supplicant"
|
# if the above doesn't work try: WPA_DAEMON_CMD="/usr/sbin/wpa_supplicant -Dwired -i$ONT_IF -B -C /var/run/wpa_supplicant"
|
||||||
|
|
||||||
# kill any existing wpa_supplicant process
|
# kill any existing wpa_supplicant process
|
||||||
|
echo -n "$(getTimestamp) killing any existing wpa_supplicant process... "
|
||||||
PID=$(pgrep -f "wpa_supplicant.*ngeth0")
|
PID=$(pgrep -f "wpa_supplicant.*ngeth0")
|
||||||
if [ ${PID} > 0 ];
|
if [ ${PID} > 0 ];
|
||||||
then
|
then
|
||||||
echo "$(getTimestamp) pfatt terminating existing wpa_supplicant on PID ${PID}..."
|
echo "$(getTimestamp) pfatt terminating existing wpa_supplicant on PID ${PID}..."
|
||||||
RES=$(kill ${PID})
|
RES=$(kill ${PID})
|
||||||
fi
|
fi
|
||||||
|
echo "OK!"
|
||||||
|
|
||||||
# start wpa_supplicant daemon
|
# start wpa_supplicant daemon
|
||||||
|
echo -n "$(getTimestamp) starting wpa_supplicant daemon... "
|
||||||
RES=$(${WPA_DAEMON_CMD})
|
RES=$(${WPA_DAEMON_CMD})
|
||||||
PID=$(pgrep -f "wpa_supplicant.*ngeth0")
|
PID=$(pgrep -f "wpa_supplicant.*ngeth0")
|
||||||
echo "$(getTimestamp) pfatt wpa_supplicant running on PID ${PID}..."
|
echo "$(getTimestamp) pfatt wpa_supplicant running on PID ${PID}..."
|
||||||
|
|
||||||
# Set WPA configuration parameters.
|
# Set WPA configuration parameters.
|
||||||
echo "$(getTimestamp) pfatt setting wpa_supplicant network configuration..."
|
echo -n "$(getTimestamp) pfatt setting wpa_supplicant network configuration..."
|
||||||
IFS=","
|
IFS=","
|
||||||
for STR in ${WPA_PARAMS};
|
for STR in ${WPA_PARAMS};
|
||||||
do
|
do
|
||||||
STR="$(echo -e "${STR}" | sed -e 's/^[[:space:]]*//')"
|
STR="$(echo -e "${STR}" | sed -e 's/^[[:space:]]*//')"
|
||||||
RES=$(eval wpa_cli ${STR})
|
RES=$(eval wpa_cli ${STR})
|
||||||
done
|
done
|
||||||
|
echo "OK!"
|
||||||
|
|
||||||
# wait until wpa_cli has authenticated.
|
# wait until wpa_cli has authenticated.
|
||||||
|
echo -n "$(getTimestamp) waiting until wpa_cli has authenticated..."
|
||||||
WPA_STATUS_CMD="wpa_cli status | grep 'suppPortStatus' | cut -d= -f2"
|
WPA_STATUS_CMD="wpa_cli status | grep 'suppPortStatus' | cut -d= -f2"
|
||||||
IP_STATUS_CMD="ifconfig ngeth0 | grep 'inet\ ' | cut -d' ' -f2"
|
IP_STATUS_CMD="ifconfig ngeth0 | grep 'inet\ ' | cut -d' ' -f2"
|
||||||
|
echo "OK!"
|
||||||
|
|
||||||
echo "$(getTimestamp) pfatt waiting EAP for authorization..."
|
# Get authorization
|
||||||
|
echo "$(getTimestamp) pfatt waiting EAP for authorization..."
|
||||||
# TODO: blocking for bootup
|
|
||||||
while true;
|
while true;
|
||||||
do
|
do
|
||||||
WPA_STATUS=$(eval ${WPA_STATUS_CMD})
|
WPA_STATUS=$(eval ${WPA_STATUS_CMD})
|
||||||
|
@ -126,6 +124,7 @@ getTimestamp(){
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
echo "$(getTimestamp) pfatt ngeth0 should now be available to configure as your WAN..."
|
|
||||||
echo "$(getTimestamp) pfatt done!"
|
echo "$(getTimestamp) All done... ngeth0 should now be available to configure as your pfSense WAN"
|
||||||
|
|
||||||
} >> $LOG
|
} >> $LOG
|
||||||
|
|
Loading…
Reference in a new issue