Exemple #1
0
include_once(dirname(__FILE__) . '/framework/class.unix.inc');
include_once(dirname(__FILE__).   "/framework/frame.class.inc");
include_once(dirname(__FILE__) . '/ressources/class.system.network.inc');
include_once(dirname(__FILE__) . '/ressources/class.ldap.inc');
include_once(dirname(__FILE__) . '/ressources/class.computers.inc');
include_once(dirname(__FILE__) . '/ressources/class.ocs.inc');

if(is_array($argv)){if(preg_match("#--verbose#",implode(" ",$argv))){$GLOBALS["VERBOSE"]=true;}}
if(is_array($argv)){if(preg_match("#--rebuild#",implode(" ",$argv))){$GLOBALS["REBUILD"]=true;}}
if(is_array($argv)){if(preg_match("#--force#",implode(" ",$argv))){$GLOBALS["FORCE"]=true;}}
if($GLOBALS["VERBOSE"]){echo "Debug mode TRUE for {$argv[1]}\n";}


if($argv[1]=='--mysql'){mysqlCheck();die();}
if($argv[1]=='--mysqllist'){mysql_table_list();die();}
if($argv[1]=='--certificate-self'){CreateSelfSignedCertificate();}
if($argv[1]=='--certificate'){CreateCertificate();}
if($argv[1]=='--final-cert'){CreateFinalCertificate();exit;}
if($argv[1]=='--injection'){AutomaticInjection();exit;}


function build_certificate($hostname){
	$unix=new unix();
	if($GLOBALS["REBUILD"]){
		if(is_file("{$GLOBALS["SSLKEY_PATH"]}/$hostname.crt")){
			@unlink("{$GLOBALS["SSLKEY_PATH"]}/$hostname.crt");
		}
	}
	
	$sock=new sockets();
	$sock->SET_INFO("ApacheCertificatesLocations",$GLOBALS["SSLKEY_PATH"]);
Exemple #2
0
        $GLOBALS["FORCE"] = true;
    }
}
if ($GLOBALS["VERBOSE"]) {
    echo "Debug mode TRUE for {$argv[1]}\n";
}
if ($argv[1] == '--mysql') {
    mysqlCheck();
    die;
}
if ($argv[1] == '--mysqllist') {
    mysql_table_list();
    die;
}
if ($argv[1] == '--certificate-self') {
    CreateSelfSignedCertificate();
}
if ($argv[1] == '--certificate') {
    CreateCertificate();
}
if ($argv[1] == '--final-cert') {
    CreateFinalCertificate();
    exit;
}
if ($argv[1] == '--injection') {
    AutomaticInjection();
    exit;
}
if ($argv[1] == '--builddbinc') {
    builddbinc();
    exit;
Exemple #3
0
function builddbinc()
{
    if (!is_dir("/usr/share/ocsinventory-reports/ocsreports")) {
        echo "Starting......: " . date("H:i:s") . " OCS web Engine /usr/share/ocsinventory-reports/ocsreports no such directory\n";
        return;
    }
    $q = new mysql();
    $f[] = "<?php";
    $f[] = "\$_SESSION[\"SERVEUR_SQL\"]=\"{$q->mysql_server}:{$q->mysql_port}\";";
    $f[] = "\$_SESSION[\"COMPTE_BASE\"]=\"{$q->mysql_admin}\";";
    $f[] = "\$_SESSION[\"PSWD_BASE\"]=\"{$q->mysql_password}\";";
    $f[] = "define(\"DB_NAME\", \"ocsweb\");";
    $f[] = "define(\"SERVER_READ\",\"{$q->mysql_server}:{$q->mysql_port}\");";
    $f[] = "define(\"SERVER_WRITE\",\"{$q->mysql_server}:{$q->mysql_port}\");";
    $f[] = "define(\"COMPTE_BASE\",\"{$q->mysql_admin}\");";
    $f[] = "define(\"PSWD_BASE\",\"{$q->mysql_password}\");";
    $f[] = "?>";
    @file_put_contents("/usr/share/ocsinventory-reports/ocsreports/dbconfig.inc.php", @implode("\n", $f));
    echo "Starting......: " . date("H:i:s") . " OCS web Engine dbconfig.inc.php done\n";
    if (!is_file("etc/ocs/cert/cacert.pem")) {
        CreateSelfSignedCertificate();
    }
}