1
|
<?php
|
2
|
/*
|
3
|
vpn_openvpn_crl.php
|
4
|
|
5
|
Copyright (C) 2005 Peter Allgeyer (allgeyer@web.de).
|
6
|
All rights reserved.
|
7
|
|
8
|
Redistribution and use in source and binary forms, with or without
|
9
|
modification, are permitted provided that the following conditions are met:
|
10
|
|
11
|
1. Redistributions of source code must retain the above copyright notice,
|
12
|
this list of conditions and the following disclaimer.
|
13
|
|
14
|
2. Redistributions in binary form must reproduce the above copyright
|
15
|
notice, this list of conditions and the following disclaimer in the
|
16
|
documentation and/or other materials provided with the distribution.
|
17
|
|
18
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
19
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
21
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
22
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27
|
POSSIBILITY OF SUCH DAMAGE.
|
28
|
*/
|
29
|
|
30
|
require("guiconfig.inc");
|
31
|
require_once("openvpn.inc");
|
32
|
|
33
|
if (!is_array($config['ovpn']))
|
34
|
$config['ovpn'] = array();
|
35
|
if (!is_array($config['ovpn']['server'])){
|
36
|
$config['ovpn']['server'] = array();
|
37
|
$config['ovpn']['server']['tunnel'] = array();
|
38
|
}
|
39
|
if (!is_array($config['ovpn']['server']['crl']))
|
40
|
$config['ovpn']['server']['crl'] = array();
|
41
|
|
42
|
$ovpncrl = &$config['ovpn']['server']['crl'];
|
43
|
|
44
|
$id = $_GET['id'];
|
45
|
if (isset($_POST['id']))
|
46
|
$id = $_POST['id'];
|
47
|
|
48
|
|
49
|
if ($_POST['apply']) {
|
50
|
$retval = 0;
|
51
|
$retval = ovpn_server_crl_add();
|
52
|
|
53
|
/* remove dirty flag */
|
54
|
unlink_if_exists($d_ovpncrldirty_path);
|
55
|
|
56
|
$savemsg = get_std_save_message($retval);
|
57
|
}
|
58
|
|
59
|
if ($_GET['act'] == "del") {
|
60
|
if ($ovpncrl[$id]) {
|
61
|
$ovpnent = $ovpncrl[$id];
|
62
|
|
63
|
unset($ovpncrl[$id]);
|
64
|
write_config();
|
65
|
|
66
|
/* Remove crl file */
|
67
|
ovpn_server_crl_del($ovpnent['crlname']);
|
68
|
|
69
|
/* we should send a SIGUSR1 to openvpn daemon */
|
70
|
touch($d_ovpncrldirty_path);
|
71
|
|
72
|
header("Location: vpn_openvpn_crl.php");
|
73
|
exit;
|
74
|
}
|
75
|
}
|
76
|
|
77
|
$pgtitle = "VPN: OpenVPN";
|
78
|
include("head.inc");
|
79
|
|
80
|
?>
|
81
|
<?php include("fbegin.inc"); ?>
|
82
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
83
|
<p class="pgtitle"><?=$pgtitle?></p>
|
84
|
<?php if ($input_errors) print_input_errors($input_errors); ?>
|
85
|
<?php if (file_exists($d_sysrebootreqd_path) && !file_exists($d_ovpncrldirty_path)) print_info_box(get_std_save_message(0)); ?>
|
86
|
|
87
|
<form action="vpn_openvpn_crl.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
|
88
|
<?php if (file_exists($d_ovpncrldirty_path)): ?><p>
|
89
|
<?php print_info_box_np("OpenVPN CRL files have been changed.<br>You must apply the changes in order for them to take effect.");?>
|
90
|
<?php endif; ?>
|
91
|
|
92
|
<table width="100%" border="0" cellpadding="0" cellspacing="0">
|
93
|
<tr><td>
|
94
|
<?php
|
95
|
$tab_array = array();
|
96
|
$tab_array[] = array("Server", false, "vpn_openvpn_srv.php");
|
97
|
$tab_array[] = array("Client", false, "vpn_openvpn_cli.php");
|
98
|
$tab_array[] = array("Client-specific Configuration", false, "vpn_openvpn_ccd.php");
|
99
|
$tab_array[] = array("CRL", true, "vpn_openvpn_crl.php");
|
100
|
display_top_tabs($tab_array);
|
101
|
?>
|
102
|
</td></tr>
|
103
|
|
104
|
<tr>
|
105
|
<td>
|
106
|
<div id="mainarea">
|
107
|
<table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
|
108
|
<tr>
|
109
|
<td class="vtable">
|
110
|
<strong><span class="red">WARNING: This feature is experimental and modifies your optional interface configuration.
|
111
|
Backup your configuration before using OpenVPN, and restore it before upgrading.
|
112
|
</span></strong>
|
113
|
</td>
|
114
|
</tr>
|
115
|
</table>
|
116
|
|
117
|
<table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
|
118
|
<tr>
|
119
|
<td width="40%" class="listhdrr">CRL name</td>
|
120
|
<td width="50%" class="listhdr">Description</td>
|
121
|
<td width="10%" class="list"></td>
|
122
|
</tr>
|
123
|
<?php $i = 0; foreach ($ovpncrl as $crl):
|
124
|
|
125
|
if (!isset($crl['enable'])) {
|
126
|
$spans = "<span class=\"gray\">";
|
127
|
$spane = "</span>";
|
128
|
} else {
|
129
|
$spans = $spane = "";
|
130
|
}
|
131
|
?>
|
132
|
|
133
|
<tr>
|
134
|
<td class="listlr"><?=$spans;?>
|
135
|
<?= $crl['crlname'];?>
|
136
|
<?=$spane;?></td>
|
137
|
<td class="listbg"><?=$spans;?>
|
138
|
<?= htmlspecialchars($crl['descr']);?>
|
139
|
<?=$spane;?></td>
|
140
|
<td valign="middle" nowrap class="list"><a href="vpn_openvpn_crl_edit.php?id=<?=$i;?>"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_e.gif" title="edit CRL file" width="17" height="17" border="0"></a>
|
141
|
<a href="vpn_openvpn_crl.php?act=del&id=<?=$i;?>" onclick="return confirm('Do you really want to delete this CRL file?')"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_x.gif" title="delete CRL file" width="17" height="17" border="0"></a></td>
|
142
|
</tr>
|
143
|
<?php $i++; endforeach; ?>
|
144
|
<tr>
|
145
|
<td class="list" colspan="2"> </td>
|
146
|
<td class="list"><a href="vpn_openvpn_crl_edit.php"><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_plus.gif" title="add CRL file" width="17" height="17" border="0"></a></td>
|
147
|
</tr>
|
148
|
<td colspan="4">
|
149
|
<p><span class="vexpl"><span class="red"><strong>Note:</strong></span><br>
|
150
|
A CRL (certificate revocation list) is used when a particular
|
151
|
key is compromised but when the overall PKI is still intact.<br>
|
152
|
<br>
|
153
|
Suppose you had a PKI consisting of a CA, root certificate, and
|
154
|
a number of client certificates. Suppose a laptop computer
|
155
|
containing a client key and certificate was stolen. By adding the
|
156
|
stolen certificate to the CRL file, you could reject any connection
|
157
|
which attempts to use it, while preserving the overall
|
158
|
integrity of the PKI.<br>
|
159
|
<br>
|
160
|
The only time when it would be necessary to rebuild the entire
|
161
|
PKI from scratch would be if the root certificate key itself was
|
162
|
compromised.
|
163
|
</span>
|
164
|
</p>
|
165
|
</td>
|
166
|
</table>
|
167
|
</td>
|
168
|
</tr>
|
169
|
</table>
|
170
|
</form>
|
171
|
<?php include("fend.inc"); ?>
|