luci-app-strongswan-swanctl: add secrets configuration tab

Add a new "Secrets Configuration" tab for the generic uci 'secret'
section type, which replaces the dedicated 'mschapv2_secrets' section.
The secret kind is selected via the 'type' option, defaulting to 'ike':

- eap, xauth, ntlm, ike, ppk: identity list and shared secret
- private, rsa, ecdsa, pkcs8, pkcs12: key file and passphrase
- token: handle, slot, module and pin

Register 'secret' in the shared section name validator so secret section
names cannot collide with sections of other types.

Signed-off-by: Florian Eckert <fe@dev.tdt.de>
This commit is contained in:
Florian Eckert authored and Florian Eckert committed 2026-09-30 11:58:57 +02:00
1 parent 43877a130c
commit 8afbea7e0c
1 file changed
+81
@@ -70,6 +70,87 @@ return view.extend({
_('URIs where an OCSP responder for the CA is available.'));
o.modalonly = true;
// Secrets Configuration
s = m.section(form.GridSection, 'secret', _('Secrets'),
_('Define shared secrets and private key passphrases used for authentication.'));
s.addremove = true;
s.nodescriptions = true;
s.anonymous = true;
o = s.option(form.Value, 'description', _('Description'),
_('An optional description of what this secret is used for.'));
o = s.option(form.ListValue, 'type', _('Type'),
_('Kind of secret to define'));
o.rmempty = false;
o.default = 'ike';
o.value('eap');
o.value('xauth');
o.value('ntlm');
o.value('ike');
o.value('ppk');
o.value('private');
o.value('rsa');
o.value('ecdsa');
o.value('pkcs8');
o.value('pkcs12');
o.value('token');
o = s.option(form.DynamicList, 'id', _('Identity'),
_('Identities this secret is valid for'));
o.depends('type', 'eap');
o.depends('type', 'xauth');
o.depends('type', 'ntlm');
o.depends('type', 'ike');
o.depends('type', 'ppk');
o = s.option(form.Value, 'secret', _('Secret'),
_('Shared secret for authentication, or passphrase to decrypt a private key.'));
o.datatype = 'string';
o.password = true;
o.depends('type', 'eap');
o.depends('type', 'xauth');
o.depends('type', 'ntlm');
o.depends('type', 'ike');
o.depends('type', 'ppk');
o.depends('type', 'private');
o.depends('type', 'rsa');
o.depends('type', 'ecdsa');
o.depends('type', 'pkcs8');
o.depends('type', 'pkcs12');
o.modalonly = true;
o = s.option(form.Value, 'file', _('Key File'),
_('Path to the private key file.'));
o.datatype = 'file';
o.depends('type', 'private');
o.depends('type', 'rsa');
o.depends('type', 'ecdsa');
o.depends('type', 'pkcs8');
o.depends('type', 'pkcs12');
o = s.option(form.Value, 'handle', _('Handle'),
_('Handle of the private key on the smartcard.'));
o.depends('type', 'token');
o.modalonly = true;
o = s.option(form.Value, 'slot', _('Slot'),
_('Slot of the smartcard to use.'));
o.depends('type', 'token');
o.modalonly = true;
o = s.option(form.Value, 'module', _('Module'),
_('PKCS#11 module to use.'));
o.depends('type', 'token');
o.modalonly = true;
o = s.option(form.Value, 'pin', _('PIN'),
_('PIN to access the private key on the smartcard.'));
o.datatype = 'string';
o.password = true;
o.depends('type', 'token');
o.modalonly = true;
return m.render();
}
});