diff --git a/.version b/.version new file mode 100644 index 0000000..49d5957 --- /dev/null +++ b/.version @@ -0,0 +1 @@ +0.1 diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..e69de29 diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..e69de29 diff --git a/ChangeLog b/ChangeLog new file mode 120000 index 0000000..d526672 --- /dev/null +++ b/ChangeLog @@ -0,0 +1 @@ +debian/changelog \ No newline at end of file diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 0000000..401ac70 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,22 @@ +cfgdir = $(datadir)/vyatta-cfg/templates +opdir = $(datadir)/vyatta-op/templates +curverdir = $(sysconfdir)/config-migrate/current +bin_sudo_usersdir = $(bindir)/sudo-users + +vprefix = /opt/vyatta +vsbindir = $(vprefix)/sbin + +sbin_SCRIPTS = +sbin_SCRIPTS += scripts/eap_proxy.py +sbin_SCRIPTS += scripts/vyatta-service-eap-proxy-update.sh + +bin_sudo_users_SCRIPTS = + +curver_DATA = + +cpiop = find . ! -regex '\(.*~\|.*\.bak\|.*\.swp\|.*\#.*\#\)' -print0 | \ + cpio -0pd + +install-exec-hook: + mkdir -p $(DESTDIR)$(cfgdir) + cd templates-cfg; $(cpiop) $(DESTDIR)$(cfgdir) diff --git a/NEWS b/NEWS new file mode 100644 index 0000000..e69de29 diff --git a/README b/README new file mode 100644 index 0000000..1688e84 --- /dev/null +++ b/README @@ -0,0 +1,3 @@ +This package has eap-proxy configuration templates and scripts. + +See README.md for details. diff --git a/configure.ac b/configure.ac new file mode 100644 index 0000000..a53e31d --- /dev/null +++ b/configure.ac @@ -0,0 +1,32 @@ +# Process this file with autoconf to produce a configure script. +AC_PREREQ(2.59) + +m4_define([VERSION_ID], [m4_esyscmd([ + if test -f .version ; then + head -n 1 .version | tr -d \\n + else + echo -n 2.4 + fi])]) +AC_INIT([vyatta-eap-proxy], VERSION_ID) + +test -n "$VYATTA_VERSION" || VYATTA_VERSION=$PACKAGE_VERSION + +AC_CONFIG_AUX_DIR([config]) +AM_INIT_AUTOMAKE([gnu no-dist-gzip dist-bzip2 subdir-objects]) +AC_PREFIX_DEFAULT([/opt/vyatta]) + +AC_ARG_ENABLE([nostrip], + AC_HELP_STRING([--enable-nostrip], + [include -nostrip option during packaging]), + [NOSTRIP=-nostrip], [NOSTRIP=]) + +AC_CONFIG_FILES([Makefile]) + +AC_SUBST(NOSTRIP) + +AC_PROG_CC +AC_PROG_CXX +AM_PROG_AS +AM_PROG_CC_C_O +AC_OUTPUT + diff --git a/copy_to_router.sh b/copy_to_router.sh deleted file mode 100755 index ebf5d8f..0000000 --- a/copy_to_router.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# just a helpful script for copying everything over to the router; assumes -# "router" resolves to your EdgeRouter. -set -ex -scp eap_proxy.py router:/config/scripts -scp eap_proxy.sh router:/config/scripts/post-config.d -scp eap_tcpdump.sh router: diff --git a/debian/README b/debian/README new file mode 100644 index 0000000..dece42b --- /dev/null +++ b/debian/README @@ -0,0 +1,6 @@ +The Debian Package vyatta-eap-proxy +---------------------------- + +This package has EAP proxy configuration templates and scripts. + + -- John Doe Sat, 1 Oct 2017 17:53:53 -0700 diff --git a/debian/autogen.sh b/debian/autogen.sh new file mode 100755 index 0000000..e8c94af --- /dev/null +++ b/debian/autogen.sh @@ -0,0 +1,11 @@ +#!/bin/sh + + +rm -rf config +rm -f aclocal.m4 config.guess config.statusconfig.sub configure INSTALL + +autoreconf --force --install + +rm -f config.sub config.guess +ln -s /usr/share/misc/config.sub . +ln -s /usr/share/misc/config.guess . diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..51d72a8 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,6 @@ +vyatta-eap-proxy (0.1.0) unstable; urgency=low + + * Initial release. + + -- John Doe Sat, 1 Oct 2017 17:53:53 -0700 + diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +5 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..1e6aac6 --- /dev/null +++ b/debian/control @@ -0,0 +1,13 @@ +Source: vyatta-eap-proxy +Section: contrib/net +Priority: extra +Maintainer: John Doe +Standards-Version: 3.9.6 +Build-Depends: debhelper (>= 5), autotools-dev, autoconf + +Package: vyatta-eap-proxy +Architecture: all +Depends: vyatta-cfg-system, vyatta-cfg +Replaces: vyatta-eap-proxy +Description: EAP proxy + Proxy EAP packets between two interfaces diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..e69de29 diff --git a/debian/docs b/debian/docs new file mode 100644 index 0000000..50bd824 --- /dev/null +++ b/debian/docs @@ -0,0 +1,2 @@ +NEWS +README diff --git a/debian/lintian b/debian/lintian new file mode 100644 index 0000000..52049bf --- /dev/null +++ b/debian/lintian @@ -0,0 +1,2 @@ +vyatta-eap-proxy: file-in-unusual-dir +vyatta-eap-proxy: dir-or-file-in-opt diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..56a3e43 --- /dev/null +++ b/debian/rules @@ -0,0 +1,105 @@ +#!/usr/bin/make -f +# -*- makefile -*- +# Sample debian/rules that uses debhelper. +# This file was originally written by Joey Hess and Craig Small. +# As a special exception, when this file is copied by dh-make into a +# dh-make output file, you may use that output file without restriction. +# This special exception was added by Craig Small in version 0.37 of dh-make. + +# Uncomment this to turn on verbose mode. +#export DH_VERBOSE=1 + + +# These are used for cross-compiling and for saving the configure script +# from having to guess our platform (since we know it already) +DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE) +DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE) +PACKAGE=vyatta-eap-proxy +PKGDIR=$(CURDIR)/debian/$(PACKAGE) + +CFLAGS = -Wall -g + +configure = ./configure +configure += --host=$(DEB_HOST_GNU_TYPE) +configure += --build=$(DEB_BUILD_GNU_TYPE) +configure += --prefix=/opt/vyatta +configure += --mandir=\$${prefix}/share/man +configure += --infodir=\$${prefix}/share/info +configure += CFLAGS="$(CFLAGS)" +configure += LDFLAGS="-Wl,-z,defs" + +ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS))) + CFLAGS += -O0 +else + CFLAGS += -O2 +endif + +configure: configure.ac Makefile.am + chmod +x debian/autogen.sh + debian/autogen.sh + +config.status: configure + dh_testdir + rm -f config.cache + $(configure) + +build: build-stamp + +build-stamp: config.status + dh_testdir + $(MAKE) + touch $@ + +clean: clean-patched + +# Clean everything up, including everything auto-generated +# at build time that needs not to be kept around in the Debian diff +clean-patched: + dh_testdir + dh_testroot + if test -f Makefile ; then $(MAKE) clean distclean ; fi + rm -f build-stamp + rm -f config.status config.sub config.guess config.log + rm -f aclocal.m4 configure Makefile.in Makefile INSTALL + rm -rf config + dh_clean + +install: build + dh_testdir + dh_testroot + dh_clean -k + dh_installdirs + + $(MAKE) DESTDIR=$(PKGDIR) install + + install -D --mode=0644 debian/lintian $(PKGDIR)/usr/share/lintian/overrides/$(PACKAGE) + +# Build architecture-independent files here. +binary-indep: build install + rm -f debian/files + dh_testdir + dh_testroot + dh_installchangelogs ChangeLog + dh_installdocs + dh_install + dh_installdebconf + dh_link + dh_strip + dh_compress + dh_fixperms + dh_installdeb + if [ -f "../.VYATTA_DEV_BUILD" ]; then \ + dh_gencontrol -- -v999.dev; \ + else \ + dh_gencontrol; \ + fi + dh_md5sums + dh_builddeb + +# Build architecture-dependent files here. +binary-arch: build install +# This is an architecture independent package +# so; we have nothing to do by default. + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install diff --git a/eap_proxy.sh b/eap_proxy.sh deleted file mode 100755 index 13389d1..0000000 --- a/eap_proxy.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# Startup script for eap_proxy.py. Place eap_proxy.py in /config/scripts and -# place this in /config/scripts/post-config.d -# -IF_WAN=eth0 -IF_ROUTER=eth2 -CONFIG_OPTIONS=( - --restart-dhcp --ignore-when-wan-up --ignore-logoff --ping-gateway) -DAEMON_OPTIONS=(--daemon --pidfile /var/run/eap_proxy.pid --syslog) -/usr/bin/python /config/scripts/eap_proxy.py \ - "$IF_WAN" "$IF_ROUTER" "${CONFIG_OPTIONS[@]}" "${DAEMON_OPTIONS[@]}" & diff --git a/eap_proxy.py b/scripts/eap_proxy.py similarity index 100% rename from eap_proxy.py rename to scripts/eap_proxy.py diff --git a/eap_tcpdump.sh b/scripts/eap_tcpdump.sh similarity index 100% rename from eap_tcpdump.sh rename to scripts/eap_tcpdump.sh diff --git a/scripts/vyatta-service-eap-proxy-update.sh b/scripts/vyatta-service-eap-proxy-update.sh new file mode 100755 index 0000000..41e6c84 --- /dev/null +++ b/scripts/vyatta-service-eap-proxy-update.sh @@ -0,0 +1,28 @@ +#!/bin/bash +BIN_PATH="/opt/vyatta/sbin/eap_proxy.py" +PIDFILE="/var/run/eap_proxy.pid" +CONFIG_OPTIONS=(\ + "ping-gateway" \ + "ignore-when-wan-up" \ + "ignore-start" \ + "ignore-logoff" \ + "restart-dhcp" \ + "set-mac" \ +) +DAEMON_OPTIONS=(--daemon --pidfile "$PIDFILE" --syslog) + +/sbin/start-stop-daemon --stop --retry 30 --pidfile "$PIDFILE" --oknodo --quiet + +if [[ "$COMMIT_ACTION" != "DELETE" ]]; then + if_wan=$(cli-shell-api returnValue service eap-proxy wan-interface) + if_router=$(cli-shell-api returnValue service eap-proxy router-interface) + + options=() + for option in "${CONFIG_OPTIONS[@]}"; do + if [[ "$(cli-shell-api returnValue service eap-proxy "$option")" == "enable" ]]; then + options+=("--$option") + fi + done + /sbin/start-stop-daemon --start --pidfile "$PIDFILE" --exec "$BIN_PATH" -- \ + "$if_wan" "$if_router" "${options[@]}" "${DAEMON_OPTIONS[@]}" +fi diff --git a/templates-cfg/service/eap-proxy/ignore-logoff/node.def b/templates-cfg/service/eap-proxy/ignore-logoff/node.def new file mode 100644 index 0000000..a9cfdb0 --- /dev/null +++ b/templates-cfg/service/eap-proxy/ignore-logoff/node.def @@ -0,0 +1,7 @@ +type: txt +default: "enable" +help: Enable/disable ignoring EAPOL-Logoff from router +allowed: echo enable disable +syntax:expression: $VAR(@) in "enable", "disable"; "ignore-logoff setting must be enable or disable" +val_help: enable; Always ignore EAPOL-Logoff from router (default) +val_help: disable; Don't ignore EAPOL-Logoff from router diff --git a/templates-cfg/service/eap-proxy/ignore-start/node.def b/templates-cfg/service/eap-proxy/ignore-start/node.def new file mode 100644 index 0000000..4709bf2 --- /dev/null +++ b/templates-cfg/service/eap-proxy/ignore-start/node.def @@ -0,0 +1,7 @@ +type: txt +default: "disable" +help: Enable/disable ignoring EAPOL-Start from router +allowed: echo enable disable +syntax:expression: $VAR(@) in "enable", "disable"; "ignore-start setting must be enable or disable" +val_help: enable; Always ignore EAPOL-Start from router +val_help: disable; Don't ignore EAPOL-Start from router (default) diff --git a/templates-cfg/service/eap-proxy/ignore-when-wan-up/node.def b/templates-cfg/service/eap-proxy/ignore-when-wan-up/node.def new file mode 100644 index 0000000..b9df429 --- /dev/null +++ b/templates-cfg/service/eap-proxy/ignore-when-wan-up/node.def @@ -0,0 +1,7 @@ +type: txt +default: "enable" +help: Enable/disable ignoring router packets when WAN is up (see ping-gateway) +allowed: echo enable disable +syntax:expression: $VAR(@) in "enable", "disable"; "ignore-when-wan-up setting must be enable or disable" +val_help: enable; Ignore router packets when WAN is up (default) +val_help: disable; Keep proxying router packets when WAN is up diff --git a/templates-cfg/service/eap-proxy/node.def b/templates-cfg/service/eap-proxy/node.def new file mode 100644 index 0000000..9b7e85a --- /dev/null +++ b/templates-cfg/service/eap-proxy/node.def @@ -0,0 +1,4 @@ +priority: 999 +help: EAP proxy settings +end: + sudo /opt/vyatta/sbin/vyatta-service-eap-proxy-update.sh diff --git a/templates-cfg/service/eap-proxy/ping-gateway/node.def b/templates-cfg/service/eap-proxy/ping-gateway/node.def new file mode 100644 index 0000000..c2037ba --- /dev/null +++ b/templates-cfg/service/eap-proxy/ping-gateway/node.def @@ -0,0 +1,7 @@ +type: txt +default: "enable" +help: Enable/disable pinging gateway to check if WAN is up (in addition to having an IP) +allowed: echo enable disable +syntax:expression: $VAR(@) in "enable", "disable"; "ping-gateway setting must be enable or disable" +val_help: enable; Ping gateway and check whether wan-interface.0 has an IP to check if WAN is up (default) +val_help: disable; Only check whether wan-interface.0 has an IP to check if WAN is up diff --git a/templates-cfg/service/eap-proxy/restart-dhcp/node.def b/templates-cfg/service/eap-proxy/restart-dhcp/node.def new file mode 100644 index 0000000..fecaa2c --- /dev/null +++ b/templates-cfg/service/eap-proxy/restart-dhcp/node.def @@ -0,0 +1,7 @@ +type: txt +default: "enable" +help: Enable/disable restarting dhclient on wan-interface.0 if WAN is not up after receiving EAP-Success on wan-interface (see ping-gateway) +allowed: echo enable disable +syntax:expression: $VAR(@) in "enable", "disable"; "restart-dhcp setting must be enable or disable" +val_help: enable; Restart dhclient on wan-interface.0 if WAN is not up after receiving EAP-Success on wan-interface (default) +val_help: disable; Do not restart dhclient on wan-interface.0 if WAN is not up after receiving EAP-Success on wan-interface diff --git a/templates-cfg/service/eap-proxy/router-interface/node.def b/templates-cfg/service/eap-proxy/router-interface/node.def new file mode 100644 index 0000000..9d5ff80 --- /dev/null +++ b/templates-cfg/service/eap-proxy/router-interface/node.def @@ -0,0 +1,3 @@ +type: txt +help: Interface name of the AT&T router +default: "eth2" diff --git a/templates-cfg/service/eap-proxy/set-mac/node.def b/templates-cfg/service/eap-proxy/set-mac/node.def new file mode 100644 index 0000000..1ef7d6a --- /dev/null +++ b/templates-cfg/service/eap-proxy/set-mac/node.def @@ -0,0 +1,7 @@ +type: txt +default: "disable" +help: Enable/disable setting wan-interface.0's MAC address to router's MAC address +allowed: echo enable disable +syntax:expression: $VAR(@) in "enable", "disable"; "set-mac setting must be enable or disable" +val_help: enable; Set wan-interface.0's MAC address to router's MAC address +val_help: disable; Do not set wan-interface.0's MAC address to router's MAC address (default) diff --git a/templates-cfg/service/eap-proxy/wan-interface/node.def b/templates-cfg/service/eap-proxy/wan-interface/node.def new file mode 100644 index 0000000..e111b80 --- /dev/null +++ b/templates-cfg/service/eap-proxy/wan-interface/node.def @@ -0,0 +1,3 @@ +type: txt +help: Interface name of the AT&T ONT/WAN +default: "eth0"