From f40fd7918a407a4054181c34e4e61264107de957 Mon Sep 17 00:00:00 2001 From: Christian Schmidt Date: Sat, 9 Apr 2011 12:33:29 +0200 Subject: [PATCH] Changed openvpn CGI to create a CN without a blank as this may leed to errors when using the verify script. Even removed the net2net display options. Host connections should be default now. --- config/rootfiles/core/49/filelists/files | 1 + html/cgi-bin/ovpnmain.cgi | 99 +++--------------------- 2 files changed, 13 insertions(+), 87 deletions(-) diff --git a/config/rootfiles/core/49/filelists/files b/config/rootfiles/core/49/filelists/files index a39cef6717..97a2c0029c 100644 --- a/config/rootfiles/core/49/filelists/files +++ b/config/rootfiles/core/49/filelists/files @@ -2,6 +2,7 @@ etc/system-release etc/init.d/squid var/ipfire/backup/bin/backup.pl srv/web/ipfire/cgi-bin/ids.cgi +srv/web/ipfire/cgi-bin/ovpnmain.cgi srv/web/ipfire/cgi-bin/pppsetup.cgi srv/web/ipfire/cgi-bin/proxy.cgi var/ipfire/langs/de.pl diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi index fcaeb5c353..c99e7beaeb 100644 --- a/html/cgi-bin/ovpnmain.cgi +++ b/html/cgi-bin/ovpnmain.cgi @@ -1862,35 +1862,6 @@ END } else { $errormessage = $Lang::tr{'invalid key'}; } -#test33 - -### -### Choose between adding a host-net or net-net connection -### -} elsif ($cgiparams{'ACTION'} eq $Lang::tr{'add'} && $cgiparams{'TYPE'} eq '') { - &General::readhash("${General::swroot}/ovpn/settings", \%vpnsettings); - &Header::showhttpheaders(); - &Header::openpage($Lang::tr{'vpn configuration main'}, 1, ''); - &Header::openbigbox('100%', 'LEFT', '', ''); - &Header::openbox('100%', 'LEFT', $Lang::tr{'connection type'}); - print <$Lang::tr{'connection type'}:
- - - - - - -
$Lang::tr{'host to net vpn'}
$Lang::tr{'net to net vpn'}
-END - ; - &Header::closebox(); - &Header::closebigbox(); - &Header::closepage(); - exit (0); -### -### Adding a new connection -### } elsif (($cgiparams{'ACTION'} eq $Lang::tr{'add'}) || ($cgiparams{'ACTION'} eq $Lang::tr{'edit'}) || ($cgiparams{'ACTION'} eq $Lang::tr{'save'} && $cgiparams{'ADVANCED'} eq '')) { @@ -1904,9 +1875,10 @@ END $errormessage = $Lang::tr{'invalid key'}; goto VPNCONF_END; } + $cgiparams{'ENABLED'} = $confighash{$cgiparams{'KEY'}}[0]; $cgiparams{'NAME'} = $confighash{$cgiparams{'KEY'}}[1]; - $cgiparams{'TYPE'} = $confighash{$cgiparams{'KEY'}}[3]; + $cgiparams{'TYPE'} = 'host'; $cgiparams{'AUTH'} = $confighash{$cgiparams{'KEY'}}[4]; $cgiparams{'PSK'} = $confighash{$cgiparams{'KEY'}}[5]; $cgiparams{'SIDE'} = $confighash{$cgiparams{'KEY'}}[6]; @@ -1946,11 +1918,6 @@ END goto VPNCONF_ERROR; } -# if (($cgiparams{'TYPE'} eq 'net') && ($cgiparams{'SIDE'} !~ /^(left|right)$/)) { -# $errormessage = $Lang::tr{'ipfire side is invalid'}; -# goto VPNCONF_ERROR; -# } - # Check if there is no other entry with this name if (! $cgiparams{'KEY'}) { foreach my $key (keys %confighash) { @@ -1961,11 +1928,6 @@ END } } - if (($cgiparams{'TYPE'} eq 'net') && (! $cgiparams{'REMOTE'})) { - $errormessage = $Lang::tr{'invalid input for remote host/ip'}; - goto VPNCONF_ERROR; - } - if ($cgiparams{'REMOTE'}) { if (! &General::validip($cgiparams{'REMOTE'})) { if (! &General::validfqdn ($cgiparams{'REMOTE'})) { @@ -1994,10 +1956,6 @@ END } } } - if (($cgiparams{'TYPE'} eq 'net') && (! &General::validipandmask($cgiparams{'REMOTE_SUBNET'}))) { - $errormessage = $Lang::tr{'remote subnet is invalid'}; - goto VPNCONF_ERROR; - } if ($cgiparams{'ENABLED'} !~ /^(on|off)$/) { $errormessage = $Lang::tr{'invalid input'}; @@ -2121,6 +2079,9 @@ END goto VPNCONF_ERROR; } } elsif ($cgiparams{'AUTH'} eq 'certgen') { + + $cgiparams{'CERT_NAME'} =~ s/ //g; + if ($cgiparams{'KEY'}) { $errormessage = $Lang::tr{'cant change certificates'}; goto VPNCONF_ERROR; @@ -2279,17 +2240,13 @@ END if ((! $cgiparams{'KEY'}) && $cgiparams{'AUTH'} ne 'psk') { $confighash{$key}[2] = $cgiparams{'CERT_NAME'}; } - $confighash{$key}[3] = $cgiparams{'TYPE'}; + $confighash{$key}[3] = 'host'; if ($cgiparams{'AUTH'} eq 'psk') { $confighash{$key}[4] = 'psk'; $confighash{$key}[5] = $cgiparams{'PSK'}; } else { $confighash{$key}[4] = 'cert'; } - if ($cgiparams{'TYPE'} eq 'net') { - $confighash{$key}[6] = $cgiparams{'SIDE'}; - $confighash{$key}[11] = $cgiparams{'REMOTE_SUBNET'}; - } $confighash{$key}[8] = $cgiparams{'LOCAL_SUBNET'}; $confighash{$key}[10] = $cgiparams{'REMOTE'}; $confighash{$key}[25] = $cgiparams{'REMARK'}; @@ -2376,7 +2333,7 @@ END } print "
"; - print ""; + print ""; if ($cgiparams{'KEY'}) { print ""; @@ -2386,7 +2343,6 @@ END &Header::openbox('100%', 'LEFT', "$Lang::tr{'connection'}:"); print "\n"; print ""; - if ($cgiparams{'TYPE'} eq 'host') { if ($cgiparams{'KEY'}) { print "\n"; } else { @@ -2402,42 +2358,6 @@ END # print ""; # print ""; # print <"; - if ($cgiparams{'KEY'}) { - print ""; - } else { - print ""; - } - print <  - - - - - - - - - -ttt - - - - - - - - - - - - -END - ; - } print ""; print ""; @@ -2519,6 +2439,11 @@ END print < + + + + + -- 2.39.2
$Lang::tr{'name'}:$cgiparams{'NAME'}
$cgiparams{'NAME'} 
$Lang::tr{'Act as'}$Lang::tr{'remote host/ip'}:
$Lang::tr{'local subnet'}$Lang::tr{'remote subnet'}
$Lang::tr{'ovpn subnet'}
$Lang::tr{'protocol'}$Lang::tr{'destination port'}:
$Lang::tr{'comp-lzo'}
$Lang::tr{'MTU'} 
$Lang::tr{'remark title'} 
 $Lang::tr{'valid till'} (days):
  $Lang::tr{'pkcs12 file password'}:
 $Lang::tr{'pkcs12 file password'}:
($Lang::tr{'confirmation'})