This commit is contained in:
parent
8d2ab70bdf
commit
163e0d61c2
@ -3,28 +3,33 @@ include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
//include ($_SERVER["DOCUMENT_ROOT"]."/Config/_siteconfig_.php");
|
||||
?>
|
||||
<!-- MAIN CONTENT BEGINN ################################################################################ -->
|
||||
<h1><b>Administration Center</b></h1>
|
||||
<table>
|
||||
|
||||
<tr><td width=60%>
|
||||
<h2>Actions:</h2>
|
||||
<?php
|
||||
$moduleid = 0;
|
||||
foreach ($SITE_MODULES_ADMIN as $modul)
|
||||
{
|
||||
$moduleid++;
|
||||
$cut = strpos($modul, "#");
|
||||
$modtitle = substr($modul,0,$cut);
|
||||
echo "<a href=\"/Admin/index.php?site=".$moduleid."&uebergabe=0&uebergabe2=0&uebergabe3=0&uebergabe4=0\">
|
||||
<p># ".$modtitle."</p>
|
||||
</a>";
|
||||
}
|
||||
?>
|
||||
<a href ="/sql/"><p># PhpMyAdmin</p></a>
|
||||
</td>
|
||||
<td>
|
||||
<img src="/Admin/Modules/Home/img/tux.png">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!-- MAIN -->
|
||||
<div id="main">
|
||||
<div class="wrapper">
|
||||
<h1><b>Administration Center</b></h1>
|
||||
<table widht="100%">
|
||||
<tr>
|
||||
<td width=60%>
|
||||
<h2>Actions:</h2>
|
||||
<?php
|
||||
$moduleid = 0;
|
||||
foreach ($SITE_MODULES_ADMIN as $modul)
|
||||
{
|
||||
$moduleid++;
|
||||
$cut = strpos($modul, "#");
|
||||
$modtitle = substr($modul,0,$cut);
|
||||
echo "<a href=\"/Admin/index.php?site=".$moduleid."&uebergabe=0&uebergabe2=0&uebergabe3=0&uebergabe4=0\">
|
||||
<p># ".$modtitle."</p>
|
||||
</a>";
|
||||
}
|
||||
?>
|
||||
<a href ="/sql/"><p># PhpMyAdmin</p></a>
|
||||
</td>
|
||||
<td>
|
||||
<img src="/Admin/Modules/Home/img/tux.png">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
@ -18,29 +18,32 @@ include ($_SERVER["DOCUMENT_ROOT"]."/Config/_dbconfig_.php");
|
||||
?>
|
||||
|
||||
<!-- MAIN CONTENT BEGINN ################################################################################ -->
|
||||
<form action="<?php echo $PHP_SELF; ?>" method="post">
|
||||
<br>
|
||||
<select name="dirsort" size=1>
|
||||
<option <?php if($sort=="ASC") echo "selected";?> value="ASC">Up</option>
|
||||
<option <?php if($sort=="DESC") echo "selected";?> value="DESC">Down</option>
|
||||
</select>
|
||||
<!-- MAIN -->
|
||||
<div id="main">
|
||||
<div class="wrapper">
|
||||
<form action="<?php echo $PHP_SELF; ?>" method="post">
|
||||
<br>
|
||||
<select name="dirsort" size=1>
|
||||
<option <?php if($sort=="ASC") echo "selected";?> value="ASC">Up</option>
|
||||
<option <?php if($sort=="DESC") echo "selected";?> value="DESC">Down</option>
|
||||
</select>
|
||||
|
||||
<select name="table" size=1>
|
||||
<option <?php if($table=="year") echo "selected";?> value="year">Year</option>
|
||||
<option <?php if($table=="month") echo "selected";?> value="month">Month</option>
|
||||
<option <?php if($table=="connections") echo "selected";?> value="connections">All</option>
|
||||
</select>
|
||||
<select name="table" size=1>
|
||||
<option <?php if($table=="year") echo "selected";?> value="year">Year</option>
|
||||
<option <?php if($table=="month") echo "selected";?> value="month">Month</option>
|
||||
<option <?php if($table=="connections") echo "selected";?> value="connections">All</option>
|
||||
</select>
|
||||
|
||||
<select name="sortby" size=1>
|
||||
<option <?php if($by=="id") echo "selected";?> value="id">ID</option>
|
||||
<option <?php if($by=="client") echo "selected";?> value="client">Client</option>
|
||||
<option <?php if($by=="sent") echo "selected";?> value="sent">Sent</option>
|
||||
<option <?php if($by=="received") echo "selected";?> value="received">Received</option>
|
||||
<option <?php if($by=="ip") echo "selected";?> value="ip">IP</option>
|
||||
</select>
|
||||
Search Client:<input type="text" name="client" size="20" <?php if($client !="") echo "value=".$client;?> ></td>
|
||||
<input type="submit" value="go!">
|
||||
</form>
|
||||
<select name="sortby" size=1>
|
||||
<option <?php if($by=="id") echo "selected";?> value="id">ID</option>
|
||||
<option <?php if($by=="client") echo "selected";?> value="client">Client</option>
|
||||
<option <?php if($by=="sent") echo "selected";?> value="sent">Sent</option>
|
||||
<option <?php if($by=="received") echo "selected";?> value="received">Received</option>
|
||||
<option <?php if($by=="ip") echo "selected";?> value="ip">IP</option>
|
||||
</select>
|
||||
Search Client:<input type="text" name="client" size="20" <?php if($client !="") echo "value=".$client;?> ></td>
|
||||
<input type="submit" value="go!">
|
||||
</form>
|
||||
|
||||
<!------ Sorting Leiste Start-->
|
||||
<?
|
||||
@ -168,4 +171,5 @@ Search Client:<input type="text" name="client" size="20" <?php if($client !="")
|
||||
echo "</table>";
|
||||
mysql_close();
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,10 +0,0 @@
|
||||
<?php
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
?>
|
||||
<iframe id="iframe" src="/munin/" width="99%" height=1024
|
||||
scrolling="auto" marginheight="0" marginwidth="0" frameborder="0">
|
||||
<p> Ihr Browser kann leider keine eingebetteten Frames anzeigen:
|
||||
Sie können die eingebettete Seite über den folgenden Verweis
|
||||
aufrufen: <a href="/munin/">SELFHTML</a>
|
||||
</p>
|
||||
</iframe>
|
@ -16,8 +16,11 @@ $url = $moduleurl;
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
$status = $_REQUEST["uebergabe"];
|
||||
?>
|
||||
<!-- MAIN CONTENT BEGINN ################################################################################ -->
|
||||
<h1><b>Settings</b></h1>
|
||||
<!-- MAIN CONTENT BEGINN ################################################################################ -->
|
||||
<!-- MAIN -->
|
||||
<div id="main">
|
||||
<div class="wrapper">
|
||||
<h1><b>Settings</b></h1>
|
||||
<?php
|
||||
switch($status)
|
||||
{
|
||||
@ -240,3 +243,5 @@ echo "
|
||||
}
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Config/_siteconfig_.php");
|
||||
$id = $_REQUEST["id"];
|
||||
$path = $_REQUEST["path"];
|
||||
// Write to file vpnid_man
|
||||
$myFile = db_getconfval("sqddir")."/vpnid_man";
|
||||
$fh = fopen($myFile, 'w') or die("can't open file");
|
||||
fwrite($fh, $id);
|
||||
fclose($fh);
|
||||
|
||||
header ("Location: ".$path."&uebergabe=1&uebergabe2=1");
|
||||
?>
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
$path = $_REQUEST["path"];
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/mysql.php");
|
||||
$ret = passthru("echo > ".db_getconfval("sqddir")."/blacklist");
|
||||
echo $ret;
|
||||
header ("Location: ".$path."&uebergabe=1&uebergabe2=2");
|
||||
?>
|
@ -1,66 +0,0 @@
|
||||
<?php
|
||||
//include($_SERVER["DOCUMENT_ROOT"]."/Site/mysql.php");
|
||||
|
||||
// Change: your company name
|
||||
$config['Company_Name'] = 'SchulVPN';
|
||||
// Change: your company home page
|
||||
$config['URL_Home_Page'] = 'http://10.10.63.60/index.php';
|
||||
$config['AUTH_REALM'] = $config['Company_Name'] .' OpenVPN Web GUI v.0.3.2';
|
||||
// What files to include into ZIP
|
||||
$config['Download']['ZIP']['.pem'] = true;
|
||||
$config['Download']['ZIP']['.key'] = true;
|
||||
$config['Download']['ZIP']['.csr'] = false;
|
||||
// All the following files should be placed into downloads folder
|
||||
$config['Download']['ZIP']['Others'] = array ('readme.txt','ca.crt', 'schulvpn.ovpn', 'certinstall.sh');
|
||||
//$config['Download']['ZIP']['Others'] = array ('readme.txt', 'install.cmd', 'tls-auth.key');
|
||||
|
||||
// Use the real absolute path here.
|
||||
$config['PluginsAbsolutePath'] = $_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNConfig/plugins/";
|
||||
|
||||
// If there are no plugins
|
||||
//$config['Plugins'] = NULL;
|
||||
// Otherwise, follow this example:
|
||||
//$config['Plugins']['PLUGINMANE']['Folder'] = 'FOLDERNAME';
|
||||
|
||||
// The post-install helper plugin. Shows if PHP5 has the neccessary functions available
|
||||
$config['Plugins']['systemcheck']['Folder'] = 'systemcheck';
|
||||
|
||||
// OPENVPN ________________________________
|
||||
|
||||
// Change: the configuration directory
|
||||
$config['openvpn']['folder'] = db_getconfval("ovpnconfdir")."/";
|
||||
// Change: configuration and status file names
|
||||
$config['openvpn']['config'] = $config['openvpn']['folder'].db_getconfval("ovpnconffile");
|
||||
$config['openvpn']['status'] = $config['openvpn']['folder']."openvpn-status.log";
|
||||
|
||||
// OPENSSL ________________________________
|
||||
|
||||
// Change: openssl keys directory
|
||||
$config['openssl']['folder'] = db_getconfval("ovpnkeydir")."/keys/";
|
||||
// Change: different folders for Public Certificates, Certificate Requests and Private Keys.
|
||||
// NOTE: openssl somehow respects only newpem folder (for Public Certificates).
|
||||
$config['openssl']['pubfolder'] = $config['openssl']['folder'];
|
||||
$config['openssl']['reqfolder'] = $config['openssl']['folder'];
|
||||
$config['openssl']['prvfolder'] = $config['openssl']['folder'];
|
||||
// Change: openssl CA private and public keys
|
||||
$config['openssl']['CA']['priv'] = $config['openssl']['folder'] .'ca.key';
|
||||
$config['openssl']['CA']['pub'] = $config['openssl']['folder'] .'ca.crt';
|
||||
// Change: openssl serial file
|
||||
$config['openssl']['serial'] = $config['openssl']['folder'] .'serial';
|
||||
// Change: openssl database
|
||||
$config['openssl']['database'] = $config['openssl']['folder'] .'index.txt';
|
||||
// Change: openssl configuration
|
||||
$config['openssl']['config'] = $config['openvpn']['folder'] .'openssl.cnf';
|
||||
// NEW OPENSSL CERTIFICATE DEFAULTS _________
|
||||
|
||||
// Change all of them as it is done in your easy-rsa/vars
|
||||
$config['openssl']['default']['expiration'] = 3560;
|
||||
$config['openssl']['default']['countryName'] = 'AT';
|
||||
$config['openssl']['default']['stateOrProvinceName'] = 'Tirol';
|
||||
$config['openssl']['default']['localityName'] = 'Innsbruck';
|
||||
$config['openssl']['default']['organizationName'] = 'HTL';
|
||||
$config['openssl']['default']['organizationalUnitName'] = '';
|
||||
$config['openssl']['default']['commonName'] = '';
|
||||
$config['openssl']['default']['emailAddress'] = 'vpn@students.htlinn.ac.at';
|
||||
|
||||
?>
|
@ -1,251 +0,0 @@
|
||||
<?php
|
||||
// ----------------------------------------------
|
||||
function load_plugins ()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset ($config['Plugins']))
|
||||
{
|
||||
foreach ($config['Plugins'] as $PluginName => $PluginData)
|
||||
{
|
||||
// Check if the config.inc for a plugin exists
|
||||
if (file_exists ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNconfig/plugins/". $PluginData['Folder'] ."/config.inc"))
|
||||
{
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNconfig/plugins/". $PluginData['Folder'] ."/config.inc");
|
||||
|
||||
// Check if claimed inc files do exist
|
||||
if (isset ($config['Plugins'][$PluginName]['Action']['Include']) &&
|
||||
!file_exists ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNconfig/plugins/". $PluginData['Folder'] ."/".
|
||||
$config['Plugins'][$PluginName]['Action']['Include']))
|
||||
$config['Plugins'][$PluginName]['Action']['Include'] = NULL;
|
||||
|
||||
if (isset ($config['Plugins'][$PluginName]['Left']['Menu']) &&
|
||||
!file_exists ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNconfig/plugins/". $PluginData['Folder'] ."/".
|
||||
$config['Plugins'][$PluginName]['Left']['Menu']))
|
||||
$config['Plugins'][$PluginName]['Left']['Menu'] = NULL;
|
||||
|
||||
if (isset ($config['Plugins'][$PluginName]['Left']['Status']) &&
|
||||
!file_exists ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNconfig/plugins/". $PluginData['Folder'] ."/".
|
||||
$config['Plugins'][$PluginName]['Left']['Status']))
|
||||
$config['Plugins'][$PluginName]['Left']['Status'] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function seconds_string ($seconds, $periods = null)
|
||||
{
|
||||
$Wanted = '';
|
||||
|
||||
// Define time periods
|
||||
if (!is_array ($periods))
|
||||
{
|
||||
$periods = array (
|
||||
'years' => 31556926,
|
||||
'months' => 2629743,
|
||||
'weeks' => 604800,
|
||||
'days' => 86400,
|
||||
'hours' => 3600,
|
||||
'minutes' => 60,
|
||||
'seconds' => 1
|
||||
);
|
||||
}
|
||||
|
||||
// Wanted
|
||||
if (empty ($seconds))
|
||||
{ $Wanted = ''; }
|
||||
else
|
||||
{
|
||||
// Loop
|
||||
$seconds = (int) $seconds;
|
||||
foreach ($periods as $period => $value)
|
||||
{
|
||||
$count = floor ($seconds / $value);
|
||||
|
||||
if ($count == 0)
|
||||
continue;
|
||||
elseif ($count == 1)
|
||||
$Wanted .= ($count . ' ' . substr ($period, 0, strlen ($period) - 1) . ' ');
|
||||
else
|
||||
$Wanted .= ($count . ' ' . $period . ' ');
|
||||
|
||||
$seconds = $seconds % $value;
|
||||
}
|
||||
}
|
||||
|
||||
return rtrim ($Wanted);
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function chomp (&$string)
|
||||
{
|
||||
if (is_array ($string))
|
||||
{
|
||||
foreach ($string as $i => $val)
|
||||
{ $endchar = chomp ($string[$i]); }
|
||||
}
|
||||
else
|
||||
{
|
||||
$endchar = substr ("$string", strlen("$string") - 1, 1);
|
||||
if ($endchar == "\n")
|
||||
{ $string = substr ("$string", 0, -1); }
|
||||
}
|
||||
return $endchar;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function str_strip_spaces ($aline)
|
||||
{
|
||||
while (strpos ($aline, "\t") != FALSE) $aline = str_replace ("\t", ' ', $aline);
|
||||
while (strpos ($aline, ' ') != FALSE) $aline = str_replace (' ', ' ', $aline);
|
||||
|
||||
return $aline;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Returns $afile only if it is the full name, or prefixed by $apath
|
||||
function str_file_fullname ($apath, $afile)
|
||||
{
|
||||
if (substr ($afile, 0, 1) != '/')
|
||||
$afile = ($apath . $afile);
|
||||
|
||||
return $afile;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Returns $afile only if it is the full name, or prefixed by $apath
|
||||
function str_openssldata_to_string ($adata)
|
||||
{
|
||||
$Return = '';
|
||||
$amonth = array ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
|
||||
|
||||
if (substr ($adata, -1, 1) == 'Z')
|
||||
{
|
||||
$Return = sprintf ("%s %d %s%02d, %02d:%02d:%02d",
|
||||
$amonth [substr ($adata, 2, 2) - 1],
|
||||
substr ($adata, 4, 2),
|
||||
(substr ($adata, 0, 2) > 50 ? '19' : '20'),
|
||||
substr ($adata, 0, 2),
|
||||
substr ($adata, 6, 2),
|
||||
substr ($adata, 8, 2),
|
||||
substr ($adata, 10, 2));
|
||||
}
|
||||
|
||||
return $Return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function str_get_sometag ($aline, $sometag)
|
||||
{
|
||||
if (eregi ($sometag, $aline, $anarray))
|
||||
return $anarray[1];
|
||||
else
|
||||
return '';
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Writes content into file
|
||||
// Optionally sames old file into backup file.
|
||||
// The Backup File has to reside on the same partition!
|
||||
function writefile ($afile, $adata, $abackup = NULL)
|
||||
{
|
||||
// Move the old file into Backup one
|
||||
if ($abackup != NULL)
|
||||
{
|
||||
if (file_exists ($afile))
|
||||
{
|
||||
if (file_exists ($abackup))
|
||||
if (!unlink ($abackup))
|
||||
exit;
|
||||
if (!rename ($afile, $abackup))
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$fp = fopen ($afile, "w", 0);
|
||||
if (!$fp)
|
||||
exit;
|
||||
|
||||
fputs ($fp, $adata);
|
||||
fclose ($fp);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------
|
||||
// Guess the full file name
|
||||
function if_file_exists (&$sFileName, $bFix = FALSE)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (strpos ($sFileName, '/') == FALSE)
|
||||
{
|
||||
$sLongFileName = $config['openvpn']['folder'] . $sFileName;
|
||||
if (file_exists ($sLongFileName) && $bFix)
|
||||
$sFileName = $sLongFileName;
|
||||
}
|
||||
|
||||
return file_exists ($sFileName);
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function zlib_check_functions ()
|
||||
{
|
||||
$Result = '';
|
||||
$ZLibs = array
|
||||
(
|
||||
'gzcompress'
|
||||
);
|
||||
|
||||
foreach ($ZLibs as $Function)
|
||||
{
|
||||
$Result .= $Function . '<font color="black">:</font> ' . (function_exists ($Function) ?
|
||||
'<font color="black">OK</font>' :
|
||||
'<font color="red">DOES NOT EXIST</font>') . '<br>';
|
||||
}
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function html_dump ($aname, $athing)
|
||||
{
|
||||
echo '<pre><b><font color="darkgreen">'. $aname .'</font></b>: ';
|
||||
print_r ($athing);
|
||||
echo "</pre><br>\n";
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function html_error ($amessage, $ifexit = true)
|
||||
{
|
||||
global $config;
|
||||
echo $amessage;
|
||||
if ($ifexit)
|
||||
exit;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function html_postredir ($url)
|
||||
{
|
||||
header ('HTTP/1.1 303 REDIRECT');
|
||||
header ('Location: '. $url);
|
||||
#header ('Status: 303'); // if 1st header generates 500, then commend it out and use this one as 2nd
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// ----------------------------------------------
|
||||
function html_download ($sFile, $sName)
|
||||
{
|
||||
header ('Content-type: application/octet-stream');
|
||||
header ('Content-Disposition: attachment; filename="'. $sName . '"');
|
||||
readfile ($sFile);
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function html_download_data ($sData, $sName)
|
||||
{
|
||||
header ('Content-type: application/octet-stream');
|
||||
header ('Content-Disposition: attachment; filename="'. $sName . '"');
|
||||
echo $sData;
|
||||
}
|
||||
?>
|
@ -1,377 +0,0 @@
|
||||
<?php
|
||||
// ----------------------------------------------
|
||||
function openssl_check_functions ()
|
||||
{
|
||||
$Result = '';
|
||||
$OpenSSLs = array
|
||||
(
|
||||
'openssl_csr_new',
|
||||
'openssl_csr_sign',
|
||||
'openssl_csr_export_to_file',
|
||||
'openssl_pkey_new',
|
||||
'openssl_pkey_get_private',
|
||||
'openssl_pkey_export_to_file',
|
||||
'openssl_x509_export_to_file'
|
||||
);
|
||||
|
||||
foreach ($OpenSSLs as $Function)
|
||||
{
|
||||
$Result .= $Function . '<font color="black">:</font> ' . (function_exists ($Function) ?
|
||||
'<font color="black">OK</font>' :
|
||||
'<font color="red">DOES NOT EXIST</font>') . '<br>';
|
||||
}
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_load_database ($afile = '')
|
||||
{
|
||||
global $config;
|
||||
global $openssl;
|
||||
|
||||
$afile = ($afile == '' ? $config['openssl']['database'] : $afile);
|
||||
$lines = file ($afile);
|
||||
|
||||
if (!is_array ($lines))
|
||||
exit;
|
||||
|
||||
foreach ($lines as $line_num => $line)
|
||||
{
|
||||
chomp ($line);
|
||||
$linetokens = explode ("\t", $line);
|
||||
|
||||
// Ensure that all the fields are set
|
||||
if (count ($linetokens) == 6)
|
||||
{
|
||||
// Decode the openssl's database. See apps/apps.h
|
||||
$openssl['Database'][] = array ('Status' => $linetokens[0],
|
||||
'ExpDate' => $linetokens[1],
|
||||
'RevDate' => $linetokens[2],
|
||||
'Serial' => $linetokens[3],
|
||||
'File' => $linetokens[4],
|
||||
'Name' => $linetokens[5],
|
||||
'Country' => openssl_get_country ($linetokens[5]),
|
||||
'State' => openssl_get_state ($linetokens[5]),
|
||||
'City' => openssl_get_city ($linetokens[5]),
|
||||
'Company' => openssl_get_company ($linetokens[5]),
|
||||
'Department' => openssl_get_department ($linetokens[5]),
|
||||
'CN' => openssl_get_CN ($linetokens[5]),
|
||||
'Email' => openssl_get_email ($linetokens[5])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_write_database ($afile = '')
|
||||
{
|
||||
global $config;
|
||||
global $openssl;
|
||||
|
||||
$afile = ($afile == '' ? $config['openssl']['database'] : $afile);
|
||||
|
||||
$atext = '';
|
||||
for ($i = 0; $i < count ($openssl['Database']); $i++)
|
||||
{
|
||||
$atext .= ($atext == '' ? '' : "\n");
|
||||
$atext .= $openssl['Database'][$i]['Status'] ."\t".
|
||||
$openssl['Database'][$i]['ExpDate'] ."\t".
|
||||
$openssl['Database'][$i]['RevDate'] ."\t".
|
||||
$openssl['Database'][$i]['Serial'] ."\t".
|
||||
$openssl['Database'][$i]['File'] ."\t".
|
||||
$openssl['Database'][$i]['Name'];
|
||||
}
|
||||
|
||||
writefile ($afile, $atext, $afile .'.old');
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_write_database_attr ($atext = '', $afile = '')
|
||||
{
|
||||
global $config;
|
||||
global $openssl;
|
||||
|
||||
$afile = ($afile == '' ? $config['openssl']['database'] : $afile) .'.attr';
|
||||
$atext = ($atext == '' ? "unique_subject = yes\n" : $atext);
|
||||
|
||||
if (file_exists ($afile))
|
||||
{
|
||||
ob_start ();
|
||||
readfile ($afile);
|
||||
$atext = ob_get_contents ();
|
||||
ob_end_clean ();
|
||||
}
|
||||
|
||||
writefile ($afile, $atext, $afile .'.old');
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Returns the PEM file with spaces reduced and replaced to
|
||||
function openssl_load_cert ($anid)
|
||||
{
|
||||
global $config;
|
||||
|
||||
do
|
||||
{
|
||||
$lines = file ($config['openssl']['pubfolder'] . $anid . '.pem');
|
||||
|
||||
if (!is_array ($lines))
|
||||
{
|
||||
$Return = '';
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($lines as $line_num => $line)
|
||||
{
|
||||
chomp ($line);
|
||||
$Return[] = str_replace (' ', ' ', htmlspecialchars (str_replace (' ', ' ', $line)));
|
||||
}
|
||||
} while (FALSE);
|
||||
|
||||
return $Return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_load_serial ($afile = '')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$afile = ($afile == '' ? $config['openssl']['serial'] : $afile);
|
||||
|
||||
$lines = file ($afile);
|
||||
|
||||
if (!is_array ($lines))
|
||||
exit;
|
||||
|
||||
$Return = sscanf ($lines[0], "%X");
|
||||
|
||||
return $Return[0];
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_write_serial ($iNumber, $afile = '')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$afile = ($afile == '' ? $config['openssl']['serial'] : $afile);
|
||||
|
||||
writefile ($afile, openssl_hex_serial ($iNumber) . "\n", $afile .'.old');
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Supports up to 999,999 serials
|
||||
function openssl_hex_serial ($iNumber)
|
||||
{
|
||||
if ($iNumber < 100)
|
||||
$sString = sprintf ("%02X", $iNumber);
|
||||
elseif ($iNumber < 10000)
|
||||
$sString = sprintf ("%04X", $iNumber);
|
||||
else
|
||||
$sString = sprintf ("%06X", $iNumber);
|
||||
|
||||
return $sString;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Builds User Private Key, CSR and Public Certificate
|
||||
function openssl_build_key (&$anoutput, $adn, $validdays = NULL)
|
||||
{
|
||||
global $config;
|
||||
global $openssl;
|
||||
|
||||
$anoutput = '';
|
||||
$Return = FALSE;
|
||||
|
||||
// Allow to override default value
|
||||
$validdays = ($validdays == NULL ? $config['openssl']['default']['expiration'] : $validdays);
|
||||
|
||||
do
|
||||
{
|
||||
if (!isset ($adn) ||
|
||||
!isset ($adn['countryName']) ||
|
||||
!isset ($adn['stateOrProvinceName']) ||
|
||||
!isset ($adn['localityName']) ||
|
||||
!isset ($adn['organizationName']) ||
|
||||
!isset ($adn['organizationalUnitName']) ||
|
||||
!isset ($adn['commonName']) ||
|
||||
!isset ($adn['emailAddress'])
|
||||
)
|
||||
{ $anoutput .= "- ERROR on ". __LINE__ ." line: incomplete DN information\n"; break; }
|
||||
$anoutput .= "+ OK got the valid input\n";
|
||||
|
||||
// Get the new User Private Key
|
||||
$UserPrivKey = openssl_pkey_new (array($config['openssl']['config'],0));
|
||||
if ($UserPrivKey == FALSE)
|
||||
{ $anoutput .= "- ERROR on ". (__LINE__ - 2) ." line (openssl_pkey_new):\n ". openssl_error_strings () ." (that might usually mean that the openssl.cnf file is unavailable)"; break; }
|
||||
$anoutput .= "+ OK got the User Private Key\n";
|
||||
|
||||
// Generate the User Certificate Request
|
||||
$UserReq = openssl_csr_new ($adn,
|
||||
$UserPrivKey,
|
||||
$config['openssl']['config']);
|
||||
if ($UserReq == FALSE)
|
||||
{ $anoutput .= "- ERROR on ". (__LINE__ - 4) ." line (openssl_csr_new):\n ". openssl_error_strings (); break; }
|
||||
$anoutput .= "+ OK generated the User Certificate Request\n";
|
||||
|
||||
// Read the openssl serial
|
||||
$CAserial = openssl_load_serial ($config['openssl']['serial']);
|
||||
$anoutput .= "+ OK read current openssl serial (". openssl_hex_serial ($CAserial) .")\n";
|
||||
|
||||
$UserPubCertFile = $config['openssl']['pubfolder'] . openssl_hex_serial ($CAserial) .'.pem';
|
||||
$UserCertReqFile = $config['openssl']['reqfolder'] . openssl_hex_serial ($CAserial) .'.csr';
|
||||
$UserPrivKeyFile = $config['openssl']['prvfolder'] . openssl_hex_serial ($CAserial) .'.key';
|
||||
|
||||
// Read the openssl database
|
||||
openssl_load_database ($config['openssl']['database']);
|
||||
$anoutput .= "+ OK read the openssl database (". count ($openssl['Database']) ." items)\n";
|
||||
|
||||
// Get CA's Private Key
|
||||
$CAPrivKey = openssl_pkey_get_private ($config['openssl']['CA']['priv']);
|
||||
|
||||
if ($CAPrivKey == FALSE)
|
||||
{ $anoutput .= "- ERROR on ". (__LINE__ - 2) ." line (openssl_pkey_get_private)\n ". openssl_error_strings (); break; }
|
||||
$anoutput .= "+ OK read the CA Private Key\n";
|
||||
|
||||
// Get a CA-signed cert that lasts for 1 year
|
||||
$UserPubCert = openssl_csr_sign ($UserReq,
|
||||
$config['openssl']['CA']['pub'],
|
||||
$CAPrivKey,
|
||||
$validdays,
|
||||
$config['openssl']['config'],
|
||||
$CAserial);
|
||||
if ($UserPubCert == FALSE)
|
||||
{ $anoutput .= "- ERROR on ". (__LINE__ - 7) ." line (openssl_csr_sign)\n ". openssl_error_strings (); break; }
|
||||
$anoutput .= "+ OK signed the User Certificate Request with CA Private Key\n";
|
||||
|
||||
// Add the new row into openssl database
|
||||
$openssl['Database'][] = array ('Status' => 'V',
|
||||
'ExpDate' => date ('ymdHis',
|
||||
time() +
|
||||
date ('Z') +
|
||||
($validdays * 24 * 60 * 60)) .'Z',
|
||||
'RevDate' => '',
|
||||
'Serial' => openssl_hex_serial ($CAserial),
|
||||
'File' => openssl_hex_serial ($CAserial) .'.crt',
|
||||
'Name' => openssl_make_name ($adn)
|
||||
);
|
||||
|
||||
// Create files
|
||||
|
||||
$OldUMask = umask (0007);
|
||||
|
||||
// Write User Private Key
|
||||
if (!openssl_pkey_export_to_file ($UserPrivKey, $UserPrivKeyFile, NULL, $config['openssl']['config']))
|
||||
{ $anoutput .= "- ERROR on ". (__LINE__ - 1) ." line (openssl_pkey_export_to_file)\n ". openssl_error_strings () ." (That might mean that the key folder is not write enabled for www user)"; break; }
|
||||
$anoutput .= "+ OK wrote User Private Key into file $UserPrivKeyFile\n";
|
||||
|
||||
// Write User Public Certificate
|
||||
if (!openssl_x509_export_to_file ($UserPubCert, $UserPubCertFile, FALSE))
|
||||
{ $anoutput .= "- ERROR on ". (__LINE__ - 1) ." line (openssl_x509_export_to_file)\n ". openssl_error_strings (); break; }
|
||||
$anoutput .= "+ OK wrote User Public Certificate into file $UserPubCertFile\n";
|
||||
|
||||
// Write User Certificate Request
|
||||
if (!openssl_csr_export_to_file ($UserReq, $UserCertReqFile))
|
||||
{ $anoutput .= "- ERROR on ". (__LINE__ - 1) ." line (openssl_csr_export_to_file)\n ". openssl_error_strings (); break; }
|
||||
$anoutput .= "+ OK wrote User Certificate Request into file $UserCertReqFile\n";
|
||||
|
||||
// Write new openssl database
|
||||
openssl_write_database ($config['openssl']['database']);
|
||||
openssl_write_database_attr ('', $config['openssl']['database']);
|
||||
$anoutput .= "+ OK wrote new openssl database\n";
|
||||
|
||||
// Write new openssl serial
|
||||
openssl_write_serial ($CAserial + 1, $config['openssl']['serial']);
|
||||
$anoutput .= "+ OK wrote new openssl serial\n";
|
||||
|
||||
umask ($OldUMask);
|
||||
|
||||
$Return = openssl_hex_serial ($CAserial);
|
||||
} while (FALSE);
|
||||
|
||||
return $Return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_error_strings ()
|
||||
{
|
||||
$sString = '';
|
||||
while ($msg = openssl_error_string ())
|
||||
$sString .= $msg ."\n";
|
||||
|
||||
return $sString;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_make_name ($adn)
|
||||
{
|
||||
$sString = '';
|
||||
|
||||
if (strlen ($adn['countryName']) > 0) $sString .= '/C=' . $adn['countryName'];
|
||||
if (strlen ($adn['stateOrProvinceName']) > 0) $sString .= '/ST=' . $adn['stateOrProvinceName'];
|
||||
if (strlen ($adn['localityName']) > 0) $sString .= '/L=' . $adn['localityName'];
|
||||
if (strlen ($adn['organizationName']) > 0) $sString .= '/O=' . $adn['organizationName'];
|
||||
if (strlen ($adn['organizationalUnitName']) > 0) $sString .= '/OU=' . $adn['organizationalUnitName'];
|
||||
if (strlen ($adn['commonName']) > 0) $sString .= '/CN=' . $adn['commonName'];
|
||||
if (strlen ($adn['emailAddress']) > 0) $sString .= '/emailAddress='. $adn['emailAddress'];
|
||||
|
||||
return $sString;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_get_country ($aline)
|
||||
{ return str_get_sometag ($aline . '/', '\/C=([^/]*)\/'); }
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_get_state ($aline)
|
||||
{ return str_get_sometag ($aline . '/', '\/ST=([^/]*)\/'); }
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_get_city ($aline)
|
||||
{ return str_get_sometag ($aline . '/', '\/L=([^/]*)\/'); }
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_get_company ($aline)
|
||||
{ return str_get_sometag ($aline . '/', '\/O=([^/]*)\/'); }
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_get_department ($aline)
|
||||
{ return str_get_sometag ($aline . '/', '\/OU=([^/]*)\/'); }
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_get_CN ($aline)
|
||||
{ return str_get_sometag ($aline . '/', '\/CN=([^/]*)\/'); }
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_get_email ($aline)
|
||||
{ return str_get_sometag ($aline . '/', '\/emailAddress=([^/]*)\/'); }
|
||||
|
||||
// ----------------------------------------------
|
||||
// Guess the full file name
|
||||
function openssl_get_filename ($iSerial, $sExt)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$sReturn = $config['openssl']['folder'] . openssl_hex_serial ($iSerial) . $sExt;
|
||||
if (!file_exists ($sReturn))
|
||||
{
|
||||
$sReturn = $config['openssl']['pubfolder'] . openssl_hex_serial ($iSerial) . $sExt;
|
||||
if (!file_exists ($sReturn))
|
||||
{
|
||||
$sReturn = $config['openssl']['reqfolder'] . openssl_hex_serial ($iSerial) . $sExt;
|
||||
if (!file_exists ($sReturn))
|
||||
{
|
||||
$sReturn = $config['openssl']['prvfolder'] . openssl_hex_serial ($iSerial) . $sExt;
|
||||
if (!file_exists ($sReturn))
|
||||
{
|
||||
$sReturn = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $sReturn;
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Config/_siteconfig_.php");
|
||||
|
||||
$path = $_REQUEST["path"];
|
||||
// Write to file vpnid_man
|
||||
exec("touch /var/vpn/squid_restart");
|
||||
|
||||
header ("Location: ".$path."&uebergabe=1&uebergabe2=3");
|
||||
?>
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Config/_siteconfig_.php");
|
||||
|
||||
$path = $_REQUEST["path"];
|
||||
// Write to file vpnid_man
|
||||
exec("touch /var/vpn/squid_start");
|
||||
|
||||
header ("Location: ".$path."&uebergabe=1&uebergabe2=4");
|
||||
?>
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Config/_siteconfig_.php");
|
||||
|
||||
$path = $_REQUEST["path"];
|
||||
// Write to file vpnid_man
|
||||
exec("touch /var/vpn/squid_stop");
|
||||
|
||||
header ("Location: ".$path."&uebergabe=1&uebergabe2=5");
|
||||
?>
|
@ -1,45 +0,0 @@
|
||||
<?php
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
|
||||
$moduleurl = $_SERVER["REQUEST_URI"];
|
||||
$urlcut = strpos($moduleurl, "&");
|
||||
if($urlcut > 0)
|
||||
{
|
||||
$moduleurl = substr($moduleurl,0,$urlcut);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(strpos($moduleurl, "?") == 0)
|
||||
{
|
||||
$moduleurl = $_SERVER["REQUEST_URI"]."?site=1";
|
||||
}
|
||||
}
|
||||
|
||||
$mode = $_REQUEST["uebergabe"];
|
||||
$status = $_REQUEST["uebergabe2"];
|
||||
|
||||
echo" <p><a href=\"".$moduleurl."&uebergabe=0\">Home</a>
|
||||
| <a href=\"".$moduleurl."&uebergabe=1\">Config</a>
|
||||
| <a href=\"".$moduleurl."&uebergabe=2\">Logviewer</a></p><hr><br>";
|
||||
switch($status)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch($mode)
|
||||
{
|
||||
case 1:
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/Squid/index_config.php");
|
||||
break;
|
||||
case 2:
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/Squid/index_log.php");
|
||||
break;
|
||||
default:
|
||||
echo"<h1><b>Squid Management</b></h1>
|
||||
<h2>Choose an action:</h2>
|
||||
<p># <a href=\"".$moduleurl."&uebergabe=1\">Config</a></p>
|
||||
<p># <a href=\"".$moduleurl."&uebergabe=2\">Logviewer</a></p><br>";
|
||||
break;
|
||||
}
|
||||
?>
|
@ -1,297 +0,0 @@
|
||||
<?php
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
//include($_SERVER["DOCUMENT_ROOT"]."/Site/mysql.php");
|
||||
include($_SERVER["DOCUMENT_ROOT"]."/Config/_dbconfig_.php");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/Squid/include/config.inc");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/Squid/include/functions.inc");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/Squid/include/openssl-functions.inc");
|
||||
openssl_load_database ();
|
||||
|
||||
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
||||
@$x = mysql_select_db($MYSQL_DATABASE);
|
||||
if (empty($x))
|
||||
{
|
||||
echo "ERROR 0x01, Failed to connect to database!<br>";
|
||||
exit;
|
||||
}
|
||||
$sort = mysql_real_escape_string($_POST["dirsort"]); //$_GET["sort"];
|
||||
$by = mysql_real_escape_string($_POST["sortby"]); //$_GET["by"];
|
||||
$userid = mysql_real_escape_string($_POST["userid"]); //$_GET["userid"];
|
||||
$search = mysql_real_escape_string($_POST["search"]); //$_GET["search"];
|
||||
|
||||
$moduleurl = $_SERVER["REQUEST_URI"];
|
||||
$urlcut = strpos($moduleurl, "&");
|
||||
$moduleurl = substr($moduleurl,0,$urlcut);
|
||||
?>
|
||||
<!-- MAIN CONTENT BEGINN ################################################################################ -->
|
||||
<h1><b>Squid Config</b></h1>
|
||||
<?php
|
||||
if(is_file("/var/run/squid.pid"))
|
||||
{
|
||||
echo "<b>Squid is currently: <font color=green>running</font></b><br />";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<b>Squid is currently: <font color=red>stopped</font></b><br />";
|
||||
}
|
||||
|
||||
if ($_REQUEST["uebergabe2"]=="3")
|
||||
{
|
||||
echo "<b>Squid restarted successfully!</b>";
|
||||
echo "<meta http-equiv=\"Refresh\" content=\"1; url=".$moduleurl."&uebergabe=1&uebergabe2=0\">";
|
||||
}
|
||||
if ($_REQUEST["uebergabe2"]=="4")
|
||||
{
|
||||
echo "<b>Squid started successfully!</b>";
|
||||
echo "<meta http-equiv=\"Refresh\" content=\"1; url=".$moduleurl."&uebergabe=1&uebergabe2=0\">";
|
||||
}
|
||||
if ($_REQUEST["uebergabe2"]=="5")
|
||||
{
|
||||
echo "<b>Squid stopped successfully!</b>";
|
||||
echo "<meta http-equiv=\"Refresh\" content=\"3; url=".$moduleurl."&uebergabe=1&uebergabe2=0\">";
|
||||
}
|
||||
?>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<form action="/Admin/Modules/Squid/include/restartsquid.php" method="post" >
|
||||
<input type="hidden" name="path" size="50" value="<?php echo $moduleurl;?>" />
|
||||
<input type="submit" value="Restart Squid" />
|
||||
</form>
|
||||
</td>
|
||||
<?php
|
||||
if(!is_file("/var/run/squid.pid"))
|
||||
{
|
||||
echo "
|
||||
<td>
|
||||
<form action=\"/Admin/Modules/Squid/include/startsquid.php\" method=\"post\" >
|
||||
<input type=\"hidden\" name=\"path\" size=\"50\" value=\"".$moduleurl."\" />
|
||||
<input type=\"submit\" value=\"Start Squid\" />
|
||||
</form>
|
||||
</td>";
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(is_file("/var/run/squid.pid"))
|
||||
{
|
||||
echo "
|
||||
<td>
|
||||
<form action=\"/Admin/Modules/Squid/include/stopsquid.php\" method=\"post\" >
|
||||
<input type=\"hidden\" name=\"path\" size=\"50\" value=\"".$moduleurl."\" />
|
||||
<input type=\"submit\" value=\"Stop Squid\" />
|
||||
</form>
|
||||
</td>";
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<h2>Change Proxy Account:</h2>
|
||||
<?php
|
||||
if ($_REQUEST["uebergabe2"]=="1")
|
||||
{
|
||||
echo "<b>Changed Squid Account successfully!</b>";
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<p>
|
||||
<form action="/Admin/Modules/Squid/changesquid.php" method="post" >
|
||||
Squid ID (HEX):
|
||||
<input type="text" name="id" size="3">
|
||||
<input type="hidden" name="path" size="50" value="<?php echo $moduleurl;?>">
|
||||
<input type="submit" value="Change Squid User">
|
||||
</form>
|
||||
</p>
|
||||
<p>
|
||||
Current Squid User:
|
||||
<?php
|
||||
function dec_to_hex($dec)
|
||||
{
|
||||
$sign = ""; // suppress errors
|
||||
if( $dec < 0){ $sign = "-"; $dec = abs($dec); }
|
||||
|
||||
$hex = Array( 0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5,
|
||||
6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 'A',
|
||||
11 => 'B', 12 => 'C', 13 => 'D', 14 => 'E',
|
||||
15 => 'F' );
|
||||
|
||||
do
|
||||
{
|
||||
$h = $hex[($dec%16)] . $h;
|
||||
$dec /= 16;
|
||||
}
|
||||
while( $dec >= 1 );
|
||||
|
||||
return $sign . $h;
|
||||
}
|
||||
|
||||
$zeile = exec(escapeshellcmd("cat ".db_getconfval("sqddir")."/vpnid"));
|
||||
$zeile = dec_to_hex($zeile);
|
||||
//echo $zeile;
|
||||
if(strlen ($zeile) <2)
|
||||
{
|
||||
$zeile = "0".$zeile;
|
||||
}
|
||||
if(strlen ($zeile) >2)
|
||||
{
|
||||
$zeile=substr($zeile, 0, -1);
|
||||
}
|
||||
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
||||
@$x = mysql_select_db($MYSQL_DATABASE);
|
||||
if (empty($x))
|
||||
{
|
||||
echo "ERROR 0x01, Failed to connect to database!<br>";
|
||||
exit;
|
||||
}
|
||||
$sql4 = "SELECT * FROM userdata WHERE VPNId = '".$zeile."';";
|
||||
$result4 = mysql_query($sql4);
|
||||
//echo $sql4;
|
||||
$ar4=mysql_fetch_array($result4,MYSQL_ASSOC);
|
||||
echo "<b>" . $ar4["Vorname"] . " " . $ar4["Nachname"] . "</b> VPNId: <b>" . $ar4["VPNId"]."</b>";
|
||||
mysql_close();
|
||||
?>
|
||||
</p>
|
||||
<br>
|
||||
|
||||
|
||||
<h2>Blacklisted Accounts:</h2>
|
||||
<?php
|
||||
if ($_REQUEST["uebergabe2"]=="2")
|
||||
{
|
||||
echo "<b>Blacklist cleared successfully!</b>";
|
||||
}
|
||||
?>
|
||||
<table border=1>
|
||||
<tr><td><b>Squid ID</b></td><td><b>Nickname</b></td><td><b>Vorname</b></td><td><b>Nachname</b></td></tr>
|
||||
<?php
|
||||
$thisFileContent = file(db_getconfval("sqddir")."/blacklist");
|
||||
//echo db_getconfval("sqddir")."/blacklist";
|
||||
$blindex = 0;
|
||||
foreach ($thisFileContent as $zeile)
|
||||
{
|
||||
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
||||
@$x = mysql_select_db($MYSQL_DATABASE);
|
||||
if (empty($x))
|
||||
{
|
||||
echo "ERROR 0x01, Failed to connect to database!<br>";
|
||||
exit;
|
||||
}
|
||||
|
||||
$hascontent = true;
|
||||
if (strlen($zeile) >2)
|
||||
{
|
||||
$zeile=substr($zeile, 0, -1);
|
||||
}
|
||||
$sql3 = "SELECT * FROM userdata WHERE VPNId = '".$zeile."';";
|
||||
$result3 = mysql_query($sql3);
|
||||
$ar3=mysql_fetch_array($result3,MYSQL_ASSOC);
|
||||
$nick = $ar3["Nickname"];
|
||||
if($nick == "")
|
||||
$hascontent=false;
|
||||
$vor = $ar3["Vorname"];
|
||||
if($vor == "")
|
||||
$hascontent=false;
|
||||
$nach = $ar3["Nachname"];
|
||||
if($nach == "")
|
||||
$hascontent=false;
|
||||
|
||||
if($hascontent == true)
|
||||
{
|
||||
$blindex = $blindex+1;
|
||||
echo "<tr><td>".$zeile."</td><td>".$nick."</td><td>".$vor."</td><td>".$nach."</td></tr>";
|
||||
}
|
||||
mysql_close();
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
<p> Blacklisted accounts:
|
||||
<b>
|
||||
<?php echo $blindex; ?></b> out of: <b>
|
||||
<?php
|
||||
if (count($openssl['Database']) == 0)
|
||||
echo 'no certificates</b>';
|
||||
elseif (count($openssl['Database'])-1 == 1)
|
||||
{
|
||||
echo '1</b> certificate';
|
||||
}
|
||||
elseif (count($openssl['Database'])-1 > 1)
|
||||
{
|
||||
echo '';
|
||||
echo count($openssl['Database'])-1;
|
||||
echo '</b> certificates';
|
||||
}?>
|
||||
</p>
|
||||
<p>
|
||||
<form action="/Admin/Modules/Squid/delbl.php" method="post" >
|
||||
<input type="hidden" name="path" size="50" value="<?php echo $moduleurl;?>">
|
||||
<input type="submit" value="Clear Blacklist">
|
||||
</form>
|
||||
</p>
|
||||
<br>
|
||||
|
||||
<h2>User changed Proxy Accounts:</h2>
|
||||
|
||||
<form action="<?php echo $PHP_SELF; ?>" method="post">
|
||||
<select name="dirsort" size=1>
|
||||
<option <?php if($sort=="ASC") echo "selected";?> value="ASC">Up</option>
|
||||
<option <?php if($sort=="DESC") echo "selected";?> value="DESC">Down</option>
|
||||
</select>
|
||||
<select name="sortby" size=1>
|
||||
<option <?php if($by=="Id") echo "selected";?> value="Id">ID</option>
|
||||
<option <?php if($by=="VPNId") echo "selected";?> value="VPNId">VPNId</option>
|
||||
<option <?php if($by=="Time") echo "selected";?> value="Time">Time</option>
|
||||
<option <?php if($by=="IP") echo "selected";?> value="IP">IP</option>
|
||||
<option <?php if($by=="Nickname") echo "selected";?> value="Nickname">Nickname</option>
|
||||
</select>
|
||||
Search User:<input type="text" name="search" size="20" <?php if($search !="") echo "value=".$search;?> ></td>
|
||||
<input type="submit" value="go!">
|
||||
</form>
|
||||
|
||||
<!------ Sorting Leiste Start-->
|
||||
<?php
|
||||
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
||||
@$x = mysql_select_db($MYSQL_DATABASE);
|
||||
if (empty($x))
|
||||
{
|
||||
echo "ERROR 0x01, Failed to connect to database!<br>";
|
||||
exit;
|
||||
}
|
||||
// MYsql befehl basteln
|
||||
|
||||
|
||||
if($by == "Nickname")
|
||||
{
|
||||
$sql = "SELECT * FROM proxyrepair;";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT * FROM proxyrepair ORDER BY $by $sort;";
|
||||
}
|
||||
|
||||
$result = mysql_query($sql);
|
||||
echo "<br><table border=1>";
|
||||
echo "<tr><td><b>User ID</b></td><td><b>VPN Id</b></td><td><b>Nickname</b></td><td><b>Vorname</b></td><td><b>Nachname</b></td><td><b>Client IP</b></td><td><b>Time</b></td><td><b>Dead VPN ID</b></td></tr>\n";
|
||||
// ------------------------------------------------ Mysql lesen
|
||||
if ($result)
|
||||
{
|
||||
while ($ar=mysql_fetch_array($result,MYSQL_ASSOC))
|
||||
{
|
||||
|
||||
$sql = "SELECT * FROM userdata WHERE Id = '".$ar["Id"]."' AND (Nickname LIKE '%".$search."%' OR Vorname LIKE '%".$search."%' OR Id LIKE '%".$search."%' OR VPNId LIKE '%".$search."%');";
|
||||
$result2 = mysql_query($sql);
|
||||
$ar2=mysql_fetch_array($result2,MYSQL_ASSOC);
|
||||
|
||||
if($ar2["Nickname"] != "")
|
||||
echo "<tr><td>",$ar["Id"],"</td><td>",$ar["VPNId"],"</td><td>",$ar2["Nickname"],"</td><td>",$ar2["Vorname"],"</td><td>",$ar2["Nachname"],
|
||||
"</td><td>", $ar["IP"],"</td><td>",$ar["Time"],"</td><td>",$ar["RepID"],"</td></tr>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<br>";
|
||||
}
|
||||
echo "</table>";
|
||||
mysql_close();
|
||||
?>
|
||||
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
//include($_SERVER["DOCUMENT_ROOT"]."/Site/mysql.php");
|
||||
include($_SERVER["DOCUMENT_ROOT"]."/Config/_dbconfig_.php");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/Squid/include/config.inc");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/Squid/include/functions.inc");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/Squid/include/openssl-functions.inc");
|
||||
openssl_load_database ();
|
||||
|
||||
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
||||
@$x = mysql_select_db($MYSQL_DATABASE);
|
||||
if (empty($x))
|
||||
{
|
||||
echo "ERROR 0x01, Failed to connect to database!<br>";
|
||||
exit;
|
||||
}
|
||||
$sort = mysql_real_escape_string($_POST["dirsort"]); //$_GET["sort"];
|
||||
$by = mysql_real_escape_string($_POST["sortby"]); //$_GET["by"];
|
||||
$userid = mysql_real_escape_string($_POST["userid"]); //$_GET["userid"];
|
||||
$search = mysql_real_escape_string($_POST["search"]); //$_GET["search"];
|
||||
|
||||
$moduleurl = $_SERVER["REQUEST_URI"];
|
||||
$urlcut = strpos($moduleurl, "&");
|
||||
$moduleurl = substr($moduleurl,0,$urlcut);
|
||||
?>
|
||||
<!-- MAIN CONTENT BEGINN ################################################################################ -->
|
||||
<h1><b>Squid Logs</b></h1>
|
||||
|
||||
<?php
|
||||
require "/usr/local/mysar/www/index.php"; ?>
|
@ -1,3 +0,0 @@
|
||||
export CPATH=..:$HOME/include:/usr/local/include:/usr/include:/usr/include/mysql
|
||||
needed: libmysqlclient-dev
|
||||
gcc -l mysqlclient -o traffic Traffic.c
|
@ -1,4 +0,0 @@
|
||||
user: openvpn
|
||||
passwd: openvpnlog
|
||||
database: openvpn
|
||||
host: localhost
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
let x=0x3f
|
||||
echo $x
|
||||
|
||||
|
||||
let x=0xfffe
|
||||
echo $x
|
@ -1,134 +0,0 @@
|
||||
/* OpenVPN - Squid Load Balancer*
|
||||
*------------------------------*
|
||||
* Version 1.0 *
|
||||
* Written by Christoph Haas *
|
||||
* License: LGPL *
|
||||
* 12.10.2010 *
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <mysql/mysql.h>
|
||||
#include <regex.h>
|
||||
#include <string.h>
|
||||
|
||||
#define __MAX_LINE__ 100
|
||||
#define __MAX_FIELD__ 255
|
||||
#define false 0
|
||||
#define true 1
|
||||
|
||||
|
||||
MYSQL mysql;
|
||||
|
||||
int connect_db(char *config)
|
||||
{
|
||||
FILE *db_data = NULL;
|
||||
regex_t reg;
|
||||
char user[__MAX_LINE__] = "";
|
||||
char passwd[__MAX_LINE__] = "";
|
||||
char database[__MAX_LINE__] = "";
|
||||
char host[__MAX_LINE__] = "";
|
||||
int port = 0;
|
||||
char tmp[__MAX_LINE__];
|
||||
char buf[__MAX_LINE__];
|
||||
int a, b;
|
||||
int length;
|
||||
|
||||
if((db_data = fopen(config, "r")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "Can't open %s for reading.\n", config);
|
||||
return false;
|
||||
}
|
||||
regcomp(®, "^([a-zA-Z0-9:]+)[ ][a-zA-Z0-9]+$", REG_EXTENDED | REG_NEWLINE);
|
||||
while(fgets(buf, __MAX_LINE__, db_data))
|
||||
{
|
||||
length = strlen(buf);
|
||||
if(length < 3)continue;
|
||||
if(length >= __MAX_LINE__)
|
||||
{
|
||||
fclose(db_data);
|
||||
regfree(®);
|
||||
fprintf(stderr, "To long line in config file.\n");
|
||||
return false;
|
||||
}
|
||||
if(buf[0] == '#')continue;
|
||||
if(regexec(®, buf, 0, 0, 0))
|
||||
{
|
||||
fclose(db_data);
|
||||
regfree(®);
|
||||
fprintf(stderr, "Syntax error in config file.\n");
|
||||
return false;
|
||||
}
|
||||
for(a = 0, b = 0; a < strlen(buf); a++)
|
||||
{
|
||||
if(buf[a] == ' ')b++;
|
||||
}
|
||||
if(b != 1)
|
||||
{
|
||||
fclose(db_data);
|
||||
regfree(®);
|
||||
fprintf(stderr, "Syntax error in config file.\n");
|
||||
return false;
|
||||
}
|
||||
if((strncmp(buf, "user: ", 6)) == 0)sscanf(buf, "%s %s", tmp, user);
|
||||
if((strncmp(buf, "passwd: ", 8)) == 0)sscanf(buf, "%s %s", tmp, passwd);
|
||||
if((strncmp(buf, "database: ", 10)) == 0)sscanf(buf, "%s %s", tmp, database);
|
||||
if((strncmp(buf, "host: ", 6)) == 0)sscanf(buf, "%s %s", tmp, host);
|
||||
if((strncmp(buf, "port: ", 6)) == 0)sscanf(buf, "%s %d", tmp, &port);
|
||||
}
|
||||
fclose(db_data);
|
||||
regfree(®);
|
||||
if((strlen(user) < 1) || (strlen(passwd) < 1) ||
|
||||
(strlen(database) < 1) || (strlen(host) < 1))
|
||||
{
|
||||
fprintf(stderr, "One value for MySQL connection isn't set. \
|
||||
Please set user, passwd, database and host.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
mysql_init(&mysql);
|
||||
if((mysql_real_connect(&mysql, host, user, passwd, database, port, NULL, 0)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "%s\n", mysql_error(&mysql));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
char Query[200]= "SELECT * FROM userdata WHERE VPNId = '\0";
|
||||
|
||||
if(argc == 2)
|
||||
{
|
||||
/*iID = atoi(argv[1]);
|
||||
printf("Int:%d\n", iID);
|
||||
sprintf(ID,"%-#10x",iID);
|
||||
printf("String:%s\n", ID);*/
|
||||
|
||||
connect_db("/home/christoph/squid_dynamic/db.conf"); // Datenbank Verbindung aufbauen
|
||||
|
||||
strcat(Query, argv[1]); // Query builden
|
||||
strcat(Query,"'"); //
|
||||
|
||||
mysql_query(&mysql, Query); // Query abschicken
|
||||
result = mysql_store_result(&mysql); // Result speichern
|
||||
|
||||
while ((row = mysql_fetch_row(result))) // Alle Datensätze auslesen (in dem Fall eh nur einer)
|
||||
{
|
||||
printf("%s:%s\n", row[9], row[10]); // Feld 9 und 10 (login/pass) aus dem datensatz ausgeben
|
||||
}
|
||||
|
||||
mysql_free_result(result); // Result wieder löschen
|
||||
mysql_close(&mysql); // Datenbank Verbindung schliesen
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("USAGE: sqidy xx | xx = VPNId\n"); // bei flascheingabe der Parameter
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
00
|
@ -1,115 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Zaehlvariable einlesen
|
||||
id=$ID_VPN
|
||||
|
||||
# Abfrage ob Stringlaenge von id NULL ist
|
||||
if [ ${#ID_VPN} == 0 ];
|
||||
then id=0
|
||||
fi
|
||||
|
||||
# id inkrementieren
|
||||
let id=$id+1
|
||||
|
||||
# 255 Overflow verhindern
|
||||
if [ $id -gt 254 ]
|
||||
then id=0
|
||||
fi
|
||||
|
||||
# Variable id fuer naechsten Durchlauf speichern
|
||||
export ID_VPN=$id
|
||||
|
||||
# id HEX wandeln
|
||||
hex=$(echo "obase=16; $id" |bc)
|
||||
|
||||
# Abfrage ob Strinlaenge von hex kleiner als 2
|
||||
if [ ${#hex} -lt 2 ];
|
||||
then hex=0$hex
|
||||
fi
|
||||
|
||||
# Login-Daten aus Datenbank holen
|
||||
credentials=$(./squidy $hex)
|
||||
# Abfrage ob Datensatz leer :
|
||||
zero="0"
|
||||
|
||||
if [ "$credentials" == ":" ];
|
||||
then
|
||||
. write_conf &
|
||||
zero="1"
|
||||
fi
|
||||
if [ ${#credentials} == 0 ];
|
||||
then
|
||||
. write_conf &
|
||||
zero="1"
|
||||
fi
|
||||
|
||||
######################################################################################
|
||||
|
||||
# Config- Datei schreiben.
|
||||
if [ $zero == "0" ]
|
||||
then
|
||||
echo "
|
||||
# Squid config by h44z
|
||||
|
||||
# TAG: http_port
|
||||
# Usage: port
|
||||
# hostname:port
|
||||
# 1.2.3.4:port
|
||||
http_port 10.8.0.1:3128 transparent
|
||||
http_port 10.8.0.1:8080
|
||||
#https_port 10.8.0.1:8181 key=/etc/apache2/ssl/apache.pem
|
||||
|
||||
|
||||
visible_hostname vpnrack
|
||||
|
||||
# TAG: icp_port
|
||||
icp_port 0
|
||||
|
||||
# TAG: no_cache
|
||||
acl QUERY urlpath_regex cgi-bin \\?
|
||||
no_cache deny QUERY
|
||||
|
||||
# TAG: cache_mem (bytes)
|
||||
cache_mem 32 MB
|
||||
|
||||
# TAG: cache_dir
|
||||
cache_dir ufs /var/cache/squid 100 16 256
|
||||
|
||||
# TAG: cache_access_log
|
||||
cache_access_log /var/log/squid/access.log
|
||||
|
||||
# TAG: cache_log
|
||||
cache_log /var/log/squid/cache.log
|
||||
|
||||
# TAG: cache_store_log
|
||||
cache_store_log /var/log/squid/store.log
|
||||
|
||||
# TAG: emulate_httpd_log on|off
|
||||
emulate_httpd_log on
|
||||
|
||||
# TAG: pid_filename
|
||||
pid_filename /var/run/squid.pid
|
||||
|
||||
# TAG: cache_mgr
|
||||
cache_mgr christoph.haas2@students.htlinn.ac.at
|
||||
|
||||
|
||||
http_access allow all
|
||||
acl https port 443
|
||||
http_access allow https
|
||||
|
||||
|
||||
# TAG: http_reply_access
|
||||
# Allow replies to client requests. This is complementary to http_access.
|
||||
#http_reply_access allow all
|
||||
|
||||
cache_peer 192.168.195.101 parent 8080 7 no-query default no-digest login=$credentials
|
||||
|
||||
never_direct allow all
|
||||
" > /etc/squid3/squid.conf
|
||||
|
||||
######################################################################################
|
||||
#restart squid
|
||||
killall -9 squid
|
||||
squid -D -YC -f /etc/squid3/squid.conf
|
||||
fi
|
@ -1,132 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Script um die cache_peer funktion von Squid upzudaten.
|
||||
# V1.0
|
||||
# 13.10.2010
|
||||
# Stoeckholzer, Haas
|
||||
|
||||
if [ ${#1} == 0 ];
|
||||
then
|
||||
echo "USAGE: write_conf_file updatetime"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while [ "1" == "1" ] ;
|
||||
do
|
||||
sleep $1
|
||||
zero="1"
|
||||
|
||||
while [ $zero == "1" ] ;
|
||||
do
|
||||
|
||||
# Zaehlvariable einlesen
|
||||
id=$(cat /var/vpn/vpnid)
|
||||
|
||||
# id inkrementieren
|
||||
let id=$id+1
|
||||
|
||||
# 255 Overflow verhindern
|
||||
if [ $id -gt 254 ]
|
||||
then
|
||||
id=0
|
||||
fi
|
||||
|
||||
# Variable id fuer naechsten Durchlauf speichern
|
||||
echo $id > /var/vpn/vpnid
|
||||
|
||||
# id HEX wandeln
|
||||
hex=$(echo "obase=16; $id" |bc)
|
||||
|
||||
|
||||
# Abfrage ob Strinlaenge von hex kleiner als 2
|
||||
if [ ${#hex} -lt 2 ];
|
||||
then
|
||||
hex=0$hex
|
||||
fi
|
||||
|
||||
black=$(cat /var/vpn/blacklist | grep $hex)
|
||||
|
||||
if [ ${#black} -lt 2 ];
|
||||
then
|
||||
# Login-Daten aus Datenbank holen
|
||||
credentials=$(/home/christoph/squid_dynamic/squidy $hex)
|
||||
# Abfrage ob Datensatz leer :
|
||||
|
||||
if [ ${#credentials} -gt 10 ];
|
||||
then
|
||||
zero="0"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "USING credentials: $credentials"
|
||||
|
||||
sudo killall -9 unlinkd
|
||||
sudo killall -9 squid
|
||||
|
||||
sudo rm /etc/squid3/squid.conf
|
||||
######################################################################################
|
||||
|
||||
# Config- Datei schreiben.
|
||||
sudo echo -e -n "
|
||||
# Squid config by h44z
|
||||
|
||||
# TAG: http_port
|
||||
# Usage: port
|
||||
# hostname:port
|
||||
# 1.2.3.4:port
|
||||
http_port 10.8.0.1:3128 transparent
|
||||
http_port 10.8.0.1:8080
|
||||
#https_port 10.8.0.1:8181 key=/etc/apache2/ssl/apache.pem
|
||||
|
||||
|
||||
visible_hostname vpnrack
|
||||
|
||||
# TAG: icp_port
|
||||
icp_port 0
|
||||
|
||||
# TAG: no_cache
|
||||
acl QUERY urlpath_regex cgi-bin \\?
|
||||
no_cache deny QUERY
|
||||
|
||||
# TAG: cache_mem (bytes)
|
||||
cache_mem 32 MB
|
||||
|
||||
# TAG: cache_dir
|
||||
cache_dir ufs /var/cache/squid 100 16 256
|
||||
|
||||
# TAG: cache_access_log
|
||||
cache_access_log /var/log/squid/access.log
|
||||
|
||||
# TAG: cache_log
|
||||
cache_log /var/log/squid/cache.log
|
||||
|
||||
# TAG: cache_store_log
|
||||
cache_store_log /var/log/squid/store.log
|
||||
|
||||
# TAG: emulate_httpd_log on|off
|
||||
emulate_httpd_log on
|
||||
|
||||
# TAG: pid_filename
|
||||
pid_filename /var/run/squid.pid
|
||||
|
||||
# TAG: cache_mgr
|
||||
cache_mgr christoph.haas2@students.htlinn.ac.at
|
||||
#blubber
|
||||
|
||||
http_access allow all
|
||||
acl https port 443
|
||||
http_access allow https
|
||||
|
||||
|
||||
# TAG: http_reply_access
|
||||
# Allow replies to client requests. This is complementary to http_access.
|
||||
#http_reply_access allow all
|
||||
|
||||
cache_peer 192.168.195.101 parent 8080 7 no-query default no-digest login=$credentials
|
||||
|
||||
never_direct allow all
|
||||
" > /etc/squid3/squid.conf
|
||||
echo "Written credentials: $credentials"
|
||||
######################################################################################
|
||||
#restart squid
|
||||
sudo squid -D -YC -f /etc/squid3/squid.conf
|
||||
done
|
@ -1,130 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Script um die cache_peer funktion von Squid upzudaten.
|
||||
# V1.0
|
||||
# 13.10.2010
|
||||
# Stoeckholzer, Haas
|
||||
|
||||
if [ ${#1} == 0 ];
|
||||
then
|
||||
echo "USAGE: write_conf_file updatetime"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while [ "1" == "1" ] ; do
|
||||
|
||||
sleep $1
|
||||
zero="1"
|
||||
|
||||
while [ $zero == "1" ] ; do
|
||||
|
||||
# Zaehlvariable einlesen
|
||||
id=$(cat /var/vpn/vpnid)
|
||||
|
||||
# id inkrementieren
|
||||
let id=$id+1
|
||||
|
||||
# 255 Overflow verhindern
|
||||
if [ $id -gt 254 ]
|
||||
then id=0
|
||||
fi
|
||||
|
||||
# Variable id fuer naechsten Durchlauf speichern
|
||||
echo $id > /var/vpn/vpnid
|
||||
|
||||
# id HEX wandeln
|
||||
hex=$(echo "obase=16; $id" |bc)
|
||||
|
||||
# Abfrage ob Strinlaenge von hex kleiner als 2
|
||||
if [ ${#hex} -lt 2 ];
|
||||
then hex=0$hex
|
||||
fi
|
||||
|
||||
# Login-Daten aus Datenbank holen
|
||||
credentials=$(/home/christoph/squid_dynamic/squidy $hex)
|
||||
# Abfrage ob Datensatz leer :
|
||||
|
||||
if [ ${#credentials} -gt 10 ];
|
||||
then
|
||||
zero="0"
|
||||
fi
|
||||
echo "Schleife zero: $zero"
|
||||
echo "Schleife id: $id"
|
||||
echo "Schleife hex: $hex"
|
||||
done
|
||||
echo "USING zero: $zero"
|
||||
echo "USING id: $id"
|
||||
echo "USING hex: $hex"
|
||||
echo "USING credentials: $credentials"
|
||||
|
||||
sudo killall -9 unlinkd
|
||||
sudo killall -9 squid
|
||||
|
||||
sudo rm /etc/squid3/squid.conf
|
||||
######################################################################################
|
||||
|
||||
# Config- Datei schreiben.
|
||||
sudo echo -e -n "
|
||||
# Squid config by h44z
|
||||
|
||||
# TAG: http_port
|
||||
# Usage: port
|
||||
# hostname:port
|
||||
# 1.2.3.4:port
|
||||
http_port 10.8.0.1:3128 transparent
|
||||
http_port 10.8.0.1:8080
|
||||
#https_port 10.8.0.1:8181 key=/etc/apache2/ssl/apache.pem
|
||||
|
||||
|
||||
visible_hostname vpnrack
|
||||
|
||||
# TAG: icp_port
|
||||
icp_port 0
|
||||
|
||||
# TAG: no_cache
|
||||
acl QUERY urlpath_regex cgi-bin \\?
|
||||
no_cache deny QUERY
|
||||
|
||||
# TAG: cache_mem (bytes)
|
||||
cache_mem 32 MB
|
||||
|
||||
# TAG: cache_dir
|
||||
cache_dir ufs /var/cache/squid 100 16 256
|
||||
|
||||
# TAG: cache_access_log
|
||||
cache_access_log /var/log/squid/access.log
|
||||
|
||||
# TAG: cache_log
|
||||
cache_log /var/log/squid/cache.log
|
||||
|
||||
# TAG: cache_store_log
|
||||
cache_store_log /var/log/squid/store.log
|
||||
|
||||
# TAG: emulate_httpd_log on|off
|
||||
emulate_httpd_log on
|
||||
|
||||
# TAG: pid_filename
|
||||
pid_filename /var/run/squid.pid
|
||||
|
||||
# TAG: cache_mgr
|
||||
cache_mgr christoph.haas2@students.htlinn.ac.at
|
||||
#blubber
|
||||
|
||||
http_access allow all
|
||||
acl https port 443
|
||||
http_access allow https
|
||||
|
||||
|
||||
# TAG: http_reply_access
|
||||
# Allow replies to client requests. This is complementary to http_access.
|
||||
#http_reply_access allow all
|
||||
|
||||
cache_peer 192.168.195.101 parent 8080 7 no-query default no-digest login=$credentials
|
||||
|
||||
never_direct allow all
|
||||
" > /etc/squid3/squid.conf
|
||||
echo "Written credentials: $credentials"
|
||||
######################################################################################
|
||||
#restart squid
|
||||
sudo squid -D -YC -f /etc/squid3/squid.conf
|
||||
|
||||
done
|
@ -1,183 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Script um die cache_peer funktion von Squid manuell von der Website aus upzudaten.
|
||||
# V1.0
|
||||
# 13.10.2010
|
||||
# Stoeckholzer, Haas
|
||||
|
||||
while [ "1" == "1" ];
|
||||
do
|
||||
|
||||
write=1
|
||||
zero=0
|
||||
# ueberpruefen ob file vpnid_man vorhanden
|
||||
if [ -e /var/vpn/vpnid_man ];
|
||||
then
|
||||
echo 1
|
||||
zero=1
|
||||
fi
|
||||
|
||||
# ueberpruefen ob file vpnid_next vorhanden
|
||||
if [ -e /var/vpn/vpnid_next ];
|
||||
then
|
||||
echo 2
|
||||
zero=2
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ "$zero" == "1" ];
|
||||
then
|
||||
# Manuelle ID als hex einlesen einlesen
|
||||
hex=$(cat /var/vpn/vpnid_man)
|
||||
id=$(printf "%d\n" 0x$hex)
|
||||
echo $id > /var/vpn/vpnid
|
||||
rm /var/vpn/vpnid_man
|
||||
echo $hex
|
||||
# Login-Daten aus Datenbank holen
|
||||
credentials=$(/home/christoph/squid_dynamic/squidy $hex)
|
||||
fi
|
||||
|
||||
if [ "$zero" == "2" ];
|
||||
then
|
||||
schleife="1"
|
||||
rm /var/vpn/vpnid_next
|
||||
|
||||
while [ $schleife == "1" ] ;
|
||||
do
|
||||
# Zaehlvariable einlesen
|
||||
id_alt=$(cat /var/vpn/vpnid)
|
||||
|
||||
# alte id HEX wandeln zum BLacklisten
|
||||
hex_alt=$(echo "obase=16; $id_alt" |bc)
|
||||
|
||||
# Abfrage ob Strinlaenge von hex kleiner als 2
|
||||
if [ ${#hex_alt} -lt 2 ];
|
||||
then
|
||||
hex_alt=0$hex_alt
|
||||
fi
|
||||
|
||||
# alte id BLacklisten
|
||||
if [ $write == 1 ];
|
||||
then
|
||||
echo $hex_alt >> /var/vpn/blacklist
|
||||
fi
|
||||
|
||||
# id inkrementieren
|
||||
let id=$id_alt+1
|
||||
|
||||
# 255 Overflow verhindern
|
||||
if [ $id -gt 254 ]
|
||||
then
|
||||
id=0
|
||||
fi
|
||||
|
||||
# Variable id fuer naechsten Durchlauf speichern
|
||||
echo $id > /var/vpn/vpnid
|
||||
|
||||
# id HEX wandeln
|
||||
hex=$(echo "obase=16; $id" |bc)
|
||||
|
||||
# Abfrage ob Strinlaenge von hex kleiner als 2
|
||||
if [ ${#hex} -lt 2 ];
|
||||
then
|
||||
hex=0$hex
|
||||
fi
|
||||
|
||||
# hole id_hex aus BLacklist?
|
||||
black=$(cat /var/vpn/blacklist|grep $hex)
|
||||
|
||||
# Abfrage ob id_hex in BLacklist
|
||||
if [ ${#black} -lt 2 ];
|
||||
then
|
||||
# Login-Daten aus Datenbank holen
|
||||
credentials=$(/home/christoph/squid_dynamic/squidy $hex)
|
||||
|
||||
# Abfrage ob Datensatz leer :
|
||||
if [ ${#credentials} -gt 10 ];
|
||||
then
|
||||
schleife="0"
|
||||
fi
|
||||
else write=0
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Abfrage ob Datensatz leer (zur Sicherheit):
|
||||
if [ ${#credentials} -gt 10 ] && [ $zero != "0" ];
|
||||
then
|
||||
|
||||
# stop squid
|
||||
sudo killall -9 unlinkd
|
||||
sudo killall -9 squid
|
||||
|
||||
sudo rm /etc/squid3/squid.conf
|
||||
######################################################################################
|
||||
# Config- Datei schreiben.
|
||||
sudo echo -e -n "
|
||||
# Squid config by h44z
|
||||
|
||||
# TAG: http_port
|
||||
# Usage: port
|
||||
# hostname:port
|
||||
# 1.2.3.4:port
|
||||
http_port 10.8.0.1:3128 transparent
|
||||
http_port 10.8.0.1:8080
|
||||
#https_port 10.8.0.1:8181 key=/etc/apache2/ssl/apache.pem
|
||||
|
||||
|
||||
visible_hostname vpnrack
|
||||
|
||||
# TAG: icp_port
|
||||
icp_port 0
|
||||
|
||||
# TAG: no_cache
|
||||
acl QUERY urlpath_regex cgi-bin \\?
|
||||
no_cache deny QUERY
|
||||
|
||||
# TAG: cache_mem (bytes)
|
||||
cache_mem 32 MB
|
||||
|
||||
# TAG: cache_dir
|
||||
cache_dir ufs /var/cache/squid 100 16 256
|
||||
|
||||
# TAG: cache_access_log
|
||||
cache_access_log /var/log/squid/access.log
|
||||
|
||||
# TAG: cache_log
|
||||
cache_log /var/log/squid/cache.log
|
||||
|
||||
# TAG: cache_store_log
|
||||
cache_store_log /var/log/squid/store.log
|
||||
|
||||
# TAG: emulate_httpd_log on|off
|
||||
emulate_httpd_log on
|
||||
|
||||
# TAG: pid_filename
|
||||
pid_filename /var/run/squid.pid
|
||||
|
||||
# TAG: cache_mgr
|
||||
cache_mgr christoph.haas2@students.htlinn.ac.at
|
||||
|
||||
http_access allow all
|
||||
acl https port 443
|
||||
http_access allow https
|
||||
|
||||
|
||||
# TAG: http_reply_access
|
||||
# Allow replies to client requests. This is complementary to http_access.
|
||||
#http_reply_access allow all
|
||||
|
||||
cache_peer 192.168.195.101 parent 8080 7 no-query default no-digest login=$credentials
|
||||
|
||||
never_direct allow all
|
||||
" > /etc/squid3/squid.conf
|
||||
######################################################################################
|
||||
|
||||
echo "Written: $credentials"
|
||||
|
||||
#start squid
|
||||
squid -D -YC -f /etc/squid3/squid.conf
|
||||
fi
|
||||
sleep 2
|
||||
done
|
@ -1,158 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Script um die cache_peer funktion von Squid manuell von der Website aus upzudaten.
|
||||
# V1.0
|
||||
# 13.10.2010
|
||||
# Stoeckholzer, Haas
|
||||
|
||||
while [ "1" == "1" ];
|
||||
do
|
||||
|
||||
zero=0
|
||||
# ueberpruefen ob file vpnid_man vorhanden
|
||||
if [ -e /var/vpn/vpnid_man ];
|
||||
then
|
||||
echo 1
|
||||
zero=1
|
||||
fi
|
||||
|
||||
# ueberpruefen ob file vpnid_next vorhanden
|
||||
if [ -e /var/vpn/vpnid_next ];
|
||||
then
|
||||
echo 2
|
||||
zero=2
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ "$zero" == "1" ];
|
||||
then
|
||||
# Manuelle ID als hex einlesen einlesen
|
||||
hex=$(cat /var/vpn/vpnid_man)
|
||||
id=$(printf "%d\n" $hex)
|
||||
echo $id > /var/vpn/vpnid
|
||||
rm /var/vpn/vpnid_man
|
||||
echo $hex
|
||||
# Login-Daten aus Datenbank holen
|
||||
credentials=$(/home/christoph/squid_dynamic/squidy $hex)
|
||||
fi
|
||||
|
||||
if [ "$zero" == "2" ];
|
||||
then
|
||||
schleife="1"
|
||||
rm /var/vpn/vpnid_next
|
||||
|
||||
while [ $schleife == "1" ] ;
|
||||
do
|
||||
# Zaehlvariable einlesen
|
||||
id=$(cat /var/vpn/vpnid)
|
||||
# id inkrementieren
|
||||
let id=$id+1
|
||||
|
||||
# 255 Overflow verhindern
|
||||
if [ $id -gt 254 ]
|
||||
then
|
||||
id=0
|
||||
fi
|
||||
|
||||
# Variable id fuer naechsten Durchlauf speichern
|
||||
echo $id > /var/vpn/vpnid
|
||||
|
||||
# id HEX wandeln
|
||||
hex=$(echo "obase=16; $id" |bc)
|
||||
|
||||
# Abfrage ob Strinlaenge von hex kleiner als 2
|
||||
if [ ${#hex} -lt 2 ];
|
||||
then
|
||||
hex=0$hex
|
||||
fi
|
||||
|
||||
# Login-Daten aus Datenbank holen
|
||||
credentials=$(/home/christoph/squid_dynamic/squidy $hex)
|
||||
|
||||
# Abfrage ob Datensatz leer :
|
||||
if [ ${#credentials} -gt 10 ];
|
||||
then
|
||||
schleife="0"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Abfrage ob Datensatz leer (zur Sicherheit):
|
||||
if [ ${#credentials} -gt 10 ] && [ $zero != "0" ];
|
||||
then
|
||||
|
||||
# stop squid
|
||||
sudo killall -9 unlinkd
|
||||
sudo killall -9 squid
|
||||
|
||||
sudo rm /etc/squid3/squid.conf
|
||||
######################################################################################
|
||||
# Config- Datei schreiben.
|
||||
sudo echo -e -n "
|
||||
# Squid config by h44z
|
||||
|
||||
# TAG: http_port
|
||||
# Usage: port
|
||||
# hostname:port
|
||||
# 1.2.3.4:port
|
||||
http_port 10.8.0.1:3128 transparent
|
||||
http_port 10.8.0.1:8080
|
||||
#https_port 10.8.0.1:8181 key=/etc/apache2/ssl/apache.pem
|
||||
|
||||
|
||||
visible_hostname vpnrack
|
||||
|
||||
# TAG: icp_port
|
||||
icp_port 0
|
||||
|
||||
# TAG: no_cache
|
||||
acl QUERY urlpath_regex cgi-bin \\?
|
||||
no_cache deny QUERY
|
||||
|
||||
# TAG: cache_mem (bytes)
|
||||
cache_mem 32 MB
|
||||
|
||||
# TAG: cache_dir
|
||||
cache_dir ufs /var/cache/squid 100 16 256
|
||||
|
||||
# TAG: cache_access_log
|
||||
cache_access_log /var/log/squid/access.log
|
||||
|
||||
# TAG: cache_log
|
||||
cache_log /var/log/squid/cache.log
|
||||
|
||||
# TAG: cache_store_log
|
||||
cache_store_log /var/log/squid/store.log
|
||||
|
||||
# TAG: emulate_httpd_log on|off
|
||||
emulate_httpd_log on
|
||||
|
||||
# TAG: pid_filename
|
||||
pid_filename /var/run/squid.pid
|
||||
|
||||
# TAG: cache_mgr
|
||||
cache_mgr christoph.haas2@students.htlinn.ac.at
|
||||
|
||||
http_access allow all
|
||||
acl https port 443
|
||||
http_access allow https
|
||||
|
||||
|
||||
# TAG: http_reply_access
|
||||
# Allow replies to client requests. This is complementary to http_access.
|
||||
#http_reply_access allow all
|
||||
|
||||
cache_peer 192.168.195.101 parent 8080 7 no-query default no-digest login=$credentials
|
||||
|
||||
never_direct allow all
|
||||
" > /etc/squid3/squid.conf
|
||||
######################################################################################
|
||||
|
||||
echo "Written: $credentials"
|
||||
|
||||
#start squid
|
||||
squid -D -YC -f /etc/squid3/squid.conf
|
||||
fi
|
||||
sleep 2
|
||||
done
|
@ -1,5 +0,0 @@
|
||||
/home/christoph/stopsquid
|
||||
|
||||
#iptables -t nat -A PREROUTING -i tap0 -p tcp --dport 80 -j REDIRECT --to-ports 3128
|
||||
#iptables -t nat -A PREROUTING -i tap0 -p tcp --dport 443 -j REDIRECT --to-ports 3128
|
||||
squid -D -YC -f /etc/squid3/squid.conf
|
@ -1,6 +0,0 @@
|
||||
#iptables -t nat -D PREROUTING -i tap0 -p tcp --dport 80 -j REDIRECT --to-ports 3128
|
||||
#iptables -t nat -D PREROUTING -i tap0 -p tcp --dport 443 -j REDIRECT --to-ports 3128
|
||||
|
||||
killall squid
|
||||
killall squid
|
||||
killall squid
|
@ -1,14 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Config/_siteconfig_.php");
|
||||
$id = $_REQUEST["id"];
|
||||
$path = $_REQUEST["path"];
|
||||
// Write to file vpnid_man
|
||||
$myFile = db_getconfval("sqddir")."/vpnid_man";
|
||||
$fh = fopen($myFile, 'w') or die("can't open file");
|
||||
fwrite($fh, $id);
|
||||
fclose($fh);
|
||||
|
||||
header ("Location: ".$path."&uebergabe=1");
|
||||
?>
|
@ -1,9 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
$path = $_REQUEST["path"];
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/mysql.php");
|
||||
$ret = passthru("echo > ".db_getconfval("sqddir")."/blacklist");
|
||||
echo $ret;
|
||||
header ("Location: ".$path."&uebergabe=2");
|
||||
?>
|
@ -1,66 +0,0 @@
|
||||
<?php
|
||||
//include($_SERVER["DOCUMENT_ROOT"]."/Site/mysql.php");
|
||||
|
||||
// Change: your company name
|
||||
$config['Company_Name'] = 'SchulVPN';
|
||||
// Change: your company home page
|
||||
$config['URL_Home_Page'] = 'http://10.10.63.60/index.php';
|
||||
$config['AUTH_REALM'] = $config['Company_Name'] .' OpenVPN Web GUI v.0.3.2';
|
||||
// What files to include into ZIP
|
||||
$config['Download']['ZIP']['.pem'] = true;
|
||||
$config['Download']['ZIP']['.key'] = true;
|
||||
$config['Download']['ZIP']['.csr'] = false;
|
||||
// All the following files should be placed into downloads folder
|
||||
$config['Download']['ZIP']['Others'] = array ('readme.txt','ca.crt', 'schulvpn.ovpn', 'certinstall.sh');
|
||||
//$config['Download']['ZIP']['Others'] = array ('readme.txt', 'install.cmd', 'tls-auth.key');
|
||||
|
||||
// Use the real absolute path here.
|
||||
$config['PluginsAbsolutePath'] = $_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNConfig/plugins/";
|
||||
|
||||
// If there are no plugins
|
||||
//$config['Plugins'] = NULL;
|
||||
// Otherwise, follow this example:
|
||||
//$config['Plugins']['PLUGINMANE']['Folder'] = 'FOLDERNAME';
|
||||
|
||||
// The post-install helper plugin. Shows if PHP5 has the neccessary functions available
|
||||
$config['Plugins']['systemcheck']['Folder'] = 'systemcheck';
|
||||
|
||||
// OPENVPN ________________________________
|
||||
|
||||
// Change: the configuration directory
|
||||
$config['openvpn']['folder'] = db_getconfval("ovpnconfdir")."/";
|
||||
// Change: configuration and status file names
|
||||
$config['openvpn']['config'] = $config['openvpn']['folder'].db_getconfval("ovpnconffile");
|
||||
$config['openvpn']['status'] = $config['openvpn']['folder']."openvpn-status.log";
|
||||
|
||||
// OPENSSL ________________________________
|
||||
|
||||
// Change: openssl keys directory
|
||||
$config['openssl']['folder'] = db_getconfval("ovpnkeydir")."/keys/";
|
||||
// Change: different folders for Public Certificates, Certificate Requests and Private Keys.
|
||||
// NOTE: openssl somehow respects only newpem folder (for Public Certificates).
|
||||
$config['openssl']['pubfolder'] = $config['openssl']['folder'];
|
||||
$config['openssl']['reqfolder'] = $config['openssl']['folder'];
|
||||
$config['openssl']['prvfolder'] = $config['openssl']['folder'];
|
||||
// Change: openssl CA private and public keys
|
||||
$config['openssl']['CA']['priv'] = $config['openssl']['folder'] .'ca.key';
|
||||
$config['openssl']['CA']['pub'] = $config['openssl']['folder'] .'ca.crt';
|
||||
// Change: openssl serial file
|
||||
$config['openssl']['serial'] = $config['openssl']['folder'] .'serial';
|
||||
// Change: openssl database
|
||||
$config['openssl']['database'] = $config['openssl']['folder'] .'index.txt';
|
||||
// Change: openssl configuration
|
||||
$config['openssl']['config'] = $config['openvpn']['folder'] .'openssl.cnf';
|
||||
// NEW OPENSSL CERTIFICATE DEFAULTS _________
|
||||
|
||||
// Change all of them as it is done in your easy-rsa/vars
|
||||
$config['openssl']['default']['expiration'] = 3560;
|
||||
$config['openssl']['default']['countryName'] = 'AT';
|
||||
$config['openssl']['default']['stateOrProvinceName'] = 'Tirol';
|
||||
$config['openssl']['default']['localityName'] = 'Innsbruck';
|
||||
$config['openssl']['default']['organizationName'] = 'HTL';
|
||||
$config['openssl']['default']['organizationalUnitName'] = '';
|
||||
$config['openssl']['default']['commonName'] = '';
|
||||
$config['openssl']['default']['emailAddress'] = 'vpn@students.htlinn.ac.at';
|
||||
|
||||
?>
|
@ -1,251 +0,0 @@
|
||||
<?php
|
||||
// ----------------------------------------------
|
||||
function load_plugins ()
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (isset ($config['Plugins']))
|
||||
{
|
||||
foreach ($config['Plugins'] as $PluginName => $PluginData)
|
||||
{
|
||||
// Check if the config.inc for a plugin exists
|
||||
if (file_exists ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNconfig/plugins/". $PluginData['Folder'] ."/config.inc"))
|
||||
{
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNconfig/plugins/". $PluginData['Folder'] ."/config.inc");
|
||||
|
||||
// Check if claimed inc files do exist
|
||||
if (isset ($config['Plugins'][$PluginName]['Action']['Include']) &&
|
||||
!file_exists ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNconfig/plugins/". $PluginData['Folder'] ."/".
|
||||
$config['Plugins'][$PluginName]['Action']['Include']))
|
||||
$config['Plugins'][$PluginName]['Action']['Include'] = NULL;
|
||||
|
||||
if (isset ($config['Plugins'][$PluginName]['Left']['Menu']) &&
|
||||
!file_exists ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNconfig/plugins/". $PluginData['Folder'] ."/".
|
||||
$config['Plugins'][$PluginName]['Left']['Menu']))
|
||||
$config['Plugins'][$PluginName]['Left']['Menu'] = NULL;
|
||||
|
||||
if (isset ($config['Plugins'][$PluginName]['Left']['Status']) &&
|
||||
!file_exists ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/VPNconfig/plugins/". $PluginData['Folder'] ."/".
|
||||
$config['Plugins'][$PluginName]['Left']['Status']))
|
||||
$config['Plugins'][$PluginName]['Left']['Status'] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function seconds_string ($seconds, $periods = null)
|
||||
{
|
||||
$Wanted = '';
|
||||
|
||||
// Define time periods
|
||||
if (!is_array ($periods))
|
||||
{
|
||||
$periods = array (
|
||||
'years' => 31556926,
|
||||
'months' => 2629743,
|
||||
'weeks' => 604800,
|
||||
'days' => 86400,
|
||||
'hours' => 3600,
|
||||
'minutes' => 60,
|
||||
'seconds' => 1
|
||||
);
|
||||
}
|
||||
|
||||
// Wanted
|
||||
if (empty ($seconds))
|
||||
{ $Wanted = ''; }
|
||||
else
|
||||
{
|
||||
// Loop
|
||||
$seconds = (int) $seconds;
|
||||
foreach ($periods as $period => $value)
|
||||
{
|
||||
$count = floor ($seconds / $value);
|
||||
|
||||
if ($count == 0)
|
||||
continue;
|
||||
elseif ($count == 1)
|
||||
$Wanted .= ($count . ' ' . substr ($period, 0, strlen ($period) - 1) . ' ');
|
||||
else
|
||||
$Wanted .= ($count . ' ' . $period . ' ');
|
||||
|
||||
$seconds = $seconds % $value;
|
||||
}
|
||||
}
|
||||
|
||||
return rtrim ($Wanted);
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function chomp (&$string)
|
||||
{
|
||||
if (is_array ($string))
|
||||
{
|
||||
foreach ($string as $i => $val)
|
||||
{ $endchar = chomp ($string[$i]); }
|
||||
}
|
||||
else
|
||||
{
|
||||
$endchar = substr ("$string", strlen("$string") - 1, 1);
|
||||
if ($endchar == "\n")
|
||||
{ $string = substr ("$string", 0, -1); }
|
||||
}
|
||||
return $endchar;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function str_strip_spaces ($aline)
|
||||
{
|
||||
while (strpos ($aline, "\t") != FALSE) $aline = str_replace ("\t", ' ', $aline);
|
||||
while (strpos ($aline, ' ') != FALSE) $aline = str_replace (' ', ' ', $aline);
|
||||
|
||||
return $aline;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Returns $afile only if it is the full name, or prefixed by $apath
|
||||
function str_file_fullname ($apath, $afile)
|
||||
{
|
||||
if (substr ($afile, 0, 1) != '/')
|
||||
$afile = ($apath . $afile);
|
||||
|
||||
return $afile;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Returns $afile only if it is the full name, or prefixed by $apath
|
||||
function str_openssldata_to_string ($adata)
|
||||
{
|
||||
$Return = '';
|
||||
$amonth = array ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
|
||||
|
||||
if (substr ($adata, -1, 1) == 'Z')
|
||||
{
|
||||
$Return = sprintf ("%s %d %s%02d, %02d:%02d:%02d",
|
||||
$amonth [substr ($adata, 2, 2) - 1],
|
||||
substr ($adata, 4, 2),
|
||||
(substr ($adata, 0, 2) > 50 ? '19' : '20'),
|
||||
substr ($adata, 0, 2),
|
||||
substr ($adata, 6, 2),
|
||||
substr ($adata, 8, 2),
|
||||
substr ($adata, 10, 2));
|
||||
}
|
||||
|
||||
return $Return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function str_get_sometag ($aline, $sometag)
|
||||
{
|
||||
if (eregi ($sometag, $aline, $anarray))
|
||||
return $anarray[1];
|
||||
else
|
||||
return '';
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Writes content into file
|
||||
// Optionally sames old file into backup file.
|
||||
// The Backup File has to reside on the same partition!
|
||||
function writefile ($afile, $adata, $abackup = NULL)
|
||||
{
|
||||
// Move the old file into Backup one
|
||||
if ($abackup != NULL)
|
||||
{
|
||||
if (file_exists ($afile))
|
||||
{
|
||||
if (file_exists ($abackup))
|
||||
if (!unlink ($abackup))
|
||||
exit;
|
||||
if (!rename ($afile, $abackup))
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
$fp = fopen ($afile, "w", 0);
|
||||
if (!$fp)
|
||||
exit;
|
||||
|
||||
fputs ($fp, $adata);
|
||||
fclose ($fp);
|
||||
}
|
||||
|
||||
|
||||
// ----------------------------------------------
|
||||
// Guess the full file name
|
||||
function if_file_exists (&$sFileName, $bFix = FALSE)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if (strpos ($sFileName, '/') == FALSE)
|
||||
{
|
||||
$sLongFileName = $config['openvpn']['folder'] . $sFileName;
|
||||
if (file_exists ($sLongFileName) && $bFix)
|
||||
$sFileName = $sLongFileName;
|
||||
}
|
||||
|
||||
return file_exists ($sFileName);
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function zlib_check_functions ()
|
||||
{
|
||||
$Result = '';
|
||||
$ZLibs = array
|
||||
(
|
||||
'gzcompress'
|
||||
);
|
||||
|
||||
foreach ($ZLibs as $Function)
|
||||
{
|
||||
$Result .= $Function . '<font color="black">:</font> ' . (function_exists ($Function) ?
|
||||
'<font color="black">OK</font>' :
|
||||
'<font color="red">DOES NOT EXIST</font>') . '<br>';
|
||||
}
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function html_dump ($aname, $athing)
|
||||
{
|
||||
echo '<pre><b><font color="darkgreen">'. $aname .'</font></b>: ';
|
||||
print_r ($athing);
|
||||
echo "</pre><br>\n";
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function html_error ($amessage, $ifexit = true)
|
||||
{
|
||||
global $config;
|
||||
echo $amessage;
|
||||
if ($ifexit)
|
||||
exit;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function html_postredir ($url)
|
||||
{
|
||||
header ('HTTP/1.1 303 REDIRECT');
|
||||
header ('Location: '. $url);
|
||||
#header ('Status: 303'); // if 1st header generates 500, then commend it out and use this one as 2nd
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// ----------------------------------------------
|
||||
function html_download ($sFile, $sName)
|
||||
{
|
||||
header ('Content-type: application/octet-stream');
|
||||
header ('Content-Disposition: attachment; filename="'. $sName . '"');
|
||||
readfile ($sFile);
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function html_download_data ($sData, $sName)
|
||||
{
|
||||
header ('Content-type: application/octet-stream');
|
||||
header ('Content-Disposition: attachment; filename="'. $sName . '"');
|
||||
echo $sData;
|
||||
}
|
||||
?>
|
@ -1,377 +0,0 @@
|
||||
<?php
|
||||
// ----------------------------------------------
|
||||
function openssl_check_functions ()
|
||||
{
|
||||
$Result = '';
|
||||
$OpenSSLs = array
|
||||
(
|
||||
'openssl_csr_new',
|
||||
'openssl_csr_sign',
|
||||
'openssl_csr_export_to_file',
|
||||
'openssl_pkey_new',
|
||||
'openssl_pkey_get_private',
|
||||
'openssl_pkey_export_to_file',
|
||||
'openssl_x509_export_to_file'
|
||||
);
|
||||
|
||||
foreach ($OpenSSLs as $Function)
|
||||
{
|
||||
$Result .= $Function . '<font color="black">:</font> ' . (function_exists ($Function) ?
|
||||
'<font color="black">OK</font>' :
|
||||
'<font color="red">DOES NOT EXIST</font>') . '<br>';
|
||||
}
|
||||
|
||||
return $Result;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_load_database ($afile = '')
|
||||
{
|
||||
global $config;
|
||||
global $openssl;
|
||||
|
||||
$afile = ($afile == '' ? $config['openssl']['database'] : $afile);
|
||||
$lines = file ($afile);
|
||||
|
||||
if (!is_array ($lines))
|
||||
exit;
|
||||
|
||||
foreach ($lines as $line_num => $line)
|
||||
{
|
||||
chomp ($line);
|
||||
$linetokens = explode ("\t", $line);
|
||||
|
||||
// Ensure that all the fields are set
|
||||
if (count ($linetokens) == 6)
|
||||
{
|
||||
// Decode the openssl's database. See apps/apps.h
|
||||
$openssl['Database'][] = array ('Status' => $linetokens[0],
|
||||
'ExpDate' => $linetokens[1],
|
||||
'RevDate' => $linetokens[2],
|
||||
'Serial' => $linetokens[3],
|
||||
'File' => $linetokens[4],
|
||||
'Name' => $linetokens[5],
|
||||
'Country' => openssl_get_country ($linetokens[5]),
|
||||
'State' => openssl_get_state ($linetokens[5]),
|
||||
'City' => openssl_get_city ($linetokens[5]),
|
||||
'Company' => openssl_get_company ($linetokens[5]),
|
||||
'Department' => openssl_get_department ($linetokens[5]),
|
||||
'CN' => openssl_get_CN ($linetokens[5]),
|
||||
'Email' => openssl_get_email ($linetokens[5])
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_write_database ($afile = '')
|
||||
{
|
||||
global $config;
|
||||
global $openssl;
|
||||
|
||||
$afile = ($afile == '' ? $config['openssl']['database'] : $afile);
|
||||
|
||||
$atext = '';
|
||||
for ($i = 0; $i < count ($openssl['Database']); $i++)
|
||||
{
|
||||
$atext .= ($atext == '' ? '' : "\n");
|
||||
$atext .= $openssl['Database'][$i]['Status'] ."\t".
|
||||
$openssl['Database'][$i]['ExpDate'] ."\t".
|
||||
$openssl['Database'][$i]['RevDate'] ."\t".
|
||||
$openssl['Database'][$i]['Serial'] ."\t".
|
||||
$openssl['Database'][$i]['File'] ."\t".
|
||||
$openssl['Database'][$i]['Name'];
|
||||
}
|
||||
|
||||
writefile ($afile, $atext, $afile .'.old');
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_write_database_attr ($atext = '', $afile = '')
|
||||
{
|
||||
global $config;
|
||||
global $openssl;
|
||||
|
||||
$afile = ($afile == '' ? $config['openssl']['database'] : $afile) .'.attr';
|
||||
$atext = ($atext == '' ? "unique_subject = yes\n" : $atext);
|
||||
|
||||
if (file_exists ($afile))
|
||||
{
|
||||
ob_start ();
|
||||
readfile ($afile);
|
||||
$atext = ob_get_contents ();
|
||||
ob_end_clean ();
|
||||
}
|
||||
|
||||
writefile ($afile, $atext, $afile .'.old');
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Returns the PEM file with spaces reduced and replaced to
|
||||
function openssl_load_cert ($anid)
|
||||
{
|
||||
global $config;
|
||||
|
||||
do
|
||||
{
|
||||
$lines = file ($config['openssl']['pubfolder'] . $anid . '.pem');
|
||||
|
||||
if (!is_array ($lines))
|
||||
{
|
||||
$Return = '';
|
||||
break;
|
||||
}
|
||||
|
||||
foreach ($lines as $line_num => $line)
|
||||
{
|
||||
chomp ($line);
|
||||
$Return[] = str_replace (' ', ' ', htmlspecialchars (str_replace (' ', ' ', $line)));
|
||||
}
|
||||
} while (FALSE);
|
||||
|
||||
return $Return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_load_serial ($afile = '')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$afile = ($afile == '' ? $config['openssl']['serial'] : $afile);
|
||||
|
||||
$lines = file ($afile);
|
||||
|
||||
if (!is_array ($lines))
|
||||
exit;
|
||||
|
||||
$Return = sscanf ($lines[0], "%X");
|
||||
|
||||
return $Return[0];
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_write_serial ($iNumber, $afile = '')
|
||||
{
|
||||
global $config;
|
||||
|
||||
$afile = ($afile == '' ? $config['openssl']['serial'] : $afile);
|
||||
|
||||
writefile ($afile, openssl_hex_serial ($iNumber) . "\n", $afile .'.old');
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Supports up to 999,999 serials
|
||||
function openssl_hex_serial ($iNumber)
|
||||
{
|
||||
if ($iNumber < 100)
|
||||
$sString = sprintf ("%02X", $iNumber);
|
||||
elseif ($iNumber < 10000)
|
||||
$sString = sprintf ("%04X", $iNumber);
|
||||
else
|
||||
$sString = sprintf ("%06X", $iNumber);
|
||||
|
||||
return $sString;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
// Builds User Private Key, CSR and Public Certificate
|
||||
function openssl_build_key (&$anoutput, $adn, $validdays = NULL)
|
||||
{
|
||||
global $config;
|
||||
global $openssl;
|
||||
|
||||
$anoutput = '';
|
||||
$Return = FALSE;
|
||||
|
||||
// Allow to override default value
|
||||
$validdays = ($validdays == NULL ? $config['openssl']['default']['expiration'] : $validdays);
|
||||
|
||||
do
|
||||
{
|
||||
if (!isset ($adn) ||
|
||||
!isset ($adn['countryName']) ||
|
||||
!isset ($adn['stateOrProvinceName']) ||
|
||||
!isset ($adn['localityName']) ||
|
||||
!isset ($adn['organizationName']) ||
|
||||
!isset ($adn['organizationalUnitName']) ||
|
||||
!isset ($adn['commonName']) ||
|
||||
!isset ($adn['emailAddress'])
|
||||
)
|
||||
{ $anoutput .= "- ERROR on ". __LINE__ ." line: incomplete DN information\n"; break; }
|
||||
$anoutput .= "+ OK got the valid input\n";
|
||||
|
||||
// Get the new User Private Key
|
||||
$UserPrivKey = openssl_pkey_new (array($config['openssl']['config'],0));
|
||||
if ($UserPrivKey == FALSE)
|
||||
{ $anoutput .= "- ERROR on ". (__LINE__ - 2) ." line (openssl_pkey_new):\n ". openssl_error_strings () ." (that might usually mean that the openssl.cnf file is unavailable)"; break; }
|
||||
$anoutput .= "+ OK got the User Private Key\n";
|
||||
|
||||
// Generate the User Certificate Request
|
||||
$UserReq = openssl_csr_new ($adn,
|
||||
$UserPrivKey,
|
||||
$config['openssl']['config']);
|
||||
if ($UserReq == FALSE)
|
||||
{ $anoutput .= "- ERROR on ". (__LINE__ - 4) ." line (openssl_csr_new):\n ". openssl_error_strings (); break; }
|
||||
$anoutput .= "+ OK generated the User Certificate Request\n";
|
||||
|
||||
// Read the openssl serial
|
||||
$CAserial = openssl_load_serial ($config['openssl']['serial']);
|
||||
$anoutput .= "+ OK read current openssl serial (". openssl_hex_serial ($CAserial) .")\n";
|
||||
|
||||
$UserPubCertFile = $config['openssl']['pubfolder'] . openssl_hex_serial ($CAserial) .'.pem';
|
||||
$UserCertReqFile = $config['openssl']['reqfolder'] . openssl_hex_serial ($CAserial) .'.csr';
|
||||
$UserPrivKeyFile = $config['openssl']['prvfolder'] . openssl_hex_serial ($CAserial) .'.key';
|
||||
|
||||
// Read the openssl database
|
||||
openssl_load_database ($config['openssl']['database']);
|
||||
$anoutput .= "+ OK read the openssl database (". count ($openssl['Database']) ." items)\n";
|
||||
|
||||
// Get CA's Private Key
|
||||
$CAPrivKey = openssl_pkey_get_private ($config['openssl']['CA']['priv']);
|
||||
|
||||
if ($CAPrivKey == FALSE)
|
||||
{ $anoutput .= "- ERROR on ". (__LINE__ - 2) ." line (openssl_pkey_get_private)\n ". openssl_error_strings (); break; }
|
||||
$anoutput .= "+ OK read the CA Private Key\n";
|
||||
|
||||
// Get a CA-signed cert that lasts for 1 year
|
||||
$UserPubCert = openssl_csr_sign ($UserReq,
|
||||
$config['openssl']['CA']['pub'],
|
||||
$CAPrivKey,
|
||||
$validdays,
|
||||
$config['openssl']['config'],
|
||||
$CAserial);
|
||||
if ($UserPubCert == FALSE)
|
||||
{ $anoutput .= "- ERROR on ". (__LINE__ - 7) ." line (openssl_csr_sign)\n ". openssl_error_strings (); break; }
|
||||
$anoutput .= "+ OK signed the User Certificate Request with CA Private Key\n";
|
||||
|
||||
// Add the new row into openssl database
|
||||
$openssl['Database'][] = array ('Status' => 'V',
|
||||
'ExpDate' => date ('ymdHis',
|
||||
time() +
|
||||
date ('Z') +
|
||||
($validdays * 24 * 60 * 60)) .'Z',
|
||||
'RevDate' => '',
|
||||
'Serial' => openssl_hex_serial ($CAserial),
|
||||
'File' => openssl_hex_serial ($CAserial) .'.crt',
|
||||
'Name' => openssl_make_name ($adn)
|
||||
);
|
||||
|
||||
// Create files
|
||||
|
||||
$OldUMask = umask (0007);
|
||||
|
||||
// Write User Private Key
|
||||
if (!openssl_pkey_export_to_file ($UserPrivKey, $UserPrivKeyFile, NULL, $config['openssl']['config']))
|
||||
{ $anoutput .= "- ERROR on ". (__LINE__ - 1) ." line (openssl_pkey_export_to_file)\n ". openssl_error_strings () ." (That might mean that the key folder is not write enabled for www user)"; break; }
|
||||
$anoutput .= "+ OK wrote User Private Key into file $UserPrivKeyFile\n";
|
||||
|
||||
// Write User Public Certificate
|
||||
if (!openssl_x509_export_to_file ($UserPubCert, $UserPubCertFile, FALSE))
|
||||
{ $anoutput .= "- ERROR on ". (__LINE__ - 1) ." line (openssl_x509_export_to_file)\n ". openssl_error_strings (); break; }
|
||||
$anoutput .= "+ OK wrote User Public Certificate into file $UserPubCertFile\n";
|
||||
|
||||
// Write User Certificate Request
|
||||
if (!openssl_csr_export_to_file ($UserReq, $UserCertReqFile))
|
||||
{ $anoutput .= "- ERROR on ". (__LINE__ - 1) ." line (openssl_csr_export_to_file)\n ". openssl_error_strings (); break; }
|
||||
$anoutput .= "+ OK wrote User Certificate Request into file $UserCertReqFile\n";
|
||||
|
||||
// Write new openssl database
|
||||
openssl_write_database ($config['openssl']['database']);
|
||||
openssl_write_database_attr ('', $config['openssl']['database']);
|
||||
$anoutput .= "+ OK wrote new openssl database\n";
|
||||
|
||||
// Write new openssl serial
|
||||
openssl_write_serial ($CAserial + 1, $config['openssl']['serial']);
|
||||
$anoutput .= "+ OK wrote new openssl serial\n";
|
||||
|
||||
umask ($OldUMask);
|
||||
|
||||
$Return = openssl_hex_serial ($CAserial);
|
||||
} while (FALSE);
|
||||
|
||||
return $Return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_error_strings ()
|
||||
{
|
||||
$sString = '';
|
||||
while ($msg = openssl_error_string ())
|
||||
$sString .= $msg ."\n";
|
||||
|
||||
return $sString;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_make_name ($adn)
|
||||
{
|
||||
$sString = '';
|
||||
|
||||
if (strlen ($adn['countryName']) > 0) $sString .= '/C=' . $adn['countryName'];
|
||||
if (strlen ($adn['stateOrProvinceName']) > 0) $sString .= '/ST=' . $adn['stateOrProvinceName'];
|
||||
if (strlen ($adn['localityName']) > 0) $sString .= '/L=' . $adn['localityName'];
|
||||
if (strlen ($adn['organizationName']) > 0) $sString .= '/O=' . $adn['organizationName'];
|
||||
if (strlen ($adn['organizationalUnitName']) > 0) $sString .= '/OU=' . $adn['organizationalUnitName'];
|
||||
if (strlen ($adn['commonName']) > 0) $sString .= '/CN=' . $adn['commonName'];
|
||||
if (strlen ($adn['emailAddress']) > 0) $sString .= '/emailAddress='. $adn['emailAddress'];
|
||||
|
||||
return $sString;
|
||||
}
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_get_country ($aline)
|
||||
{ return str_get_sometag ($aline . '/', '\/C=([^/]*)\/'); }
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_get_state ($aline)
|
||||
{ return str_get_sometag ($aline . '/', '\/ST=([^/]*)\/'); }
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_get_city ($aline)
|
||||
{ return str_get_sometag ($aline . '/', '\/L=([^/]*)\/'); }
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_get_company ($aline)
|
||||
{ return str_get_sometag ($aline . '/', '\/O=([^/]*)\/'); }
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_get_department ($aline)
|
||||
{ return str_get_sometag ($aline . '/', '\/OU=([^/]*)\/'); }
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_get_CN ($aline)
|
||||
{ return str_get_sometag ($aline . '/', '\/CN=([^/]*)\/'); }
|
||||
|
||||
// ----------------------------------------------
|
||||
function openssl_get_email ($aline)
|
||||
{ return str_get_sometag ($aline . '/', '\/emailAddress=([^/]*)\/'); }
|
||||
|
||||
// ----------------------------------------------
|
||||
// Guess the full file name
|
||||
function openssl_get_filename ($iSerial, $sExt)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$sReturn = $config['openssl']['folder'] . openssl_hex_serial ($iSerial) . $sExt;
|
||||
if (!file_exists ($sReturn))
|
||||
{
|
||||
$sReturn = $config['openssl']['pubfolder'] . openssl_hex_serial ($iSerial) . $sExt;
|
||||
if (!file_exists ($sReturn))
|
||||
{
|
||||
$sReturn = $config['openssl']['reqfolder'] . openssl_hex_serial ($iSerial) . $sExt;
|
||||
if (!file_exists ($sReturn))
|
||||
{
|
||||
$sReturn = $config['openssl']['prvfolder'] . openssl_hex_serial ($iSerial) . $sExt;
|
||||
if (!file_exists ($sReturn))
|
||||
{
|
||||
$sReturn = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $sReturn;
|
||||
}
|
||||
|
||||
|
||||
?>
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Config/_siteconfig_.php");
|
||||
|
||||
$path = $_REQUEST["path"];
|
||||
// Write to file vpnid_man
|
||||
exec("touch /var/vpn/squid_restart");
|
||||
|
||||
header ("Location: ".$path."&uebergabe=3");
|
||||
?>
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Config/_siteconfig_.php");
|
||||
|
||||
$path = $_REQUEST["path"];
|
||||
// Write to file vpnid_man
|
||||
exec("touch /var/vpn/squid_start");
|
||||
|
||||
header ("Location: ".$path."&uebergabe=4");
|
||||
?>
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Config/_siteconfig_.php");
|
||||
|
||||
$path = $_REQUEST["path"];
|
||||
// Write to file vpnid_man
|
||||
exec("touch /var/vpn/squid_stop");
|
||||
|
||||
header ("Location: ".$path."&uebergabe=5");
|
||||
?>
|
@ -1,297 +0,0 @@
|
||||
<?php
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
//include($_SERVER["DOCUMENT_ROOT"]."/Site/mysql.php");
|
||||
include($_SERVER["DOCUMENT_ROOT"]."/Config/_dbconfig_.php");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/Squid/include/config.inc");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/Squid/include/functions.inc");
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Admin/Modules/Squid/include/openssl-functions.inc");
|
||||
openssl_load_database ();
|
||||
|
||||
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
||||
@$x = mysql_select_db($MYSQL_DATABASE);
|
||||
if (empty($x))
|
||||
{
|
||||
echo "ERROR 0x01, Failed to connect to database!<br>";
|
||||
exit;
|
||||
}
|
||||
$sort = mysql_real_escape_string($_POST["dirsort"]); //$_GET["sort"];
|
||||
$by = mysql_real_escape_string($_POST["sortby"]); //$_GET["by"];
|
||||
$userid = mysql_real_escape_string($_POST["userid"]); //$_GET["userid"];
|
||||
$search = mysql_real_escape_string($_POST["search"]); //$_GET["search"];
|
||||
|
||||
$moduleurl = $_SERVER["REQUEST_URI"];
|
||||
$urlcut = strpos($moduleurl, "&");
|
||||
$moduleurl = substr($moduleurl,0,$urlcut);
|
||||
?>
|
||||
<!-- MAIN CONTENT BEGINN ################################################################################ -->
|
||||
<h1><b>Squid Config</b></h1>
|
||||
<?php
|
||||
if(is_file("/var/run/squid.pid"))
|
||||
{
|
||||
echo "<b>Squid is currently: <font color=green>running</font></b><br />";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<b>Squid is currently: <font color=red>stopped</font></b><br />";
|
||||
}
|
||||
|
||||
if ($_REQUEST["uebergabe"]=="3")
|
||||
{
|
||||
echo "<b>Squid restarted successfully!</b>";
|
||||
echo "<meta http-equiv=\"Refresh\" content=\"1; url=".$moduleurl."&uebergabe=0\">";
|
||||
}
|
||||
if ($_REQUEST["uebergabe"]=="4")
|
||||
{
|
||||
echo "<b>Squid started successfully!</b>";
|
||||
echo "<meta http-equiv=\"Refresh\" content=\"1; url=".$moduleurl."&uebergabe=0\">";
|
||||
}
|
||||
if ($_REQUEST["uebergabe"]=="5")
|
||||
{
|
||||
echo "<b>Squid stopped successfully!</b>";
|
||||
echo "<meta http-equiv=\"Refresh\" content=\"3; url=".$moduleurl."&uebergabe=0\">";
|
||||
}
|
||||
?>
|
||||
<table>
|
||||
<tr>
|
||||
<td>
|
||||
<form action="/Admin/Modules/Squid/include/restartsquid.php" method="post" >
|
||||
<input type="hidden" name="path" size="50" value="<?php echo $moduleurl;?>" />
|
||||
<input type="submit" value="Restart Squid" />
|
||||
</form>
|
||||
</td>
|
||||
<?php
|
||||
if(!is_file("/var/run/squid.pid"))
|
||||
{
|
||||
echo "
|
||||
<td>
|
||||
<form action=\"/Admin/Modules/Squid/include/startsquid.php\" method=\"post\" >
|
||||
<input type=\"hidden\" name=\"path\" size=\"50\" value=\"".$moduleurl."\" />
|
||||
<input type=\"submit\" value=\"Start Squid\" />
|
||||
</form>
|
||||
</td>";
|
||||
}
|
||||
?>
|
||||
<?php
|
||||
if(is_file("/var/run/squid.pid"))
|
||||
{
|
||||
echo "
|
||||
<td>
|
||||
<form action=\"/Admin/Modules/Squid/include/stopsquid.php\" method=\"post\" >
|
||||
<input type=\"hidden\" name=\"path\" size=\"50\" value=\"".$moduleurl."\" />
|
||||
<input type=\"submit\" value=\"Stop Squid\" />
|
||||
</form>
|
||||
</td>";
|
||||
}
|
||||
?>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
<h2>Change Proxy Account:</h2>
|
||||
<?php
|
||||
if ($_REQUEST["uebergabe"]=="1")
|
||||
{
|
||||
echo "<b>Changed Squid Account successfully!</b>";
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<p>
|
||||
<form action="/Admin/Modules/Squid/changesquid.php" method="post" >
|
||||
Squid ID (HEX):
|
||||
<input type="text" name="id" size="3">
|
||||
<input type="hidden" name="path" size="50" value="<?php echo $moduleurl;?>">
|
||||
<input type="submit" value="Change Squid User">
|
||||
</form>
|
||||
</p>
|
||||
<p>
|
||||
Current Squid User:
|
||||
<?php
|
||||
function dec_to_hex($dec)
|
||||
{
|
||||
$sign = ""; // suppress errors
|
||||
if( $dec < 0){ $sign = "-"; $dec = abs($dec); }
|
||||
|
||||
$hex = Array( 0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5,
|
||||
6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 'A',
|
||||
11 => 'B', 12 => 'C', 13 => 'D', 14 => 'E',
|
||||
15 => 'F' );
|
||||
|
||||
do
|
||||
{
|
||||
$h = $hex[($dec%16)] . $h;
|
||||
$dec /= 16;
|
||||
}
|
||||
while( $dec >= 1 );
|
||||
|
||||
return $sign . $h;
|
||||
}
|
||||
|
||||
$zeile = exec(escapeshellcmd("cat ".db_getconfval("sqddir")."/vpnid"));
|
||||
$zeile = dec_to_hex($zeile);
|
||||
//echo $zeile;
|
||||
if(strlen ($zeile) <2)
|
||||
{
|
||||
$zeile = "0".$zeile;
|
||||
}
|
||||
if(strlen ($zeile) >2)
|
||||
{
|
||||
$zeile=substr($zeile, 0, -1);
|
||||
}
|
||||
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
||||
@$x = mysql_select_db($MYSQL_DATABASE);
|
||||
if (empty($x))
|
||||
{
|
||||
echo "ERROR 0x01, Failed to connect to database!<br>";
|
||||
exit;
|
||||
}
|
||||
$sql4 = "SELECT * FROM userdata WHERE VPNId = '".$zeile."';";
|
||||
$result4 = mysql_query($sql4);
|
||||
//echo $sql4;
|
||||
$ar4=mysql_fetch_array($result4,MYSQL_ASSOC);
|
||||
echo "<b>" . $ar4["Vorname"] . " " . $ar4["Nachname"] . "</b> VPNId: <b>" . $ar4["VPNId"]."</b>";
|
||||
mysql_close();
|
||||
?>
|
||||
</p>
|
||||
<br>
|
||||
|
||||
|
||||
<h2>Blacklisted Accounts:</h2>
|
||||
<?php
|
||||
if ($_REQUEST["uebergabe"]=="2")
|
||||
{
|
||||
echo "<b>Blacklist cleared successfully!</b>";
|
||||
}
|
||||
?>
|
||||
<table border=1>
|
||||
<tr><td><b>Squid ID</b></td><td><b>Nickname</b></td><td><b>Vorname</b></td><td><b>Nachname</b></td></tr>
|
||||
<?php
|
||||
$thisFileContent = file(db_getconfval("sqddir")."/blacklist");
|
||||
//echo db_getconfval("sqddir")."/blacklist";
|
||||
$blindex = 0;
|
||||
foreach ($thisFileContent as $zeile)
|
||||
{
|
||||
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
||||
@$x = mysql_select_db($MYSQL_DATABASE);
|
||||
if (empty($x))
|
||||
{
|
||||
echo "ERROR 0x01, Failed to connect to database!<br>";
|
||||
exit;
|
||||
}
|
||||
|
||||
$hascontent = true;
|
||||
if (strlen($zeile) >2)
|
||||
{
|
||||
$zeile=substr($zeile, 0, -1);
|
||||
}
|
||||
$sql3 = "SELECT * FROM userdata WHERE VPNId = '".$zeile."';";
|
||||
$result3 = mysql_query($sql3);
|
||||
$ar3=mysql_fetch_array($result3,MYSQL_ASSOC);
|
||||
$nick = $ar3["Nickname"];
|
||||
if($nick == "")
|
||||
$hascontent=false;
|
||||
$vor = $ar3["Vorname"];
|
||||
if($vor == "")
|
||||
$hascontent=false;
|
||||
$nach = $ar3["Nachname"];
|
||||
if($nach == "")
|
||||
$hascontent=false;
|
||||
|
||||
if($hascontent == true)
|
||||
{
|
||||
$blindex = $blindex+1;
|
||||
echo "<tr><td>".$zeile."</td><td>".$nick."</td><td>".$vor."</td><td>".$nach."</td></tr>";
|
||||
}
|
||||
mysql_close();
|
||||
}
|
||||
|
||||
?>
|
||||
</table>
|
||||
<p> Blacklisted accounts:
|
||||
<b>
|
||||
<?php echo $blindex; ?></b> out of: <b>
|
||||
<?php
|
||||
if (count($openssl['Database']) == 0)
|
||||
echo 'no certificates</b>';
|
||||
elseif (count($openssl['Database'])-1 == 1)
|
||||
{
|
||||
echo '1</b> certificate';
|
||||
}
|
||||
elseif (count($openssl['Database'])-1 > 1)
|
||||
{
|
||||
echo '';
|
||||
echo count($openssl['Database'])-1;
|
||||
echo '</b> certificates';
|
||||
}?>
|
||||
</p>
|
||||
<p>
|
||||
<form action="/Admin/Modules/Squid/delbl.php" method="post" >
|
||||
<input type="hidden" name="path" size="50" value="<?php echo $moduleurl;?>">
|
||||
<input type="submit" value="Clear Blacklist">
|
||||
</form>
|
||||
</p>
|
||||
<br>
|
||||
|
||||
<h2>User changed Proxy Accounts:</h2>
|
||||
|
||||
<form action="<?php echo $PHP_SELF; ?>" method="post">
|
||||
<select name="dirsort" size=1>
|
||||
<option <?php if($sort=="ASC") echo "selected";?> value="ASC">Up</option>
|
||||
<option <?php if($sort=="DESC") echo "selected";?> value="DESC">Down</option>
|
||||
</select>
|
||||
<select name="sortby" size=1>
|
||||
<option <?php if($by=="Id") echo "selected";?> value="Id">ID</option>
|
||||
<option <?php if($by=="VPNId") echo "selected";?> value="VPNId">VPNId</option>
|
||||
<option <?php if($by=="Time") echo "selected";?> value="Time">Time</option>
|
||||
<option <?php if($by=="IP") echo "selected";?> value="IP">IP</option>
|
||||
<option <?php if($by=="Nickname") echo "selected";?> value="Nickname">Nickname</option>
|
||||
</select>
|
||||
Search User:<input type="text" name="search" size="20" <?php if($search !="") echo "value=".$search;?> ></td>
|
||||
<input type="submit" value="go!">
|
||||
</form>
|
||||
|
||||
<!------ Sorting Leiste Start-->
|
||||
<?php
|
||||
@$y = mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASS);
|
||||
@$x = mysql_select_db($MYSQL_DATABASE);
|
||||
if (empty($x))
|
||||
{
|
||||
echo "ERROR 0x01, Failed to connect to database!<br>";
|
||||
exit;
|
||||
}
|
||||
// MYsql befehl basteln
|
||||
|
||||
|
||||
if($by == "Nickname")
|
||||
{
|
||||
$sql = "SELECT * FROM proxyrepair;";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql = "SELECT * FROM proxyrepair ORDER BY $by $sort;";
|
||||
}
|
||||
|
||||
$result = mysql_query($sql);
|
||||
echo "<br><table border=1>";
|
||||
echo "<tr><td><b>User ID</b></td><td><b>VPN Id</b></td><td><b>Nickname</b></td><td><b>Vorname</b></td><td><b>Nachname</b></td><td><b>Client IP</b></td><td><b>Time</b></td><td><b>Dead VPN ID</b></td></tr>\n";
|
||||
// ------------------------------------------------ Mysql lesen
|
||||
if ($result)
|
||||
{
|
||||
while ($ar=mysql_fetch_array($result,MYSQL_ASSOC))
|
||||
{
|
||||
|
||||
$sql = "SELECT * FROM userdata WHERE Id = '".$ar["Id"]."' AND (Nickname LIKE '%".$search."%' OR Vorname LIKE '%".$search."%' OR Id LIKE '%".$search."%' OR VPNId LIKE '%".$search."%');";
|
||||
$result2 = mysql_query($sql);
|
||||
$ar2=mysql_fetch_array($result2,MYSQL_ASSOC);
|
||||
|
||||
if($ar2["Nickname"] != "")
|
||||
echo "<tr><td>",$ar["Id"],"</td><td>",$ar["VPNId"],"</td><td>",$ar2["Nickname"],"</td><td>",$ar2["Vorname"],"</td><td>",$ar2["Nachname"],
|
||||
"</td><td>", $ar["IP"],"</td><td>",$ar["Time"],"</td><td>",$ar["RepID"],"</td></tr>\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "<br>";
|
||||
}
|
||||
echo "</table>";
|
||||
mysql_close();
|
||||
?>
|
||||
|
@ -1,3 +0,0 @@
|
||||
export CPATH=..:$HOME/include:/usr/local/include:/usr/include:/usr/include/mysql
|
||||
needed: libmysqlclient-dev
|
||||
gcc -l mysqlclient -o traffic Traffic.c
|
@ -1,4 +0,0 @@
|
||||
user: openvpn
|
||||
passwd: openvpnlog
|
||||
database: openvpn
|
||||
host: localhost
|
@ -1,7 +0,0 @@
|
||||
#!/bin/bash
|
||||
let x=0x3f
|
||||
echo $x
|
||||
|
||||
|
||||
let x=0xfffe
|
||||
echo $x
|
@ -1,134 +0,0 @@
|
||||
/* OpenVPN - Squid Load Balancer*
|
||||
*------------------------------*
|
||||
* Version 1.0 *
|
||||
* Written by Christoph Haas *
|
||||
* License: LGPL *
|
||||
* 12.10.2010 *
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <mysql/mysql.h>
|
||||
#include <regex.h>
|
||||
#include <string.h>
|
||||
|
||||
#define __MAX_LINE__ 100
|
||||
#define __MAX_FIELD__ 255
|
||||
#define false 0
|
||||
#define true 1
|
||||
|
||||
|
||||
MYSQL mysql;
|
||||
|
||||
int connect_db(char *config)
|
||||
{
|
||||
FILE *db_data = NULL;
|
||||
regex_t reg;
|
||||
char user[__MAX_LINE__] = "";
|
||||
char passwd[__MAX_LINE__] = "";
|
||||
char database[__MAX_LINE__] = "";
|
||||
char host[__MAX_LINE__] = "";
|
||||
int port = 0;
|
||||
char tmp[__MAX_LINE__];
|
||||
char buf[__MAX_LINE__];
|
||||
int a, b;
|
||||
int length;
|
||||
|
||||
if((db_data = fopen(config, "r")) == NULL)
|
||||
{
|
||||
fprintf(stderr, "Can't open %s for reading.\n", config);
|
||||
return false;
|
||||
}
|
||||
regcomp(®, "^([a-zA-Z0-9:]+)[ ][a-zA-Z0-9]+$", REG_EXTENDED | REG_NEWLINE);
|
||||
while(fgets(buf, __MAX_LINE__, db_data))
|
||||
{
|
||||
length = strlen(buf);
|
||||
if(length < 3)continue;
|
||||
if(length >= __MAX_LINE__)
|
||||
{
|
||||
fclose(db_data);
|
||||
regfree(®);
|
||||
fprintf(stderr, "To long line in config file.\n");
|
||||
return false;
|
||||
}
|
||||
if(buf[0] == '#')continue;
|
||||
if(regexec(®, buf, 0, 0, 0))
|
||||
{
|
||||
fclose(db_data);
|
||||
regfree(®);
|
||||
fprintf(stderr, "Syntax error in config file.\n");
|
||||
return false;
|
||||
}
|
||||
for(a = 0, b = 0; a < strlen(buf); a++)
|
||||
{
|
||||
if(buf[a] == ' ')b++;
|
||||
}
|
||||
if(b != 1)
|
||||
{
|
||||
fclose(db_data);
|
||||
regfree(®);
|
||||
fprintf(stderr, "Syntax error in config file.\n");
|
||||
return false;
|
||||
}
|
||||
if((strncmp(buf, "user: ", 6)) == 0)sscanf(buf, "%s %s", tmp, user);
|
||||
if((strncmp(buf, "passwd: ", 8)) == 0)sscanf(buf, "%s %s", tmp, passwd);
|
||||
if((strncmp(buf, "database: ", 10)) == 0)sscanf(buf, "%s %s", tmp, database);
|
||||
if((strncmp(buf, "host: ", 6)) == 0)sscanf(buf, "%s %s", tmp, host);
|
||||
if((strncmp(buf, "port: ", 6)) == 0)sscanf(buf, "%s %d", tmp, &port);
|
||||
}
|
||||
fclose(db_data);
|
||||
regfree(®);
|
||||
if((strlen(user) < 1) || (strlen(passwd) < 1) ||
|
||||
(strlen(database) < 1) || (strlen(host) < 1))
|
||||
{
|
||||
fprintf(stderr, "One value for MySQL connection isn't set. \
|
||||
Please set user, passwd, database and host.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
mysql_init(&mysql);
|
||||
if((mysql_real_connect(&mysql, host, user, passwd, database, port, NULL, 0)) == NULL)
|
||||
{
|
||||
fprintf(stderr, "%s\n", mysql_error(&mysql));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
char Query[200]= "SELECT * FROM userdata WHERE VPNId = '\0";
|
||||
|
||||
if(argc == 2)
|
||||
{
|
||||
/*iID = atoi(argv[1]);
|
||||
printf("Int:%d\n", iID);
|
||||
sprintf(ID,"%-#10x",iID);
|
||||
printf("String:%s\n", ID);*/
|
||||
|
||||
connect_db("/home/christoph/squid_dynamic/db.conf"); // Datenbank Verbindung aufbauen
|
||||
|
||||
strcat(Query, argv[1]); // Query builden
|
||||
strcat(Query,"'"); //
|
||||
|
||||
mysql_query(&mysql, Query); // Query abschicken
|
||||
result = mysql_store_result(&mysql); // Result speichern
|
||||
|
||||
while ((row = mysql_fetch_row(result))) // Alle Datensätze auslesen (in dem Fall eh nur einer)
|
||||
{
|
||||
printf("%s:%s\n", row[9], row[10]); // Feld 9 und 10 (login/pass) aus dem datensatz ausgeben
|
||||
}
|
||||
|
||||
mysql_free_result(result); // Result wieder löschen
|
||||
mysql_close(&mysql); // Datenbank Verbindung schliesen
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("USAGE: sqidy xx | xx = VPNId\n"); // bei flascheingabe der Parameter
|
||||
}
|
||||
}
|
Binary file not shown.
Binary file not shown.
@ -1 +0,0 @@
|
||||
00
|
@ -1,115 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Zaehlvariable einlesen
|
||||
id=$ID_VPN
|
||||
|
||||
# Abfrage ob Stringlaenge von id NULL ist
|
||||
if [ ${#ID_VPN} == 0 ];
|
||||
then id=0
|
||||
fi
|
||||
|
||||
# id inkrementieren
|
||||
let id=$id+1
|
||||
|
||||
# 255 Overflow verhindern
|
||||
if [ $id -gt 254 ]
|
||||
then id=0
|
||||
fi
|
||||
|
||||
# Variable id fuer naechsten Durchlauf speichern
|
||||
export ID_VPN=$id
|
||||
|
||||
# id HEX wandeln
|
||||
hex=$(echo "obase=16; $id" |bc)
|
||||
|
||||
# Abfrage ob Strinlaenge von hex kleiner als 2
|
||||
if [ ${#hex} -lt 2 ];
|
||||
then hex=0$hex
|
||||
fi
|
||||
|
||||
# Login-Daten aus Datenbank holen
|
||||
credentials=$(./squidy $hex)
|
||||
# Abfrage ob Datensatz leer :
|
||||
zero="0"
|
||||
|
||||
if [ "$credentials" == ":" ];
|
||||
then
|
||||
. write_conf &
|
||||
zero="1"
|
||||
fi
|
||||
if [ ${#credentials} == 0 ];
|
||||
then
|
||||
. write_conf &
|
||||
zero="1"
|
||||
fi
|
||||
|
||||
######################################################################################
|
||||
|
||||
# Config- Datei schreiben.
|
||||
if [ $zero == "0" ]
|
||||
then
|
||||
echo "
|
||||
# Squid config by h44z
|
||||
|
||||
# TAG: http_port
|
||||
# Usage: port
|
||||
# hostname:port
|
||||
# 1.2.3.4:port
|
||||
http_port 10.8.0.1:3128 transparent
|
||||
http_port 10.8.0.1:8080
|
||||
#https_port 10.8.0.1:8181 key=/etc/apache2/ssl/apache.pem
|
||||
|
||||
|
||||
visible_hostname vpnrack
|
||||
|
||||
# TAG: icp_port
|
||||
icp_port 0
|
||||
|
||||
# TAG: no_cache
|
||||
acl QUERY urlpath_regex cgi-bin \\?
|
||||
no_cache deny QUERY
|
||||
|
||||
# TAG: cache_mem (bytes)
|
||||
cache_mem 32 MB
|
||||
|
||||
# TAG: cache_dir
|
||||
cache_dir ufs /var/cache/squid 100 16 256
|
||||
|
||||
# TAG: cache_access_log
|
||||
cache_access_log /var/log/squid/access.log
|
||||
|
||||
# TAG: cache_log
|
||||
cache_log /var/log/squid/cache.log
|
||||
|
||||
# TAG: cache_store_log
|
||||
cache_store_log /var/log/squid/store.log
|
||||
|
||||
# TAG: emulate_httpd_log on|off
|
||||
emulate_httpd_log on
|
||||
|
||||
# TAG: pid_filename
|
||||
pid_filename /var/run/squid.pid
|
||||
|
||||
# TAG: cache_mgr
|
||||
cache_mgr christoph.haas2@students.htlinn.ac.at
|
||||
|
||||
|
||||
http_access allow all
|
||||
acl https port 443
|
||||
http_access allow https
|
||||
|
||||
|
||||
# TAG: http_reply_access
|
||||
# Allow replies to client requests. This is complementary to http_access.
|
||||
#http_reply_access allow all
|
||||
|
||||
cache_peer 192.168.195.101 parent 8080 7 no-query default no-digest login=$credentials
|
||||
|
||||
never_direct allow all
|
||||
" > /etc/squid3/squid.conf
|
||||
|
||||
######################################################################################
|
||||
#restart squid
|
||||
killall -9 squid
|
||||
squid -D -YC -f /etc/squid3/squid.conf
|
||||
fi
|
@ -1,132 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Script um die cache_peer funktion von Squid upzudaten.
|
||||
# V1.0
|
||||
# 13.10.2010
|
||||
# Stoeckholzer, Haas
|
||||
|
||||
if [ ${#1} == 0 ];
|
||||
then
|
||||
echo "USAGE: write_conf_file updatetime"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while [ "1" == "1" ] ;
|
||||
do
|
||||
sleep $1
|
||||
zero="1"
|
||||
|
||||
while [ $zero == "1" ] ;
|
||||
do
|
||||
|
||||
# Zaehlvariable einlesen
|
||||
id=$(cat /var/vpn/vpnid)
|
||||
|
||||
# id inkrementieren
|
||||
let id=$id+1
|
||||
|
||||
# 255 Overflow verhindern
|
||||
if [ $id -gt 254 ]
|
||||
then
|
||||
id=0
|
||||
fi
|
||||
|
||||
# Variable id fuer naechsten Durchlauf speichern
|
||||
echo $id > /var/vpn/vpnid
|
||||
|
||||
# id HEX wandeln
|
||||
hex=$(echo "obase=16; $id" |bc)
|
||||
|
||||
|
||||
# Abfrage ob Strinlaenge von hex kleiner als 2
|
||||
if [ ${#hex} -lt 2 ];
|
||||
then
|
||||
hex=0$hex
|
||||
fi
|
||||
|
||||
black=$(cat /var/vpn/blacklist | grep $hex)
|
||||
|
||||
if [ ${#black} -lt 2 ];
|
||||
then
|
||||
# Login-Daten aus Datenbank holen
|
||||
credentials=$(/home/christoph/squid_dynamic/squidy $hex)
|
||||
# Abfrage ob Datensatz leer :
|
||||
|
||||
if [ ${#credentials} -gt 10 ];
|
||||
then
|
||||
zero="0"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "USING credentials: $credentials"
|
||||
|
||||
sudo killall -9 unlinkd
|
||||
sudo killall -9 squid
|
||||
|
||||
sudo rm /etc/squid3/squid.conf
|
||||
######################################################################################
|
||||
|
||||
# Config- Datei schreiben.
|
||||
sudo echo -e -n "
|
||||
# Squid config by h44z
|
||||
|
||||
# TAG: http_port
|
||||
# Usage: port
|
||||
# hostname:port
|
||||
# 1.2.3.4:port
|
||||
http_port 10.8.0.1:3128 transparent
|
||||
http_port 10.8.0.1:8080
|
||||
#https_port 10.8.0.1:8181 key=/etc/apache2/ssl/apache.pem
|
||||
|
||||
|
||||
visible_hostname vpnrack
|
||||
|
||||
# TAG: icp_port
|
||||
icp_port 0
|
||||
|
||||
# TAG: no_cache
|
||||
acl QUERY urlpath_regex cgi-bin \\?
|
||||
no_cache deny QUERY
|
||||
|
||||
# TAG: cache_mem (bytes)
|
||||
cache_mem 32 MB
|
||||
|
||||
# TAG: cache_dir
|
||||
cache_dir ufs /var/cache/squid 100 16 256
|
||||
|
||||
# TAG: cache_access_log
|
||||
cache_access_log /var/log/squid/access.log
|
||||
|
||||
# TAG: cache_log
|
||||
cache_log /var/log/squid/cache.log
|
||||
|
||||
# TAG: cache_store_log
|
||||
cache_store_log /var/log/squid/store.log
|
||||
|
||||
# TAG: emulate_httpd_log on|off
|
||||
emulate_httpd_log on
|
||||
|
||||
# TAG: pid_filename
|
||||
pid_filename /var/run/squid.pid
|
||||
|
||||
# TAG: cache_mgr
|
||||
cache_mgr christoph.haas2@students.htlinn.ac.at
|
||||
#blubber
|
||||
|
||||
http_access allow all
|
||||
acl https port 443
|
||||
http_access allow https
|
||||
|
||||
|
||||
# TAG: http_reply_access
|
||||
# Allow replies to client requests. This is complementary to http_access.
|
||||
#http_reply_access allow all
|
||||
|
||||
cache_peer 192.168.195.101 parent 8080 7 no-query default no-digest login=$credentials
|
||||
|
||||
never_direct allow all
|
||||
" > /etc/squid3/squid.conf
|
||||
echo "Written credentials: $credentials"
|
||||
######################################################################################
|
||||
#restart squid
|
||||
sudo squid -D -YC -f /etc/squid3/squid.conf
|
||||
done
|
@ -1,130 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Script um die cache_peer funktion von Squid upzudaten.
|
||||
# V1.0
|
||||
# 13.10.2010
|
||||
# Stoeckholzer, Haas
|
||||
|
||||
if [ ${#1} == 0 ];
|
||||
then
|
||||
echo "USAGE: write_conf_file updatetime"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
while [ "1" == "1" ] ; do
|
||||
|
||||
sleep $1
|
||||
zero="1"
|
||||
|
||||
while [ $zero == "1" ] ; do
|
||||
|
||||
# Zaehlvariable einlesen
|
||||
id=$(cat /var/vpn/vpnid)
|
||||
|
||||
# id inkrementieren
|
||||
let id=$id+1
|
||||
|
||||
# 255 Overflow verhindern
|
||||
if [ $id -gt 254 ]
|
||||
then id=0
|
||||
fi
|
||||
|
||||
# Variable id fuer naechsten Durchlauf speichern
|
||||
echo $id > /var/vpn/vpnid
|
||||
|
||||
# id HEX wandeln
|
||||
hex=$(echo "obase=16; $id" |bc)
|
||||
|
||||
# Abfrage ob Strinlaenge von hex kleiner als 2
|
||||
if [ ${#hex} -lt 2 ];
|
||||
then hex=0$hex
|
||||
fi
|
||||
|
||||
# Login-Daten aus Datenbank holen
|
||||
credentials=$(/home/christoph/squid_dynamic/squidy $hex)
|
||||
# Abfrage ob Datensatz leer :
|
||||
|
||||
if [ ${#credentials} -gt 10 ];
|
||||
then
|
||||
zero="0"
|
||||
fi
|
||||
echo "Schleife zero: $zero"
|
||||
echo "Schleife id: $id"
|
||||
echo "Schleife hex: $hex"
|
||||
done
|
||||
echo "USING zero: $zero"
|
||||
echo "USING id: $id"
|
||||
echo "USING hex: $hex"
|
||||
echo "USING credentials: $credentials"
|
||||
|
||||
sudo killall -9 unlinkd
|
||||
sudo killall -9 squid
|
||||
|
||||
sudo rm /etc/squid3/squid.conf
|
||||
######################################################################################
|
||||
|
||||
# Config- Datei schreiben.
|
||||
sudo echo -e -n "
|
||||
# Squid config by h44z
|
||||
|
||||
# TAG: http_port
|
||||
# Usage: port
|
||||
# hostname:port
|
||||
# 1.2.3.4:port
|
||||
http_port 10.8.0.1:3128 transparent
|
||||
http_port 10.8.0.1:8080
|
||||
#https_port 10.8.0.1:8181 key=/etc/apache2/ssl/apache.pem
|
||||
|
||||
|
||||
visible_hostname vpnrack
|
||||
|
||||
# TAG: icp_port
|
||||
icp_port 0
|
||||
|
||||
# TAG: no_cache
|
||||
acl QUERY urlpath_regex cgi-bin \\?
|
||||
no_cache deny QUERY
|
||||
|
||||
# TAG: cache_mem (bytes)
|
||||
cache_mem 32 MB
|
||||
|
||||
# TAG: cache_dir
|
||||
cache_dir ufs /var/cache/squid 100 16 256
|
||||
|
||||
# TAG: cache_access_log
|
||||
cache_access_log /var/log/squid/access.log
|
||||
|
||||
# TAG: cache_log
|
||||
cache_log /var/log/squid/cache.log
|
||||
|
||||
# TAG: cache_store_log
|
||||
cache_store_log /var/log/squid/store.log
|
||||
|
||||
# TAG: emulate_httpd_log on|off
|
||||
emulate_httpd_log on
|
||||
|
||||
# TAG: pid_filename
|
||||
pid_filename /var/run/squid.pid
|
||||
|
||||
# TAG: cache_mgr
|
||||
cache_mgr christoph.haas2@students.htlinn.ac.at
|
||||
#blubber
|
||||
|
||||
http_access allow all
|
||||
acl https port 443
|
||||
http_access allow https
|
||||
|
||||
|
||||
# TAG: http_reply_access
|
||||
# Allow replies to client requests. This is complementary to http_access.
|
||||
#http_reply_access allow all
|
||||
|
||||
cache_peer 192.168.195.101 parent 8080 7 no-query default no-digest login=$credentials
|
||||
|
||||
never_direct allow all
|
||||
" > /etc/squid3/squid.conf
|
||||
echo "Written credentials: $credentials"
|
||||
######################################################################################
|
||||
#restart squid
|
||||
sudo squid -D -YC -f /etc/squid3/squid.conf
|
||||
|
||||
done
|
@ -1,183 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Script um die cache_peer funktion von Squid manuell von der Website aus upzudaten.
|
||||
# V1.0
|
||||
# 13.10.2010
|
||||
# Stoeckholzer, Haas
|
||||
|
||||
while [ "1" == "1" ];
|
||||
do
|
||||
|
||||
write=1
|
||||
zero=0
|
||||
# ueberpruefen ob file vpnid_man vorhanden
|
||||
if [ -e /var/vpn/vpnid_man ];
|
||||
then
|
||||
echo 1
|
||||
zero=1
|
||||
fi
|
||||
|
||||
# ueberpruefen ob file vpnid_next vorhanden
|
||||
if [ -e /var/vpn/vpnid_next ];
|
||||
then
|
||||
echo 2
|
||||
zero=2
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ "$zero" == "1" ];
|
||||
then
|
||||
# Manuelle ID als hex einlesen einlesen
|
||||
hex=$(cat /var/vpn/vpnid_man)
|
||||
id=$(printf "%d\n" 0x$hex)
|
||||
echo $id > /var/vpn/vpnid
|
||||
rm /var/vpn/vpnid_man
|
||||
echo $hex
|
||||
# Login-Daten aus Datenbank holen
|
||||
credentials=$(/home/christoph/squid_dynamic/squidy $hex)
|
||||
fi
|
||||
|
||||
if [ "$zero" == "2" ];
|
||||
then
|
||||
schleife="1"
|
||||
rm /var/vpn/vpnid_next
|
||||
|
||||
while [ $schleife == "1" ] ;
|
||||
do
|
||||
# Zaehlvariable einlesen
|
||||
id_alt=$(cat /var/vpn/vpnid)
|
||||
|
||||
# alte id HEX wandeln zum BLacklisten
|
||||
hex_alt=$(echo "obase=16; $id_alt" |bc)
|
||||
|
||||
# Abfrage ob Strinlaenge von hex kleiner als 2
|
||||
if [ ${#hex_alt} -lt 2 ];
|
||||
then
|
||||
hex_alt=0$hex_alt
|
||||
fi
|
||||
|
||||
# alte id BLacklisten
|
||||
if [ $write == 1 ];
|
||||
then
|
||||
echo $hex_alt >> /var/vpn/blacklist
|
||||
fi
|
||||
|
||||
# id inkrementieren
|
||||
let id=$id_alt+1
|
||||
|
||||
# 255 Overflow verhindern
|
||||
if [ $id -gt 254 ]
|
||||
then
|
||||
id=0
|
||||
fi
|
||||
|
||||
# Variable id fuer naechsten Durchlauf speichern
|
||||
echo $id > /var/vpn/vpnid
|
||||
|
||||
# id HEX wandeln
|
||||
hex=$(echo "obase=16; $id" |bc)
|
||||
|
||||
# Abfrage ob Strinlaenge von hex kleiner als 2
|
||||
if [ ${#hex} -lt 2 ];
|
||||
then
|
||||
hex=0$hex
|
||||
fi
|
||||
|
||||
# hole id_hex aus BLacklist?
|
||||
black=$(cat /var/vpn/blacklist|grep $hex)
|
||||
|
||||
# Abfrage ob id_hex in BLacklist
|
||||
if [ ${#black} -lt 2 ];
|
||||
then
|
||||
# Login-Daten aus Datenbank holen
|
||||
credentials=$(/home/christoph/squid_dynamic/squidy $hex)
|
||||
|
||||
# Abfrage ob Datensatz leer :
|
||||
if [ ${#credentials} -gt 10 ];
|
||||
then
|
||||
schleife="0"
|
||||
fi
|
||||
else write=0
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Abfrage ob Datensatz leer (zur Sicherheit):
|
||||
if [ ${#credentials} -gt 10 ] && [ $zero != "0" ];
|
||||
then
|
||||
|
||||
# stop squid
|
||||
sudo killall -9 unlinkd
|
||||
sudo killall -9 squid
|
||||
|
||||
sudo rm /etc/squid3/squid.conf
|
||||
######################################################################################
|
||||
# Config- Datei schreiben.
|
||||
sudo echo -e -n "
|
||||
# Squid config by h44z
|
||||
|
||||
# TAG: http_port
|
||||
# Usage: port
|
||||
# hostname:port
|
||||
# 1.2.3.4:port
|
||||
http_port 10.8.0.1:3128 transparent
|
||||
http_port 10.8.0.1:8080
|
||||
#https_port 10.8.0.1:8181 key=/etc/apache2/ssl/apache.pem
|
||||
|
||||
|
||||
visible_hostname vpnrack
|
||||
|
||||
# TAG: icp_port
|
||||
icp_port 0
|
||||
|
||||
# TAG: no_cache
|
||||
acl QUERY urlpath_regex cgi-bin \\?
|
||||
no_cache deny QUERY
|
||||
|
||||
# TAG: cache_mem (bytes)
|
||||
cache_mem 32 MB
|
||||
|
||||
# TAG: cache_dir
|
||||
cache_dir ufs /var/cache/squid 100 16 256
|
||||
|
||||
# TAG: cache_access_log
|
||||
cache_access_log /var/log/squid/access.log
|
||||
|
||||
# TAG: cache_log
|
||||
cache_log /var/log/squid/cache.log
|
||||
|
||||
# TAG: cache_store_log
|
||||
cache_store_log /var/log/squid/store.log
|
||||
|
||||
# TAG: emulate_httpd_log on|off
|
||||
emulate_httpd_log on
|
||||
|
||||
# TAG: pid_filename
|
||||
pid_filename /var/run/squid.pid
|
||||
|
||||
# TAG: cache_mgr
|
||||
cache_mgr christoph.haas2@students.htlinn.ac.at
|
||||
|
||||
http_access allow all
|
||||
acl https port 443
|
||||
http_access allow https
|
||||
|
||||
|
||||
# TAG: http_reply_access
|
||||
# Allow replies to client requests. This is complementary to http_access.
|
||||
#http_reply_access allow all
|
||||
|
||||
cache_peer 192.168.195.101 parent 8080 7 no-query default no-digest login=$credentials
|
||||
|
||||
never_direct allow all
|
||||
" > /etc/squid3/squid.conf
|
||||
######################################################################################
|
||||
|
||||
echo "Written: $credentials"
|
||||
|
||||
#start squid
|
||||
squid -D -YC -f /etc/squid3/squid.conf
|
||||
fi
|
||||
sleep 2
|
||||
done
|
@ -1,158 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Script um die cache_peer funktion von Squid manuell von der Website aus upzudaten.
|
||||
# V1.0
|
||||
# 13.10.2010
|
||||
# Stoeckholzer, Haas
|
||||
|
||||
while [ "1" == "1" ];
|
||||
do
|
||||
|
||||
zero=0
|
||||
# ueberpruefen ob file vpnid_man vorhanden
|
||||
if [ -e /var/vpn/vpnid_man ];
|
||||
then
|
||||
echo 1
|
||||
zero=1
|
||||
fi
|
||||
|
||||
# ueberpruefen ob file vpnid_next vorhanden
|
||||
if [ -e /var/vpn/vpnid_next ];
|
||||
then
|
||||
echo 2
|
||||
zero=2
|
||||
fi
|
||||
|
||||
|
||||
|
||||
if [ "$zero" == "1" ];
|
||||
then
|
||||
# Manuelle ID als hex einlesen einlesen
|
||||
hex=$(cat /var/vpn/vpnid_man)
|
||||
id=$(printf "%d\n" $hex)
|
||||
echo $id > /var/vpn/vpnid
|
||||
rm /var/vpn/vpnid_man
|
||||
echo $hex
|
||||
# Login-Daten aus Datenbank holen
|
||||
credentials=$(/home/christoph/squid_dynamic/squidy $hex)
|
||||
fi
|
||||
|
||||
if [ "$zero" == "2" ];
|
||||
then
|
||||
schleife="1"
|
||||
rm /var/vpn/vpnid_next
|
||||
|
||||
while [ $schleife == "1" ] ;
|
||||
do
|
||||
# Zaehlvariable einlesen
|
||||
id=$(cat /var/vpn/vpnid)
|
||||
# id inkrementieren
|
||||
let id=$id+1
|
||||
|
||||
# 255 Overflow verhindern
|
||||
if [ $id -gt 254 ]
|
||||
then
|
||||
id=0
|
||||
fi
|
||||
|
||||
# Variable id fuer naechsten Durchlauf speichern
|
||||
echo $id > /var/vpn/vpnid
|
||||
|
||||
# id HEX wandeln
|
||||
hex=$(echo "obase=16; $id" |bc)
|
||||
|
||||
# Abfrage ob Strinlaenge von hex kleiner als 2
|
||||
if [ ${#hex} -lt 2 ];
|
||||
then
|
||||
hex=0$hex
|
||||
fi
|
||||
|
||||
# Login-Daten aus Datenbank holen
|
||||
credentials=$(/home/christoph/squid_dynamic/squidy $hex)
|
||||
|
||||
# Abfrage ob Datensatz leer :
|
||||
if [ ${#credentials} -gt 10 ];
|
||||
then
|
||||
schleife="0"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Abfrage ob Datensatz leer (zur Sicherheit):
|
||||
if [ ${#credentials} -gt 10 ] && [ $zero != "0" ];
|
||||
then
|
||||
|
||||
# stop squid
|
||||
sudo killall -9 unlinkd
|
||||
sudo killall -9 squid
|
||||
|
||||
sudo rm /etc/squid3/squid.conf
|
||||
######################################################################################
|
||||
# Config- Datei schreiben.
|
||||
sudo echo -e -n "
|
||||
# Squid config by h44z
|
||||
|
||||
# TAG: http_port
|
||||
# Usage: port
|
||||
# hostname:port
|
||||
# 1.2.3.4:port
|
||||
http_port 10.8.0.1:3128 transparent
|
||||
http_port 10.8.0.1:8080
|
||||
#https_port 10.8.0.1:8181 key=/etc/apache2/ssl/apache.pem
|
||||
|
||||
|
||||
visible_hostname vpnrack
|
||||
|
||||
# TAG: icp_port
|
||||
icp_port 0
|
||||
|
||||
# TAG: no_cache
|
||||
acl QUERY urlpath_regex cgi-bin \\?
|
||||
no_cache deny QUERY
|
||||
|
||||
# TAG: cache_mem (bytes)
|
||||
cache_mem 32 MB
|
||||
|
||||
# TAG: cache_dir
|
||||
cache_dir ufs /var/cache/squid 100 16 256
|
||||
|
||||
# TAG: cache_access_log
|
||||
cache_access_log /var/log/squid/access.log
|
||||
|
||||
# TAG: cache_log
|
||||
cache_log /var/log/squid/cache.log
|
||||
|
||||
# TAG: cache_store_log
|
||||
cache_store_log /var/log/squid/store.log
|
||||
|
||||
# TAG: emulate_httpd_log on|off
|
||||
emulate_httpd_log on
|
||||
|
||||
# TAG: pid_filename
|
||||
pid_filename /var/run/squid.pid
|
||||
|
||||
# TAG: cache_mgr
|
||||
cache_mgr christoph.haas2@students.htlinn.ac.at
|
||||
|
||||
http_access allow all
|
||||
acl https port 443
|
||||
http_access allow https
|
||||
|
||||
|
||||
# TAG: http_reply_access
|
||||
# Allow replies to client requests. This is complementary to http_access.
|
||||
#http_reply_access allow all
|
||||
|
||||
cache_peer 192.168.195.101 parent 8080 7 no-query default no-digest login=$credentials
|
||||
|
||||
never_direct allow all
|
||||
" > /etc/squid3/squid.conf
|
||||
######################################################################################
|
||||
|
||||
echo "Written: $credentials"
|
||||
|
||||
#start squid
|
||||
squid -D -YC -f /etc/squid3/squid.conf
|
||||
fi
|
||||
sleep 2
|
||||
done
|
@ -1,5 +0,0 @@
|
||||
/home/christoph/stopsquid
|
||||
|
||||
#iptables -t nat -A PREROUTING -i tap0 -p tcp --dport 80 -j REDIRECT --to-ports 3128
|
||||
#iptables -t nat -A PREROUTING -i tap0 -p tcp --dport 443 -j REDIRECT --to-ports 3128
|
||||
squid -D -YC -f /etc/squid3/squid.conf
|
@ -1,6 +0,0 @@
|
||||
#iptables -t nat -D PREROUTING -i tap0 -p tcp --dport 80 -j REDIRECT --to-ports 3128
|
||||
#iptables -t nat -D PREROUTING -i tap0 -p tcp --dport 443 -j REDIRECT --to-ports 3128
|
||||
|
||||
killall squid
|
||||
killall squid
|
||||
killall squid
|
@ -1,3 +1,6 @@
|
||||
<!-- MAIN -->
|
||||
<div id="main">
|
||||
<div class="wrapper">
|
||||
<?php
|
||||
include ($_SERVER["DOCUMENT_ROOT"]."/Site/checkadmin.php");
|
||||
|
||||
@ -62,3 +65,5 @@ switch($mode)
|
||||
break;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -76,20 +76,20 @@ function Potenz($sent_sum)
|
||||
$sql = "SELECT * FROM $table ORDER BY $by $sort;";
|
||||
$result = mysql_query($sql);
|
||||
|
||||
echo "<table style=\"border=1px solid;\">";
|
||||
echo "<table style=\"border: 1px solid;\">";
|
||||
if($table=='connections')
|
||||
{
|
||||
echo "<tr><td>Start Time</td><td>Stop Time</td><td>Client IP</td><td>Download
|
||||
echo "<tr style=\"border: 1px solid;\"><td>Start Time</td><td>Stop Time</td><td>Client IP</td><td>Download
|
||||
</td><td>Upload</td></tr>\n";
|
||||
}
|
||||
else if($table=='month')
|
||||
{
|
||||
echo "<tr><td>Month</td><td>Year</td><td>Connection Time</td><td>Download
|
||||
echo "<tr style=\"border: 1px solid;\"><td>Month</td><td>Year</td><td>Connection Time</td><td>Download
|
||||
</td><td>Upload</td></tr>\n";
|
||||
}
|
||||
else if($table=='year')
|
||||
{
|
||||
echo "<tr><td>Year</td><td>Connection Time</td><td>Download
|
||||
echo "<tr style=\"border: 1px solid;\"><td>Year</td><td>Connection Time</td><td>Download
|
||||
</td><td>Upload</td></tr>\n";
|
||||
}
|
||||
else
|
||||
|
@ -16,7 +16,6 @@ echo "
|
||||
Nachname: ".$_SESSION["user_nachname"]."<br>
|
||||
Vorname: ".$_SESSION["user_vorname"]."<br>
|
||||
Email: ".$_SESSION["user_email"]."<br>
|
||||
Novell Login: ".$_SESSION["user_novlogin"]."<br>
|
||||
Avatar: ".$_SESSION["user_avatar"]."
|
||||
</td>
|
||||
<td> <img src=\"Modules/UserControl/avatar/".$_SESSION["user_avatar"].".png\"
|
||||
@ -156,15 +155,7 @@ echo "
|
||||
<tr>
|
||||
<td>Passwort:</td>
|
||||
<td><input type=\"password\" name=\"pwd\" size=\"20\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Novell Login (Email):</td>
|
||||
<td><input type=\"text\" name=\"novlogin\" value=\"".$_SESSION["user_novlogin"]."\" size=\"50\"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Novell Password:</td>
|
||||
<td><input type=\"password\" name=\"novpass\" size=\"50\"></td>
|
||||
</tr>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input type=\"hidden\" name=\"path\" value=\"".$moduleurl."\" size=\"50\"></td>
|
||||
</tr>
|
||||
|
@ -17,8 +17,6 @@ $benutzer["Kennwort"] = mysql_real_escape_string($_REQUEST["pwd"]);
|
||||
$benutzer["Nachname"] = mysql_real_escape_string($_REQUEST["nachname"]);
|
||||
$benutzer["Vorname"] = mysql_real_escape_string($_REQUEST["vorname"]);
|
||||
$benutzer["Avatar"] = mysql_real_escape_string($_REQUEST["avatar"]);
|
||||
$benutzer["NovLogin"] = mysql_real_escape_string($_REQUEST["novlogin"]);
|
||||
$benutzer["NovPass"] = mysql_real_escape_string($_REQUEST["novpass"]);
|
||||
$moduleurl = $_REQUEST["path"];
|
||||
|
||||
if($_SESSION["user_id"] != $benutzer["id"])
|
||||
@ -67,30 +65,12 @@ $sql = "UPDATE userdata SET ";
|
||||
}
|
||||
$sql = $sql . "Avatar='". $benutzer["Avatar"]."' ";
|
||||
$strcount = 1;
|
||||
}
|
||||
if($benutzer["NovLogin"] != "")
|
||||
{
|
||||
if($strcount==1)
|
||||
{
|
||||
$sql = $sql . ",";
|
||||
}
|
||||
$sql = $sql . "NovLogin='". $benutzer["NovLogin"]."' ";
|
||||
$strcount = 1;
|
||||
}
|
||||
if($benutzer["NovPass"] != "")
|
||||
{
|
||||
if($strcount==1)
|
||||
{
|
||||
$sql = $sql . ",";
|
||||
}
|
||||
$sql = $sql . "NovPass='". $benutzer["NovPass"]."' ";
|
||||
$strcount = 1;
|
||||
}
|
||||
$sql = $sql . "WHERE id = '" . $benutzer["id"]."'";
|
||||
//echo $sql;
|
||||
mysql_query ($sql);
|
||||
$sql = "SELECT ".
|
||||
"Id, VPNId, IsAdmin, Nickname, Nachname, Vorname, Email, Avatar, NovLogin, NovPass ".
|
||||
"Id, VPNId, IsAdmin, Nickname, Nachname, Vorname, Email, Avatar, ".
|
||||
"FROM ".
|
||||
"userdata ".
|
||||
"WHERE ".
|
||||
@ -113,8 +93,6 @@ if (mysql_num_rows ($result) > 0)
|
||||
$_SESSION["user_vorname"] = $data["Vorname"];
|
||||
$_SESSION["user_email"] = $data["Email"];
|
||||
$_SESSION["user_avatar"] = $data["Avatar"];
|
||||
$_SESSION["user_novlogin"] = $data["NovLogin"];
|
||||
$_SESSION["user_novpass"] = $data["NovPass"];
|
||||
mysql_close();
|
||||
header ("Location: ".$moduleurl."&uebergabe=0");
|
||||
}
|
||||
|
@ -51,13 +51,13 @@ echo "
|
||||
<div class=\"wrapper\">
|
||||
<table>
|
||||
<tr>
|
||||
<td><h1>Welcome ".$_SESSION["user_vorname"]." ".$_SESSION["user_nachname"]."!</h1><br></td>
|
||||
<td><h1>Welcome ".$_SESSION["user_vorname"]." ".$_SESSION["user_nachname"]."!</h1><br/><br/></td>
|
||||
<td><img src=\"Modules/UserControl/avatar/".$_SESSION["user_avatar"].".png\" width=\"90\" height=\"90\"></img></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<h2>Your Userstatistics:</h2>
|
||||
|
||||
<br/>
|
||||
<form action=\"".$PHP_SELF."\" method=\"post\">
|
||||
<select name=\"dirsort\" size=1>
|
||||
<option "; if($sort=="ASC") echo "selected"; echo " value=\"ASC\">Up</option>
|
||||
@ -201,6 +201,7 @@ echo "
|
||||
echo "<br>
|
||||
|
||||
<h2>VPN Config:</h2>
|
||||
<br/>
|
||||
<form action=\"/Modules/UserControl/getcert.php\" method=\"post\">
|
||||
|
||||
<tr>
|
||||
@ -278,14 +279,12 @@ echo "<br>
|
||||
}
|
||||
|
||||
echo "
|
||||
<h2>User Information:</h2><br>
|
||||
<h2>User Information:</h2><br/>
|
||||
Benutzer Id: ".$_SESSION["user_id"]."<br>
|
||||
VPN Id: ".$_SESSION["user_vpnid"]."<br>
|
||||
Nickname: ".$_SESSION["user_nickname"]."<br>
|
||||
Nachname: ".$_SESSION["user_nachname"]."<br>
|
||||
Vorname: ".$_SESSION["user_vorname"]."<br>
|
||||
Email Adress: ".$_SESSION["user_email"]."<br>
|
||||
Novell Login (Email): ".$_SESSION["user_novlogin"]."<br>
|
||||
Vorname: ".$_SESSION["user_vorname"]."<br>
|
||||
Current IP: ".getenv("REMOTE_ADDR")."<br>
|
||||
<form action=\"".$moduleurl."&uebergabe=2\" method=\"post\">
|
||||
<input type=\"submit\" value=\"Change Userinformation\">
|
||||
|
Loading…
Reference in New Issue
Block a user