-
Notifications
You must be signed in to change notification settings - Fork 9
/
pscollect
executable file
·97 lines (78 loc) · 2.61 KB
/
pscollect
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
function errexit() {
echo -e "$1"
exit 1
}
cmd=$0
[[ $EUID -ne 0 ]] && errexit "? Please rerun: 'sudo $cmd'"
fl="/tmp/pistrong-diagnostics"
echo "*** Gathering diagnostic information for pistrong/strongSwan ***"
rm -f $fl
echo "...Environmental details"
echo -e "\n*** System Info ***" >> $fl
cat /etc/os-release >> $fl
uname -a >> $fl
if [ -d /root/piStrong ]
then
echo "...ls -l /root/piStrong"
echo -e "\n*** ls -l /root/piStrong" >> $fl
ls -l /root/piStrong >> $fl
else
echo "...apt-cache policy strongswan"
echo -e "\n*** apt-cache policy strongswan" >> $fl
apt-cache policy strongswan >> $fl
fi
echo "...systemctl status strongswan"
echo -e "\n*** systemctl status strongswan ***" >> $fl
systemctl status strongswan >> $fl
echo "...pistrong config [minus smtp credentials]"
echo -e "\n*** pistrong config ***" >> $fl
pistrong config | grep -v -E "smtpuser|smtppassword" >> $fl
echo "...pistrong showca"
echo -e "\n*** pistrong showca ***" >> $fl
pistrong showca >> $fl
echo "...pistrong list --full"
echo -e "\n*** pistrong list --full ***" >> $fl
pistrong list --full >> $fl
if [ -f /etc/swanctl/pistrong/makeCA.log ]
then
echo "...copy /etc/swanctl/pistrong/makeCA.log"
echo -e "\n*** /etc/swanctl/pistrong/makeCA.log ***" >> $fl
cat /etc/swanctl/pistrong/makeCA.log >> $fl
fi
if [ -f /etc/swanctl/pistrong/makeTunnel.log ]
then
echo "...copy /etc/swanctl/pistrong/makeTunnel.log"
echo -e "\n*** /etc/swanctl/pistrong/makeTunnel.log ***" >> $fl
cat /etc/swanctl/pistrong/makeTunnel.log >> $fl
fi
if [ -f /etc/swanctl/conf.d/pistrong-CAServerConnection.conf ]
then
echo "...copy /etc/swanctl/conf.d/pistrong-CAServerConnection.conf"
echo -e "\n*** /etc/swanctl/conf.d/pistrong-CAServerConnection.conf ***" >> $fl
cat /etc/swanctl/conf.d/pistrong-CAServerConnection.conf >> $fl
fi
echo "...ls -lR /etc/swanctl"
echo -e "\n*** ls -l /etc/swanctl ***" >> $fl
ls -lR /etc/swanctl >> $fl
echo "...ip configuration information"
echo -e "\n*** IP information ***" >> $fl
echo " ** ip a **" >> $fl
ip a >> $fl
echo " ** ip r **" >> $fl
ip r >> $fl
echo " ** ip r show table 220 **" >> $fl
ip r show table 220 >> $fl
echo "...iptables filter table"
echo -e "\n*** iptables filter table ***" >> $fl
iptables -L -v -n >> $fl
echo "...iptables nat table"
echo -e "\n*** iptables nat table ***" >> $fl
iptables -L -v -n -t nat >> $fl
echo "...journalctl for charon and swanctl"
echo -e "\n*** journalctl ***" >> $fl
journalctl -b | grep -E "charon|swanctl" >> $fl
echo "Done."
echo -e "\n*** Done *** " >> $fl
echo "Please provide $fl to the pistrong maintainer as requested"
exit