From 65765fe95a34d81ad4a3aedb035936bbaf6a3f0e Mon Sep 17 00:00:00 2001
From: Christian Poessinger <christian@poessinger.com>
Date: Thu, 29 Jul 2021 18:47:42 +0200
Subject: ipsec: T1210: add op-mode command to print Windows connection profile

---
 op-mode-definitions/generate-ipsec-profile.xml.in | 111 ++++++++++++++++++----
 1 file changed, 90 insertions(+), 21 deletions(-)

(limited to 'op-mode-definitions')

diff --git a/op-mode-definitions/generate-ipsec-profile.xml.in b/op-mode-definitions/generate-ipsec-profile.xml.in
index d1e5efd20..be9227971 100644
--- a/op-mode-definitions/generate-ipsec-profile.xml.in
+++ b/op-mode-definitions/generate-ipsec-profile.xml.in
@@ -7,33 +7,49 @@
           <help>Generate IPsec related configurations</help>
         </properties>
         <children>
-          <tagNode name="mac-ios-profile">
+          <node name="profile">
             <properties>
-              <help>Generate Apple iOS profile from IPsec connection profile</help>
-              <completionHelp>
-                <path>vpn ipsec remote-access connection</path>
-              </completionHelp>
+              <help>Generate IKEv2 IPSec remote-access VPN profiles</help>
             </properties>
             <children>
-              <tagNode name="remote">
+              <tagNode name="ios-remote-access">
                 <properties>
-                  <help>Remote address where the client will connect to</help>
+                  <help>Generate iOS profile for specified remote-access connection name</help>
                   <completionHelp>
-                    <list>&lt;fqdn&gt;</list>
-                    <script>${vyos_completion_dir}/list_local_ips.sh --both</script>
+                    <path>vpn ipsec remote-access connection</path>
                   </completionHelp>
                 </properties>
-                <command>${vyos_op_scripts_dir}/ikev2_profile_generator.py --connection "$4" --remote "$6"</command>
                 <children>
-                  <tagNode name="name">
+                  <tagNode name="remote">
                     <properties>
-                      <help>Connection name as seen in the VPN application</help>
+                      <help>Remote address where the client will connect to</help>
                       <completionHelp>
-                        <list>&lt;name&gt;</list>
+                        <list>&lt;fqdn&gt;</list>
+                        <script>${vyos_completion_dir}/list_local_ips.sh --both</script>
                       </completionHelp>
                     </properties>
-                    <command>${vyos_op_scripts_dir}/ikev2_profile_generator.py --connection "$4" --remote "$6" --name "$8"</command>
+                    <command>${vyos_op_scripts_dir}/ikev2_profile_generator.py --os ios --connection "$5" --remote "$7"</command>
                     <children>
+                      <tagNode name="name">
+                        <properties>
+                          <help>Connection name as seen in the VPN application</help>
+                          <completionHelp>
+                            <list>&lt;name&gt;</list>
+                          </completionHelp>
+                        </properties>
+                        <command>${vyos_op_scripts_dir}/ikev2_profile_generator.py --os ios --connection "$5" --remote "$7" --name "$9"</command>
+                        <children>
+                          <tagNode name="profile">
+                            <properties>
+                              <help>Profile name as seen under system profiles</help>
+                              <completionHelp>
+                                <list>&lt;name&gt;</list>
+                              </completionHelp>
+                            </properties>
+                            <command>${vyos_op_scripts_dir}/ikev2_profile_generator.py --os ios --connection "$5" --remote "$7" --name "$9" --profile "${11}"</command>
+                          </tagNode>
+                        </children>
+                      </tagNode>
                       <tagNode name="profile">
                         <properties>
                           <help>Profile name as seen under system profiles</help>
@@ -41,18 +57,40 @@
                             <list>&lt;name&gt;</list>
                           </completionHelp>
                         </properties>
