From 8b7b10249691d474339d3d1e75e1df18df873f13 Mon Sep 17 00:00:00 2001 From: aus Date: Tue, 20 Nov 2018 18:30:47 -0600 Subject: [PATCH] add logging --- README.md | 4 ++ bin/pfatt.sh | 133 +++++++++++++++++++++++++++------------------------ 2 files changed, 74 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 52c4556..d4ac320 100644 --- a/README.md +++ b/README.md @@ -195,6 +195,10 @@ That's it! Now your clients should be recieving public IPv6 addresses via DHCP6. # Troubleshooting +## Logging + +Output from `pfatt.sh` and `pfatt-5268AC.sh` can be found in `/var/log/pfatt.log`. + ## tcpdump Use tcpdump to watch the authentication, vlan and dhcp bypass process (see above). Run tcpdumps on the `$ONT_IF` interface and the `$RG_IF` interface: diff --git a/bin/pfatt.sh b/bin/pfatt.sh index 27cec99..b4c5483 100755 --- a/bin/pfatt.sh +++ b/bin/pfatt.sh @@ -3,84 +3,91 @@ set -e ONT_IF='em0' RG_IF='em1' -RG_ETHER_ADDR='xx:xx:xx:xx:xx:xx' +RG_ETHER_ADDR='xx:xx:xx:xx:xx:xx' +LOG=/var/log/pfatt.log -echo "$0: pfSense + AT&T U-verse Residential Gateway for true bridge mode" -echo "Configuration: " -echo " ONT_IF: $ONT_IF" -echo " RG_IF: $RG_IF" -echo "RG_ETHER_ADDR: $RG_ETHER_ADDR" +getTimestamp(){ + echo `date "+%Y-%m-%d %H:%M:%S :: [pfatt.sh] ::"` +} -echo -n "loading netgraph kernel modules... " -/sbin/kldload ng_etf -echo "OK! (any 'already loaded' errors can be ignored)" +{ + echo "$(getTimestamp) pfSense + AT&T U-verse Residential Gateway for true bridge mode" + echo "$(getTimestamp) Configuration: " + echo "$(getTimestamp) ONT_IF: $ONT_IF" + echo "$(getTimestamp) RG_IF: $RG_IF" + echo "$(getTimestamp) RG_ETHER_ADDR: $RG_ETHER_ADDR" -echo -n "attaching interfaces to ng_ether... " -/usr/local/bin/php -r "pfSense_ngctl_attach('.', '$ONT_IF');" -/usr/local/bin/php -r "pfSense_ngctl_attach('.', '$RG_IF');" -echo "OK!" + echo -n "$(getTimestamp) loading netgraph kernel modules... " + /sbin/kldload ng_etf + echo "OK! (any 'already loaded' errors can be ignored)" -echo "building netgraph nodes..." + echo -n "$(getTimestamp) attaching interfaces to ng_ether... " + /usr/local/bin/php -r "pfSense_ngctl_attach('.', '$ONT_IF');" + /usr/local/bin/php -r "pfSense_ngctl_attach('.', '$RG_IF');" + echo "OK!" -echo -n " creating ng_one2many... " -/usr/sbin/ngctl mkpeer $ONT_IF: one2many lower one -/usr/sbin/ngctl name $ONT_IF:lower o2m -echo "OK!" + echo "$(getTimestamp) building netgraph nodes..." -echo -n " creating vlan node and interface... " -/usr/sbin/ngctl mkpeer o2m: vlan many0 downstream -/usr/sbin/ngctl name o2m:many0 vlan0 -/usr/sbin/ngctl mkpeer vlan0: eiface vlan0 ether + echo -n "$(getTimestamp) creating ng_one2many... " + /usr/sbin/ngctl mkpeer $ONT_IF: one2many lower one + /usr/sbin/ngctl name $ONT_IF:lower o2m + echo "OK!" -/usr/sbin/ngctl msg vlan0: 'addfilter { vlan=0 hook="vlan0" }' -/usr/sbin/ngctl msg ngeth0: set $RG_ETHER_ADDR -echo "OK!" + echo -n "$(getTimestamp) creating vlan node and interface... " + /usr/sbin/ngctl mkpeer o2m: vlan many0 downstream + /usr/sbin/ngctl name o2m:many0 vlan0 + /usr/sbin/ngctl mkpeer vlan0: eiface vlan0 ether -echo -n " defining etf for $ONT_IF (ONT)... " -/usr/sbin/ngctl mkpeer o2m: etf many1 downstream -/usr/sbin/ngctl name o2m:many1 waneapfilter -/usr/sbin/ngctl connect waneapfilter: $ONT_IF: nomatch upper -echo "OK!" + /usr/sbin/ngctl msg vlan0: 'addfilter { vlan=0 hook="vlan0" }' + /usr/sbin/ngctl msg ngeth0: set $RG_ETHER_ADDR + echo "OK!" -echo -n " defining etf for $RG_IF (RG)... " -/usr/sbin/ngctl mkpeer $RG_IF: etf lower downstream -/usr/sbin/ngctl name $RG_IF:lower laneapfilter -/usr/sbin/ngctl connect laneapfilter: $RG_IF: nomatch upper -echo "OK!" + echo -n "$(getTimestamp) defining etf for $ONT_IF (ONT)... " + /usr/sbin/ngctl mkpeer o2m: etf many1 downstream + /usr/sbin/ngctl name o2m:many1 waneapfilter + /usr/sbin/ngctl connect waneapfilter: $ONT_IF: nomatch upper + echo "OK!" -echo -n " bridging etf for $ONT_IF <-> $RG_IF... " -/usr/sbin/ngctl connect waneapfilter: laneapfilter: eapout eapout -echo "OK!" + echo -n "$(getTimestamp) defining etf for $RG_IF (RG)... " + /usr/sbin/ngctl mkpeer $RG_IF: etf lower downstream + /usr/sbin/ngctl name $RG_IF:lower laneapfilter + /usr/sbin/ngctl connect laneapfilter: $RG_IF: nomatch upper + echo "OK!" -echo -n " defining filters for EAP traffic... " -/usr/sbin/ngctl msg waneapfilter: 'setfilter { matchhook="eapout" ethertype=0x888e }' -/usr/sbin/ngctl msg laneapfilter: 'setfilter { matchhook="eapout" ethertype=0x888e }' -echo "OK!" + echo -n "$(getTimestamp) bridging etf for $ONT_IF <-> $RG_IF... " + /usr/sbin/ngctl connect waneapfilter: laneapfilter: eapout eapout + echo "OK!" -echo -n " enabling one2many links... " -/usr/sbin/ngctl msg o2m: setconfig "{ xmitAlg=2 failAlg=1 enabledLinks=[ 1 1 ] }" -echo "OK!" + echo -n "$(getTimestamp) defining filters for EAP traffic... " + /usr/sbin/ngctl msg waneapfilter: 'setfilter { matchhook="eapout" ethertype=0x888e }' + /usr/sbin/ngctl msg laneapfilter: 'setfilter { matchhook="eapout" ethertype=0x888e }' + echo "OK!" -echo -n " removing waneapfilter:nomatch hook... " -/usr/sbin/ngctl rmhook waneapfilter: nomatch -echo "OK!" + echo -n "$(getTimestamp) enabling one2many links... " + /usr/sbin/ngctl msg o2m: setconfig "{ xmitAlg=2 failAlg=1 enabledLinks=[ 1 1 ] }" + echo "OK!" -echo "enabling interfaces..." -echo -n " $RG_IF ... " -/sbin/ifconfig $RG_IF up -echo "OK!" + echo -n "$(getTimestamp) removing waneapfilter:nomatch hook... " + /usr/sbin/ngctl rmhook waneapfilter: nomatch + echo "OK!" -echo -n " $ONT_IF ... " -/sbin/ifconfig $ONT_IF up -echo "OK!" + echo "$(getTimestamp) enabling interfaces..." + echo -n " $RG_IF ... " + /sbin/ifconfig $RG_IF up + echo "OK!" -echo -n "enabling promiscuous mode on $RG_IF... " -/sbin/ifconfig $RG_IF promisc -echo "OK!" + echo -n " $ONT_IF ... " + /sbin/ifconfig $ONT_IF up + echo "OK!" -echo -n "enabling promiscuous mode on $ONT_IF... " -/sbin/ifconfig $ONT_IF promisc -echo "OK!" + echo -n "$(getTimestamp) enabling promiscuous mode on $RG_IF... " + /sbin/ifconfig $RG_IF promisc + echo "OK!" -echo "ngeth0 should now be available to configure as your pfSense WAN" -echo "done!" + echo -n "$(getTimestamp) enabling promiscuous mode on $ONT_IF... " + /sbin/ifconfig $ONT_IF promisc + echo "OK!" + + echo "$(getTimestamp) ngeth0 should now be available to configure as your pfSense WAN" + echo "$(getTimestamp) done!" +} >> $LOG