VPN-Management-GUI 2.0.3 porting start
This commit is contained in:
parent
d3b0130655
commit
68a4fa5922
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 46 KiB |
Binary file not shown.
Before Width: | Height: | Size: 33 KiB |
@ -1,3 +0,0 @@
|
||||
<?php
|
||||
echo "Error!";
|
||||
?>
|
7
install/.htaccess
Normal file
7
install/.htaccess
Normal file
@ -0,0 +1,7 @@
|
||||
AuthType Basic
|
||||
AuthName "VPN WebAdmin - Authorised Personal Only"
|
||||
AuthBasicProvider file
|
||||
AuthUserFile /etc/apache2/htpasswd
|
||||
AuthGroupFile /dev/null
|
||||
require valid-user
|
||||
|
146
install/index.php
Normal file
146
install/index.php
Normal file
@ -0,0 +1,146 @@
|
||||
<?php
|
||||
function check_perms($path,$perm)
|
||||
{
|
||||
clearstatcache();
|
||||
$configmod = substr(sprintf('%o', fileperms($path)), -4);
|
||||
$trcss = (($configmod != $perm) ? "background-color:#fd7a7a;" : "background-color:#91f587;");
|
||||
if($configmod != $perm) define("FAIL_INST", 1);
|
||||
echo "<tr style=".$trcss.">";
|
||||
echo "<td style=\"border:0px;\">". $path ."</td>";
|
||||
echo "<td style=\"border:0px;\">$perm</td>";
|
||||
echo "<td style=\"border:0px;\">$configmod</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
?>
|
||||
|
||||
<html>
|
||||
<head><title>VPNManagement Installer Page</title></head>
|
||||
<body>
|
||||
<h1>Install VPNManagement</h1>
|
||||
|
||||
<p>Checking PHP...
|
||||
<?php
|
||||
if (version_compare(PHP_VERSION, '4.3.3') < 0)
|
||||
{
|
||||
echo "<font color=red> [FAIL]</font></p>";
|
||||
die('You are running an unsupported PHP version. Please upgrade to PHP 4.3.3 or higher before trying to install SchulVPN');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<font color=lime> [OK]</font></p>";
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<p>Checking OpenVPN...
|
||||
<?php
|
||||
$vpn = shell_exec("/usr/sbin/openvpn --version");
|
||||
preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $vpn, $versionvpn);
|
||||
if (version_compare($versionvpn[0], '2.1.0') < 0)
|
||||
{
|
||||
echo "<font color=red> [FAIL]</font></p>";
|
||||
die("You are running an unsupported OpenVPN version (".$versionvpn[0]."). Please upgrade to OpenVPN 2.1.0 or higher before trying to install SchulVPN");
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<font color=lime> [OK]</font></p>";
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<p>Checking MySQL...
|
||||
<?php
|
||||
$mysql = shell_exec('mysql -V');
|
||||
preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $mysql, $version);
|
||||
|
||||
if (version_compare($version[0], '5.0.00') < 0)
|
||||
{
|
||||
echo "<font color=red> [FAIL]</font></p>";
|
||||
die('You are running an unsupported MySQL version (".$version[0]."). Please upgrade to MySQL 5.0.00 or higher before trying to install SchulVPN');
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<font color=lime> [OK]</font></p>";
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<p>Checking OpenSSL...
|
||||
<?php
|
||||
$ssl=exec("echo \$OPENSSL_CONF");;
|
||||
if($ssl == "/etc/openvpn/easy-rsa2/openssl.cnf")
|
||||
{
|
||||
echo "<font color=lime> [OK]</font></p>";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<font color=red> [FAIL]</font></p>";
|
||||
die("No OpenSSL Config found: ".$ssl." should be: /etc/openvpn/easy-rsa2/openssl.cnf!");
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<p>Checking Directorys...
|
||||
<table width=\"70%\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\" style=\"text-align:center;\">
|
||||
<tr>
|
||||
<th style="border:5px;"><b>File/Folder Name</b></th>
|
||||
<th style="border:5px;"><b>Needed Chmod</b></th>
|
||||
<th style="border:5px;"><b>Current Chmod</b></th>
|
||||
</tr>
|
||||
<?php
|
||||
check_perms("/var/www","0777");
|
||||
check_perms("/etc/openvpn","0777");
|
||||
check_perms("/etc/openvpn/easy-rsa2","0777");
|
||||
check_perms("/etc/openvpn/easy-rsa2/keys","0777");
|
||||
check_perms("/etc/openvpn/config/server.conf","0777");
|
||||
check_perms("/etc/openvpn/config/database","0777");
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
if(FAIL_INST == 1)
|
||||
{
|
||||
die('Please change the folder/file permissions!');
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
|
||||
<form action="install1.php" method="post">
|
||||
<table>
|
||||
<br>
|
||||
<tr>
|
||||
<td>Rootuser/Server:</td>
|
||||
<td><input type="text" name="name" size="50" value="root"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Rootuser/Server Email:</td>
|
||||
<td><input type="text" name="email" size="50"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Passwort:</td>
|
||||
<td><input type="password" name="pwd" size="50"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Datenbank Server:</td>
|
||||
<td><input type="text" name="dbserv" size="50" value="localhost"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Datenbank Port:</td>
|
||||
<td><input type="text" name="dbport" size="50" value="3306"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Datenbank Name:</td>
|
||||
<td><input type="text" name="dbname" size="50" value="openvpn"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Datenbank User:</td>
|
||||
<td><input type="text" name="dbuser" size="50"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Datenbank Passwort:</td>
|
||||
<td><input type="password" name="dbpwd" size="50"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>OpenVPN Config Directory (WITHOUT ending /):</td>
|
||||
<td><input type="text" name="vpndir" size="50" value="/etc/openvpn/config"></td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type="submit" value="Install! STEP 1">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
330
install/install1.php
Normal file
330
install/install1.php
Normal file
@ -0,0 +1,330 @@
|
||||
<html>
|
||||
<head><title>Installer Page STEP 1</title></head>
|
||||
<body>
|
||||
<?php
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Define Script Version
|
||||
//------------------------------------------------------------------------------
|
||||
$version = "2.0.3";
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
|
||||
echo "INSTALLING...<br>";
|
||||
|
||||
// Aufbau der Datenbankverbindung
|
||||
@$y = mysql_connect($_REQUEST["dbserv"],$_REQUEST["dbuser"],$_REQUEST["dbpwd"]);
|
||||
$sql = 'CREATE DATABASE ' . $_REQUEST["dbname"];
|
||||
if (mysql_query($sql, $y))
|
||||
{
|
||||
echo "Datenbank erfolgreich angelegt! [<b><font color=lime>OK</b></font>]<br>\n";
|
||||
$config = "<?php
|
||||
\$MYSQL_HOST=\"".$_REQUEST["dbserv"]."\";
|
||||
\$MYSQL_USER=\"".$_REQUEST["dbuser"]."\";
|
||||
\$MYSQL_PASS=\"".$_REQUEST["dbpwd"]."\";
|
||||
\$MYSQL_DATABASE=\"".$_REQUEST["dbname"]."\";?>";
|
||||
$dateiname = "../Config/_dbconfig_.php";
|
||||
$handler = fOpen($dateiname , "w");
|
||||
fWrite($handler , $config);
|
||||
fClose($handler);
|
||||
|
||||
$config = "user: ".$_REQUEST["dbuser"].
|
||||
"\npasswd: ".$_REQUEST["dbpwd"].
|
||||
"\ndatabase: ".$_REQUEST["dbname"].
|
||||
"\nhost: ".$_REQUEST["dbserv"];
|
||||
$dateiname = $_REQUEST["vpndir"]."/database";
|
||||
$handler = fOpen($dateiname , "w");
|
||||
fWrite($handler , $config);
|
||||
fClose($handler);
|
||||
exec("chmod 777 ".$dateiname);
|
||||
|
||||
echo "Konfiguration erfolgreich angelegt! [<b><font color=lime>OK</b></font>]<br>\n";
|
||||
include("../Config/_dbconfig_.php");
|
||||
}
|
||||
else
|
||||
{
|
||||
die("Fehler beim Anlegen der Datenbank! [<b><font color=red>FAIL</b></font>]<br>");
|
||||
}
|
||||
|
||||
@$x = mysql_select_db($MYSQL_DATABASE);
|
||||
if (empty($x))
|
||||
{
|
||||
die ("Keine Verbindung zur Datenbank! [<b><font color=red>FAIL</b></font>]<br>");
|
||||
}
|
||||
|
||||
// MYSQL QUERYS....
|
||||
mysql_query ("
|
||||
CREATE TABLE userdata (
|
||||
Id Int(11) NOT NULL auto_increment,
|
||||
IsAdmin Int(1) NOT NULL default 0,
|
||||
VPNId VarChar(2) NOT NULL default '-',
|
||||
Nickname VarChar(50) NOT NULL default '',
|
||||
Kennwort VarChar(50) NOT NULL default '',
|
||||
Nachname VarChar(50) NOT NULL default '',
|
||||
Vorname VarChar(50) NOT NULL default '',
|
||||
Email VarChar(100) NOT NULL default '',
|
||||
Avatar Int(1) NOT NULL default 0,
|
||||
NovLogin VarChar(50) NOT NULL default '',
|
||||
NovPass VarChar(50) NOT NULL default '',
|
||||
PRIMARY KEY (Id)
|
||||
)
|
||||
");
|
||||
|
||||
mysql_query ("
|
||||
CREATE TABLE `connections` (
|
||||
`id` int(255) unsigned NOT NULL auto_increment,
|
||||
`start` int(14) unsigned NOT NULL default '0',
|
||||
`stop` int(14) unsigned NOT NULL default '0',
|
||||
`ip` varchar(15) default NULL,
|
||||
`local_ip` varchar(15) default NULL,
|
||||
`remote_ip` varchar(15) default NULL,
|
||||
`client` varchar(255) NOT NULL default '',
|
||||
`sent` bigint(255) NOT NULL default '0',
|
||||
`received` bigint(255) NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=ascii;
|
||||
");
|
||||
|
||||
mysql_query ("
|
||||
CREATE TABLE `month` (
|
||||
`id` int(255) unsigned NOT NULL auto_increment,
|
||||
`month` int(2) unsigned NOT NULL default '0',
|
||||
`year` int(5) unsigned NOT NULL default '0',
|
||||
`sent` bigint(255) unsigned NOT NULL default '0',
|
||||
`received` bigint(255) unsigned NOT NULL default '0',
|
||||
`client` varchar(255) NOT NULL default '',
|
||||
`time` int(255) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=ascii;
|
||||
");
|
||||
|
||||
mysql_query ("
|
||||
CREATE TABLE `year` (
|
||||
`id` int(255) unsigned NOT NULL auto_increment,
|
||||
`year` int(5) unsigned NOT NULL default '0',
|
||||
`sent` bigint(255) unsigned NOT NULL default '0',
|
||||
`received` bigint(255) unsigned NOT NULL default '0',
|
||||
`client` varchar(255) NOT NULL default '',
|
||||
`time` int(255) unsigned NOT NULL default '0',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=ascii;
|
||||
");
|
||||
|
||||
mysql_query ("
|
||||
CREATE TABLE `forum_question` (
|
||||
`id` int(4) NOT NULL auto_increment,
|
||||
`topic` varchar(255) NOT NULL default '',
|
||||
`detail` longtext NOT NULL,
|
||||
`name` varchar(65) NOT NULL default '',
|
||||
`avatar` varchar(65) NOT NULL default '0',
|
||||
`closed` varchar(65) NOT NULL default '0',
|
||||
`category` varchar(65) NOT NULL default '0',
|
||||
`w_adminonly` varchar(65) NOT NULL default '0',
|
||||
`w_guest` varchar(65) NOT NULL default '0',
|
||||
`r_adminonly` varchar(65) NOT NULL default '0',
|
||||
`r_guest` varchar(65) NOT NULL default '0',
|
||||
`datetime` varchar(25) NOT NULL default '',
|
||||
`view` int(4) NOT NULL default '0',
|
||||
`reply` int(4) NOT NULL default '0',
|
||||
`lastupdate` varchar(50) NOT NULL default '',
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MyISAM AUTO_INCREMENT=1 ;
|
||||
");
|
||||
|
||||
mysql_query ("
|
||||
CREATE TABLE `forum_answer` (
|
||||
`question_id` int(4) NOT NULL default '0',
|
||||
`a_id` int(4) NOT NULL default '0',
|
||||
`a_name` varchar(65) NOT NULL default '',
|
||||
`a_avatar` varchar(65) NOT NULL default '',
|
||||
`a_answer` longtext NOT NULL,
|
||||
`a_datetime` varchar(25) NOT NULL default '',
|
||||
`a_attachment` varchar(25) NOT NULL default '',
|
||||
KEY `a_id` (`a_id`)
|
||||
) TYPE=MyISAM;
|
||||
");
|
||||
|
||||
mysql_query ("
|
||||
CREATE TABLE `config` (
|
||||
`id` int(254) NOT NULL auto_increment,
|
||||
`attr` varchar(100) NOT NULL default '',
|
||||
`value` varchar(500) NOT NULL default '',
|
||||
`extra` varchar(100) NOT NULL default 'NULL',
|
||||
PRIMARY KEY (`id`)
|
||||
) TYPE=MyISAM;
|
||||
");
|
||||
|
||||
mysql_query ("
|
||||
CREATE TABLE `proxyrepair` (
|
||||
`Count` int(11) NOT NULL AUTO_INCREMENT,
|
||||
`Id` int(11) NOT NULL,
|
||||
`VPNId` varchar(3) NOT NULL,
|
||||
`IP` varchar(16) NOT NULL,
|
||||
`Time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
`RepID` varchar(3) NOT NULL,
|
||||
PRIMARY KEY (`Count`)
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=77 ;
|
||||
");
|
||||
|
||||
// Definition des standard Benutzer
|
||||
$benutzer[0]["IsAdmin"] =1;
|
||||
$benutzer[0]["VPNId"] = "-";
|
||||
$benutzer[0]["Nickname"] =$_REQUEST["name"];
|
||||
$benutzer[0]["Kennwort"] = $_REQUEST["pwd"];
|
||||
$benutzer[0]["Nachname"] = "Admin";
|
||||
$benutzer[0]["Vorname"] = "Server";
|
||||
$benutzer[0]["Email"] = $_REQUEST["email"];
|
||||
|
||||
// Zuerst alle Datensätze löschen um keine Dopplungen zu bekommen.
|
||||
mysql_query ("DELETE FROM userdata");
|
||||
|
||||
// Daten eintragen
|
||||
while (list ($key, $value) = each ($benutzer))
|
||||
{
|
||||
// SQL-Anweisung erstellen
|
||||
$sql = "INSERT INTO ".
|
||||
"userdata (IsAdmin, VPNId, Nickname, Kennwort, Nachname, Vorname, Email) ".
|
||||
"VALUES ('".$value["IsAdmin"]."','".
|
||||
$value["VPNId"]."', '".
|
||||
$value["Nickname"]."', '".
|
||||
md5 ($value["Kennwort"])."', '".
|
||||
$value["Nachname"]."', '".
|
||||
$value["Vorname"]."', '".
|
||||
$value["Email"]."')";
|
||||
mysql_query ($sql);
|
||||
|
||||
if (mysql_affected_rows ($y) > 0)
|
||||
{
|
||||
echo "Benutzer erfolgreich angelegt! [<b><font color=lime>OK</b></font>]<br>\n";
|
||||
echo "
|
||||
<form action=\"install2.php\" method=\"post\">
|
||||
<table>
|
||||
<br>
|
||||
<tr>
|
||||
<td>Sitename:</td>
|
||||
<td><input type=\"text\" name=\"sitename\" size=\"50\" value=\"SchulVPN\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Sitesubname</td>
|
||||
<td><input type=\"text\" name=\"subname\" size=\"50\" value=\"Surf Secure\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Siteinfo (Header Marquee, empty = no marquee) </td>
|
||||
<td><input type=\"text\" name=\"siteinfo\" size=\"50\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Theme:</td>
|
||||
<td>
|
||||
<select name=\"sitetheme\" size=1> ";
|
||||
// Öffnet ein Unterverzeichnis mit dem Namen "daten"
|
||||
$verzeichnis = openDir($_SERVER["DOCUMENT_ROOT"]."/Themes");
|
||||
// Verzeichnis lesen
|
||||
while ($file = readDir($verzeichnis))
|
||||
{
|
||||
// Höhere Verzeichnisse nicht anzeigen!
|
||||
if ($file != "." && $file != "..")
|
||||
{
|
||||
$filecut = strpos($file, ".");
|
||||
if($filecut > 0)
|
||||
{
|
||||
$file = substr($file,0,$filecut);
|
||||
echo "<option value=\"".$file."\">".$file."</option>";
|
||||
}
|
||||
}
|
||||
}
|
||||
// Verzeichnis schließen
|
||||
closeDir($verzeichnis);
|
||||
|
||||
echo "
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>OpenVPN Config Directory (WITHOUT ending /):</td>
|
||||
<td><input type=\"text\" name=\"ovpnconfdir\" size=\"50\" value=\"".$_REQUEST["vpndir"]."\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>OpenVPN Config File Name:</td>
|
||||
<td><input type=\"text\" name=\"ovpnconffile\" size=\"50\" value=\"server.conf\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>OpenVPN Key Directory (WITHOUT ending /):</td>
|
||||
<td><input type=\"text\" name=\"ovpnkeydir\" size=\"50\" value=\"/etc/openvpn/easy-rsa2\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>OpenVPN Additional Download Directory (e.g. for client.ovpn, ca.crt, readme ...) (WITHOUT ending /):</td>
|
||||
<td><input type=\"text\" name=\"publicdown\" value=\"/var/www/publicdown\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Download Directory (for Explorer, WITHOUT ending /):</td>
|
||||
<td><input type=\"text\" name=\"downdir\" size=\"50\" value=\"/home/explorer\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Enable Mail Support:</td>
|
||||
<td>
|
||||
<select name=\"withmail\" size=1>
|
||||
<option value=\"1\">Yes</option>
|
||||
<option value=\"0\">No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SMTP Server:</td>
|
||||
<td><input type=\"text\" name=\"mserv\" size=\"50\" value=\"smtp.live.com\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SMTP User:</td>
|
||||
<td><input type=\"text\" name=\"muser\" size=\"50\" value=\"user@live.com\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SMTP Password:</td>
|
||||
<td><input type=\"password\" name=\"mpass\" size=\"50\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SMTP Sender Mail-Address:</td>
|
||||
<td><input type=\"text\" name=\"mname\" size=\"50\" value=\"noreply@schulvpn.org\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Enable Squid Support:</td>
|
||||
<td>
|
||||
<select name=\"withsquid\" size=1>
|
||||
<option value=\"1\">Yes</option>
|
||||
<option value=\"0\">No</option>
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SQUID Config Directory (WITHOUT ending /):</td>
|
||||
<td><input type=\"text\" name=\"sqdir\" size=\"50\" value=\"/etc/squid\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SQUID Config File Name:</td>
|
||||
<td><input type=\"text\" name=\"sqconf\" size=\"50\" value=\"squid.conf\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>SQUID Dynamic Directory (WIHTOUT ending /):</td>
|
||||
<td><input type=\"text\" name=\"sqddir\" size=\"50\" value=\"/var/sqd\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type=\"hidden\" name=\"admin\" size=\"50\" value=\""; echo $benutzer[0]["Nickname"]; echo "\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type=\"hidden\" name=\"adress\" size=\"50\" value=\""; echo $_SERVER['HTTP_HOST']; echo "\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type=\"hidden\" name=\"version\" size=\"50\" value=\""; echo $version; echo "\"><td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type=\"submit\" value=\"Install! STEP 2\">
|
||||
</form> ";
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Fehler beim Anlegen der Benutzer. [<b><font color=red>FAIL</b></font>]<br>\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
64
install/install2.php
Normal file
64
install/install2.php
Normal file
@ -0,0 +1,64 @@
|
||||
<html>
|
||||
<head><title>Installer Page STEP 2</title></head>
|
||||
<body>
|
||||
<?php
|
||||
echo "INSTALLING...STEP 2<br>";
|
||||
include("../Site/mysql.php");
|
||||
|
||||
list($db,$conn) = db_connect();
|
||||
if (empty($db))
|
||||
{
|
||||
die ("Keine Verbindung zur Datenbank! [<b><font color=red>FAIL</b></font>]<br>");
|
||||
}
|
||||
|
||||
// Daten eintragen
|
||||
while (list ($attr, $value) = each ($_REQUEST))
|
||||
{
|
||||
// SQL-Anweisung erstellen
|
||||
$sql = "INSERT INTO ".
|
||||
"config (attr, value) ".
|
||||
"VALUES ('".$attr."','".
|
||||
$value."')";
|
||||
mysql_query ($sql);
|
||||
}
|
||||
//$sql = "UPDATE config SET value='".md5 ($_REQUEST["mpass"])."' WHERE attr='mpass';";
|
||||
if (mysql_affected_rows ($conn) > 0)
|
||||
{
|
||||
echo "Config erfolgreich gespeichert! [<b><font color=lime>OK</b></font>]<br>\n";
|
||||
echo "
|
||||
<form action=\"install3.php\" method=\"post\">
|
||||
<table>
|
||||
<br>
|
||||
<tr>
|
||||
<td>Country Shortcut:</td>
|
||||
<td><input type=\"text\" name=\"country\" size=\"50\" value=\"AT\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Province:</td>
|
||||
<td><input type=\"text\" name=\"province\" size=\"50\" value=\"Tirol\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>City:</td>
|
||||
<td><input type=\"text\" name=\"city\" size=\"50\" value=\"Innsbruck\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Organisation:</td>
|
||||
<td><input type=\"text\" name=\"organisation\" size=\"50\" value=\"HTL\"><td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Default Email:</td>
|
||||
<td><input type=\"text\" name=\"email\" size=\"50\" value=\"vpn@students.htlinn.ac.at\"><td>
|
||||
</tr>
|
||||
</table>
|
||||
<input type=\"submit\" value=\"Install! STEP 3\">
|
||||
</form> ";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Fehler beim Anlegen der Config!! [<b><font color=red>FAIL</b></font>]<br>\n";
|
||||
}
|
||||
mysql_close();
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
69
install/install3.php
Normal file
69
install/install3.php
Normal file
@ -0,0 +1,69 @@
|
||||
<html>
|
||||
<head><title>Installer Page STEP 3</title></head>
|
||||
<body>
|
||||
<?php
|
||||
echo "INSTALLING...STEP 3<br>";
|
||||
include ("../Site/mysql.php");
|
||||
|
||||
$ovpnconfdir = db_getconfval("ovpnconfdir");
|
||||
$ovpnkeydir = db_getconfval("ovpnkeydir");
|
||||
mysql_close();
|
||||
|
||||
//Generate DH, CA, Server cert...
|
||||
$vars =
|
||||
"export EASY_RSA=\"`pwd`\"
|
||||
export OPENSSL=\"openssl\"
|
||||
export PKCS11TOOL=\"pkcs11-tool\"
|
||||
export GREP=\"grep\"
|
||||
export KEY_CONFIG=`\$EASY_RSA/whichopensslcnf \$EASY_RSA`
|
||||
export KEY_DIR=\"\$EASY_RSA/keys/\"
|
||||
echo NOTE: If you run ./clean-all, I will be doing a rm -rf on \$KEY_DIR
|
||||
export PKCS11_MODULE_PATH=\"dummy\"
|
||||
export PKCS11_PIN=\"dummy\"
|
||||
export KEY_SIZE=1024
|
||||
export CA_EXPIRE=3650
|
||||
export KEY_EXPIRE=3650
|
||||
export KEY_COUNTRY=\"".$_REQUEST["country"]."\"
|
||||
export KEY_PROVINCE=\"".$_REQUEST["province"]."\"
|
||||
export KEY_CITY=\"".$_REQUEST["city"]."\"
|
||||
export KEY_ORG=\"".$_REQUEST["organisation"]."\"
|
||||
export KEY_EMAIL=\"".$_REQUEST["email"]."\"";
|
||||
|
||||
$dateiname = $ovpnkeydir."/vars";
|
||||
$handler = fOpen($dateiname , "a+");
|
||||
fWrite($handler , $vars);
|
||||
fClose($handler);
|
||||
$res = exec("chmod 777 ".$ovpnkeydir."/vars");
|
||||
if($res =="")
|
||||
{
|
||||
echo "Umgebungsvariablen erfolgreich angelegt! [<b><font color=lime>OK</b></font>]<br>\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
die("Fehler beim Anlegen der Umgebungsvariablen! (evt Rechteproblem??) [<b><font color=red>FAIL</b></font>]<br>");
|
||||
}
|
||||
chdir ("$ovpnkeydir");
|
||||
$res=exec("./install");
|
||||
chdir ("/var/www/install/");
|
||||
$res = exec("chmod -R 777 ".$ovpnkeydir."/keys");
|
||||
//##############################################################################
|
||||
// How to fix?
|
||||
exec("cp ".$ovpnkeydir."/keys/ca.crt /var/www/downloads/ca.crt");
|
||||
exec("cp ".$ovpnkeydir."/keys/ca.crt /var/www/admin/downloads/ca.crt");
|
||||
//##############################################################################
|
||||
if($res =="")
|
||||
{
|
||||
echo "Server Zertifikate erfolgreich angelegt! [<b><font color=lime>OK</b></font>]<br>\n";
|
||||
echo "<form action=\"install4.php\" method=\"post\">
|
||||
<input type=\"submit\" value=\"Install! STEP 4\">
|
||||
</form> ";
|
||||
}
|
||||
else
|
||||
{
|
||||
die("Fehler beim Anlegen der Server Zertifikate! (evt Rechteproblem??) [<b><font color=red>FAIL</b></font>]<br>");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
50
install/install4.php
Normal file
50
install/install4.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
include("../Site/mysql.php");
|
||||
|
||||
$ovpnconfdir = db_getconfval("ovpnconfdir");
|
||||
$ovpnconffile = db_getconfval("ovpnconffile");
|
||||
// echo $ovpnconfdir."/".$ovpnconffile;
|
||||
|
||||
echo "
|
||||
<html>
|
||||
<head><title>Installer Page STEP 4</title></head>
|
||||
<body>
|
||||
<form action=\"install4.php\" method =\"post\">
|
||||
Change the OpenVPN Server config...
|
||||
<textarea name=\"inhalt\" rows=25 cols=100 wrap=\"virtual\">
|
||||
";
|
||||
|
||||
include($ovpnconfdir."/".$ovpnconffile);
|
||||
|
||||
echo "
|
||||
</textarea>
|
||||
<input name=\"submit\" type=\"submit\" id=\"submit\" value=\"Speichern\">
|
||||
<input type=\"reset\" name=\"Submit2\" value=\"Reset\">
|
||||
|
||||
</form>";
|
||||
|
||||
if ($_REQUEST["submit"] == "Speichern")
|
||||
{
|
||||
$fp = fopen($ovpnconfdir."/".$ovpnconffile,"w");
|
||||
$data =$_REQUEST["inhalt"];
|
||||
$data = str_replace("\r","",$data);
|
||||
fputs($fp,$data);
|
||||
fclose($fp);
|
||||
|
||||
echo "<meta http-equiv=\"Refresh\" content=\"4; url=install4.php?changedone=1\">";
|
||||
$check_ok = "<font color = 'red'>Ihre Daten wurden erfolgreich geändert!<br>Bitte warten sie bis die Daten aktualisiert werden.</font>";
|
||||
echo $check_ok;
|
||||
}
|
||||
if ($_REQUEST["changedone"] == "1")
|
||||
{
|
||||
$check_ok = "<font color = 'green'>Ihre Daten wurden erfolgreich gespeichert!</font>";
|
||||
echo $check_ok;
|
||||
}
|
||||
|
||||
|
||||
echo "<form action=\"install5.php\" method=\"post\">
|
||||
<input type=\"submit\" value=\"Install! STEP 5\">
|
||||
</form> ";
|
||||
?>
|
||||
</body>
|
||||
</html>
|
26
install/install5.php
Normal file
26
install/install5.php
Normal file
@ -0,0 +1,26 @@
|
||||
<html>
|
||||
<head><title>Installer Page STEP 5</title></head>
|
||||
<body>
|
||||
<?php
|
||||
echo "CLEANING UP...STEP 5<br>";
|
||||
|
||||
$res = shell_exec("rm -R /var/www/install");
|
||||
echo $res;
|
||||
|
||||
if (is_dir('/var/www/install'))
|
||||
{
|
||||
echo "Automatic removing of Install Directory failed! [<b><font color=RED>FAIL</b></font>] <br>";
|
||||
die("Your Install Directory Still Exists, Please Remove Immediately!!!!");
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Installation abgeschlossen!! [<b><font color=lime>OK</b></font>]<br>\n";
|
||||
echo "<form action=\"/\" method=\"post\">
|
||||
<input type=\"submit\" value=\"FINISH\">
|
||||
</form> ";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user