From 33e24e989996ec809e1be696866258ce987cc527 Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Thu, 15 Sep 2016 11:40:03 +0200 Subject: Reimplementation of TriJetScud's commit:578688a25ba784d839512fefafab4cabdaf32fc5. Simpilfy the operational commands Instead of trying to parse the outout of ipsec or swanctl, just dump whatever swanctl outputs. --- .gitignore | 18 +----------------- configure.ac | 16 ---------------- templates/show/vpn/ipsec/sa/detail/node.def.in | 3 --- .../show/vpn/ipsec/sa/detail/peer/node.tag/node.def.in | 3 --- .../detail/peer/node.tag/tunnel/node.tag/node.def.in | 3 --- .../vpn/ipsec/sa/detail/profile/node.tag/node.def.in | 3 --- .../profile/node.tag/tunnel/node.tag/node.def.in | 3 --- templates/show/vpn/ipsec/sa/nat-traversal/node.def.in | 2 -- templates/show/vpn/ipsec/sa/node.def | 6 ++++++ templates/show/vpn/ipsec/sa/node.def.in | 3 --- templates/show/vpn/ipsec/sa/peer/node.tag/node.def.in | 3 --- .../ipsec/sa/peer/node.tag/tunnel/node.tag/node.def.in | 3 --- .../show/vpn/ipsec/sa/profile/node.tag/node.def.in | 3 --- .../sa/profile/node.tag/tunnel/node.tag/node.def.in | 3 --- templates/show/vpn/ipsec/sa/statistics/node.def.in | 3 --- .../vpn/ipsec/sa/statistics/peer/node.tag/node.def.in | 3 --- .../peer/node.tag/tunnel/node.tag/node.def.in | 3 --- .../ipsec/sa/statistics/profile/node.tag/node.def.in | 3 --- .../profile/node.tag/tunnel/node.tag/node.def.in | 3 --- 19 files changed, 7 insertions(+), 80 deletions(-) delete mode 100644 templates/show/vpn/ipsec/sa/detail/node.def.in delete mode 100644 templates/show/vpn/ipsec/sa/detail/peer/node.tag/node.def.in delete mode 100644 templates/show/vpn/ipsec/sa/detail/peer/node.tag/tunnel/node.tag/node.def.in delete mode 100644 templates/show/vpn/ipsec/sa/detail/profile/node.tag/node.def.in delete mode 100644 templates/show/vpn/ipsec/sa/detail/profile/node.tag/tunnel/node.tag/node.def.in delete mode 100644 templates/show/vpn/ipsec/sa/nat-traversal/node.def.in create mode 100644 templates/show/vpn/ipsec/sa/node.def delete mode 100644 templates/show/vpn/ipsec/sa/node.def.in delete mode 100644 templates/show/vpn/ipsec/sa/peer/node.tag/node.def.in delete mode 100644 templates/show/vpn/ipsec/sa/peer/node.tag/tunnel/node.tag/node.def.in delete mode 100644 templates/show/vpn/ipsec/sa/profile/node.tag/node.def.in delete mode 100644 templates/show/vpn/ipsec/sa/profile/node.tag/tunnel/node.tag/node.def.in delete mode 100644 templates/show/vpn/ipsec/sa/statistics/node.def.in delete mode 100644 templates/show/vpn/ipsec/sa/statistics/peer/node.tag/node.def.in delete mode 100644 templates/show/vpn/ipsec/sa/statistics/peer/node.tag/tunnel/node.tag/node.def.in delete mode 100644 templates/show/vpn/ipsec/sa/statistics/profile/node.tag/node.def.in delete mode 100644 templates/show/vpn/ipsec/sa/statistics/profile/node.tag/tunnel/node.tag/node.def.in diff --git a/.gitignore b/.gitignore index 470b73c..cce2a86 100644 --- a/.gitignore +++ b/.gitignore @@ -48,21 +48,5 @@ templates/show/vpn/ike/sa/node.def templates/show/vpn/ike/sa/peer/node.tag/node.def templates/show/vpn/ike/secrets/node.def templates/show/vpn/ike/status/node.def -templates/show/vpn/ipsec/sa/detail/node.def -templates/show/vpn/ipsec/sa/detail/peer/node.tag/node.def -templates/show/vpn/ipsec/sa/detail/peer/node.tag/tunnel/node.tag/node.def -templates/show/vpn/ipsec/sa/detail/profile/node.tag/node.def -templates/show/vpn/ipsec/sa/detail/profile/node.tag/tunnel/node.tag/node.def -templates/show/vpn/ipsec/sa/nat-traversal/node.def -templates/show/vpn/ipsec/sa/node.def -templates/show/vpn/ipsec/sa/peer/node.tag/node.def -templates/show/vpn/ipsec/sa/peer/node.tag/tunnel/node.tag/node.def -templates/show/vpn/ipsec/sa/profile/node.tag/node.def -templates/show/vpn/ipsec/sa/profile/node.tag/tunnel/node.tag/node.def -templates/show/vpn/ipsec/sa/statistics/node.def -templates/show/vpn/ipsec/sa/statistics/peer/node.tag/node.def -templates/show/vpn/ipsec/sa/statistics/peer/node.tag/tunnel/node.tag/node.def -templates/show/vpn/ipsec/sa/statistics/profile/node.tag/node.def -templates/show/vpn/ipsec/sa/statistics/profile/node.tag/tunnel/node.tag/node.def templates/show/vpn/ipsec/status/node.def -/scripts/vyatta-gen-x509-keypair \ No newline at end of file +/scripts/vyatta-gen-x509-keypair diff --git a/configure.ac b/configure.ac index 6002c2d..19a356f 100644 --- a/configure.ac +++ b/configure.ac @@ -54,22 +54,6 @@ AC_OUTPUT([ templates/generate/vpn/rsa-key/bits/node.tag/node.def templates/generate/vpn/rsa-key/bits/node.tag/random/node.tag/node.def templates/show/vpn/ipsec/status/node.def - templates/show/vpn/ipsec/sa/node.def - templates/show/vpn/ipsec/sa/nat-traversal/node.def - templates/show/vpn/ipsec/sa/statistics/node.def - templates/show/vpn/ipsec/sa/statistics/profile/node.tag/node.def - templates/show/vpn/ipsec/sa/statistics/profile/node.tag/tunnel/node.tag/node.def - templates/show/vpn/ipsec/sa/statistics/peer/node.tag/node.def - templates/show/vpn/ipsec/sa/statistics/peer/node.tag/tunnel/node.tag/node.def - templates/show/vpn/ipsec/sa/detail/node.def - templates/show/vpn/ipsec/sa/detail/profile/node.tag/node.def - templates/show/vpn/ipsec/sa/detail/profile/node.tag/tunnel/node.tag/node.def - templates/show/vpn/ipsec/sa/detail/peer/node.tag/node.def - templates/show/vpn/ipsec/sa/detail/peer/node.tag/tunnel/node.tag/node.def - templates/show/vpn/ipsec/sa/profile/node.tag/node.def - templates/show/vpn/ipsec/sa/profile/node.tag/tunnel/node.tag/node.def - templates/show/vpn/ipsec/sa/peer/node.tag/node.def - templates/show/vpn/ipsec/sa/peer/node.tag/tunnel/node.tag/node.def templates/show/vpn/debug/node.def templates/show/vpn/debug/detail/node.def templates/show/vpn/debug/peer/node.tag/node.def diff --git a/templates/show/vpn/ipsec/sa/detail/node.def.in b/templates/show/vpn/ipsec/sa/detail/node.def.in deleted file mode 100644 index 781d61b..0000000 --- a/templates/show/vpn/ipsec/sa/detail/node.def.in +++ /dev/null @@ -1,3 +0,0 @@ -help: Show details for all active IPsec Security Associations (SA) -run: sudo @SUDOUSRDIR@/vyatta-op-vpn.pl --show-ipsec-sa-detail - sudo @SUDOUSRDIR@/vyatta-op-vpnprof.pl --show-ipsec-sa-detail diff --git a/templates/show/vpn/ipsec/sa/detail/peer/node.tag/node.def.in b/templates/show/vpn/ipsec/sa/detail/peer/node.tag/node.def.in deleted file mode 100644 index 659acfa..0000000 --- a/templates/show/vpn/ipsec/sa/detail/peer/node.tag/node.def.in +++ /dev/null @@ -1,3 +0,0 @@ -help: Show details for all active IPsec Security Associations (SA) for a peer -allowed: @SUDOUSRDIR@/vyatta-op-vpn.pl --get-peers-for-cli -run: sudo @SUDOUSRDIR@/vyatta-op-vpn.pl --show-ipsec-sa-peer-detail="$7" diff --git a/templates/show/vpn/ipsec/sa/detail/peer/node.tag/tunnel/node.tag/node.def.in b/templates/show/vpn/ipsec/sa/detail/peer/node.tag/tunnel/node.tag/node.def.in deleted file mode 100644 index 5c121c3..0000000 --- a/templates/show/vpn/ipsec/sa/detail/peer/node.tag/tunnel/node.tag/node.def.in +++ /dev/null @@ -1,3 +0,0 @@ -help: Show details for the active IPsec Security Associations (SA) for a peer's tunnel -allowed: @SUDOUSRDIR@/vyatta-op-vpn.pl --get-conn-for-cli=${COMP_WORDS[6]} -run: sudo @SUDOUSRDIR@/vyatta-op-vpn.pl --show-ipsec-sa-conn-detail $7 $9 diff --git a/templates/show/vpn/ipsec/sa/detail/profile/node.tag/node.def.in b/templates/show/vpn/ipsec/sa/detail/profile/node.tag/node.def.in deleted file mode 100644 index bcbc520..0000000 --- a/templates/show/vpn/ipsec/sa/detail/profile/node.tag/node.def.in +++ /dev/null @@ -1,3 +0,0 @@ -help: Show details for all active IPsec Security Associations (SA) for a profile -allowed: @SUDOUSRDIR@/vyatta-op-vpnprof.pl --get-profiles-for-cli -run: sudo @SUDOUSRDIR@/vyatta-op-vpnprof.pl --show-ipsec-sa-profile-detail="$7" diff --git a/templates/show/vpn/ipsec/sa/detail/profile/node.tag/tunnel/node.tag/node.def.in b/templates/show/vpn/ipsec/sa/detail/profile/node.tag/tunnel/node.tag/node.def.in deleted file mode 100644 index e31b008..0000000 --- a/templates/show/vpn/ipsec/sa/detail/profile/node.tag/tunnel/node.tag/node.def.in +++ /dev/null @@ -1,3 +0,0 @@ -help: Show details for the active IPsec Security Associations (SA) for a tunnel bound to profile -allowed: @SUDOUSRDIR@/vyatta-op-vpnprof.pl --get-conn-for-cli=${COMP_WORDS[6]} -run: sudo @SUDOUSRDIR@/vyatta-op-vpnprof.pl --show-ipsec-sa-conn-detail $7 $9 diff --git a/templates/show/vpn/ipsec/sa/nat-traversal/node.def.in b/templates/show/vpn/ipsec/sa/nat-traversal/node.def.in deleted file mode 100644 index f3bbe87..0000000 --- a/templates/show/vpn/ipsec/sa/nat-traversal/node.def.in +++ /dev/null @@ -1,2 +0,0 @@ -help: Show all active IPsec Security Associations (SA) that are using NAT Traversal -run: sudo @SUDOUSRDIR@/vyatta-op-vpn.pl --show-ipsec-sa-natt diff --git a/templates/show/vpn/ipsec/sa/node.def b/templates/show/vpn/ipsec/sa/node.def new file mode 100644 index 0000000..99a5cc1 --- /dev/null +++ b/templates/show/vpn/ipsec/sa/node.def @@ -0,0 +1,6 @@ +help: Show all active IPsec Security Associations (SA) +run: if pgrep charon >&/dev/null; then + sudo /usr/sbin/swanctl --list-sas + else + echo -e "IPSec Process NOT Running\n" + fi diff --git a/templates/show/vpn/ipsec/sa/node.def.in b/templates/show/vpn/ipsec/sa/node.def.in deleted file mode 100644 index 036a1d7..0000000 --- a/templates/show/vpn/ipsec/sa/node.def.in +++ /dev/null @@ -1,3 +0,0 @@ -help: Show all active IPsec Security Associations (SA) -run: sudo @SUDOUSRDIR@/vyatta-op-vpn.pl --show-ipsec-sa - sudo @SUDOUSRDIR@/vyatta-op-vpnprof.pl --show-ipsec-sa diff --git a/templates/show/vpn/ipsec/sa/peer/node.tag/node.def.in b/templates/show/vpn/ipsec/sa/peer/node.tag/node.def.in deleted file mode 100644 index 1cae596..0000000 --- a/templates/show/vpn/ipsec/sa/peer/node.tag/node.def.in +++ /dev/null @@ -1,3 +0,0 @@ -help: Show all active IPsec Security Associations (SA) for a peer -allowed: @SUDOUSRDIR@/vyatta-op-vpn.pl --get-peers-for-cli -run: sudo @SUDOUSRDIR@/vyatta-op-vpn.pl --show-ipsec-sa-peer="$6" diff --git a/templates/show/vpn/ipsec/sa/peer/node.tag/tunnel/node.tag/node.def.in b/templates/show/vpn/ipsec/sa/peer/node.tag/tunnel/node.tag/node.def.in deleted file mode 100644 index 8cc8a9c..0000000 --- a/templates/show/vpn/ipsec/sa/peer/node.tag/tunnel/node.tag/node.def.in +++ /dev/null @@ -1,3 +0,0 @@ -help: Show the active IPsec Security Association (SA) for a peer's tunnel -allowed: @SUDOUSRDIR@/vyatta-op-vpn.pl --get-conn-for-cli=${COMP_WORDS[5]} -run: sudo @SUDOUSRDIR@/vyatta-op-vpn.pl --show-ipsec-sa-conn $6 $8 diff --git a/templates/show/vpn/ipsec/sa/profile/node.tag/node.def.in b/templates/show/vpn/ipsec/sa/profile/node.tag/node.def.in deleted file mode 100644 index 30ed853..0000000 --- a/templates/show/vpn/ipsec/sa/profile/node.tag/node.def.in +++ /dev/null @@ -1,3 +0,0 @@ -help: Show all active IPsec Security Associations (SA) for a profile -allowed: @SUDOUSRDIR@/vyatta-op-vpnprof.pl --get-profiles-for-cli -run: sudo @SUDOUSRDIR@/vyatta-op-vpnprof.pl --show-ipsec-sa-profile="$6" diff --git a/templates/show/vpn/ipsec/sa/profile/node.tag/tunnel/node.tag/node.def.in b/templates/show/vpn/ipsec/sa/profile/node.tag/tunnel/node.tag/node.def.in deleted file mode 100644 index 3d643bc..0000000 --- a/templates/show/vpn/ipsec/sa/profile/node.tag/tunnel/node.tag/node.def.in +++ /dev/null @@ -1,3 +0,0 @@ -help: Show the active IPsec Security Association (SA) for a profile's tunnel -allowed: @SUDOUSRDIR@/vyatta-op-vpnprof.pl --get-conn-for-cli=${COMP_WORDS[5]} -run: sudo @SUDOUSRDIR@/vyatta-op-vpnprof.pl --show-ipsec-sa-conn $6 $8 diff --git a/templates/show/vpn/ipsec/sa/statistics/node.def.in b/templates/show/vpn/ipsec/sa/statistics/node.def.in deleted file mode 100644 index 5832f1a..0000000 --- a/templates/show/vpn/ipsec/sa/statistics/node.def.in +++ /dev/null @@ -1,3 +0,0 @@ -help: Show statistics of all active tunnels that have IPsec Security Associations (SA) -run: sudo @SUDOUSRDIR@/vyatta-op-vpn.pl --show-ipsec-sa-stats - sudo @SUDOUSRDIR@/vyatta-op-vpnprof.pl --show-ipsec-sa-stats diff --git a/templates/show/vpn/ipsec/sa/statistics/peer/node.tag/node.def.in b/templates/show/vpn/ipsec/sa/statistics/peer/node.tag/node.def.in deleted file mode 100644 index 8b72451..0000000 --- a/templates/show/vpn/ipsec/sa/statistics/peer/node.tag/node.def.in +++ /dev/null @@ -1,3 +0,0 @@ -help: Show stats for all active IPsec Security Associations (SA) for a peer -allowed: @SUDOUSRDIR@/vyatta-op-vpn.pl --get-peers-for-cli -run: sudo @SUDOUSRDIR@/vyatta-op-vpn.pl --show-ipsec-sa-stats-peer="$7" diff --git a/templates/show/vpn/ipsec/sa/statistics/peer/node.tag/tunnel/node.tag/node.def.in b/templates/show/vpn/ipsec/sa/statistics/peer/node.tag/tunnel/node.tag/node.def.in deleted file mode 100644 index 6566a44..0000000 --- a/templates/show/vpn/ipsec/sa/statistics/peer/node.tag/tunnel/node.tag/node.def.in +++ /dev/null @@ -1,3 +0,0 @@ -help: Show stats for the active IPsec Security Association (SA) for a peer's tunnel -allowed: @SUDOUSRDIR@/vyatta-op-vpn.pl --get-conn-for-cli=${COMP_WORDS[6]} -run: sudo @SUDOUSRDIR@/vyatta-op-vpn.pl --show-ipsec-sa-stats-conn $7 $9 diff --git a/templates/show/vpn/ipsec/sa/statistics/profile/node.tag/node.def.in b/templates/show/vpn/ipsec/sa/statistics/profile/node.tag/node.def.in deleted file mode 100644 index 1bc76d6..0000000 --- a/templates/show/vpn/ipsec/sa/statistics/profile/node.tag/node.def.in +++ /dev/null @@ -1,3 +0,0 @@ -help: Show stats for all active IPsec Security Associations (SA) for a profile -allowed: @SUDOUSRDIR@/vyatta-op-vpnprof.pl --get-profiles-for-cli -run: sudo @SUDOUSRDIR@/vyatta-op-vpnprof.pl --show-ipsec-sa-stats-profile="$7" diff --git a/templates/show/vpn/ipsec/sa/statistics/profile/node.tag/tunnel/node.tag/node.def.in b/templates/show/vpn/ipsec/sa/statistics/profile/node.tag/tunnel/node.tag/node.def.in deleted file mode 100644 index 9ae35c8..0000000 --- a/templates/show/vpn/ipsec/sa/statistics/profile/node.tag/tunnel/node.tag/node.def.in +++ /dev/null @@ -1,3 +0,0 @@ -help: Show stats for the active IPsec Security Association (SA) for a tunnel bound to profile -allowed: @SUDOUSRDIR@/vyatta-op-vpnprof.pl --get-conn-for-cli=${COMP_WORDS[6]} -run: sudo @SUDOUSRDIR@/vyatta-op-vpnprof.pl --show-ipsec-sa-stats-conn $7 $9 -- cgit v1.2.3