public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH] vpnmain.cgi: set SubjectAlternativeName default during root, certificate generation
@ 2020-01-05 17:54 Peter Müller
  2020-01-05 18:11 ` [PATCH v2] vpnmain.cgi: set SubjectAlternativeName default during root " Peter Müller
  0 siblings, 1 reply; 10+ messages in thread
From: Peter Müller @ 2020-01-05 17:54 UTC (permalink / raw)
  To: development

[-- Attachment #1: Type: text/plain, Size: 1402 bytes --]

Some IPsec implementations such as OpenIKED require SubjectAlternativeName
data on certificates and refuse to establish connections otherwise.

The StrongSwan project also recommends it (see:
https://wiki.strongswan.org/projects/strongswan/wiki/SimpleCA) although
it is currently not enforced by their IPsec software.

For convenience purposes and to raise awareness, this patch adds a default
SubjectAlternativeName based on the machines hostname or IP address. Existing
certificates remain unchanged for obvious reasons.

Fixes #11594

Signed-off-by: Peter Müller <peter.mueller(a)ipfire.org>
---
 html/cgi-bin/vpnmain.cgi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/html/cgi-bin/vpnmain.cgi b/html/cgi-bin/vpnmain.cgi
index 33b504bc9..9b7bd81ca 100644
--- a/html/cgi-bin/vpnmain.cgi
+++ b/html/cgi-bin/vpnmain.cgi
@@ -822,8 +822,10 @@ END
 			close IPADDR;
 			chomp ($ipaddr);
 			$cgiparams{'ROOTCERT_HOSTNAME'} = (gethostbyaddr(pack("C4", split(/\./, $ipaddr)), 2))[0];
+			$cgiparams{'SUBJECTALTNAME'} = "DNS:" . (gethostbyaddr(pack("C4", split(/\./, $ipaddr)), 2))[0];
 			if ($cgiparams{'ROOTCERT_HOSTNAME'} eq '') {
 				$cgiparams{'ROOTCERT_HOSTNAME'} = $ipaddr;
+				$cgiparams{'SUBJECTALTNAME'} = "IP:" . $ipaddr;
 			}
 		}
 		$cgiparams{'ROOTCERT_COUNTRY'} = $vpnsettings{'ROOTCERT_COUNTRY'} if (!$cgiparams{'ROOTCERT_COUNTRY'});
-- 
2.16.4

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-01-13 12:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-05 17:54 [PATCH] vpnmain.cgi: set SubjectAlternativeName default during root, certificate generation Peter Müller
2020-01-05 18:11 ` [PATCH v2] vpnmain.cgi: set SubjectAlternativeName default during root " Peter Müller
2020-01-06 11:15   ` Michael Tremer
2020-01-06 19:26     ` Peter Müller
2020-01-07 21:47   ` [PATCH v3 1/3] " Peter Müller
2020-01-07 21:47     ` [PATCH v3 2/3] update translation files for vpnmain.cgi changes Peter Müller
2020-01-07 21:48       ` [PATCH v3 3/3] Core Update 140: ship changed vpnmain.cgi Peter Müller
2020-01-08 10:58     ` [PATCH v3 1/3] vpnmain.cgi: set SubjectAlternativeName default during root certificate generation Michael Tremer
2020-01-09 15:20       ` Peter Müller
2020-01-13 12:37         ` Michael Tremer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox