vpnmain.cgi: Fix reading common names from certificates

OpenSSL has changed the output of the subject lines of
certificates.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2018-03-01 19:58:11 +00:00
parent 63b515dc26
commit 568a227bd3
2 changed files with 4 additions and 3 deletions

View File

@@ -4,6 +4,7 @@ etc/sysctl.conf
etc/fcron.daily/openvpn-crl-updater
etc/rc.d/init.d/dhcp
srv/web/ipfire/cgi-bin/ovpnmain.cgi
srv/web/ipfire/cgi-bin/vpnmain.cgi
usr/lib/python2.7/lib-dynload/_hashlib.so
usr/lib/python2.7/lib-dynload/_ssl.so
var/ipfire/langs

View File

@@ -199,10 +199,10 @@ sub callssl ($) {
sub getCNfromcert ($) {
#&General::log("ipsec", "Extracting name from $_[0]...");
my $temp = `/usr/bin/openssl x509 -text -in $_[0]`;
$temp =~ /Subject:.*CN=(.*)[\n]/;
$temp =~ /Subject:.*CN = (.*)[\n]/;
$temp = $1;
$temp =~ s+/Email+, E+;
$temp =~ s/ ST=/ S=/;
$temp =~ s/ ST = / S = /;
$temp =~ s/,//g;
$temp =~ s/\'//g;
return $temp;
@@ -216,7 +216,7 @@ sub getsubjectfromcert ($) {
$temp =~ /Subject: (.*)[\n]/;
$temp = $1;
$temp =~ s+/Email+, E+;
$temp =~ s/ ST=/ S=/;
$temp =~ s/ ST = / S = /;
return $temp;
}
###