From 5ef27f558a3d8ea3ef2f1f76e9d9614f58fb01db Mon Sep 17 00:00:00 2001 From: Jed Reynolds Date: Tue, 2 Jul 2019 13:15:55 -0700 Subject: [PATCH] adds scp of config files to station --- setup-concentrator.sh | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/setup-concentrator.sh b/setup-concentrator.sh index 78a0e741..39d8d927 100755 --- a/setup-concentrator.sh +++ b/setup-concentrator.sh @@ -162,7 +162,8 @@ EOF function create_station_peer() { if [ -f "$SWANC/peers-available/${1}.conf-remote" ]; then echo "Peer $1 remote config already exists." - return; + echo "Remove $SWANC/peers-available/${1}.conf-remote to continue." + exit 1; fi cat > "$SWANC/peers-available/${1}.conf-remote" < $SWANC/remote-${1}-secrets.conf - echo "created $SWANC/remote-${1}-secrets.conf" + done > $SWANC/${1}-secrets.conf-remote + echo "created $SWANC/${1}-secrets.conf-remote" } function get_vrf_for_if() { @@ -284,12 +284,18 @@ function activate_all() { done } +function copy_config() { + local vrf=`get_vrf_for_if $WAN_IF` + ip vrf exec $vrf scp $WAN_IP:$SWANC/${1}-secrets.conf-remote $SWANC/${1}-secrets.conf + ip vrf exec $vrf scp $WAN_IP:$SWANC/peers-available/${1}.conf-remote $SWANC/peers-available/${1}.conf +} + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # M A I N # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -while getopts "a:c:d:p:v:behi" arg; do +while getopts "a:c:d:f:p:v:behi" arg; do case $arg in a) check_arg $OPTARG @@ -297,7 +303,7 @@ while getopts "a:c:d:p:v:behi" arg; do activate_peer $OPTARG ;; b) - enable_ipsec_if $WLAN_IF + enable_ipsec_if $WAN_IF ;; c) check_arg $OPTARG @@ -315,16 +321,22 @@ while getopts "a:c:d:p:v:behi" arg; do e) activate_all ;; - + f) + check_arg $OPTARG + copy_config $OPTARG + ;; h) cat <