summaryrefslogtreecommitdiff
path: root/op-mode-definitions/vpn-ipsec.xml.in
blob: 18b72b87ca0d937cc03e012cb17bfb03880b87b0 (plain)
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<?xml version="1.0"  encoding="UTF-8"?>
<interfaceDefinition>
  <node name="reset">
    <children>
      <node name="vpn">
        <properties>
          <help>Reset Virtual Private Network (VPN) information</help>
        </properties>
        <children>
          <tagNode name="ipsec-peer">
            <properties>
              <help>Reset all tunnels for given peer</help>
              <completionHelp>
                <path>vpn ipsec site-to-site peer</path>
              </completionHelp>
            </properties>
            <children>
              <tagNode name="tunnel">
                <properties>
                  <help>Reset a specific tunnel for given peer</help>
                </properties>
                <command>sudo ${vyos_op_scripts_dir}/vpn_ipsec.py --action="reset-peer" --name="$4" --tunnel="$6"</command>
              </tagNode>
              <node name="vti">
                <properties>
                  <help>Reset the VTI tunnel for given peer</help>
                </properties>
                <command>sudo ${vyos_op_scripts_dir}/vpn_ipsec.py --action="reset-peer" --name="$4" --tunnel="vti"</command>
              </node>
            </children>
            <command>sudo ${vyos_op_scripts_dir}/vpn_ipsec.py --action="reset-peer" --name="$4" --tunnel="all"</command>
          </tagNode>
          <tagNode name="ipsec-profile">
            <properties>
              <help>Reset all tunnels for given DMVPN profile</help>
              <completionHelp>
                <path>vpn ipsec profile</path>
              </completionHelp>
            </properties>
            <children>
              <tagNode name="tunnel">
                <properties>
                  <help>Reset a specific tunnel for given DMVPN profile</help>
                </properties>
                <command>sudo ${vyos_op_scripts_dir}/vpn_ipsec.py --action="reset-profile" --name="$4" --tunnel="$6"</command>
              </tagNode>
            </children>
            <command>sudo ${vyos_op_scripts_dir}/vpn_ipsec.py --action="reset-profile" --name="$4" --tunnel="all"</command>
          </tagNode>
        </children>
      </node>
    </children>
  </node>
  <node name="restart">
    <children>
      <node name="vpn">
        <properties>
          <help>Restart IPSec VPN</help>
        </properties>
        <command>if pgrep charon >/dev/null ; then sudo ipsec restart ; sleep 3 ; sudo swanctl -q ; else echo "IPSec process not running" ; fi</command>
      </node>
    </children>
  </node>
  <node name="show">
    <children>
      <node name="vpn">
        <properties>
          <help>Show Virtual Private Network (VPN) information</help>
        </properties>
        <children>
          <node name="debug">
            <properties>
              <help>Show VPN debugging information</help>
            </properties>
            <children>
              <tagNode name="peer">
                <properties>
                  <help>Show debugging information for a peer</help>
                </properties>
                <children>
                  <tagNode name="tunnel">
                    <properties>
                      <help>Show debug information for peer tunnel</help>
                    </properties>
                    <command>sudo ${vyos_op_scripts_dir}/vpn_ipsec.py --action="vpn-debug" --name="$5" --tunnel="$7"</command>
                  </tagNode>
                </children>
                <command>sudo ${vyos_op_scripts_dir}/vpn_ipsec.py --action="vpn-debug" --name="$5" --tunnel="all"</command>
              </tagNode>
            </children>
            <command>sudo ${vyos_op_scripts_dir}/vpn_ipsec.py --action="vpn-debug" --name="all"</command>
          </node>
          <node name="ike">
            <properties>
              <help>Show Internet Key Exchange (IKE) information</help>
            </properties>
            <children>
              <node name="sa">
                <properties>
                  <help>Show all currently active IKE Security Associations (SA)</help>
                </properties>
                <children>
                  <node name="nat-traversal">
                    <properties>
                      <help>Show all currently active IKE Security Associations (SA) that are using NAT Traversal</help>
                    </properties>
                    <command>sudo ${vyos_op_scripts_dir}/vpn_ike_sa.py --nat="yes"</command>
                  </node>
                  <tagNode name="peer">
                    <properties>
                      <help>Show all currently active IKE Security Associations (SA) for a peer</help>
                    </properties>
                    <command>sudo ${vyos_op_scripts_dir}/vpn_ike_sa.py --peer="$6"</command>
                  </tagNode>
                </children>
                <command>sudo ${vyos_op_scripts_dir}/vpn_ike_sa.py</command>
              </node>
              <node name="secrets">
                <properties>
                  <help>Show all the pre-shared key secrets</help>
                </properties>
                <command>sudo cat /etc/ipsec.secrets | sed 's/#.*//'</command>
              </node>
              <node name="status">
                <properties>
                  <help>Show summary of IKE process information</help>
                </properties>
                <command>if pgrep charon >/dev/null ; then echo "Running: $(pgrep charon)" ; else echo "Process is not running" ; fi</command>
              </node>
            </children>
          </node>
          <node name="ipsec">
            <properties>
              <help>Show Internet Protocol Security (IPSec) information</help>
            </properties>
            <children>
              <node name="policy">
                <properties>
                  <help>Show the in-kernel crypto policies</help>
                </properties>
                <command>sudo ip xfrm policy list</command>
              </node>
              <leafNode name="remote-access">
                 <properties>
                   <help>Show active VPN server sessions</help>
                 </properties>
                <command>${vyos_op_scripts_dir}/show_vpn_ra.py</command>
              </leafNode>
              <node name="sa">
                <properties>
                  <help>Show all active IPSec Security Associations (SA)</help>
                </properties>
                <children>
                  <!--
                  <node name="detail">
                    <properties>
                      <help>Show Detail on all active IPSec Security Associations (SA)</help>
                    </properties>
                    <command></command>
                  </node>
                  <tagNode name="stats">
                    <properties>
                      <help>Show statistics for all currently active IPSec Security Associations (SA)</help>
                      <valueHelp>
                        <format>txt</format>
                        <description>Show Statistics for SAs associated with a specific peer</description>
                      </valueHelp>
                    </properties>
                    <children>
                      <tagNode name="tunnel">
                        <properties>
                          <help>Show Statistics for SAs associated with a specific peer</help>
                        </properties>
                        <command></command>
                      </tagNode>
                    </children>
                    <command></command>
                  </tagNode>
                  -->
                  <node name="verbose">
                    <properties>
                      <help>Show Verbose Detail on all active IPSec Security Associations (SA)</help>
                    </properties>
                    <command>if pgrep charon >/dev/null ; then sudo /usr/sbin/ipsec statusall ; else echo "IPSec process not running" ; fi</command>
                  </node>
                </children>
                <command>if pgrep charon >/dev/null ; then sudo /usr/libexec/vyos/op_mode/show_ipsec_sa.py ; else echo "IPSec process not running" ; fi</command>
              </node>
              <node name="state">
                <properties>
                  <help>Show the in-kernel crypto state</help>
                </properties>
                <command>sudo ip xfrm state list</command>
              </node>
              <node name="status">
                <properties>
                  <help>Show status of IPSec process</help>
                </properties>
                <command>if pgrep charon >/dev/null ; then echo -e "IPSec Process Running: $(pgrep charon)\n$(sudo /usr/sbin/ipsec status)" ; else echo "IPSec process not running" ; fi</command>
              </node>
            </children>
          </node>
        </children>
      </node>
    </children>
  </node>
</interfaceDefinition>