function install($filekey = 0, $OS)
{
    include_once dirname(__FILE__) . "/ressources/class.ccurl.inc";
    $unix = new unix();
    $filename = null;
    $MD5 = null;
    $DebianVersion = DebianVersion();
    if ($OS != $DebianVersion) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, influxdb Debian version incompatible!\n";
        }
        build_progress_idb("Incompatible system {$OS}<>{$DebianVersion}!", 110);
        die;
    }
    if ($filekey != 0) {
        $sock = new sockets();
        $ArticaTechNetHaProxyRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetHaProxyRepo")));
        $version = $ArticaTechNetHaProxyRepo[$filekey][$OS]["VERSION"];
        $filename = $ArticaTechNetHaProxyRepo[$filekey][$OS]["FILENAME"];
        $MD5 = $ArticaTechNetHaProxyRepo[$filekey][$OS]["MD5"];
        $URL = $ArticaTechNetHaProxyRepo[$filekey][$OS]["URL"];
    }
    $rmmod = $unix->find_program("rmmod");
    $depmod = $unix->find_program("depmod");
    $modprobe = $unix->find_program("modprobe");
    $ldconfig = $unix->find_program("ldconfig");
    echo "Downloading {$URL}\n";
    $curl = new ccurl($URL);
    $tmpdir = $unix->TEMP_DIR();
    $php = $unix->LOCATE_PHP5_BIN();
    build_progress_idb("{downloading}", 1);
    $curl->WriteProgress = true;
    $curl->ProgressFunction = "download_progress";
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: Downloading {$filename}\n";
    }
    if (!$curl->GetFile("{$tmpdir}/{$filename}")) {
        build_progress_idb("{$curl->error}", 110);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$curl->error}\n";
        }
        while (list($key, $value) = each($curl->errors)) {
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$value}\n";
            }
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, HaProxy unable to install....\n";
        }
        @unlink("{$tmpdir}/{$filename}");
        return;
    }
    if ($MD5 != null) {
        $DESTMD5 = md5_file("{$tmpdir}/{$filename}");
        if ($DESTMD5 != $MD5) {
            echo "{$DESTMD5}<>{$MD5}\n";
            @unlink("{$tmpdir}/{$filename}");
            build_progress_idb("{install_failed} {corrupted_package}", 110);
            return;
        }
    }
    build_progress_idb("{stopping_service}", 95);
    if (!is_file("/etc/init.d/haproxy")) {
        system("{$php} /usr/share/artica-postfix/exec.initslapd.php --haproxy");
    }
    system("/etc/init.d/firehol stop");
    system("/etc/init.d/haproxy stop");
    build_progress_idb("{extracting}", 96);
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, extracting....\n";
    }
    $tar = $unix->find_program("tar");
    shell_exec("{$tar} xvf {$tmpdir}/{$filename} -C /");
    build_progress_idb("{installing} 1/1", 96);
    system("{$ldconfig}");
    if ($GLOBALS["PROGRESS"]) {
        build_progress_idb("{restarting_service}", 97);
        system("{$php} /usr/share/artica-postfix/exec.status.php --haproxy >/dev/null");
        system("/etc/init.d/artica-status restart --force");
        build_progress_idb("{restarting_service} 1/2", 98);
        system("/etc/init.d/haproxy restart");
        build_progress_idb("{restarting_service} 2/2", 98);
        system("/etc/init.d/firehol restart");
    }
    build_progress_idb("{refresh_status}", 98);
    build_progress_idb("{done}", 100);
}
示例#2
0
function CONFIGURE_SQUID()
{
    $Debian = DebianVersion();
    $Architecture = Architecture();
    /* NETTLE !!
     * http://www.linuxfromscratch.org/blfs/view/svn/postlfs/nettle.html
     */
    $CFLAGS[] = "#!/bin/sh";
    $CFLAGS[] = "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin";
    $CFLAGS[] = "CFLAGS=\"-g -O2 -fPIE -fstack-protector -DNUMTHREADS=256 --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wall\"";
    $CFLAGS[] = "CXXFLAGS=\"-g -O2 -fPIE -DNUMTHREADS=256 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security\"";
    $CFLAGS[] = "CPPFLAGS=\"-D_FORTIFY_SOURCE=2\" LDFLAGS=\"-fPIE -pie -Wl,-z,relro -Wl,-z,now\"";
    $CFLAGS[] = "echo \$CFLAGS";
    $CFLAGS[] = "echo \$CXXFLAGS";
    $CFLAGS[] = "echo \$CPPFLAGS";
    $CFLAGS[] = "";
    @file_put_contents("/tmp/flags.sh", @implode("\n", $CFLAGS));
    $CFLAGS = array();
    @chmod("/tmp/flags.sh", 0755);
    system("/tmp/flags.sh");
    $cmds[] = "--prefix=/usr";
    if ($Architecture == 64) {
        $cmds[] = "--build=x86_64-linux-gnu";
    }
    $cmds[] = "--includedir=\${prefix}/include";
    $cmds[] = "--mandir=\${prefix}/share/man";
    $cmds[] = "--infodir=\${prefix}/share/info";
    $cmds[] = "--localstatedir=/var";
    $cmds[] = "--libexecdir=\${prefix}/lib/squid3";
    $cmds[] = "--disable-maintainer-mode";
    $cmds[] = "--disable-dependency-tracking";
    $cmds[] = "--srcdir=.";
    $cmds[] = "--datadir=/usr/share/squid3";
    $cmds[] = "--sysconfdir=/etc/squid3";
    $cmds[] = "--enable-gnuregex";
    $cmds[] = "--enable-removal-policy=heap";
    $cmds[] = "--enable-follow-x-forwarded-for";
    $cmds[] = "--enable-cache-digests";
    $cmds[] = "--enable-http-violations";
    $cmds[] = "--enable-removal-policies=lru,heap";
    $cmds[] = "--enable-arp-acl";
    $cmds[] = "--enable-truncate";
    $cmds[] = "--with-large-files";
    $cmds[] = "--with-pthreads";
    $cmds[] = "--enable-esi";
    $cmds[] = "--enable-storeio=aufs,diskd,ufs,rock";
    $cmds[] = "--enable-x-accelerator-vary";
    $cmds[] = "--with-dl";
    $cmds[] = "--enable-linux-netfilter";
    if ($Debian > 6) {
        $cmds[] = "--with-netfilter-conntrack";
    }
    $cmds[] = "--enable-wccpv2";
    $cmds[] = "--enable-eui";
    $cmds[] = "--enable-auth";
    $cmds[] = "--enable-auth-basic";
    $cmds[] = "--enable-snmp";
    $cmds[] = "--enable-icmp";
    $cmds[] = "--enable-auth-digest";
    $cmds[] = "--enable-log-daemon-helpers";
    $cmds[] = "--enable-url-rewrite-helpers";
    $cmds[] = "--enable-auth-ntlm";
    $cmds[] = "--with-default-user=squid";
    $cmds[] = "--enable-icap-client";
    $cmds[] = "--enable-cache-digests";
    $cmds[] = "--enable-poll";
    $cmds[] = "--enable-epoll";
    $cmds[] = "--enable-async-io=128";
    $cmds[] = "--enable-zph-qos";
    $cmds[] = "--enable-delay-pools";
    $cmds[] = "--enable-http-violations";
    $cmds[] = "--enable-url-maps";
    $cmds[] = "--enable-ecap";
    $cmds[] = "--enable-ssl";
    $cmds[] = "--with-openssl";
    $cmds[] = "--enable-ssl-crtd";
    $cmds[] = "--enable-xmalloc-statistics";
    $cmds[] = "--enable-ident-lookups";
    $cmds[] = "--with-filedescriptors=65536";
    $cmds[] = "--with-aufs-threads=128";
    $cmds[] = "--disable-arch-native";
    //$cmds[]="--disable-ipv6";
    //CPPFLAGS="-I../libltdl"
    $configure = "./configure " . @implode(" ", $cmds);
    echo "apt-get install libssl-dev conntrack libnetfilter-conntrack-dev libcap-dev\n";
    echo "***************************************************************\n\n\n{$configure}\n\n***************************************************************\n";
    return $configure;
}
示例#3
0
function compile_ufdbcat()
{
    $unix = new unix();
    $uri = "http://www.articatech.net/download/ufdbGuard-1.31.tar.gz";
    $curl = new ccurl("http://www.articatech.net/download/ufdbGuard-1.31.tar.gz");
    echo "Downloading {$uri}\n";
    $tempdir = $unix->TEMP_DIR() . "/ufdb";
    $tempfile = "{$tempdir}/ufdbGuard-1.31.tar.gz";
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    $cp = $unix->find_program("cp");
    if (is_dir($tempdir)) {
        shell_exec("{$rm} -rf {$tempdir}");
    }
    @mkdir($tempdir, 0755, true);
    if (is_file($tempfile)) {
        @unlink($tempfile);
    }
    if (!$curl->GetFile($tempfile)) {
        echo "Fatal, unable to download {$uri}\n";
        meta_admin_mysql(0, "Fatal, unable to download {$uri}", @implode("\n", $curl->errors), __FILE__, __LINE__);
        return;
    }
    if (is_dir("{$tempdir}/ufdbcompile")) {
        shell_exec("{$rm} -rf {$tempdir}/ufdbcompile");
    }
    echo "Uncompressing {$tempdir}/ufdbGuard-1.31.tar.gz to {$tempdir}/\n";
    shell_exec("{$tar} -xf {$tempdir}/ufdbGuard-1.31.tar.gz -C {$tempdir}/");
    $dirs = $unix->dirdir($tempdir);
    while (list($directory, $value) = each($dirs)) {
        echo "Found directory {$directory}\n";
        if (is_file("{$directory}/src/mtserver/ufdbguardd.c")) {
            $WORKDIR = "{$directory}";
            break;
        }
    }
    if (!is_dir($WORKDIR)) {
        echo "Fatal, unable to download {$uri}\n";
        meta_admin_mysql(0, "Fatal, unable to locate working directory", __FILE__, __LINE__);
        if (is_dir($tempdir)) {
            shell_exec("{$rm} -rf {$tempdir}");
        }
        return;
    }
    echo "Patching mtserver/ufdbguardd.c\n";
    $C = explode("\n", @file_get_contents("{$directory}/src/mtserver/ufdbguardd.c"));
    while (list($index, $line) = each($C)) {
        if (strpos($line, "/tmp/ufdbguardd-") > 0) {
            echo "Patching mtserver/ufdbguardd.c line {$index}\n";
            $C[$index] = str_replace("/tmp/ufdbguardd-", "/var/run/ufdbcat-", $line);
        }
    }
    @file_put_contents("{$directory}/src/mtserver/ufdbguardd.c", @implode("\n", $C));
    chdir($WORKDIR);
    if (is_dir("/opt/ufdbcat")) {
        shell_exec("{$rm} -rf /opt/ufdbcat");
    }
    echo "Configure\n";
    $f[] = "./configure";
    $f[] = "--prefix=/opt/ufdbcat";
    $f[] = "--includedir=\"\\\${prefix}/include\"";
    $f[] = "--mandir=\"\\\${prefix}/share/man\"";
    $f[] = "--infodir=\"\\\${prefix}/share/info\"";
    $f[] = "--sysconfdir=/etc/ufdbcat";
    $f[] = "--localstatedir=/opt/ufdbcat";
    $f[] = "--with-ufdb-logdir=/var/log/ufdbcat";
    $f[] = "--with-ufdb-dbhome=/home/ufdbcat";
    $f[] = "--with-ufdb-user=root";
    $f[] = "--with-ufdb-config=/etc/ufdbcat";
    $f[] = "--with-ufdb-logdir=/var/log/ufdbcat";
    $f[] = "--with-ufdb-config=/etc/ufdbcat";
    $f[] = "--with-ufdb-piddir=/var/run/ufdbcat";
    $cmd = @implode(" ", $f);
    system($cmd);
    echo "Make\n";
    system("make");
    echo "Install\n";
    system("make install");
    if (!is_file("/opt/ufdbcat/bin/ufdbguardd")) {
        echo "Fatal, unable to compile ufdbcat\n";
        meta_admin_mysql(0, "Fatal, unable to compile ufdbcat", __FILE__, __LINE__);
        if (is_dir($tempdir)) {
            shell_exec("{$rm} -rf {$tempdir}");
        }
        return;
    }
    @copy("/opt/ufdbcat/bin/ufdbguardd", "/opt/ufdbcat/bin/ufdbcatdd");
    @unlink("/opt/ufdbcat/bin/ufdbguardd");
    @chmod("/opt/ufdbcat/bin/ufdbcatdd", 0755);
    $ufdbcatVersion = ufdbcatVersion();
    $Architecture = Architecture();
    $DebianVersion = DebianVersion();
    $base = "/root/ufdbcat-compile";
    if (is_dir($base)) {
        shell_exec("{$rm} -rf {$base}");
    }
    @mkdir("{$base}/opt/ufdbcat", 0755, true);
    shell_exec("{$cp} -rfp /opt/ufdbcat/* {$base}/opt/ufdbcat/");
    $filename = "ufdbcat-debian{$DebianVersion}-{$Architecture}-{$ufdbcatVersion}.tar.gz";
    chdir($base);
    @unlink("/root/{$filename}");
    shell_exec("/bin/tar -czf /root/{$filename} *");
    echo "/root/{$filename} done\n\n";
}
示例#4
0
function iscsi_target()
{
    $Debian = DebianVersion();
    $Architecture = Architecture();
    $version = package_nginx_version();
    $f[] = "/usr/sbin/ietd";
    $f[] = "/usr/sbin/ietadm";
    $f[] = "/lib/modules/3.2.0-4-amd64/extra/iscsi/iscsi_trgt.ko";
    $f[] = "/lib/modules/3.2.0-4-amd64/updates/dkms/iscsi_trgt.ko.distrib";
    $base = "/root/ietadm";
    while (list($num, $filename) = each($f)) {
        if (is_dir($filename)) {
            @mkdir("{$base}/{$filename}", 0755, true);
            echo "/bin/cp -rfd {$filename}/* {$base}{$filename}/\n";
            shell_exec("/bin/cp -rfd {$filename}/* {$base}{$filename}/");
            continue;
        }
        if (is_file($filename)) {
            $dirname = dirname($filename);
            if (!is_dir("{$base}/{$dirname}")) {
                @mkdir("{$base}/{$dirname}", 0755, true);
            }
            echo "/bin/cp -fd {$filename} {$base}{$dirname}/\n";
            shell_exec("/bin/cp -fd {$filename} {$base}/{$dirname}/");
        }
    }
    chdir($base);
    if (is_file("{$base}/ietd-{$Architecture}.tar.gz")) {
        @unlink("{$base}/ietd-{$Architecture}.tar.gz");
    }
    $filename = "ietd-debian{$Debian}-{$Architecture}.tar.gz";
    shell_exec("tar -czf {$filename} *");
    shell_exec("/bin/cp {$filename} /root/");
    echo "/root/{$filename} done\n";
}
示例#5
0
function create_package()
{
    $Architecture = Architecture();
    $unix = new unix();
    $wget = $unix->find_program("wget");
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    $cp = $unix->find_program("cp");
    $DebianVersion = DebianVersion();
    if ($DebianVersion == 6) {
        $DebianVersion = null;
    } else {
        $DebianVersion = "-debian{$DebianVersion}";
    }
    @mkdir('/root/samba-builder/usr/sbin', 0755, true);
    @mkdir('/root/samba-builder/usr/bin', 0755, true);
    @mkdir('/root/samba-builder/usr/lib/samba', 0755, true);
    @mkdir('/root/samba-builder/usr/lib/samba/vfs', 0755, true);
    @mkdir('/root/samba-builder/usr/lib/samba/idmap', 0755, true);
    @mkdir('/root/samba-builder/usr/lib/samba/charset', 0755, true);
    @mkdir('/root/samba-builder/usr/lib/samba/auth', 0755, true);
    @mkdir('/root/samba-builder/lib/security', 0755, true);
    @mkdir('/root/samba-builder/usr/include', 0755, true);
    @mkdir('/root/samba-builder/usr/lib', 0755, true);
    @mkdir('/root/samba-builder/lib', 0755, true);
    @mkdir('/root/samba-builder/usr/include', 0755, true);
    @mkdir('/root/samba-builder/etc/ctdb/events.d', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/de/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/ar/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/cs/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/da/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/es/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/fi/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/fr/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/hu/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/it/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/ja/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/ko/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/nb/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/nl/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/pl/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/pt_BR/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/ru/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/sv/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/zh_CN/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/share/locale/zh_TW/LC_MESSAGES', 0755, true);
    @mkdir('/root/samba-builder/usr/bin', 0755, true);
    @mkdir('/root/samba-builder/usr/lib', 0755, true);
    @mkdir('/root/samba-builder/usr/lib/php5/20090626+lfs', 0755, true);
    @mkdir('/root/samba-builder/usr/lib/xapian-omega', 0755, true);
    @mkdir('/root/samba-builder/usr/share/omega', 0755, true);
    @mkdir('/root/samba-builder/usr/include/xapian', 0755, true);
    $f[] = "/usr/sbin/smbd";
    $f[] = "/usr/sbin/nmbd";
    $f[] = "/usr/sbin/swat";
    $f[] = "/usr/sbin/winbindd";
    $f[] = "/usr/sbin/msktutil";
    $f[] = "/usr/bin/wbinfo";
    $f[] = "/usr/bin/smbclient";
    $f[] = "/usr/bin/net";
    $f[] = "/usr/bin/smbspool";
    $f[] = "/usr/bin/testparm";
    $f[] = "/usr/bin/smbstatus";
    $f[] = "/usr/bin/smbget";
    $f[] = "/usr/bin/smbta-util";
    $f[] = "/usr/bin/smbcontrol";
    $f[] = "/usr/bin/smbtree";
    $f[] = "/usr/bin/tdbbackup";
    $f[] = "/usr/bin/nmblookup";
    $f[] = "/usr/bin/pdbedit";
    $f[] = "/usr/bin/tdbdump";
    $f[] = "/usr/bin/tdbrestore";
    $f[] = "/usr/bin/tdbtool";
    $f[] = "/usr/bin/smbpasswd";
    $f[] = "/usr/bin/rpcclient";
    $f[] = "/usr/bin/smbcacls";
    $f[] = "/usr/bin/profiles";
    $f[] = "/usr/bin/ntlm_auth";
    $f[] = "/usr/bin/sharesec";
    $f[] = "/usr/bin/smbcquotas";
    $f[] = "/usr/bin/eventlogadm";
    $f[] = "/usr/lib/samba/lowcase.dat";
    $f[] = "/usr/lib/samba/upcase.dat";
    $f[] = "/usr/lib/samba/valid.dat";
    $f[] = "/usr/lib/samba/vfs/recycle.so";
    $f[] = "/usr/lib/samba/vfs/audit.so";
    $f[] = "/usr/lib/samba/vfs/extd_audit.so";
    $f[] = "/usr/lib/samba/vfs/full_audit.so";
    $f[] = "/usr/lib/samba/vfs/netatalk.so";
    $f[] = "/usr/lib/samba/vfs/fake_perms.so";
    $f[] = "/usr/lib/samba/vfs/default_quota.so";
    $f[] = "/usr/lib/samba/vfs/readonly.so";
    $f[] = "/usr/lib/samba/vfs/cap.so";
    $f[] = "/usr/lib/samba/vfs/expand_msdfs.so";
    $f[] = "/usr/lib/samba/vfs/shadow_copy.so";
    $f[] = "/usr/lib/samba/vfs/shadow_copy2.so";
    $f[] = "/usr/lib/samba/vfs/xattr_tdb.so";
    $f[] = "/usr/lib/samba/vfs/catia.so";
    $f[] = "/usr/lib/samba/vfs/streams_xattr.so";
    $f[] = "/usr/lib/samba/vfs/streams_depot.so";
    $f[] = "/usr/lib/samba/vfs/readahead.so";
    $f[] = "/usr/lib/samba/vfs/fileid.so";
    $f[] = "/usr/lib/samba/vfs/preopen.so";
    $f[] = "/usr/lib/samba/vfs/syncops.so";
    $f[] = "/usr/lib/samba/vfs/acl_xattr.so";
    $f[] = "/usr/lib/samba/vfs/acl_tdb.so";
    $f[] = "/usr/lib/samba/vfs/smb_traffic_analyzer.so";
    $f[] = "/usr/lib/samba/vfs/dirsort.so";
    $f[] = "/usr/lib/samba/vfs/scannedonly.so";
    $f[] = "/usr/lib/samba/vfs/crossrename.so";
    $f[] = "/usr/lib/samba/vfs/linux_xfs_sgid.so";
    $f[] = "/usr/lib/samba/vfs/time_audit.so";
    $f[] = "/usr/lib/samba/idmap/rid.so";
    $f[] = "/usr/lib/samba/idmap/autorid.so";
    $f[] = "/usr/lib/samba/idmap/ad.so";
    $f[] = "/usr/lib/samba/charset/CP850.so";
    $f[] = "/usr/lib/samba/charset/CP437.so";
    $f[] = "/usr/lib/samba/auth/script.so";
    $f[] = "/usr/lib/samba/de.msg";
    $f[] = "/usr/lib/samba/en.msg";
    $f[] = "/usr/lib/samba/fi.msg";
    $f[] = "/usr/lib/samba/fr.msg";
    $f[] = "/usr/lib/samba/it.msg";
    $f[] = "/usr/lib/samba/ja.msg";
    $f[] = "/usr/lib/samba/nl.msg";
    $f[] = "/usr/lib/samba/pl.msg";
    $f[] = "/usr/lib/samba/ru.msg";
    $f[] = "/usr/lib/samba/tr.msg";
    $f[] = "/lib/security/pam_smbpass.so";
    $f[] = "/lib/security/pam_winbind.so";
    $f[] = "/usr/lib/libtalloc.so.2.0.5";
    $f[] = "/usr/lib/libtalloc.a";
    $f[] = "/usr/include/talloc.h";
    $f[] = "/usr/lib/libtdb.so.1.2.9";
    $f[] = "/usr/lib/libtdb.a";
    $f[] = "/usr/include/tdb.h";
    $f[] = "/usr/lib/libwbclient.so.0";
    $f[] = "/usr/lib/libwbclient.a";
    $f[] = "/usr/include/wbclient.h";
    $f[] = "/usr/lib/libnetapi.so.0";
    $f[] = "/usr/lib/libnetapi.a";
    $f[] = "/usr/include/netapi.h";
    $f[] = "/usr/lib/libsmbclient.so.0";
    $f[] = "/usr/lib/libsmbclient.a";
    $f[] = "/usr/include/libsmbclient.h";
    $f[] = "/usr/lib/libsmbsharemodes.so.0";
    $f[] = "/usr/lib/libsmbsharemodes.a";
    $f[] = "/usr/include/smb_share_modes.h";
    $f[] = "/usr/share/locale/de/LC_MESSAGES/net.mo";
    $f[] = "/usr/share/locale/ar/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/cs/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/da/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/de/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/es/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/fi/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/fr/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/hu/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/it/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/ja/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/ko/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/nb/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/nl/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/pl/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/pt_BR/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/ru/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/sv/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/zh_CN/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/share/locale/zh_TW/LC_MESSAGES/pam_winbind.mo";
    $f[] = "/usr/lib/libnetapi.a";
    $f[] = "/usr/lib/libnetapi.so.0";
    $f[] = "/usr/lib/libsmbclient.a";
    $f[] = "/usr/lib/libsmbclient.so.0";
    $f[] = "/usr/lib/libsmbsharemodes.a";
    $f[] = "/usr/lib/libsmbsharemodes.so.0";
    $f[] = "/usr/lib/libtalloc.a";
    $f[] = "/usr/lib/libtalloc.so.2.0.5";
    $f[] = "/usr/lib/libtalloc.so.2";
    $f[] = "/usr/lib/libtdb.a";
    $f[] = "/usr/lib/libtdb.so.1.2.9";
    $f[] = "/usr/lib/libtdb.so.1";
    $f[] = "/usr/lib/libcups.so.2";
    $f[] = "/usr/lib/libavahi-client.so.3";
    $f[] = "/usr/lib/libavahi-client.so.3.2.7";
    $f[] = "/usr/lib/libwbclient.so.0";
    $f[] = "/lib/libnss_winbind.so";
    $f[] = "/lib/libnss_wins.so";
    $f[] = "/usr/bin/ctdb";
    $f[] = "/usr/bin/smnotify";
    $f[] = "/usr/bin/ping_pong";
    $f[] = "/usr/bin/ctdb_diagnostics";
    $f[] = "/usr/bin/onnode";
    $f[] = "/usr/include/ctdb.h";
    $f[] = "/usr/include/ctdb_private.h";
    $f[] = "/usr/sbin/ctdbd";
    $f[] = "/usr/share/locale/cs/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/da/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/de/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/eo/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/es/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/fi/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/fr/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/ga/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/gl/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/hu/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/id/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/is/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/it/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/ja/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/ko/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/lv/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/nb/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/nl/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/pl/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/pt/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/ro/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/ru/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/sk/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/sl/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/sv/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/th/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/tr/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/uk/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/vi/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/wa/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/zh_TW/LC_MESSAGES/popt.mo";
    $f[] = "/usr/share/locale/zh_CN/LC_MESSAGES/popt.mo";
    $f[] = "/usr/lib/libpopt.la";
    $f[] = "/usr/lib/libpopt.so.0.0.0";
    $f[] = "/usr/lib/libpopt.so.0";
    $f[] = "/usr/lib/libpopt.so";
    $f[] = "/usr/include/popt.h";
    $f[] = "/usr/lib/libxapian.la";
    $f[] = "/usr/lib/libxapian.so";
    $f[] = "/usr/lib/libxapian.a";
    $f[] = "/usr/lib/libxapian.so.22.5.0 ";
    $f[] = "/usr/lib/libxapian.so.22";
    $f[] = "/usr/lib/libxapian.so.22.6.3";
    $f[] = "/usr/lib/xapian-omega/bin/omega";
    $f[] = "/usr/bin/quartzcheck";
    $f[] = "/usr/bin/quartzcheck";
    $f[] = "/usr/bin/quartzcompact";
    $f[] = "/usr/bin/quartzcompact";
    $f[] = "/usr/bin/quartzdump";
    $f[] = "/usr/bin/xapian-check";
    $f[] = "/usr/bin/xapian-compact";
    $f[] = "/usr/bin/xapian-inspect";
    $f[] = "/usr/bin/xapian-progsrv";
    $f[] = "/usr/bin/xapian-tcpsrv";
    $f[] = "/usr/bin/copydatabase";
    $f[] = "/usr/bin/delve";
    $f[] = "/usr/bin/quest";
    $f[] = "/usr/bin/simpleexpand";
    $f[] = "/usr/bin/simpleindex";
    $f[] = "/usr/bin/simplesearch";
    $f[] = "/usr/bin/xapian-config";
    $f[] = "/usr/include/xapian.h";
    $f[] = "/usr/share/php5/xapian.php";
    $f[] = "/usr/lib/php5/20090626+lfs/xapian.so";
    $f[] = "/usr/lib/php5/20090626/xapian.so";
    $f[] = "/usr/lib/php5/20090626+lfs/xapian.la";
    $f[] = "/usr/lib/php5/20090626/xapian.la";
    $f[] = "/usr/bin/xapian-check";
    $f[] = "/usr/bin/xapian-compact";
    $f[] = "/usr/bin/xapian-inspect";
    $f[] = "/usr/bin/xapian-replicate";
    $f[] = "/usr/bin/xapian-replicate-server";
    $f[] = "/usr/bin/xapian-chert-update";
    $f[] = "/usr/bin/xapian-progsrv";
    $f[] = "/usr/bin/xapian-tcpsrv";
    $f[] = "/usr/bin/dbi2omega ";
    $f[] = "/usr/bin/htdig2omega ";
    $f[] = "/usr/bin/mbox2omega";
    $f[] = "/usr/bin/omindex";
    $f[] = "/usr/bin/scriptindex";
    $f[] = "/usr/bindbi2omega";
    $f[] = "/usr/binhtdig2omega";
    $f[] = "/usr/binmbox2omega";
    while (list($num, $ligne) = each($f)) {
        if (!is_file($ligne)) {
            echo "{$ligne} no such file\n";
            continue;
        }
        $dir = dirname($ligne);
        echo "Installing {$ligne} in /root/samba-builder{$dir}/\n";
        if (!is_dir("/root/samba-builder{$dir}")) {
            @mkdir("/root/samba-builder{$dir}", 0755, true);
        }
        shell_exec("/bin/cp -fd {$ligne} /root/samba-builder{$dir}/");
    }
    shell_exec("/bin/cp -rfd /usr/lib/samba/* /root/samba-builder/usr/lib/samba/");
    shell_exec("/bin/cp -rfd /etc/ctdb/* /root/samba-builder/etc/ctdb/");
    shell_exec("/bin/cp -rfd /usr/lib/xapian-omega/* /root/samba-builder/usr/lib/xapian-omega/");
    shell_exec("/bin/cp -rfd /usr/share/omega/* /root/samba-builder/usr/share/omega/");
    echo "Creating package done....\n";
    if (is_dir("/root/3/samba-3.6.22")) {
        $SOURCESOURCE_DIRECTORY = "/root/3/samba-3.6.22";
    }
    if (is_file("{$SOURCESOURCE_DIRECTORY}/nsswitch/libnss_wins.so")) {
        echo "Copy {$SOURCESOURCE_DIRECTORY}/nsswitch/libnss_wins.so\n";
        @copy("{$SOURCESOURCE_DIRECTORY}/nsswitch/libnss_wins.so", "/lib/libnss_wins.so");
    }
    if (is_file("{$SOURCESOURCE_DIRECTORY}/nsswitch/libnss_winbind.so")) {
        echo "Copy {$SOURCESOURCE_DIRECTORY}/nsswitch/libnss_winbind.so\n";
        @copy("{$SOURCESOURCE_DIRECTORY}/nsswitch/libnss_winbind.so", "/lib/libnss_winbind.so");
    }
    if ($Architecture == 64) {
        $Architecture = "x64";
    }
    if ($Architecture == 32) {
        $Architecture = "i386";
    }
    @mkdir("/root/samba-builder/etc/init.d", 0755, true);
    if (is_file("{$SOURCESOURCE_DIRECTORY}/packaging/LSB/samba.sh")) {
        shell_exec("/bin/cp {$SOURCESOURCE_DIRECTORY}/packaging/LSB/samba.sh /root/samba-builder/etc/init.d/samba");
        @chmod("/root/samba-builder/etc/init.d/samba", 0755);
    } else {
        echo "{$SOURCESOURCE_DIRECTORY}/packaging/LSB/samba.sh no such file";
    }
    $version = SAMBA_VERSION();
    echo "Building package Arch:{$Architecture} Version:{$version}  {$DebianVersion}\n";
    @chdir("/root/samba-builder");
    if (is_file("/root/samba-builder/sambac{$DebianVersion}-{$Architecture}-{$version}.tar.gz")) {
        @unlink("/root/samba-builder/sambac-{$Architecture}-{$version}.tar.gz");
    }
    echo "Compressing sambac{$DebianVersion}-{$Architecture}-{$version}.tar.gz\n";
    shell_exec("{$tar} -czf sambac{$DebianVersion}-{$Architecture}-{$version}.tar.gz *");
    echo "Compressing /root/samba-builder/sambac{$DebianVersion}-{$Architecture}-{$version}.tar.gz Done...\n";
    if (is_file("/root/ftp-password")) {
        echo "Uploading /root/samba-builder/sambac{$DebianVersion}-{$Architecture}-{$version}.tar.gz Done...\n";
        echo "/root/samba-builder/sambac-{$Architecture}{$DebianVersion}-{$version}.tar.gz is now ready to be uploaded\n";
        if ($DebianVersion == null) {
            shell_exec("curl -T /root/samba-builder/sambac{$DebianVersion}-{$Architecture}-{$version}.tar.gz ftp://www.articatech.net/download/ --user " . @file_get_contents("/root/ftp-password"));
            if (is_file("/root/rebuild-artica")) {
                shell_exec("{$wget} \"" . @file_get_contents("/root/rebuild-artica") . "\" -O /tmp/rebuild.html");
            }
        }
    }
}
示例#6
0
function create_package()
{
    $Architecture = Architecture();
    if ($Architecture == 64) {
        $Architecture = "x64";
    }
    if ($Architecture == 32) {
        $Architecture = "i386";
    }
    $WORKDIR = $GLOBALS["ROOT-DIR"];
    @mkdir("{$WORKDIR}/sbin", 0755, true);
    @mkdir("{$WORKDIR}/usr/sbin", 0755, true);
    @mkdir("{$WORKDIR}//usr/lib/powerdns/", 0755, true);
    if (is_dir("/lib/powerdns")) {
        shell_exec("/bin/cp -rfd /lib/powerdns/* {$WORKDIR}/usr/lib/powerdns/");
    }
    $fdir[] = "/usr/lib/powerdns";
    $fdir[] = "/lib/powerdns";
    $fdir[] = "/etc/powerdns";
    $fdir[] = "/usr/share/poweradmin";
    $fdir[] = "/usr/share/doc/pdns";
    $fdir[] = "/usr/lib/powerdns";
    while (list($num, $ligne) = each($fdir)) {
        @mkdir("{$WORKDIR}{$ligne}", 0755, true);
        echo "Installing {$ligne} in {$WORKDIR}{$ligne}/\n";
        shell_exec("/bin/cp -rfd {$ligne}/* {$WORKDIR}{$ligne}/");
    }
    $f[] = "/usr/sbin/pdns_recursor";
    $f[] = "/usr/sbin/pdns_server";
    $f[] = "/usr/bin/pdnssec";
    $f[] = "/usr/bin/dnsreplay";
    $f[] = "/usr/bin/pdns_control";
    $f[] = "/usr/bin/rec_control";
    $f[] = "/etc/init.d/pdns-recursor";
    $f[] = "/usr/bin/zone2sql";
    $f[] = "/usr/bin/zone2ldap";
    $f[] = "/usr/bin/zone2json";
    $f[] = "/etc/init.d/pdns";
    $f[] = "/usr/share/man/man8/pdns_control.8";
    $f[] = "/usr/share/man/man8/pdnssec.8";
    $f[] = "/usr/share/man/man8/pdns_server.8";
    $f[] = "/usr/share/man/man1/pdns_recursor.1";
    $f[] = "/usr/share/man/man1/rec_control.1";
    while (list($num, $ligne) = each($f)) {
        if (!is_file($ligne)) {
            echo "{$ligne} no such file\n";
            continue;
        }
        $dir = dirname($ligne);
        echo "Installing {$ligne} in {$WORKDIR}{$dir}/\n";
        if (!is_dir("{$WORKDIR}{$dir}")) {
            @mkdir("{$WORKDIR}{$dir}", 0755, true);
        }
        shell_exec("/bin/cp -fd {$ligne} {$WORKDIR}{$dir}/");
    }
    $version = PDNS_VERSION();
    echo "Creating package done....\n";
    echo "Building package Arch:{$Architecture} Version:{$version}\n";
    echo "Going to {$WORKDIR}\n";
    @chdir("{$WORKDIR}");
    $debianv = DebianVersion();
    if ($debianv > 6) {
        $debianv = "-debian{$debianv}";
    }
    $TARGET_TGZ = "/root/pdnsc-{$Architecture}{$debianv}-{$version}.tar.gz";
    echo "Compressing {$TARGET_TGZ}\n";
    if (is_file($TARGET_TGZ)) {
        @unlink($TARGET_TGZ);
    }
    shell_exec("tar -czf {$TARGET_TGZ} *");
    echo "Compressing {$TARGET_TGZ} Done...\n";
}
示例#7
0
function install()
{
    include_once dirname(__FILE__) . "/ressources/class.ccurl.inc";
    $unix = new unix();
    $DebianVersion = DebianVersion();
    if ($DebianVersion < 7) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, zfs Debian version incompatible!\n";
        }
        build_progress_idb("Incompatible system!", 110);
        die;
    }
    if (!is_file("/etc/apt/sources.list.d/zfsonlinux.list")) {
        $filename = "zfsonlinux_6_all.deb";
        $curl = new ccurl("http://archive.zfsonlinux.org/debian/pool/main/z/zfsonlinux/zfsonlinux_6_all.deb");
        $tmpdir = $unix->TEMP_DIR();
        build_progress_idb("{downloading} zfsonlinux_6_all", 1);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: Downloading zfsonlinux_6_all\n";
        }
        if (!$curl->GetFile("{$tmpdir}/{$filename}")) {
            build_progress_idb("{$curl->error}", 110);
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$curl->error}\n";
            }
            while (list($key, $value) = each($curl->errors)) {
                if ($GLOBALS["OUTPUT"]) {
                    echo "Starting......: " . date("H:i:s") . " [INIT]: {$value}\n";
                }
            }
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, ZFS unable to install....\n";
            }
            @unlink("{$tmpdir}/{$filename}");
            return;
        }
        build_progress_idb("{extracting}", 10);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, extracting....\n";
        }
        $dpkg = $unix->find_program("dpkg");
        system("{$dpkg} --force-all -i {$tmpdir}/{$filename}");
    }
    if (!is_file("/etc/apt/sources.list.d/zfsonlinux.list")) {
        echo "zfsonlinux.list no such file\n";
        build_progress_idb("{failed_to_install}", 110);
        return;
    }
    $zfs = $unix->find_program("zfs");
    if (!is_file("/sbin/zfs")) {
        $aptget = $unix->find_program("apt-get");
        build_progress_idb("{updating_repository}", 15);
        $tmpf = $unix->FILE_TEMP();
        $cmd = "DEBIAN_FRONTEND=noninteractive {$aptget} --force-yes update";
        system($cmd);
        build_progress_idb("{install_zfs}/{compiling_kernel}", 50);
        $cmd = "DEBIAN_FRONTEND=noninteractive {$aptget} --force-yes -fuy -o Dpkg::Options::=\"--force-confnew\"  install debian-zfs";
        system($cmd);
    }
    build_progress_idb("{install_zfs}/{checking}", 50);
    if (!is_file("/sbin/zpool")) {
        build_progress_idb("{failed_to_install}", 110);
        return;
    }
    build_progress_idb("{success}", 95);
    build_progress_idb("{done}", 100);
}
示例#8
0
function create_package()
{
    $unix = new unix();
    $wget = $unix->find_program("wget");
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    $cp = $unix->find_program("cp");
    $Architecture = Architecture();
    $version = haproxy_version();
    $debian_version = DebianVersion();
    mkdir("{$GLOBALS["WORKDIR"]}/usr/local/sbin", 0755, true);
    shell_exec("{$cp} -rfd /usr/local/sbin/haproxy {$GLOBALS["WORKDIR"]}/usr/local/sbin/haproxy");
    shell_exec("{$cp} -rfd /usr/local/sbin/haproxy-systemd-wrapper {$GLOBALS["WORKDIR"]}/usr/local/sbin/haproxy-systemd-wrapper");
    if ($Architecture == 64) {
        $Architecture = "x64";
    }
    if ($Architecture == 32) {
        $Architecture = "i386";
    }
    echo "Compile Arch {$Architecture} v:{$version} Debian {$debian_version}\n";
    chdir("{$GLOBALS["WORKDIR"]}");
    $packagename = "haproxy-{$Architecture}-debian{$debian_version}-{$version}.tar.gz";
    echo "Compressing....{$GLOBALS["WORKDIR"]}/{$packagename}\n";
    shell_exec("{$tar} -czf {$packagename} *");
    shell_exec("{$cp} {$GLOBALS["WORKDIR"]}/{$packagename} /root/");
    system_admin_events("{$GLOBALS["WORKDIR"]}/{$packagename}  ready...", __FUNCTION__, __FILE__, __LINE__);
    if (is_file("/root/ftp-password")) {
        echo "{$GLOBALS["WORKDIR"]}/{$packagename} is now ready to be uploaded\n";
        shell_exec("curl -T {$GLOBALS["WORKDIR"]}/{$packagename} ftp://www.articatech.net/download/ --user " . @file_get_contents("/root/ftp-password"));
        system_admin_events("Uploading {$packagename} done.", __FUNCTION__, __FILE__, __LINE__);
        if (is_file("/root/rebuild-artica")) {
            shell_exec("{$wget} \"" . @file_get_contents("/root/rebuild-artica") . "\" -O /tmp/rebuild.html");
        }
    }
    $took = $unix->distanceOfTimeInWords($t, time(), true);
    system_admin_events("Installing the new HaProxy {$version} success took:{$took}", __FUNCTION__, __FILE__, __LINE__, "software");
}
示例#9
0
function package_nginx()
{
    /*
    	 * 
    	 * apt-get install libxslt1-dev
    	 * http://openresty.org/#Download
    cd /root
    wget http://openresty.org/download/ngx_openresty-1.7.2.1.tar.gz
    tar -xf ngx_openresty-1.7.2.1.tar.gz
    cd ngx_openresty-1.7.2.1.tar.gz
    git config --global http.proxy http://192.168.1.245:3140
    
    cd ngx_openresty-1.2.8.6/bundle
    git clone git://github.com/yaoweibin/ngx_http_substitutions_filter_module.git
    mv ngx_http_substitutions_filter_module ngx_http_substitutions_filter_module-1.0
    
    git clone https://github.com/kvspb/nginx-auth-ldap.git  
    mv nginx-auth-ldap ngx_http_auth_ldap_module-1.0
    
    cd ngx_openresty-1.2.8.6/bundle
    git clone  https://github.com/yaoweibin/nginx_tcp_proxy_module.git 
    cd ...
    patch -p1 < bundle/nginx_tcp_proxy_module/tcp.patch
    
    wget http://mdounin.ru/hg/ngx_http_auth_request_module/archive/a29d74804ff1.tar.gz
    tar -xf a29d74804ff1.tar.gz
    mv ngx_http_auth_request_module-a29d74804ff1 ngx_http_auth_request_module-1.0
    
    
    
    git clone https://github.com/pagespeed/ngx_pagespeed.git
    mv nginx-auth-ldap ngx_http_auth_ldap_module-1.0
    
    
    // MArche pas
    wget https://github.com/downloads/SpiderLabs/ModSecurity/modsecurity-apache_2.7.1.tar.gz
    tar -xf modsecurity-apache_2.7.1.tar.gz
    cd modsecurity-apache_2.7.1
    ./configure --enable-standalone-module --prefix=/usr
    make 
    make install
    cp -rfv /modsecurity-apache_2.7.1/nginx/modsecurity /root/ngx_openresty-1.4.3.9/bundle/
    mv modsecurity ngx_http_modsecurity-1.0
    //
    
     *****
    dans configure
    [http_substitutions_filter_module=>'ngx_http_substitutions_filter_module'],
    [http_auth_ldap_module=>'ngx_http_auth_ldap_module'],
    
    
    // marche pas pour l'instant [http_modsecurity=>'ngx_http_modsecurity'],
    
    
    // ne semble nécéssaire à partir de la v 1.3.9
    [http_auth_request_module=>'ngx_http_auth_request_module'],
    
    *****
    * Inutile de rajouter l'option du module dans la ligne de commande.
    */
    $base = "/root/nginx-compiled";
    shell_exec("/bin/rm -rf {$base}");
    shell_exec("/bin/rm -rf /etc/nginx/sites-enabled/*");
    $f[] = "/usr/share/nginx";
    $f[] = "/usr/sbin/nginx";
    $f[] = "/etc/nginx";
    $f[] = "/var/lib/nginx";
    $f[] = "/usr/lib/libxslt.a";
    $f[] = "/usr/lib/libxslt.la";
    $f[] = "/usr/lib/libxslt.so";
    $f[] = "/usr/lib/libxslt.so.1";
    $f[] = "/usr/lib/libxslt.so.1.1.26";
    $f[] = "/usr/lib32/libxslt.so.1";
    $f[] = "/usr/lib32/libxslt.so.1.1.26";
    $f[] = "/usr/lib/mod_security2.so";
    $f[] = "/usr/lib/mod_security2.la";
    $f[] = "/usr/lib/mod_security2.a";
    $f[] = "/usr/lib/standalone.so";
    $f[] = "/usr/lib/standalone.la";
    $f[] = "/usr/lib/standalone.a";
    $Debian = DebianVersion();
    $Architecture = Architecture();
    $version = package_nginx_version();
    while (list($num, $filename) = each($f)) {
        if (is_dir($filename)) {
            @mkdir("{$base}/{$filename}", 0755, true);
            echo "/bin/cp -rf {$filename}/* {$base}{$filename}/\n";
            shell_exec("/bin/cp -rf {$filename}/* {$base}{$filename}/");
            continue;
        }
        if (is_file($filename)) {
            $dirname = dirname($filename);
            if (!is_dir("{$base}/{$dirname}")) {
                @mkdir("{$base}/{$dirname}", 0755, true);
            }
            echo "/bin/cp -f {$filename} {$base}{$dirname}/\n";
            shell_exec("/bin/cp -f {$filename} {$base}/{$dirname}/");
        }
    }
    chdir($base);
    if (is_file("{$base}/nginx-{$Architecture}-{$version}.tar.gz")) {
        @unlink("{$base}/nginx-{$Architecture}-{$version}.tar.gz");
    }
    $filename = "nginx-debian{$Debian}-{$Architecture}-{$version}.tar.gz";
    shell_exec("/bin/rm -rf {$base}/etc/nginx/sites-enabled/*");
    shell_exec("tar -czf {$filename} *");
    shell_exec("/bin/cp {$filename} /root/");
    echo "/root/{$filename} done\n";
}
示例#10
0
function install()
{
    include_once dirname(__FILE__) . "/ressources/class.ccurl.inc";
    $unix = new unix();
    $sock = new sockets();
    $DebianVersion = DebianVersion();
    $aptget = $unix->find_program("apt-get");
    $aptkey = $unix->find_program("apt-key");
    if ($DebianVersion < 7) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, influxdb Debian version incompatible!\n";
        }
        build_progress_idb("Incompatible system!", 110);
        die;
    }
    if (!is_dir("/etc/apt/sources.list.d")) {
        @mkdir("/etc/apt/sources.list.d");
    }
    @file_put_contents("/etc/apt/sources.list.d/ubiquiti.list", "\ndeb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti\n");
    system("{$aptkey} adv --keyserver keyserver.ubuntu.com --recv C0A52C50");
    build_progress_idb("{update_debian_repository}", 20);
    $cmd = "DEBIAN_FRONTEND=noninteractive {$aptget} -o Dpkg::Options::=\"--force-confnew\" --force-yes -y update 2>&1";
    system($cmd);
    build_progress_idb("{installing_package}", 50);
    $cmd = "DEBIAN_FRONTEND=noninteractive {$aptget} -o Dpkg::Options::=\"--force-confnew\" --force-yes -y install unifi 2>&1";
    system($cmd);
    build_progress_idb("{installing_package} {done}", 55);
    if (is_file("/usr/lib/unifi/lib/ace.jar")) {
        $sock->SET_INFO("EnableUnifiController", 1);
        build_progress_idb("{restarting_services}", 60);
        system("/etc/init.d/artica-status restart --force");
        build_progress_idb("{restarting_services}", 70);
        restart_progress(true);
        build_progress_idb("{done}", 100);
        return;
    }
    build_progress_idb("{failed_to_install}", 110);
}
function install($filekey = 0)
{
    include_once dirname(__FILE__) . "/ressources/class.ccurl.inc";
    $unix = new unix();
    $filename = null;
    $MD5 = null;
    $DebianVersion = DebianVersion();
    if ($DebianVersion < 7) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, influxdb Debian version incompatible!\n";
        }
        build_progress_idb("Incompatible system!", 110);
        die;
    }
    $filename = "influxdb-0.9.0.0.tar.gz";
    $MD5 = "4a5cef145fd676cb6752fec4170a32e4";
    $curl = new ccurl("http://mirror.articatech.com/download/InfluxDatabase/{$filename}");
    $tmpdir = $unix->TEMP_DIR();
    $php = $unix->LOCATE_PHP5_BIN();
    $rm = $unix->find_program("rm");
    $sock = new sockets();
    build_progress_idb("{downloading}", 1);
    $curl->WriteProgress = true;
    $curl->ProgressFunction = "download_progress";
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: Downloading {$filename}\n";
    }
    if (!$curl->GetFile("{$tmpdir}/{$filename}")) {
        build_progress_idb("{$curl->error}", 110);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$curl->error}\n";
        }
        while (list($key, $value) = each($curl->errors)) {
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$value}\n";
            }
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, influxdb unable to install....\n";
        }
        @unlink("{$tmpdir}/{$filename}");
        return;
    }
    if ($MD5 != null) {
        $DESTMD5 = md5_file("{$tmpdir}/{$filename}");
        if ($DESTMD5 != $MD5) {
            echo "{$DESTMD5}<>{$MD5}\n";
            @unlink("{$tmpdir}/{$filename}");
            build_progress_idb("{install_failed} {corrupted_package}", 110);
            return;
        }
    }
    build_progress_idb("{cleaning_backup}", 50);
    $InFluxBackupDatabaseDir = $sock->GET_INFO("InFluxBackupDatabaseDir");
    if ($InFluxBackupDatabaseDir == null) {
        $InFluxBackupDatabaseDir = "/home/artica/influx/backup";
    }
    if (is_dir($InFluxBackupDatabaseDir)) {
        shell_exec("{$rm} -rf {$InFluxBackupDatabaseDir}");
    }
    build_progress_idb("{stopping_service}", 60);
    system("/etc/init.d/influx-db stop");
    build_progress_idb("{removing_databases}", 70);
    shell_exec("{$rm} -rf /home/artica/squid/InfluxDB");
    @mkdir("/home/artica/squid/InfluxDB", 0755, true);
    shell_exec("{$rm} -rf /etc/artica-postfix/DIRSIZE_MB_CACHE/*");
    build_progress_idb("{extracting}", 80);
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, extracting....\n";
    }
    $tar = $unix->find_program("tar");
    shell_exec("{$tar} xvf {$tmpdir}/{$filename} -C /");
    build_progress_idb("{restarting_service} (1/2)", 90);
    system("/etc/init.d/influx-db restart");
    build_progress_idb("{restarting_service} (2/2)", 92);
    system("/etc/init.d/influx-db restart");
    @unlink("/etc/artica-postfix/settings/Daemons/ArticaTechNetInfluxRepo");
    build_progress_idb("{refresh_status}", 95);
    shell_exec("{$php} /usr/share/artica-postfix/exec.squid.interface-size.php --force");
    build_progress_idb("{refresh_status}", 96);
    shell_exec("{$php} php5 /usr/share/artica-postfix/exec.web-community-filter.php --squid-repo --verbose >/dev/null 2>&1");
    build_progress_idb("{refresh_status}", 97);
    system("/etc/init.d/squid-tail restart");
    build_progress_idb("{refresh_status}", 98);
    system("/etc/init.d/hypercache-tail restart");
    build_progress_idb("{refresh_status}", 99);
    system("/etc/init.d/ufdb-tail restart");
    InfluxDbSize();
    build_progress_idb("{done}", 100);
}
示例#12
0
function create_package()
{
    $unix = new unix();
    $wget = $unix->find_program("wget");
    $tar = $unix->find_program("tar");
    $rm = $unix->find_program("rm");
    $cp = $unix->find_program("cp");
    $Architecture = Architecture();
    $version = haproxy_version();
    $debian_version = DebianVersion();
    mkdir("{$GLOBALS["WORKDIR"]}/usr/local/sbin", 0755, true);
    $f[] = "/usr/local/sbin/vsftpd";
    $f[] = "/usr/local/man/man8/vsftpd.8";
    $f[] = "/usr/man/man8/vsftpd.8";
    $f[] = "/usr/share/man/man5/vsftpd.conf.5";
    $f[] = "/usr/share/man/man8/vsftpd.8";
    while (list($num, $ligne) = each($f)) {
        if (is_dir($ligne)) {
            shell_exec("/bin/cp -rfd {$ligne}/* {$GLOBALS["WORKDIR"]}/{$ligne}/");
            continue;
        }
        if (!is_file($ligne)) {
            echo "{$ligne} no such file\n";
            continue;
        }
        $dir = dirname($ligne);
        echo "Installing {$ligne} in {$GLOBALS["WORKDIR"]}{$dir}/\n";
        if (!is_dir("{$GLOBALS["WORKDIR"]}{$dir}")) {
            @mkdir("{$GLOBALS["WORKDIR"]}{$dir}", 0755, true);
        }
        shell_exec("/bin/cp -fd {$ligne} {$GLOBALS["WORKDIR"]}{$dir}/");
    }
    if ($Architecture == 64) {
        $Architecture = "x64";
    }
    if ($Architecture == 32) {
        $Architecture = "i386";
    }
    echo "Compile Arch {$Architecture} v:{$GLOBALS["VERSION"]} Debian {$debian_version}\n";
    chdir("{$GLOBALS["WORKDIR"]}");
    $packagename = "vsftpd-{$Architecture}-debian{$debian_version}-{$GLOBALS["VERSION"]}.tar.gz";
    echo "Compressing....{$GLOBALS["WORKDIR"]}/{$packagename}\n";
    shell_exec("{$tar} -czf {$packagename} *");
    shell_exec("{$cp} {$GLOBALS["WORKDIR"]}/{$packagename} /root/");
    system_admin_events("{$GLOBALS["WORKDIR"]}/{$packagename}  ready...", __FUNCTION__, __FILE__, __LINE__);
}
示例#13
0
function install($filekey = 0)
{
    include_once dirname(__FILE__) . "/ressources/class.ccurl.inc";
    $unix = new unix();
    $filename = null;
    $MD5 = null;
    $DebianVersion = DebianVersion();
    if ($DebianVersion < 7) {
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, influxdb Debian version incompatible!\n";
        }
        build_progress_idb("Incompatible system!", 110);
        die;
    }
    if ($filekey != 0) {
        $sock = new sockets();
        $ArticaTechNetSquidRepo = unserialize(base64_decode($sock->GET_INFO("ArticaTechNetInfluxRepo")));
        $version = $ArticaTechNetSquidRepo[$filekey]["VERSION"];
        $filename = $ArticaTechNetSquidRepo[$filekey]["FILENAME"];
        $MD5 = $ArticaTechNetSquidRepo[$filekey]["MD5"];
    }
    if ($filename == null) {
        $filename = "influxdb-0.9.0.0.tar.gz";
    }
    $curl = new ccurl("http://mirror.articatech.com/download/InfluxDatabase/{$filename}");
    $tmpdir = $unix->TEMP_DIR();
    $php = $unix->LOCATE_PHP5_BIN();
    build_progress_idb("{downloading}", 1);
    $curl->WriteProgress = true;
    $curl->ProgressFunction = "download_progress";
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: Downloading {$filename}\n";
    }
    if (!$curl->GetFile("{$tmpdir}/{$filename}")) {
        build_progress_idb("{$curl->error}", 110);
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$curl->error}\n";
        }
        while (list($key, $value) = each($curl->errors)) {
            if ($GLOBALS["OUTPUT"]) {
                echo "Starting......: " . date("H:i:s") . " [INIT]: {$value}\n";
            }
        }
        if ($GLOBALS["OUTPUT"]) {
            echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, influxdb unable to install....\n";
        }
        @unlink("{$tmpdir}/{$filename}");
        return;
    }
    if ($MD5 != null) {
        $DESTMD5 = md5_file("{$tmpdir}/{$filename}");
        if ($DESTMD5 != $MD5) {
            echo "{$DESTMD5}<>{$MD5}\n";
            @unlink("{$tmpdir}/{$filename}");
            build_progress_idb("{install_failed} {corrupted_package}", 110);
            return;
        }
    }
    build_progress_idb("{stopping_service}", 95);
    stop(true);
    build_progress_idb("{extracting}", 96);
    if ($GLOBALS["OUTPUT"]) {
        echo "Starting......: " . date("H:i:s") . " [INIT]: {$GLOBALS["TITLENAME"]}, extracting....\n";
    }
    $tar = $unix->find_program("tar");
    shell_exec("{$tar} xvf {$tmpdir}/{$filename} -C /");
    if ($GLOBALS["MIGRATION"]) {
        $rm = $unix->find_program("rm");
        build_progress_idb("{delete_database}...", 97);
        shell_exec("{$rm} -rf /home/artica/squid/InfluxDB");
        @mkdir("/home/artica/squid/InfluxDB", 0755, true);
        shell_exec("{$rm} -rf /etc/artica-postfix/DIRSIZE_MB_CACHE/*");
        build_progress_idb("{build_status}...", 98);
        InfluxDbSize();
    }
    if ($GLOBALS["PROGRESS"]) {
        build_progress_idb("{starting_service}", 98);
        start(true);
    }
    if ($GLOBALS["MIGRATION"]) {
        build_progress_idb("{restarting_service}", 98);
        stop(true);
        start(true);
    }
    build_progress_idb("{refresh_status}", 98);
    shell_exec("{$php} /usr/share/artica-postfix/exec.squid.interface-size.php --force");
    system("/etc/init.d/squid-tail restart");
    build_progress_idb("{done}", 100);
}
示例#14
0
function make_package()
{
    /* HOWTO
     * NDPI --------------------------------------------------------
     * apt-get install dh-autoreconf libpcap-dev libdaq-dev libyaml-dev libpng3 libnss3-dev libnet1-dev libjansson-dev
     * git clone https://github.com/betolj/ndpi-netfilter
     * cd ndpi-netfilter/
     * tar -xf nDPI.tar.gz
     * NDPI_PATH=/root/ndpi-netfilter/nDPI make
     * make modules_install
     * cp ipt/libxt_ndpi.so /lib/xtables/
     * --------------------------------------------------------
     * SURICATA 
     * git clone https://github.com/ironbee/libhtp
     * cd libhtp
     * ./configure --prefix=/usr
     * git clone git://phalanx.openinfosecfoundation.org/oisf.git
     * cd oisf/
     * ./autogen.sh
     * tar -xf suricata-2.0.9.tar.gz 
    CFLAGS="-O0 -ggdb"  ./configure --enable-pfring --enable-geoip --with-libpfring-includes=/usr/local/pfring/include/ --with-libpfring-libraries=/usr/local/pfring/lib/ --with-libpcap-includes=/usr/local/pfring/include/ --with-libpcap-libraries=/usr/local/pfring/lib/ --with-libnss-libraries=/usr/lib --with-libnss-includes=/usr/include/nss/ --with-libjansson --with-libnspr-libraries=/usr/lib --with-libnspr-includes=/usr/include/nspr --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-profiling --disable-gccmarch-native
     * make && make install && make install-full
     * --------------------------------------------------------
     * barnyard2
     * wget "http://prdownloads.sourceforge.net/libdnet/libdnet-1.11.tar.gz?download" -O libdnet-1.11.tar.gz
     * tar -xf libdnet-1.11.tar.gz
     * cd libdnet-1.11/
     * ./configure --prefix=/usr
     * make && make install
     * --------------------------------------------------------
     * git clone https://github.com/firnsy/barnyard2.git
     * ./autogen.sh 
     * ./configure --with-mysql-libraries=/usr/lib/x86_64-linux-gnu/
     * --------------------------------------------------------
    wget "http://sourceforge.net/projects/bandwidthd/files/bandwidthd/bandwidthd%202.0.1/bandwidthd-2.0.1.tgz/download" -O bandwidthd-2.0.1.tgz
    tar -xf bandwidthd-2.0.1.tgz
    
    wget http://people.redhat.com/sgrubb/libcap-ng/libcap-ng-0.7.7.tar.gz
    tar -xf libcap-ng-0.7.7.tar.gz 
    cd libcap-ng-0.7.7/
    ./autogen.sh 
    ./configure --build=x86_64-linux-gnu --prefix=/usr --includedir=\${prefix}/include --sysconfdir=/etc --localstatedir=/var --disable-silent-rules --disable-maintainer-mode --without-python3
    make  && make install
    
    wget https://ftp.mozilla.org/pub/nspr/releases/v4.9.6/src/nspr-4.9.6.tar.gz
    tar -xf nspr-4.9.6.tar.gz 
    cd nspr-4.9.6/
    ./configure --enable-64bit --prefix=/usr
    make  && make install
    
     * 
     */
    //ldconfig
    //modprobe pf_ring transparent_mode=0 min_num_slots=65534
    $f["/usr/lib/libhtp-0.5.18.so.1"] = true;
    $f["/usr/lib/libhtp-0.5.18.so.1.0.0"] = true;
    $f["/usr/lib/libhtp-0.2.so.1"] = true;
    $f["/usr/lib/libhtp-0.2.so.1.0.2"] = true;
    $f["/usr/lib/libhtp-0.5.18.so.1"] = true;
    $f["/usr/lib/libhtp-0.5.18.so.1.0.0"] = true;
    $f["/usr/lib/libhtp.a"] = true;
    $f["/usr/lib/libhtp.la"] = true;
    $f["/usr/lib/libhtp.so"] = true;
    $f["/usr/bin/suricatasc"] = true;
    $f["/usr/bin/suricata"] = true;
    $f["/usr/lib/libdnet.1"] = true;
    $f["/usr/lib/libdnet.1.0.1"] = true;
    $f["/usr/lib/libdnet.a"] = true;
    $f["/usr/lib/libdnet.la"] = true;
    $f["/usr/local/bin/barnyard2"] = true;
    $f["/usr/local/etc/barnyard2.conf"] = true;
    $f["/usr/sbin/pulledpork.pl"] = true;
    $f["/usr/sbin/snortsam"] = true;
    $f["/usr/local/lib/libpfring.a"] = true;
    $f["/usr/local/lib/libpfring.so"] = true;
    $f["/usr/bin/captest"] = true;
    $f["/usr/bin/filecap"] = true;
    $f["/usr/bin/netcap"] = true;
    $f["/usr/bin/pscap"] = true;
    $f["/usr/lib/libcap-ng.a"] = true;
    $f["/usr/lib/libcap-ng.la"] = true;
    $f["/usr/lib/libcap-ng.so"] = true;
    $f["/usr/lib/libcap-ng.so.0"] = true;
    $f["/usr/lib/libcap-ng.so.0.0.0"] = true;
    $f["/usr/lib/libplc4.a"] = true;
    $f["/usr/lib/libplc4.so"] = true;
    $f["/lib/xtables/libxt_ndpi.so"] = true;
    $f["/lib/modules/3.2.0-4-amd64/extra/xt_ndpi.ko"] = true;
    $f["/lib/modules/3.2.0-4-amd64/kernel/net/pf_ring/pf_ring.ko"] = true;
    $version = suricata_version();
    $BASE = "/root/suricata-{$version}-compiler";
    if (is_dir($BASE)) {
        system("/bin/rm -rf {$BASE}");
    }
    mkdir("{$BASE}/etc/suricata", 0755, true);
    mkdir("{$BASE}/usr/lib", 0755, true);
    mkdir("{$BASE}/usr/sbin", 0755, true);
    mkdir("{$BASE}/usr/bin", 0755, true);
    mkdir("{$BASE}/usr/local/bin", 0755, true);
    mkdir("{$BASE}/usr/local/lib", 0755, true);
    mkdir("{$BASE}/usr/local/etc", 0755, true);
    mkdir("{$BASE}/usr/bandwidthd", 0755, true);
    mkdir("{$BASE}/lib/xtables", 0755, true);
    mkdir("{$BASE}/etc/pulledpork", 0755, true);
    mkdir("{$BASE}/lib/modules/3.2.0-4-amd64/extra", 0755, true);
    mkdir("{$BASE}/lib/modules/3.2.0-4-amd64/kernel/net/pf_ring", 0755, true);
    while (list($num, $val) = each($f)) {
        echo "Copy {$num} {$BASE}" . dirname($num) . "/\n";
        shell_exec("/bin/cp -fd {$num} {$BASE}" . dirname($num) . "/");
    }
    echo "Copy Directory /etc/suricata\n";
    shell_exec("/bin/cp -rfd /etc/suricata/* {$BASE}/etc/suricata/");
    echo "Copy Directory /etc/pulledpork\n";
    shell_exec("/bin/cp -rfd /etc/pulledpork/* {$BASE}/etc/pulledpork/");
    echo "Copy Directory /usr/bandwidthd\n";
    shell_exec("/bin/cp -rfd /usr/bandwidthd/* {$BASE}/usr/bandwidthd/");
    system("cd {$BASE}");
    @chdir($BASE);
    $Architecture = Architecture();
    $DebianVersion = DebianVersion();
    $finalFileName = "/root/suricata-debian{$DebianVersion}-{$Architecture}-{$version}.tar.gz";
    if (is_file($finalFileName)) {
        @unlink($finalFileName);
    }
    echo "Compressing  {$finalFileName}\n";
    system("tar -czf {$finalFileName} *");
}