summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-10-27 08:13:31 +0200
committerGitHub <noreply@github.com>2021-10-27 08:13:31 +0200
commitaabcd6ced2fc668e1b0ea31c9c4f0d62c3f5d8a5 (patch)
tree1c20798a0d57375df331a8cd80419f89e24baf82 /src
parent8c8fe9b6f91d0a0b6c56b9e7a31b8f71dca75272 (diff)
parent0e0565b83909784abcf5858f8ea178ded98debb0 (diff)
downloadvyos-1x-aabcd6ced2fc668e1b0ea31c9c4f0d62c3f5d8a5.tar.gz
vyos-1x-aabcd6ced2fc668e1b0ea31c9c4f0d62c3f5d8a5.zip
Merge pull request #1046 from sever-sever/T3942-equ
op-mode: T3942: Add feature generate IPSec debug-archive
Diffstat (limited to 'src')
-rwxr-xr-xsrc/op_mode/generate_ipsec_debug_archive.sh36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/op_mode/generate_ipsec_debug_archive.sh b/src/op_mode/generate_ipsec_debug_archive.sh
new file mode 100755
index 000000000..53d0a6eaa
--- /dev/null
+++ b/src/op_mode/generate_ipsec_debug_archive.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+
+# Collecting IPSec Debug Information
+
+DATE=`date +%d-%m-%Y`
+
+a_CMD=(
+ "sudo ipsec status"
+ "sudo swanctl -L"
+ "sudo swanctl -l"
+ "sudo swanctl -P"
+ "sudo ip x sa show"
+ "sudo ip x policy show"
+ "sudo ip tunnel show"
+ "sudo ip address"
+ "sudo ip rule show"
+ "sudo ip route"
+ "sudo ip route show table 220"
+ )
+
+
+echo "DEBUG: ${DATE} on host \"$(hostname)\"" > /tmp/ipsec-status-${DATE}.txt
+date >> /tmp/ipsec-status-${DATE}.txt
+
+# Execute all DEBUG commands and save it to file
+for cmd in "${a_CMD[@]}"; do
+ echo -e "\n### ${cmd} ###" >> /tmp/ipsec-status-${DATE}.txt
+ ${cmd} >> /tmp/ipsec-status-${DATE}.txt 2>/dev/null
+done
+
+# Collect charon logs, build .tgz archive
+sudo journalctl /usr/lib/ipsec/charon > /tmp/journalctl-charon-${DATE}.txt && \
+sudo tar -zcvf /tmp/ipsec-debug-${DATE}.tgz /tmp/journalctl-charon-${DATE}.txt /tmp/ipsec-status-${DATE}.txt >& /dev/null
+sudo rm -f /tmp/journalctl-charon-${DATE}.txt /tmp/ipsec-status-${DATE}.txt
+
+echo "Debug file is generated and located in /tmp/ipsec-debug-${DATE}.tgz"