mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-13 12:32:59 +02:00
openvpn: Renamed CA chart, added ta.key to chart.
* Added keys to CA chart and renamed CA specifics infos to CA and key infos. * Added ta.key to CA/key chart listing.
This commit is contained in:
@@ -1530,6 +1530,17 @@ END
|
||||
exit(0);
|
||||
}
|
||||
|
||||
###
|
||||
### Download tls-auth key
|
||||
###
|
||||
}elsif ($cgiparams{'ACTION'} eq $Lang::tr{'download tls-auth key'}) {
|
||||
if ( -f "${General::swroot}/ovpn/certs/ta.key" ) {
|
||||
print "Content-Type: application/octet-stream\r\n";
|
||||
print "Content-Disposition: filename=ta.key\r\n\r\n";
|
||||
print `/bin/cat ${General::swroot}/ovpn/certs/ta.key`;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
###
|
||||
### Form for generating a root certificate
|
||||
###
|
||||
@@ -2369,6 +2380,28 @@ if ($confighash{$cgiparams{'KEY'}}[3] eq 'net') {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
###
|
||||
### Display tls-auth key
|
||||
###
|
||||
} elsif ($cgiparams{'ACTION'} eq $Lang::tr{'show tls-auth key'}) {
|
||||
|
||||
if (! -e "${General::swroot}/ovpn/certs/ta.key") {
|
||||
$errormessage = $Lang::tr{'not present'};
|
||||
} else {
|
||||
&Header::showhttpheaders();
|
||||
&Header::openpage($Lang::tr{'ovpn'}, 1, '');
|
||||
&Header::openbigbox('100%', 'LEFT', '', '');
|
||||
&Header::openbox('100%', 'LEFT', "$Lang::tr{'ta key'}:");
|
||||
my $output = `/bin/cat ${General::swroot}/ovpn/certs/ta.key`;
|
||||
$output = &Header::cleanhtml($output,"y");
|
||||
print "<pre>$output</pre>\n";
|
||||
&Header::closebox();
|
||||
print "<div align='center'><a href='/cgi-bin/ovpnmain.cgi'>$Lang::tr{'back'}</a></div>";
|
||||
&Header::closebigbox();
|
||||
&Header::closepage();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
###
|
||||
### Display Certificate Revoke List
|
||||
###
|
||||
@@ -5214,6 +5247,8 @@ END
|
||||
;
|
||||
&Header::closebox();
|
||||
}
|
||||
|
||||
# CA/key listing
|
||||
&Header::openbox('100%', 'LEFT', "$Lang::tr{'certificate authorities'}");
|
||||
print <<END;
|
||||
<table width='100%' cellspacing='1' cellpadding='0' class='tbl'>
|
||||
@@ -5228,6 +5263,8 @@ END
|
||||
my $col2="bgcolor='$color{'color20'}'";
|
||||
# DH parameter line
|
||||
my $col3="bgcolor='$color{'color22'}'";
|
||||
# ta.key line
|
||||
my $col4="bgcolor='$color{'color20'}'";
|
||||
|
||||
if (-f "${General::swroot}/ovpn/ca/cacert.pem") {
|
||||
my $casubject = `/usr/bin/openssl x509 -text -in ${General::swroot}/ovpn/ca/cacert.pem`;
|
||||
@@ -5333,6 +5370,40 @@ END
|
||||
;
|
||||
}
|
||||
|
||||
# Adding ta.key to chart
|
||||
if (-f "${General::swroot}/ovpn/certs/ta.key") {
|
||||
my $tasubject = `/bin/cat ${General::swroot}/ovpn/certs/ta.key`;
|
||||
$tasubject =~ /# (.*)[\n]/;
|
||||
$tasubject = $1;
|
||||
print <<END;
|
||||
|
||||
<tr>
|
||||
<td class='base' $col4>$Lang::tr{'ta key'}</td>
|
||||
<td class='base' $col4>$tasubject</td>
|
||||
<form method='post' name='frmtakey'><td width='3%' align='center' $col4>
|
||||
<input type='hidden' name='ACTION' value='$Lang::tr{'show tls-auth key'}' />
|
||||
<input type='image' name='$Lang::tr{'edit'}' src='/images/info.gif' alt='$Lang::tr{'show tls-auth key'}' title='$Lang::tr{'show tls-auth key'}' width='20' height='20' border='0' />
|
||||
</form>
|
||||
<form method='post' name='frmtakey'><td width='3%' align='center' $col4>
|
||||
<input type='image' name='$Lang::tr{'download tls-auth key'}' src='/images/media-floppy.png' alt='$Lang::tr{'download tls-auth key'}' title='$Lang::tr{'download tls-auth key'}' border='0' />
|
||||
<input type='hidden' name='ACTION' value='$Lang::tr{'download tls-auth key'}' />
|
||||
</form>
|
||||
<td width='4%' $col4> </td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
} else {
|
||||
# Nothing
|
||||
print <<END;
|
||||
<tr>
|
||||
<td width='25%' class='base' $col4>$Lang::tr{'ta key'}:</td>
|
||||
<td class='base' $col4>$Lang::tr{'not present'}</td>
|
||||
<td colspan='3' $col4> </td>
|
||||
</tr>
|
||||
END
|
||||
;
|
||||
}
|
||||
|
||||
if (! -f "${General::swroot}/ovpn/ca/cacert.pem") {
|
||||
print "<tr><td colspan='5' align='center'><form method='post'>";
|
||||
print "<input type='submit' name='ACTION' value='$Lang::tr{'generate root/host certificates'}' />";
|
||||
@@ -5391,6 +5462,9 @@ END
|
||||
<hr size='1'>
|
||||
<form method='post' enctype='multipart/form-data'>
|
||||
<table width='100%' border='0'cellspacing='1' cellpadding='0'>
|
||||
<tr>
|
||||
<td class'base'><b>CA-Upload</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='base' nowrap='nowrap'>$Lang::tr{'ca name'}:</td>
|
||||
<td nowrap='nowrap'><input type='text' name='CA_NAME' value='$cgiparams{'CA_NAME'}' size='15' align='left'/></td>
|
||||
|
||||
Reference in New Issue
Block a user