From f5da0d943401e527f5162e9c6344deb65b19b045 Mon Sep 17 00:00:00 2001 From: "Ole Mathias Aa. Heggem" Date: Sat, 11 Apr 2020 01:06:20 +0200 Subject: TG19 Netconfig (Better late than never) --- tools/strip-netconf.sh | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'tools/strip-netconf.sh') diff --git a/tools/strip-netconf.sh b/tools/strip-netconf.sh index 79cf53a..5f8c834 100755 --- a/tools/strip-netconf.sh +++ b/tools/strip-netconf.sh @@ -7,7 +7,7 @@ ls -1 *.conf | while read file; do -e 's/encrypted-password ".+";/encrypted-password "";/g' \ -e 's/"scp:\/\/.+" password ".+";/"scp:\/\/user\@host\/some\/folder\/" password "";/g' \ -e 's/serial-number .+;/serial-number ;/g' \ - -e 's/community .+ {/community {/g' \ + -e 's/community .+ /community /g' \ -e '/\/\* dat/d' \ -e 's/ecdsa-sha2-nistp256-key .+;/ecdsa-sha2-nistp256-key ;/g' \ -e 's/collector .+;/collector ;/g' \ @@ -17,24 +17,19 @@ ls -1 *.conf | while read file; do $file > tmp/$file # Remove SSH-host-info - sed -i '' \ + sed -i tmp/$file \ -e '/ssh-known-hosts {/ {' -e 'n; s/host .\+ {/host {/' -e '}' \ tmp/$file - - # Remove stuff from ACL's - sed -i '' \ - -e ':again' -e N -e '$!b again' \ - -e 's/prefix-list mgmt-v4 {[^}]*}/prefix-list mgmt-v4 {\'$'\n'' \/\* KANDU PA-nett (brukt på servere, infra etc) \*\/\'$'\n'' 185.110.148.0\/22;\'$'\n'' }/g' \ - tmp/$file - sed -i '' \ + # Remove stuff from ACL's + sed -i tmp/$file \ -e ':again' -e N -e '$!b again' \ - -e 's/prefix-list mgmt-v6 {[^}]*}/prefix-list mgmt-v6 {\'$'\n'' \/\* KANDU PA-nett (den delen som er brukt på servere, infra etc) \*\/\'$'\n'' 2a06:5841::\/32;\'$'\n'' }/g' \ + -e 's/prefix-list mgmt-v4 {[^}]*}/prefix-list mgmt-v4 {\n }/g' \ tmp/$file - sed -i '' \ + sed -i tmp/$file \ -e ':again' -e N -e '$!b again' \ - -e 's/prefix-list mgmt {[^}]*}/prefix-list mgmt {\'$'\n'' 185.110.148.0\/22;\'$'\n'' 2a06:5841::\/32;\'$'\n'' }/g' \ + -e 's/prefix-list mgmt-v6 {[^}]*}/prefix-list mgmt-v6 {\n }/g' \ tmp/$file done -- cgit v1.2.3