Project

General

Profile

Download (5.95 KB) Statistics
| Branch: | Tag: | Revision:
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 = array("VPN","OpenVPN");
78
include("head.inc");
79

    
80
?>
81
<?php include("fbegin.inc"); ?>
82
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
83
<?php if ($input_errors) print_input_errors($input_errors); ?>
84
<?php if (file_exists($d_sysrebootreqd_path) && !file_exists($d_ovpncrldirty_path)) print_info_box(get_std_save_message(0)); ?>
85

    
86
<form action="vpn_openvpn_crl.php" method="post" enctype="multipart/form-data" name="iform" id="iform">
87
<?php if (file_exists($d_ovpncrldirty_path)): ?><p>
88
<?php print_info_box_np("OpenVPN CRL files have been changed.<br>You must apply the changes in order for them to take effect.");?>
89
<?php endif; ?>
90

    
91
<table width="100%" border="0" cellpadding="0" cellspacing="0">
92
  <tr><td>
93
  <?php
94
	$tab_array = array();
95
	$tab_array[] = array("Server", false, "vpn_openvpn_srv.php");
96
	$tab_array[] = array("Client", false, "vpn_openvpn_cli.php");
97
	$tab_array[] = array("Client-specific Configuration", false, "vpn_openvpn_ccd.php");
98
	$tab_array[] = array("CRL", true, "vpn_openvpn_crl.php");
99
	display_top_tabs($tab_array);
100
?>
101
  </td></tr>
102
  
103
  <tr> 
104
    <td>
105
	<div id="mainarea">
106
        <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0">
107
                <tr> 
108
                  <td class="vtable">
109
				    <strong><span class="red">WARNING: This feature is experimental and modifies your optional interface configuration.
110
					Backup your configuration before using OpenVPN, and restore it before upgrading.
111
				    </span></strong>
112
				  </td>
113
				</tr>
114
        </table>
115
		
116
    <table class="tabcont" width="100%" border="0" cellpadding="0" cellspacing="0">
117
	<tr>
118
	  <td width="40%" class="listhdrr">CRL name</td>
119
	  <td width="50%" class="listhdr">Description</td>
120
	  <td width="10%" class="list"></td>
121
	</tr>
122
	<?php $i = 0; foreach ($ovpncrl as $crl):
123

    
124
		if (!isset($crl['enable'])) {
125
			$spans = "<span class=\"gray\">";
126
			$spane = "</span>";
127
		} else {
128
			$spans = $spane = "";
129
		}
130
	?>
131
	
132
	<tr>
133
	  <td class="listlr"><?=$spans;?>
134
		<?= $crl['crlname'];?>
135
	  <?=$spane;?></td>
136
	  <td class="listbg"><?=$spans;?>
137
		<?= htmlspecialchars($crl['descr']);?>&nbsp;
138
	  <?=$spane;?></td>
139
	  <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>
140
		&nbsp;<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>
141
	</tr>
142
  	<?php $i++; endforeach; ?>
143
	<tr> 
144
	  <td class="list" colspan="2">&nbsp;</td>
145
	  <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>
146
	</tr>
147
	<td colspan="4">
148
		      <p><span class="vexpl"><span class="red"><strong>Note:</strong></span><br>
149
					A  CRL  (certificate  revocation list) is used when a particular
150
					key is compromised but when the overall PKI is still intact.<br>
151
					<br>
152
					Suppose you had a PKI consisting of a CA, root certificate,  and
153
					a number of client certificates.  Suppose a laptop computer
154
					containing a client key and certificate was stolen.  By adding  the
155
					stolen certificate to the CRL file, you could reject any connection
156
					which attempts to use it, while preserving the overall
157
					integrity of the PKI.<br>
158
					<br>
159
					The  only  time when it would be necessary to rebuild the entire
160
					PKI from scratch would be if the root certificate key itself was
161
					compromised.
162
				    </span>
163
			  </p>
164
	</td>
165
    </table>
166
  </td>
167
</tr>
168
</table>
169
</form>
170
<?php include("fend.inc"); ?>
(186-186/197)