-                        <command>${vyos_op_scripts_dir}/ikev2_profile_generator.py --connection "$4" --remote "$6" --name "$8" --profile "${10}"</command>
+                        <command>${vyos_op_scripts_dir}/ikev2_profile_generator.py --os ios --connection "$5" --remote "$7" --profile "$9"</command>
+                        <children>
+                          <tagNode name="name">
+                            <properties>
+                              <help>Connection name as seen in the VPN application</help>
+                              <completionHelp>
+                                <list>&lt;name&gt;</list>
+                              </completionHelp>
+                            </properties>
+                            <command>${vyos_op_scripts_dir}/ikev2_profile_generator.py --os ios --connection "$5" --remote "$7" --profile "$9" --name "${11}"</command>
+                          </tagNode>
+                        </children>
                       </tagNode>
                     </children>
                   </tagNode>
-                  <tagNode name="profile">
+                </children>
+              </tagNode>
+              <tagNode name="windows-remote-access">
+                <properties>
+                  <help>Generate iOS profile for specified remote-access connection name</help>
+                  <completionHelp>
+                    <path>vpn ipsec remote-access connection</path>
+                  </completionHelp>
+                </properties>
+                <children>
+                  <tagNode name="remote">
                     <properties>
-                      <help>Profile name as seen under system profiles</help>
+                      <help>Remote address where the client will connect to</help>
                       <completionHelp>
-                        <list>&lt;name&gt;</list>
+                        <list>&lt;fqdn&gt;</list>
+                        <script>${vyos_completion_dir}/list_local_ips.sh --both</script>
                       </completionHelp>
                     </properties>
-                    <command>${vyos_op_scripts_dir}/ikev2_profile_generator.py --connection "$4" --remote "$6" --profile "$8"</command>
+                    <command>${vyos_op_scripts_dir}/ikev2_profile_generator.py --os windows --connection "$5" --remote "$7"</command>
                     <children>
                       <tagNode name="name">
                         <properties>
@@ -61,14 +99,45 @@
                             <list>&lt;name&gt;</list>
                           </completionHelp>
                         </properties>
-                        <command>${vyos_op_scripts_dir}/ikev2_profile_generator.py --connection "$4" --remote "$6" --profile "$8" --name "${10}"</command>
+                        <command>${vyos_op_scripts_dir}/ikev2_profile_generator.py --os windows --connection "$5" --remote "$7" --name "$9"</command>
+                        <children>
+                          <tagNode name="profile">
+                            <properties>
+                              <help>Profile name as seen under system profiles</help>
+                              <completionHelp>
+                                <list>&lt;name&gt;</list>
+                              </completionHelp>
+                            </properties>
+                            <command>${vyos_op_scripts_dir}/ikev2_profile_generator.py --os windows --connection "$5" --remote "$7" --name "$9" --profile "${11}"</command>
+                          </tagNode>
+                        </children>
+                      </tagNode>
+                      <tagNode name="profile">
+                        <properties>
+                          <help>Profile name as seen under system profiles</help>
+                          <completionHelp>
+                            <list>&lt;name&gt;</list>
+                          </completionHelp>
+                        </properties>
+                        <command>${vyos_op_scripts_dir}/ikev2_profile_generator.py --os windows --connection "$5" --remote "$7" --profile "$9"</command>
+                        <children>
+                          <tagNode name="name">
+                            <properties>
+                              <help>Connection name as seen in the VPN application</help>
+                              <completionHelp>
+                                <list>&lt;name&gt;</list>
+                              </completionHelp>
+                            </properties>
+                            <command>${vyos_op_scripts_dir}/ikev2_profile_generator.py --os windows --connection "$5" --remote "$7" --profile "$9" --name "${11}"</command>
+                          </tagNode>
+                        </children>
                       </tagNode>
                     </children>
                   </tagNode>
                 </children>
               </tagNode>
             </children>
-          </tagNode>
+          </node>
         </children>
       </node>
     </children>
-- 
cgit v1.2.3