Пример #1
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";
}
Пример #2
0
function package_nginx()
{
    /*
    	 * 
    	 * 
    	 * http://openresty.org/#Download
    cd /root
    wget http://openresty.org/download/ngx_openresty-1.2.8.6.tar.gz
    tar -xf ngx_openresty-1.2.8.6.tar.gz
    cd ngx_openresty-1.2.7.8
    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/yaoweibin/nginx_syslog_patch.git
    mv nginx_syslog_patch ngx_nginx_syslog_patch-1.0
    cd ngx_nginx_syslog_patch-1.0
    patch -p1 < syslog-1.7.0.patch
    répondre par : 
    /root/ngx_openresty-1.7.2.1/bundle/nginx-1.7.2/src/core/ngx_log.c
    /root/ngx_openresty-1.7.2.1/bundle/nginx-1.7.2/src/core/ngx_log.h
    /root/ngx_openresty-1.7.2.1/bundle/nginx-1.7.2/src/http/modules/ngx_http_log_module.c
    [nginx_syslog_patch=>'ngx_nginx_syslog_patch'],
    
    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";
}
Пример #3
0
function package_nginx()
{
    /*
    	 * 
    	 * 
    	 * http://openresty.org/#Download
    cd /root
    wget http://openresty.org/download/ngx_openresty-1.2.8.6.tar.gz
    tar -xf ngx_openresty-1.2.8.6.tar.gz
    cd ngx_openresty-1.2.7.8
    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
    
    // ************************************************** MARCHE PLUS avec la 1.7.10
    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
    // *************************************************************************************
    
    
    
    
    // ************************************************** MARCHE PLUS avec la 1.7.10
    git clone https://github.com/yaoweibin/nginx_syslog_patch.git
    mv nginx_syslog_patch ngx_nginx_syslog_patch-1.0
    cd ngx_nginx_syslog_patch-1.0
    patch -p1 < syslog-1.7.0.patch
    répondre par : 
    /root/ngx_openresty-1.7.2.1/bundle/nginx-1.7.2/src/core/ngx_log.c
    /root/ngx_openresty-1.7.2.1/bundle/nginx-1.7.2/src/core/ngx_log.h
    /root/ngx_openresty-1.7.2.1/bundle/nginx-1.7.2/src/http/modules/ngx_http_log_module.c
    [nginx_syslog_patch=>'ngx_nginx_syslog_patch'],
    // *************************************************************************************
    
    
     *****
    dans configure
    [http_substitutions_filter_module=>'ngx_http_substitutions_filter_module'],
    [http_auth_ldap_module=>'ngx_http_auth_ldap_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";
}