OpenVPN_Management_GUI/Admin/Modules/VPNconfig/include/config.php

150 lines
6.8 KiB
PHP

<?php
$moduleurl = $_SERVER["REQUEST_URI"];
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNconfig/config.inc");
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNconfig/include/functions.inc");
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNconfig/include/openvpn-functions.inc");
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNconfig/include/openssl-functions.inc");
openvpn_load_server_conf ();
if (!isset ($openvpn['Server'])) html_error ("The OpenVPN server has no configuration file");
openvpn_load_status ();
if (!isset ($openvpn['Server']['Title'])) html_error ("The OpenVPN server has no status file");
openssl_load_database ();
if(is_file("/var/run/openvpn.server.pid"))
{
echo "<b>VPN Server is currently: <font color=green>running</font></b><br />";
}
else
{
echo "<b>VPN Server is currently: <font color=red>stopped</font></b><br />";
}
if ($_REQUEST["uebergabe3"]=="1")
{
echo "<b>VPN Server restarted successfully!</b>";
echo "<meta http-equiv=\"Refresh\" content=\"1; url=".$moduleurl."&uebergabe=2\">";
}
if ($_REQUEST["uebergabe3"]=="2")
{
echo "<b>VPN Server started successfully!</b>";
echo "<meta http-equiv=\"Refresh\" content=\"1; url=".$moduleurl."&uebergabe=2\">";
}
if ($_REQUEST["uebergabe3"]=="3")
{
echo "<b>VPN Server stopped successfully!</b>";
echo "<meta http-equiv=\"Refresh\" content=\"1; url=".$moduleurl."&uebergabe=2\">";
}
?>
<table>
<tr>
<td>
<form action="/Admin/Modules/VPNconfig/include/restartvpn.php" method="post" >
<input type="hidden" name="path" size="50" value="<?php echo $moduleurl;?>" />
<input type="submit" value="Restart VPN Server" />
</form>
</td>
<?php
if(!is_file("/var/run/openvpn.server.pid"))
{
echo "
<td>
<form action=\"/Admin/Modules/VPNconfig/include/startvpn.php\" method=\"post\" >
<input type=\"hidden\" name=\"path\" size=\"50\" value=\"".$moduleurl."\" />
<input type=\"submit\" value=\"Start VPN Server\" />
</form>
</td>";
}
?>
<?php
if(is_file("/var/run/openvpn.server.pid"))
{
echo "
<td>
<form action=\"/Admin/Modules/VPNconfig/include/stopvpn.php\" method=\"post\" >
<input type=\"hidden\" name=\"path\" size=\"50\" value=\"".$moduleurl."\" />
<input type=\"submit\" value=\"Stop VPN Server\" />
</form>
</td>";
}
?>
</tr>
</table>
<br />
<table border="0" width="100%" cellspacing="0" cellpadding="4">
<tr valign="top">
<td colspan="2" style="border-top:1px groove black; border-bottom:1px groove black"><b>Server Settings</b></td></tr>
<tr valign="top">
<td nowrap width="1%" align="right" bgcolor="#DDFFCC">Mode</td>
<td><font color="darkgreen"><?php echo $openvpn['Server']['Mode']; ?>
</font></td>
</tr>
<tr valign="top">
<td nowrap width="1%" align="right" bgcolor="#DDFFCC">Uses device</td>
<td><font color="darkgreen"><?php echo $openvpn['Server']['Dev']; ?>
</font></td>
</tr>
<tr valign="top">
<td nowrap width="1%" align="right" bgcolor="#DDFFCC">Listens on</td>
<td><font color="darkgreen"><?php echo $openvpn['Server']['Local']; ?>
: <?php echo $openvpn['Server']['Port']; ?>
(<?php echo $openvpn['Server']['Proto']; ?>
)</font></td>
</tr>
<tr valign="top">
<td nowrap width="1%" align="right" bgcolor="#DDFFCC">Maximum Clients</td>
<td><font color="darkgreen"><?php echo $openvpn['Server']['MaxClients']; ?>
</font></td>
</tr>
<tr valign="top"><td colspan="2" style="border-top:1px groove black; border-bottom:1px groove black"><b>Certificate Files</b></td></tr>
<tr valign="top">
<td nowrap width="1%" align="right" bgcolor="#DDFFCC">DH</td>
<td><font color="darkgreen"><?php echo $openvpn['Server']['DH']['File']; ?>
</font> <?php echo ''; ?><?php if ($openvpn['Server']['DH']['Exists'] == true): ?><?php echo '[<a href="'; ?><?php echo $moduleurl; ?><?php echo '?Action=DownloadConfigFile&id=DH" title=\'DH File\'>download</a>]'; ?><?php else: ?><?php echo '[<font color="red">does not exist</font>]'; ?><?php endif; ?><?php echo ''; ?>
</td>
</tr>
<tr valign="top">
<td nowrap width="1%" align="right" bgcolor="#DDFFCC">CA Certificate</td>
<td><font color="darkgreen"><?php echo $openvpn['Openssl']['CA']['File']; ?>
</font> <?php echo ''; ?><?php if ($openvpn['Openssl']['CA']['Exists'] == true): ?><?php echo '[<a href="'; ?><?php echo $moduleurl; ?><?php echo '?Action=DownloadConfigFile&id=CA" title=\'Certificate Authority Public Certificate\'>download</a>]'; ?><?php else: ?><?php echo '[<font color="red">does not exist</font>]'; ?><?php endif; ?><?php echo ''; ?>
</td>
</tr>
<tr valign="top">
<td nowrap width="1%" align="right" bgcolor="#DDFFCC">Server Certificate</td>
<td><font color="darkgreen"><?php echo $openvpn['Server']['Certificate']['File']; ?>
</font> <?php echo ''; ?><?php if ($openvpn['Server']['Certificate']['Exists'] == true): ?><?php echo '[<a href="'; ?><?php echo $moduleurl; ?><?php echo '?Action=DownloadConfigFile&id=CRT" title=\'Server Public Certificate\'>download</a>]'; ?><?php else: ?><?php echo '[<font color="red">does not exist</font>]'; ?><?php endif; ?><?php echo ''; ?>
</td>
</tr>
<tr valign="top">
<td nowrap width="1%" align="right" bgcolor="#DDFFCC">Server Private Key</td>
<td><font color="darkgreen"><?php echo $openvpn['Server']['Private_Key']['File']; ?>
</font> <?php echo ''; ?><?php if ($openvpn['Server']['Private_Key']['Exists'] == true): ?><?php echo '[<a href="'; ?><?php echo $_SERVER['PHP_SELF']; ?><?php echo '?Action=DownloadConfigFile&id=KEY" title=\'Server Private Key\'>download</a>]'; ?><?php else: ?><?php echo '[<font color="red">does not exist</font>]'; ?><?php endif; ?><?php echo ''; ?>
</td>
</tr>
<tr valign="top">
<td nowrap width="1%" align="right" bgcolor="#DDFFCC">TLS Authentication</td>
<td><font color="darkgreen"><?php echo $openvpn['Server']['TLS_Auth']['File']; ?>
</font><?php echo ''; ?><?php if ($openvpn['Server']['DH']['Exists'] == true): ?><?php echo ', '; ?><?php if ($openvpn['Server']['TLS_Auth']['Key'] == 0): ?><?php echo 'server '; ?><?php else: ?><?php echo 'client '; ?><?php endif; ?><?php echo 'side [<a href="'; ?><?php echo $moduleurl; ?><?php echo '?Action=DownloadConfigFile&id=TLS" title=\'Server TLS Key\'>download</a>]'; ?><?php else: ?><?php echo '&nbsp;[<font color="red">does not exist</font>]'; ?><?php endif; ?><?php echo ''; ?>
</td>
</tr>
<tr valign="top">
<td nowrap width="1%" align="right" bgcolor="#DDFFCC">CRL Verify File</td>
<td><font color="darkgreen"><?php echo $openvpn['Server']['CRL_Verify']['File']; ?>
</font> <?php echo ''; ?><?php if ($openvpn['Server']['CRL_Verify']['Exists'] == true): ?><?php echo '[<a href="'; ?><?php echo $moduleurl; ?><?php echo '?Action=DownloadConfigFile&id=CRL" title=\'OPENSSL Certificate Revocation List\'>download</a>]'; ?><?php else: ?><?php echo '[<font color="red">does not exist</font>]'; ?><?php endif; ?><?php echo ''; ?>
</td>
</tr>
</table>