5 'require tools.widgets as widgets';
11 m = new form.Map('ipsec', _('strongSwan Configuration'),
12 _('Configure strongSwan for secure VPN connections.'));
15 // strongSwan General Settings
16 s = m.section(form.TypedSection, 'ipsec', _('General Settings'));
19 o = s.option(widgets.ZoneSelect, 'zone', _('Zone'),
20 _('Firewall zone that has to match the defined firewall zone'));
24 o = s.option(widgets.NetworkSelect, 'listen', _('Listening Interfaces'),
25 _('Interfaces that accept VPN traffic'));
26 o.datatype = 'interface';
27 o.placeholder = _('Select an interface or leave empty for all interfaces');
32 o = s.option(form.Value, 'debug', _('Debug Level'),
33 _('Trace level: 0 is least verbose, 4 is most'));
35 o.datatype = 'range(0,4)';
37 // Remote Configuration
38 s = m.section(form.GridSection, 'remote', _('Remote Configuration'),
39 _('Define Remote IKE Configurations.'));
41 s.nodescriptions = true;
43 o = s.option(form.Flag, 'enabled', _('Enabled'),
44 _('Configuration is enabled or not'));
47 o = s.option(form.Value, 'gateway', _('Gateway (Remote Endpoint)'),
48 _('IP address or FQDN name of the tunnel remote endpoint'));
49 o.datatype = 'or(hostname,ipaddr)';
52 o = s.option(form.Value, 'local_gateway', _('Local Gateway'),
53 _('IP address or FQDN of the tunnel local endpoint'));
54 o.datatype = 'or(hostname,ipaddr)';
57 o = s.option(form.Value, 'local_sourceip', _('Local Source IP'),
58 _('Virtual IP(s) to request in IKEv2 configuration payloads requests'));
59 o.datatype = 'ipaddr';
62 o = s.option(form.Value, 'local_ip', _('Local IP'),
63 _('Local address(es) to use in IKE negotiation'));
64 o.datatype = 'ipaddr';
67 o = s.option(form.Value, 'local_identifier', _('Local Identifier'),
68 _('Local identifier for IKE (phase 1)'));
69 o.datatype = 'string';
70 o.placeholder = 'C=US, O=Acme Corporation, CN=headquarters';
73 o = s.option(form.Value, 'remote_identifier', _('Remote Identifier'),
74 _('Remote identifier for IKE (phase 1)'));
75 o.datatype = 'string';
76 o.placeholder = 'C=US, O=Acme Corporation, CN=soho';
79 o = s.option(form.ListValue, 'authentication_method',
80 _('Authentication Method'), _('IKE authentication (phase 1)'));
82 o.value('psk', 'Pre-shared Key');
83 o.value('pubkey', 'Public Key');
85 o = s.option(form.Value, 'pre_shared_key', _('Pre-Shared Key'),
86 _('The pre-shared key for the tunnel'));
87 o.datatype = 'string';
90 o.depends('authentication_method', 'psk');
92 o = s.option(form.Flag, 'mobike', _('MOBIKE'),
93 _('MOBIKE (IKEv2 Mobility and Multihoming Protocol)'));
97 o = s.option(form.ListValue, 'fragmentation', _('IKE Fragmentation'),
98 _('Use IKE fragmentation'));
106 o = s.option(form.ListValue, 'crypto_proposal', _('Crypto Proposal'),
107 _('List of IKE (phase 1) proposals to use for authentication'));
108 o.value('encryption_algorithm');
109 o.value('hash_algorithm');
111 o.value('prf_algorithm');
113 o = s.option(form.MultiValue, 'tunnel', _('Tunnel'),
114 _('Name of ESP (phase 2) section'));
115 o.load = function (section_id) {
119 var sections = uci.sections('ipsec', 'tunnel');
120 if (sections.length == 0) {
121 this.value('', _('Please create a Tunnel first'));
123 sections.forEach(L.bind(function (section) {
124 this.value(section['.name']);
128 return this.super('load', [section_id]);
132 o = s.option(form.Value, 'authentication_method',
133 _('Authentication Method'), _('IKE authentication (phase 1)'));
134 o.datatype = 'string';
136 s = m.section(form.TypedSection, 'ipsec',
137 _('strongSwan General Settings'));
140 o = s.option(form.ListValue, 'encryption_algorithm',
141 _('Encryption Algorithm'),
142 '%s (aes128, aes192, aes256, 3des)'.format(_('Encryption method')));
149 o = s.option(form.ListValue, 'hash_algorithm', _('Hash Algorithm'),
150 '%s (md5, sha1, sha2, ...)'.format(_('Hash algorithm')));
160 o.value('blake2s256');
161 o.value('blake2b512');
162 o.value('blake2s256');
163 o.value('blake2b512');
164 o.value('whirlpool');
168 o = s.option(form.ListValue, 'dh_group', _('Diffie-Hellman Group'),
169 '%s (modp768, modp1024, ...)'.format(_('Diffie-Hellman exponentiation')));
178 o = s.option(form.ListValue, 'prf_algorithm', _('PRF Algorithm'),
179 _('Pseudo-Random Functions to use with IKE'));
180 o.value('prf_hmac_md5');
183 o.value('prfsha256');
185 o.value('prfsha512');
187 // Tunnel Configuration
188 s = m.section(form.GridSection, 'tunnel', _('Tunnel Configuration'),
189 _('Define Connection Children to be used as Tunnels in Remote Configurations.'));
191 s.nodescriptions = true;
193 o = s.option(form.DynamicList, 'local_subnet', _('Local Subnet'),
194 _('Local network(s)'));
195 o.datatype = 'subnet';
196 o.placeholder = '192.168.1.1/24';
199 o = s.option(form.DynamicList, 'remote_subnet', _('Remote Subnet'),
200 _('Remote network(s)'));
201 o.datatype = 'subnet';
202 o.placeholder = '192.168.2.1/24';
205 o = s.option(form.Value, 'local_nat', _('Local NAT'),
206 _('NAT range for tunnels with overlapping IP addresses'));
207 o.datatype = 'subnet';
210 o = s.option(form.ListValue, 'crypto_proposal',
211 _('Crypto Proposal (Phase 2)'), _('List of ESP (phase two) proposals'));
212 o.value('encryption_algorithm');
213 o.value('hash_algorithm');
215 o.value('prf_algorithm');
218 o = s.option(form.ListValue, 'startaction', _('Start Action'),
219 _('Action on initial configuration load'));
226 o = s.option(form.Value, 'updown', _('Up/Down Script Path'),
227 _('Path to script to run on CHILD_SA up/down events'));