This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

[MODULE] Certificate Manager
#21
RE: [Module] Certificate Manager
i use somting call replace for mysql
so if you not edit inside the line
# Made from Cert manager start

# Made from Cert manager end

it will only delete this line and not other in the custom part

but if edit beside the line i can not delete the line and it will fail :/

what it do is

is if you type

Code:
inside you mysql row [value] you have "" Replace me ""

$replace = "Replace me";
$new_line = "Diablo925 rocks";


UPDATE table SET value = replace(value, $replace, $new_line) WHERE id= 1


And you insde you row is say "" Diablo925 rocks ""


Big Grin
Sentora 1.0.3 on [Image: DO_Logo_Horizontal_Blue-3db19536.png]

-= Github =-  -= My Repo =-

My Modules
Reply
Thanks given by:
#22
RE: [Module] Certificate Manager
Can't just replace with nothing?
PHP Code:
$replace "Replace me";
$new_line "";


UPDATE table SET value replace(value$replace$new_lineWHERE id
-TGates - Project Council

SEARCH the Forums or read the DOCUMENTATION before posting!
Support Sentora and Donate: HERE

Find my support or modules useful? Donate to TGates HERE
Developers and code testers needed!
Contact TGates for more information
Reply
Thanks given by:
#23
RE: [Module] Certificate Manager
(10-10-2015, 03:34 AM)TGates Wrote: Can't just replace with nothing?
PHP Code:
$replace "Replace me";
$new_line "";


UPDATE table SET value replace(value$replace$new_lineWHERE id

yes that how it Works now :o)

that way you must not change what the cer_manger add else can it not delete the line
Sentora 1.0.3 on [Image: DO_Logo_Horizontal_Blue-3db19536.png]

-= Github =-  -= My Repo =-

My Modules
Reply
Thanks given by: TGates
#24
RE: [Module] Certificate Manager
Thanks I got it.
I think that this is not the best solution.
Since httpd-vhost.conf dynamically changes depending on the settings panel.
I tried to adapt the module to work in AWServer with ZPanelX
Unfortunately it is impossible.
Reply
Thanks given by:
#25
RE: [Module] Certificate Manager
it is the only way like i can see

about you Windows version

You need openssl and i need to make it more Windows friendly Some places I was lazy and just entered the site /var/ and does not work in windows : S
Sentora 1.0.3 on [Image: DO_Logo_Horizontal_Blue-3db19536.png]

-= Github =-  -= My Repo =-

My Modules
Reply
Thanks given by:
#26
RE: [Module] Certificate Manager
I have a module for the SSL Manager for AWServer with ZPanelX it works fine but is based on the individual config files.
my SSL Manager integrated in version AWServer with ZPanelX 2.2
For create ssl certificates used tools openssl.exe
work fine Smile 

It's my controller.ext.php (module SSL Manager)
I use your idea - ssl module
Thanks!


Code:
class module_controller
{

    static $ok;
    static $error;
    static $empty;
    static $reqadd;
    static $del;

    static function ListDomains($uid)
    {
        global $zdbh;
        global $controller;
        $currentuser = ctrl_users::GetUserDetail($uid);
        $sql = "SELECT * FROM x_vhosts WHERE vh_acc_fk=:userid AND vh_enabled_in=1 AND vh_deleted_ts IS NULL ORDER BY vh_name_vc ASC";
        $numrows = $zdbh->prepare($sql);
        $numrows->bindParam(':userid', $currentuser['userid']);
        $numrows->execute();
        if ($numrows->fetchColumn() <> 0) {
            $sql = $zdbh->prepare($sql);
            $sql->bindParam(':userid', $currentuser['userid']);
            $res = array();
            $sql->execute();
        while ($rowdomains = $sql->fetch()) {
            $res[] = array('domain' => $rowdomains['vh_name_vc']);
        }
           return $res;
       } else {
            return false;
        }
    }
    
    static function ListSSL($uname)
    {
        global $zdbh;
        global $controller;
        if (!is_dir("" . ctrl_options::GetSystemOption('hosted_dir') . $uname ."/ssl/") ) {
                mkdir("" . ctrl_options::GetSystemOption('hosted_dir') . $uname ."/ssl/", 0777);
        }
        $dir = ctrl_options::GetSystemOption('hosted_dir') . $uname ."/ssl/";
        if(substr($dir, -1) != "/") $dir .= "/";
        $d = @dir($dir);
        while(false !== ($entry = $d->read())) {
            $entryssl = str_replace('_', '.', $entry);
            if($entry[0] == ".") continue;
            $retval[] = array("name" => "$entryssl");
        }
   $d->close();
        return $retval;
    }

    static function ExecuteDeleteSSL($domain, $username)
    {
        global $zdbh;
        global $controller;
        $domainssl = str_replace('.', '_', $domain);
        $dir = ctrl_options::GetSystemOption('hosted_dir') . $username ."/ssl/". $domainssl;
        $objects = scandir($dir);
        foreach ($objects as $object) {
        if ($object != "." && $object != "..") {
            unlink($dir."/".$object);
        }
    }
        reset($objects);
        rmdir($dir);
        unlink("C:/AWServer/bin/apache/conf/ssl-vhost/" . $domain . ".conf");    
        unlink("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/". $domain .".key");
        unlink("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/". $domain .".crt");
        
        self::$del = true;
        return true;
        
    }
    
    static function SetWriteApacheConfigTrue() {
        global $zdbh;
        $sql = $zdbh->prepare("UPDATE x_settings
                                SET so_value_tx='true'
                                WHERE so_name_vc='apache_changed'");
        $sql->execute();
    }
    
    static function ExecuteCSR($domain, $name, $address, $city, $country, $company, $department)
    {
        global $zdbh;
        global $controller;
        $currentuser = ctrl_users::GetUserDetail();
        $formvars = $controller->GetAllControllerRequests('FORM');
        if (!is_dir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/") ) {
                mkdir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/", 0777);
            }
        $dn = array(
                        "countryName"            => "$country",
                        "stateOrProvinceName"    => "$name",
                        "localityName"            => "$city",
                        "organizationName"        => "$company",
                        "departmentName"        => "$department",
                        "commonName"            => "$domain",
                        "emailAddress"            => "$address"
                    );

        // Make key and signing request SSL certificate
        @exec("C:/AWServer/bin/apache/bin/openssl.exe genrsa -out " . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/". $domain .".key 2048");
        @exec("C:/AWServer/bin/apache/bin/openssl.exe req -new -key " . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/". $domain .".key -out " . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/". $domain .".csr -subj /C=". $country ."/ST=". $name ."/L=". $city ."/O=". $company = str_replace(' ', '-' ,$company) ."/OU=". $department = str_replace(' ', '-' ,$department) ."/CN=". $domain ."/emailAddress=". $address . "");
        unlink("C:/.rnd");
        
        $email = $address;
        $emailsubject = "Certificate Signing Request";
        $emailbody = "Hi $currentuser[fullname] \n\nYour application is made.\nYour request to signing SSL certificate for domain - $domain.csr \nYour private key for domain - $domain.key \nSee  attachments. \n\nBest Regards. \nYour hosting company";

        $phpmailer = new sys_email();
        $phpmailer->Subject = $emailsubject;
        $phpmailer->Body = $emailbody;
        $phpmailer->AddAttachment("". ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/".$domain.".key");
        $phpmailer->AddAttachment("". ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/".$domain.".csr");
        $phpmailer->AddAddress($email);
        $phpmailer->SendEmail();

        unlink("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/".$domain.".key");
        unlink("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/".$domain.".csr");
        rmdir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/");

        self::$reqadd = true;
        return true;
    }

    static function ExecuteMakeSSL($domain, $name, $address, $city, $country)
    {
        global $zdbh;
        global $controller;
        $currentuser = ctrl_users::GetUserDetail();
        $formvars = $controller->GetAllControllerRequests('FORM');
        $rootdir = str_replace('.', '_', $domain);
                
        if (!is_dir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/") ) {
                mkdir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/", 0777);
            }
        if (!is_dir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/") ) {
                mkdir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/", 0777);
        } else {
            self::$error = true;
            return false;
        }
        
        $dn = array(
                        "countryName"            => "$country",
                        "stateOrProvinceName"    => "$name",
                        "localityName"            => "$city",
                        "commonName"            => "$domain",
                        "emailAddress"            => "$address"
                    );

        // Make key and self-signed SSL certificate
        @exec("C:/AWServer/bin/apache/bin/openssl.exe req -new -x509 -nodes -days 3660 -newkey rsa:2048 -keyout " . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/". $domain .".key -out " . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/". $domain .".crt -subj /C=". $country ."/ST=". $name ."/L=". $city ."/O=AWServer/OU=Hosting/CN=". $domain ."/emailAddress=". $address . "");
        unlink("C:/AWServer/panel/.rnd");

        // Get the values ​​of PHP memory limit their module in the package
        $rows = $zdbh->prepare("SELECT * FROM x_quotas WHERE qt_package_fk=" . $currentuser['packageid']);
        $rows->execute();
        $quotasinfo = $rows->fetch();
        
        // Writing ssl configuration file
        $handle = fopen("C:/AWServer/bin/apache/conf/ssl-vhost/". $domain .".conf", "w+");
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = "# Generated by AWServer with ZPanelX SSL VHost configurations below #\n";
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = " \n";
        fwrite($handle, $write);
        $write = "NameVirtualHost *:443\n";
        fwrite($handle, $write);
        $write = " \n";
        fwrite($handle, $write);
        $write = "<VirtualHost *:443>\n";
        fwrite($handle, $write);
        $write = "    ServerName $domain\n";
        fwrite($handle, $write);
        $write = "    ServerAlias $domain www.$domain\n";
        fwrite($handle, $write);
        $write = "    ServerAdmin $currentuser[email]\n";
        fwrite($handle, $write);
        $write = "    SSLEngine On\n";
        fwrite($handle, $write);
        $write = "    SSLCertificateFile \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/ssl/$rootdir/$domain.crt\"\n";
        fwrite($handle, $write);
        $write = "    SSLCertificateKeyFile \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/ssl/$rootdir/$domain.key\"\n";
        fwrite($handle, $write);
        $write = "    php_admin_value open_basedir \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir" . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/tmp" . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('openbase_temp') . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('pear_path') . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('imagick_path') . "\"\n";
        fwrite($handle, $write);
        $write = "    " . ctrl_options::GetSystemOption('suhosin_value') . "\n";
        fwrite($handle, $write);
        $write = "    php_admin_value upload_tmp_dir \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/tmp\"\n";
        fwrite($handle, $write);
        $write = "    php_admin_value session.save_path \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/tmp\"\n";
        fwrite($handle, $write);
        $write = "    php_admin_value memory_limit " . $quotasinfo['qt_memlimit_mb'] . "M"."\n";
        fwrite($handle, $write);
        $write = "    ErrorLog \"" . ctrl_options::GetSystemOption('log_dir') . "domains/$currentuser[username]/$domain-error.log\"\n";
        fwrite($handle, $write);
        $write = "    CustomLog \"" . ctrl_options::GetSystemOption('log_dir') . "domains/$currentuser[username]/$domain-access.log\" " . ctrl_options::GetSystemOption('access_log_format') . "\n";
        fwrite($handle, $write);
        $write = "    CustomLog \"" . ctrl_options::GetSystemOption('log_dir') . "domains/$currentuser[username]/$domain-bandwidth.log\" " . ctrl_options::GetSystemOption('bandwidth_log_format') . "\n";
        fwrite($handle, $write);
        $write = "    DocumentRoot \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir\"\n";
        fwrite($handle, $write);
        $write = "<Directory \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir\">\n";
        fwrite($handle, $write);
        $write = "    Options FollowSymLinks\n";
        fwrite($handle, $write);
        $write = "    AllowOverride All\n";
        fwrite($handle, $write);
        $write = "    Order Allow,Deny\n";
        fwrite($handle, $write);
        $write = "    Allow from all\n";
        fwrite($handle, $write);
        $write = "</Directory>\n";
        fwrite($handle, $write);
        $write = "    ". ctrl_options::GetSystemOption('dir_index') . "\n";
        fwrite($handle, $write);
        $write = "    ". ctrl_options::GetSystemOption('php_handler') . "\n";
        fwrite($handle, $write);
        $write = "    ScriptAlias /cgi-bin/ \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir/_cgi-bin\"\n";
        fwrite($handle, $write);
        $write = "" . ctrl_options::GetSystemOption('cgi_handler') . "\n";
        fwrite($handle, $write);
        $write = " \n";
        fwrite($handle, $write);
        $write = "    # Custom global settings are loaded below this line (if any exist)\n";
        fwrite($handle, $write);
        $write = "    ". ctrl_options::GetSystemOption('global_vhcustom') . "\n";
        fwrite($handle, $write);
        $write = "</VirtualHost>\n";
        fwrite($handle, $write);
        fclose($handle);

        // Writing .htaccess file
        $handle = fopen("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/public_html/". $rootdir ."/".".htaccess", "w+");
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = "# Generated by AWServer with ZPanelX SSL VHost configurations below #\n";
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = " \n";
        $write = "RewriteEngine On\n";
        fwrite($handle, $write);
        $write = "RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]\n";
        fwrite($handle, $write);
        $write = "RewriteRule ^(.*)$ http://%1/$1 [R=301,L]\n";
        fwrite($handle, $write);
        $write = "RewriteCond %{SERVER_PORT} !^443$\n";
        fwrite($handle, $write);
        $write = "RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]\n";
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        fclose($handle);            
        
        // Restart apache during the next start daemon
        self::SetWriteApacheConfigTrue();
        self::$ok = true;
        return true;
    }
    
    static function doUploadSSL()
    {
        global $zdbh;
        global $controller;
        $currentuser = ctrl_users::GetUserDetail();
        $formvars = $controller->GetAllControllerRequests('FORM');
        $domain = $formvars["inDomain"];
        $rootdir = str_replace('.', '_', $domain);
        if (empty($_FILES["inKEY"]["name"]) || empty($_FILES["inWCA"]["name"])) {
        self::$empty = true;
        return false;
        }
        if (!is_dir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/") ) {
                mkdir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/", 0777);
            }
        if (!is_dir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/") ) {
                mkdir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/", 0777);
        } else {
            self::$error = true;
            return false;
        }
            
        $target_dir = "" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/";
            
        $uploadwcrt    = $target_dir . $domain . ".crt";
        $uploadkey    = $target_dir . $domain . ".key";
        $uploadicrt    = $target_dir . $domain . ".ca-bundle";
            
        move_uploaded_file($_FILES["inWCA"]["tmp_name"], $uploadwcrt);
        move_uploaded_file($_FILES["inKEY"]["tmp_name"], $uploadkey);
        move_uploaded_file($_FILES["inICA"]["tmp_name"], $uploadicrt);

        // Get the values ​​of PHP memory limit their module in the package
        $rows = $zdbh->prepare("SELECT * FROM x_quotas WHERE qt_package_fk=" . $currentuser['packageid']);
        $rows->execute();
        $quotasinfo = $rows->fetch();        

        // Writing ssl configuration file
        $handle = fopen("C:/AWServer/bin/apache/conf/ssl-vhost/". $domain .".conf", "w+");
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = "# Generated by AWServer with ZPanelX SSL VHost configurations below #\n";
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = " \n";
        fwrite($handle, $write);
        $write = "NameVirtualHost *:443\n";
        fwrite($handle, $write);
        $write = " \n";
        fwrite($handle, $write);
        $write = "<VirtualHost *:443>\n";
        fwrite($handle, $write);
        $write = "    ServerName $domain\n";
        fwrite($handle, $write);
        $write = "    ServerAlias $domain www.$domain\n";
        fwrite($handle, $write);
        $write = "    ServerAdmin $currentuser[email]\n";
        fwrite($handle, $write);
        $write = "    SSLEngine On\n";
        fwrite($handle, $write);
        $write = "    SSLCertificateFile \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/ssl/$rootdir/$domain.crt\"\n";
        fwrite($handle, $write);
        $write = "    SSLCertificateKeyFile \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/ssl/$rootdir/$domain.key\"\n";
        fwrite($handle, $write);
        $write = "    SSLCertificateChainFile    \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/ssl/$rootdir/$domain.ca-bundle\"\n";            
        fwrite($handle, $write);
        $write = "    php_admin_value open_basedir \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir" . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/tmp" . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('openbase_temp') . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('pear_path') . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('imagick_path') . "\"\n";
        fwrite($handle, $write);
        $write = "    " . ctrl_options::GetSystemOption('suhosin_value') . "\n";
        fwrite($handle, $write);
        $write = "    php_admin_value upload_tmp_dir \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/tmp\"\n";
        fwrite($handle, $write);
        $write = "    php_admin_value session.save_path \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/tmp\"\n";
        fwrite($handle, $write);
        $write = "    php_admin_value memory_limit " . $quotasinfo['qt_memlimit_mb'] . "M"."\n";
        fwrite($handle, $write);
        $write = "    ErrorLog \"" . ctrl_options::GetSystemOption('log_dir') . "domains/$currentuser[username]/$domain-error.log\"\n";
        fwrite($handle, $write);
        $write = "    CustomLog \"" . ctrl_options::GetSystemOption('log_dir') . "domains/$currentuser[username]/$domain-access.log\" " . ctrl_options::GetSystemOption('access_log_format') . "\n";
        fwrite($handle, $write);
        $write = "    CustomLog \"" . ctrl_options::GetSystemOption('log_dir') . "domains/$currentuser[username]/$domain-bandwidth.log\" " . ctrl_options::GetSystemOption('bandwidth_log_format') . "\n";
        fwrite($handle, $write);
        $write = "    DocumentRoot \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir/\"\n";
        fwrite($handle, $write);
        $write = "<Directory \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir/\">\n";
        fwrite($handle, $write);
        $write = "    Options FollowSymLinks\n";
        fwrite($handle, $write);
        $write = "    AllowOverride All\n";
        fwrite($handle, $write);
        $write = "    Order Allow,Deny\n";
        fwrite($handle, $write);
        $write = "    Allow from all\n";
        fwrite($handle, $write);
        $write = "</Directory>\n";
        fwrite($handle, $write);
        $write = "    ". ctrl_options::GetSystemOption('dir_index') . "\n";
        fwrite($handle, $write);
        $write = "    ". ctrl_options::GetSystemOption('php_handler') . "\n";
        fwrite($handle, $write);
        $write = "    ScriptAlias /cgi-bin/ \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir/_cgi-bin\"\n";
        fwrite($handle, $write);
        $write = "" . ctrl_options::GetSystemOption('cgi_handler') . "\n";
        fwrite($handle, $write);
        $write = " \n";
        fwrite($handle, $write);
        $write = "    # Custom global settings are loaded below this line (if any exist)\n";
        fwrite($handle, $write);
        $write = "    ". ctrl_options::GetSystemOption('global_vhcustom') . "\n";
        fwrite($handle, $write);
        $write = "</VirtualHost>\n";
        fwrite($handle, $write);
        fclose($handle);

        // Writing .htaccess file
        $handle = fopen("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/public_html/". $rootdir ."/".".htaccess", "w+");
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = "# Generated by AWServer with ZPanelX SSL VHost configurations below #\n";
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = " \n";
        $write = "RewriteEngine On\n";
        fwrite($handle, $write);
        $write = "RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]\n";
        fwrite($handle, $write);
        $write = "RewriteRule ^(.*)$ http://%1/$1 [R=301,L]\n";
        fwrite($handle, $write);
        $write = "RewriteCond %{SERVER_PORT} !^443$\n";
        fwrite($handle, $write);
        $write = "RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]\n";
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        fclose($handle);
        
        // Restart apache during the next start daemon
        self::SetWriteApacheConfigTrue();
        self::$ok = true;
        return true;
    }

    static function doMakeNewSSL()
   {
       global $controller;
       runtime_csfr::Protect();
       $currentuser = ctrl_users::GetUserDetail();
       $formvars = $controller->GetAllControllerRequests('FORM');
        if (empty($formvars['inDomain']) || empty($formvars['inName']) || empty($formvars['inAddress']) || empty($formvars['inCity']) || empty($formvars['inCountry'])) {
        self::$empty = true;
        return false; }
       if (self::ExecuteMakeSSL($formvars['inDomain'], $formvars['inName'], $formvars['inAddress'], $formvars['inCity'], $formvars['inCountry']))
       return true;
   }

    static function doMakeCSR()
   {
       global $controller;
       runtime_csfr::Protect();
       $currentuser = ctrl_users::GetUserDetail();
       $formvars = $controller->GetAllControllerRequests('FORM');
        if (empty($formvars['inDomain']) || empty($formvars['inName']) || empty($formvars['inAddress']) || empty($formvars['inCity']) || empty($formvars['inCountry']) || empty($formvars['inCompany']) || empty($formvars['inDepartment'])) {
        self::$empty = true;
        return false; }
       if (self::ExecuteCSR($formvars['inDomain'], $formvars['inName'], $formvars['inAddress'], $formvars['inCity'], $formvars['inCountry'], $formvars['inCompany'], $formvars['inDepartment']))
       return true;
   }    
    
    static function doDeleteSSL()
    {
        global $controller;
        runtime_csfr::Protect();
        $currentuser = ctrl_users::GetUserDetail();
        $formvars = $controller->GetAllControllerRequests('FORM');
        if (self::ExecuteDeleteSSL($formvars['inName'], $currentuser["username"]))
        return true;
   }
    
    static function getSSLList()
    {
        $currentuser = ctrl_users::GetUserDetail();
        return self::ListSSL($currentuser['username']);
    }
    
    static function getDomainList()
    {
        $currentuser = ctrl_users::GetUserDetail();
        return self::ListDomains($currentuser['userid']);
    }
    
    static function getCountryList()
    {
        $res = '<option value="AX"> Aland Islands </option><option value="AD"> Andorra </option><option value="AE"> United Arab Emirates </option>option value="AF"> Afghanistan </option><option value="AG"> Antigua and Barbuda </option><option value="AI"> Anguilla </option><option value="AL"> Albania </option><option value="AM"> Armenia </option><option value="AN"> Netherlands Antilles </option><option value="AO"> Angola </option><option value="AQ"> Antarctica </option><option value="AR"> Argentina </option><option value="AS"> American Samoa </option><option value="AT"> Austria </option><option value="AU"> Australia </option><option value="AW"> Aruba </option><option value="AZ"> Azerbaijan </option><option value="BA"> Bosnia and Herzegovina </option><option value="BB"> Barbados </option><option value="BD"> Bangladesh </option><option value="BE"> Belgium </option><option value="BF"> Burkina Faso </option><option value="BG"> Bulgaria </option><option value="BH"> Bahrain </option><option value="BI"> Burundi </option><option value="BJ"> Benin </option><option value="BM"> Bermuda </option><option value="BN"> Brunei Darussalam </option><option value="BO"> Bolivia </option><option value="BR"> Brazil </option><option value="BS"> Bahamas </option><option value="BT"> Bhutan </option><option value="BV"> Bouvet Island </option><option value="BW"> Botswana </option><option value="BZ"> Belize </option><option value="CA"> Canada </option><option value="CC"> Cocos Islands </option><option value="CF"> Central African Republic </option><option value="CH"> Switzerland </option><option value="CI"> Cote D\'Ivoire </option><option value="CK"> Cook Islands </option><option value="CL"> Chile </option><option value="CM"> Cameroon </option><option value="CN"> China </option><option value="CO"> Colombia </option><option value="CR"> Costa Rica </option><option value="CS"> Czechoslovakia </option><option value="CV"> Cape Verde </option><option value="CX"> Christmas Island </option><option value="CY"> Cyprus </option><option value="CZ"> Czech Republic </option><option value="DE"> Germany </option><option value="DJ"> Djibouti </option><option value="DK"> Denmark </option><option value="DM"> Dominica </option><option value="DO"> Dominican Republic </option><option value="DZ"> Algeria </option><option value="EC"> Ecuador </option><option value="EE"> Estonia </option><option value="EG"> Egypt </option><option value="EH"> Western Sahara </option><option value="ER"> Eritrea </option><option value="ES"> Spain </option><option value="ET"> Ethiopia </option><option value="FI"> Finland </option><option value="FJ"> Fiji </option><option value="FK"> Falkland Islands </option><option value="FM"> Micronesia </option><option value="FO"> Faroe Islands </option><option value="FR"> France </option><option value="FX"> France, Metropolitan </option><option value="GA"> Gabon </option><option value="GB"> Great Britain (UK) </option><option value="GD"> Grenada </option><option value="GE"> Georgia </option><option value="GF"> French Guiana </option><option value="GG"> Guernsey </option><option value="GH"> Ghana </option><option value="GI"> Gibraltar </option><option value="GL"> Greenland </option><option value="GM"> Gambia </option><option value="GN"> Guinea </option><option value="GP"> Guadeloupe </option><option value="GQ"> Equatorial Guinea </option><option value="GR"> Greece </option><option value="GT"> Guatemala </option><option value="GU"> Guam </option><option value="GW"> Guinea-Bissau </option><option value="GY"> Guyana </option><option value="HK"> Hong Kong </option><option value="HN"> Honduras </option><option value="HR"> Croatia (Hrvatska) </option><option value="HT"> Haiti </option><option value="HU"> Hungary </option><option value="ID"> Indonesia </option><option value="IE">Ireland </option><option value="IL"> Israel </option><option value="IM"> Isle of Man </option><option value="IN"> India </option><option value="IS"> Iceland </option><option value="IT"> Italy </option><option value="JE"> Jersey </option><option value="JM"> Jamaica </option><option value="JO"> Jordan </option><option value="JP"> Japan </option><option value="KE"> Kenya </option><option value="KG"> Kyrgyzstan </option><option value="KH"> Cambodia </option><option value="KI"> Kiribati </option><option value="KM"> Comoros </option><option value="KN"> Saint Kitts and Nevis </option><option value="KR"> Korea (South) </option><option value="KW"> Kuwait </option><option value="KY"> Cayman Islands </option><option value="KZ"> Kazakhstan </option><option value="LA"> Laos </option><option value="LC"> Saint Lucia </option><option value="LI"> Liechtenstein </option><option value="LK"> Sri Lanka </option><option value="LS"> Lesotho </option><option value="LT"> Lithuania </option><option value="LU"> Luxembourg </option><option value="LV"> Latvia </option><option value="LY"> Libya </option><option value="MA"> Morocco </option><option value="MC"> Monaco </option><option value="MD"> Moldova </option><option value="ME"> Montenegro </option><option value="MG"> Madagascar </option><option value="MH"> Marshall Islands </option><option value="MK"> Macedonia </option><option value="ML"> Mali </option><option value="MM"> Myanmar </option><option value="MN"> Mongolia </option><option value="MO"> Macau </option><option value="MP"> Northern Mariana Islands </option><option value="MQ"> Martinique </option><option value="MR"> Mauritania </option><option value="MS"> Montserrat </option><option value="MT"> Malta </option><option value="MU"> Mauritius </option><option value="MV"> Maldives </option><option value="MW"> Malawi </option><option value="MX"> Mexico </option><option value="MY"> Malaysia </option><option value="MZ"> Mozambique </option><option value="NA"> Namibia </option><option value="NC"> New Caledonia </option><option value="NE"> Niger </option><option value="NF"> Norfolk Island </option><option value="NG"> Nigeria </option><option value="NI"> Nicaragua </option><option value="NL"> Netherlands </option><option value="NO"> Norway </option><option value="NP"> Nepal </option><option value="NR"> Nauru </option><option value="NT"> Neutral Zone </option><option value="NU"> Niue </option><option value="NZ"> New Zealand </option><option value="OM"> Oman </option><option value="PA"> Panama </option><option value="PE"> Peru </option><option value="PF"> French Polynesia </option><option value="PG">Papua New Guinea </option><option value="PH"> Philippines </option><option value="PK"> Pakistan </option><option value="PL"> Poland </option><option value="PM"> St. Pierre and Miquelon </option><option value="PN"> Pitcairn </option><option value="PR"> Puerto Rico </option><option value="PS"> Palestinian Territory </option><option value="PT"> Portugal </option><option value="PW"> Palau </option><option value="PY"> Paraguay </option><option value="QA"> Qatar </option><option value="RE"> Reunion </option><option value="RO"> Romania </option><option value="RS"> Serbia </option><option value="RU"> Russian Federation </option><option value="RW"> Rwanda </option><option value="SA"> Saudi Arabia </option><option value="SB"> Solomon Islands </option><option value="SC"> Seychelles </option><option value="SE"> Sweden </option><option value="SG"> Singapore </option><option value="SH"> St. Helena </option><option value="SI"> Slovenia </option><option value="SK"> Slovak Republic </option><option value="SL"> Sierra Leone </option><option value="SM"> San Marino </option><option value="SN"> Senegal </option><option value="SR"> Suriname </option><option value="ST"> Sao Tome and Principe </option><option value="SU"> USSR </option><option value="SV"> El Salvador </option><option value="SZ"> Swaziland </option><option value="TC"> Turks and Caicos Islands </option><option value="TD"> Chad </option><option value="TG"> Togo </option><option value="TH"> Thailand </option><option value="TJ"> Tajikistan </option><option value="TK"> Tokelau </option><option value="TM"> Turkmenistan </option><option value="TN"> Tunisia </option><option value="TO"> Tonga </option><option value="TP"> East Timor </option><option value="TR"> Turkey </option><option value="TT"> Trinidad and Tobago </option><option value="TV"> Tuvalu </option><option value="TW"> Taiwan </option><option value="TZ"> Tanzania </option><option value="UA"> Ukraine </option><option value="UG"> Uganda </option><option value="US"> United States </option><option value="UY"> Uruguay </option><option value="UZ"> Uzbekistan </option><option value="VA"> Vatican City State</option><option value="VE"> Venezuela </option><option value="VG"> Virgin Islands </option><option value="VN"> Viet Nam </option><option value="VU"> Vanuatu </option><option value="WS"> Samoa </option><option value="YE"> Yemen </option><option value="YT"> Mayotte </option><option value="ZA"> South Africa </option><option value="ZM"> Zambia </option>';
        return $res;
    }
    
    static function getModuleName()
    {
        $module_name = ui_language::translate(ui_module::GetModuleName());
        return $module_name;
   }
    
   static function getModuleIcon()
    {
       global $controller;
       $module_icon = "modules/" . $controller->GetControllerRequest('URL', 'module') . "/assets/icon.png";
       return $module_icon;
   }

   static function getModulePath()
    {
       global $controller;
       $module_path = "modules/" . $controller->GetControllerRequest('URL', 'module') . "/";
       return $module_path;
   }

   static function getModuleDesc()
    {
       $message = ui_language::translate(ui_module::GetModuleDescription());
       return $message;
   }
    
   static function getCSFR_Tag()
    {
       return runtime_csfr::Token();
   }
    
    static function getResult()
   {
         if (self::$ok) {
           return ui_sysmessage::shout(ui_language::translate("Your SSL certificate is installed. A secure connection will be available within an hour."), "zannounceok");
       }
        if (self::$error) {
           return ui_sysmessage::shout(ui_language::translate("A certificate with that name already exists."), "zannounceerror");
       }
        if (self::$empty) {
           return ui_sysmessage::shout(ui_language::translate("An empty field is not allowed."), "zannounceerror");
       }
        if (self::$reqadd) {
           return ui_sysmessage::shout(ui_language::translate("Certificate Signing Request was made and sent to the mail you have entered."), "zannounceok");
       }
        if (self::$del) {
           return ui_sysmessage::shout(ui_language::translate("The selected certificate has been deleted."), "zannounceerror");
       }
       return;
   }
    
}

?>
Reply
Thanks given by:
#27
RE: [Module] Certificate Manager
YI have managed to get SSL working on my site www.petron-lofts.co.uk but I am not sure how to make the front end http and backend https any help would be appreciated
Reply
Thanks given by:
#28
RE: [Module] Certificate Manager
open your httpd-vhost.conf

copy yourr domain to notepad ad make it like this

but use your own config
Code:
</virtualhost>
<virtualhost *:443>
ServerName Domain.tld
ServerAlias  www.Domain.tld
ServerAdmin carsten@alio.dk
DocumentRoot "/var/sentora/hostdata/zadmin/public_html/Doamin.tld/patchtoadminpart"
ErrorLog "/var/sentora/logs/domains/zadmin/domain.tld-error.log"
CustomLog "/var/sentora/logs/domains/zadmin/domain.tld.log" combined
CustomLog "/var/sentora/logs/domains/zadmin/domain.tld.log" common
<Directory "/var/sentora/hostdata/zadmin/public_html/Doamin.tld/patchtoadminpart">
 Options +FollowSymLinks -Indexes
 AllowOverride All
 Require all granted
</Directory>
AddType application/x-httpd-php .php3 .php
ErrorDocument 500 /_errorpages/500.html
ErrorDocument 403 /_errorpages/403.html
ErrorDocument 404 /_errorpages/404.html
ErrorDocument 510 /_errorpages/510.html
DirectoryIndex index.html index.htm index.php index.asp index.aspx index.jsp index.jspa index.shtml index.shtm
SSLEngine On
SSLCertificateFile /var/sentora/hostdata/zadmin/ssl/alio_dk/domain.tld.crt
SSLCertificateKeyFile /var/sentora/hostdata/zadmin/ssl/domain.tld/domain.tld.key
SSLCACertificateFile /var/sentora/hostdata/zadmin/ssl/domain.tld/intermediate.crt
SSLProtocol All -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+AESGCM EECDH EDH+AESGCM EDH+aRSA HIGH !MEDIUM !LOW !aNULL !eNUL$
open your apache config in the panel
open Module Admin -> Apache Config -> select your domain
Remove 443 from Port Override
uncheck Forward Port 80 to Overriden Port
remove the line between # Made from Cert manager start and # Made from Cert manager end
and add the line in your notepad and wait 5 min

Remember to use your own vhost file

Centos and ubuntu vhost are not the same
Sentora 1.0.3 on [Image: DO_Logo_Horizontal_Blue-3db19536.png]

-= Github =-  -= My Repo =-

My Modules
Reply
Thanks given by:
#29
RE: [Module] Certificate Manager
(10-10-2015, 03:19 PM)MarkDark Wrote: I have a module for the SSL Manager for AWServer with ZPanelX it works fine but is based on the individual config files.
my SSL Manager integrated in version AWServer with ZPanelX 2.2
For create ssl certificates used tools openssl.exe
work fine Smile 

It's my controller.ext.php (module SSL Manager)
I use your idea - ssl module
Thanks!


Code:
class module_controller
{

    static $ok;
    static $error;
    static $empty;
    static $reqadd;
    static $del;

    static function ListDomains($uid)
    {
        global $zdbh;
        global $controller;
        $currentuser = ctrl_users::GetUserDetail($uid);
        $sql = "SELECT * FROM x_vhosts WHERE vh_acc_fk=:userid AND vh_enabled_in=1 AND vh_deleted_ts IS NULL ORDER BY vh_name_vc ASC";
        $numrows = $zdbh->prepare($sql);
        $numrows->bindParam(':userid', $currentuser['userid']);
        $numrows->execute();
        if ($numrows->fetchColumn() <> 0) {
            $sql = $zdbh->prepare($sql);
            $sql->bindParam(':userid', $currentuser['userid']);
            $res = array();
            $sql->execute();
        while ($rowdomains = $sql->fetch()) {
            $res[] = array('domain' => $rowdomains['vh_name_vc']);
        }
           return $res;
       } else {
            return false;
        }
    }
    
    static function ListSSL($uname)
    {
        global $zdbh;
        global $controller;
        if (!is_dir("" . ctrl_options::GetSystemOption('hosted_dir') . $uname ."/ssl/") ) {
                mkdir("" . ctrl_options::GetSystemOption('hosted_dir') . $uname ."/ssl/", 0777);
        }
        $dir = ctrl_options::GetSystemOption('hosted_dir') . $uname ."/ssl/";
        if(substr($dir, -1) != "/") $dir .= "/";
        $d = @dir($dir);
        while(false !== ($entry = $d->read())) {
            $entryssl = str_replace('_', '.', $entry);
            if($entry[0] == ".") continue;
            $retval[] = array("name" => "$entryssl");
        }
   $d->close();
        return $retval;
    }

    static function ExecuteDeleteSSL($domain, $username)
    {
        global $zdbh;
        global $controller;
        $domainssl = str_replace('.', '_', $domain);
        $dir = ctrl_options::GetSystemOption('hosted_dir') . $username ."/ssl/". $domainssl;
        $objects = scandir($dir);
        foreach ($objects as $object) {
        if ($object != "." && $object != "..") {
            unlink($dir."/".$object);
        }
    }
        reset($objects);
        rmdir($dir);
        unlink("C:/AWServer/bin/apache/conf/ssl-vhost/" . $domain . ".conf");    
        unlink("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/". $domain .".key");
        unlink("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/". $domain .".crt");
        
        self::$del = true;
        return true;
        
    }
    
    static function SetWriteApacheConfigTrue() {
        global $zdbh;
        $sql = $zdbh->prepare("UPDATE x_settings
                                SET so_value_tx='true'
                                WHERE so_name_vc='apache_changed'");
        $sql->execute();
    }
    
    static function ExecuteCSR($domain, $name, $address, $city, $country, $company, $department)
    {
        global $zdbh;
        global $controller;
        $currentuser = ctrl_users::GetUserDetail();
        $formvars = $controller->GetAllControllerRequests('FORM');
        if (!is_dir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/") ) {
                mkdir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/", 0777);
            }
        $dn = array(
                        "countryName"            => "$country",
                        "stateOrProvinceName"    => "$name",
                        "localityName"            => "$city",
                        "organizationName"        => "$company",
                        "departmentName"        => "$department",
                        "commonName"            => "$domain",
                        "emailAddress"            => "$address"
                    );

        // Make key and signing request SSL certificate
        @exec("C:/AWServer/bin/apache/bin/openssl.exe genrsa -out " . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/". $domain .".key 2048");
        @exec("C:/AWServer/bin/apache/bin/openssl.exe req -new -key " . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/". $domain .".key -out " . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/". $domain .".csr -subj /C=". $country ."/ST=". $name ."/L=". $city ."/O=". $company = str_replace(' ', '-' ,$company) ."/OU=". $department = str_replace(' ', '-' ,$department) ."/CN=". $domain ."/emailAddress=". $address . "");
        unlink("C:/.rnd");
        
        $email = $address;
        $emailsubject = "Certificate Signing Request";
        $emailbody = "Hi $currentuser[fullname] \n\nYour application is made.\nYour request to signing SSL certificate for domain - $domain.csr \nYour private key for domain - $domain.key \nSee  attachments. \n\nBest Regards. \nYour hosting company";

        $phpmailer = new sys_email();
        $phpmailer->Subject = $emailsubject;
        $phpmailer->Body = $emailbody;
        $phpmailer->AddAttachment("". ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/".$domain.".key");
        $phpmailer->AddAttachment("". ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/".$domain.".csr");
        $phpmailer->AddAddress($email);
        $phpmailer->SendEmail();

        unlink("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/".$domain.".key");
        unlink("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/".$domain.".csr");
        rmdir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/key/");

        self::$reqadd = true;
        return true;
    }

    static function ExecuteMakeSSL($domain, $name, $address, $city, $country)
    {
        global $zdbh;
        global $controller;
        $currentuser = ctrl_users::GetUserDetail();
        $formvars = $controller->GetAllControllerRequests('FORM');
        $rootdir = str_replace('.', '_', $domain);
                
        if (!is_dir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/") ) {
                mkdir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/", 0777);
            }
        if (!is_dir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/") ) {
                mkdir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/", 0777);
        } else {
            self::$error = true;
            return false;
        }
        
        $dn = array(
                        "countryName"            => "$country",
                        "stateOrProvinceName"    => "$name",
                        "localityName"            => "$city",
                        "commonName"            => "$domain",
                        "emailAddress"            => "$address"
                    );

        // Make key and self-signed SSL certificate
        @exec("C:/AWServer/bin/apache/bin/openssl.exe req -new -x509 -nodes -days 3660 -newkey rsa:2048 -keyout " . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/". $domain .".key -out " . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/". $domain .".crt -subj /C=". $country ."/ST=". $name ."/L=". $city ."/O=AWServer/OU=Hosting/CN=". $domain ."/emailAddress=". $address . "");
        unlink("C:/AWServer/panel/.rnd");

        // Get the values ​​of PHP memory limit their module in the package
        $rows = $zdbh->prepare("SELECT * FROM x_quotas WHERE qt_package_fk=" . $currentuser['packageid']);
        $rows->execute();
        $quotasinfo = $rows->fetch();
        
        // Writing ssl configuration file
        $handle = fopen("C:/AWServer/bin/apache/conf/ssl-vhost/". $domain .".conf", "w+");
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = "# Generated by AWServer with ZPanelX SSL VHost configurations below #\n";
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = " \n";
        fwrite($handle, $write);
        $write = "NameVirtualHost *:443\n";
        fwrite($handle, $write);
        $write = " \n";
        fwrite($handle, $write);
        $write = "<VirtualHost *:443>\n";
        fwrite($handle, $write);
        $write = "    ServerName $domain\n";
        fwrite($handle, $write);
        $write = "    ServerAlias $domain www.$domain\n";
        fwrite($handle, $write);
        $write = "    ServerAdmin $currentuser[email]\n";
        fwrite($handle, $write);
        $write = "    SSLEngine On\n";
        fwrite($handle, $write);
        $write = "    SSLCertificateFile \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/ssl/$rootdir/$domain.crt\"\n";
        fwrite($handle, $write);
        $write = "    SSLCertificateKeyFile \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/ssl/$rootdir/$domain.key\"\n";
        fwrite($handle, $write);
        $write = "    php_admin_value open_basedir \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir" . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/tmp" . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('openbase_temp') . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('pear_path') . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('imagick_path') . "\"\n";
        fwrite($handle, $write);
        $write = "    " . ctrl_options::GetSystemOption('suhosin_value') . "\n";
        fwrite($handle, $write);
        $write = "    php_admin_value upload_tmp_dir \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/tmp\"\n";
        fwrite($handle, $write);
        $write = "    php_admin_value session.save_path \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/tmp\"\n";
        fwrite($handle, $write);
        $write = "    php_admin_value memory_limit " . $quotasinfo['qt_memlimit_mb'] . "M"."\n";
        fwrite($handle, $write);
        $write = "    ErrorLog \"" . ctrl_options::GetSystemOption('log_dir') . "domains/$currentuser[username]/$domain-error.log\"\n";
        fwrite($handle, $write);
        $write = "    CustomLog \"" . ctrl_options::GetSystemOption('log_dir') . "domains/$currentuser[username]/$domain-access.log\" " . ctrl_options::GetSystemOption('access_log_format') . "\n";
        fwrite($handle, $write);
        $write = "    CustomLog \"" . ctrl_options::GetSystemOption('log_dir') . "domains/$currentuser[username]/$domain-bandwidth.log\" " . ctrl_options::GetSystemOption('bandwidth_log_format') . "\n";
        fwrite($handle, $write);
        $write = "    DocumentRoot \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir\"\n";
        fwrite($handle, $write);
        $write = "<Directory \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir\">\n";
        fwrite($handle, $write);
        $write = "    Options FollowSymLinks\n";
        fwrite($handle, $write);
        $write = "    AllowOverride All\n";
        fwrite($handle, $write);
        $write = "    Order Allow,Deny\n";
        fwrite($handle, $write);
        $write = "    Allow from all\n";
        fwrite($handle, $write);
        $write = "</Directory>\n";
        fwrite($handle, $write);
        $write = "    ". ctrl_options::GetSystemOption('dir_index') . "\n";
        fwrite($handle, $write);
        $write = "    ". ctrl_options::GetSystemOption('php_handler') . "\n";
        fwrite($handle, $write);
        $write = "    ScriptAlias /cgi-bin/ \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir/_cgi-bin\"\n";
        fwrite($handle, $write);
        $write = "" . ctrl_options::GetSystemOption('cgi_handler') . "\n";
        fwrite($handle, $write);
        $write = " \n";
        fwrite($handle, $write);
        $write = "    # Custom global settings are loaded below this line (if any exist)\n";
        fwrite($handle, $write);
        $write = "    ". ctrl_options::GetSystemOption('global_vhcustom') . "\n";
        fwrite($handle, $write);
        $write = "</VirtualHost>\n";
        fwrite($handle, $write);
        fclose($handle);

        // Writing .htaccess file
        $handle = fopen("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/public_html/". $rootdir ."/".".htaccess", "w+");
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = "# Generated by AWServer with ZPanelX SSL VHost configurations below #\n";
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = " \n";
        $write = "RewriteEngine On\n";
        fwrite($handle, $write);
        $write = "RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]\n";
        fwrite($handle, $write);
        $write = "RewriteRule ^(.*)$ http://%1/$1 [R=301,L]\n";
        fwrite($handle, $write);
        $write = "RewriteCond %{SERVER_PORT} !^443$\n";
        fwrite($handle, $write);
        $write = "RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]\n";
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        fclose($handle);            
        
        // Restart apache during the next start daemon
        self::SetWriteApacheConfigTrue();
        self::$ok = true;
        return true;
    }
    
    static function doUploadSSL()
    {
        global $zdbh;
        global $controller;
        $currentuser = ctrl_users::GetUserDetail();
        $formvars = $controller->GetAllControllerRequests('FORM');
        $domain = $formvars["inDomain"];
        $rootdir = str_replace('.', '_', $domain);
        if (empty($_FILES["inKEY"]["name"]) || empty($_FILES["inWCA"]["name"])) {
        self::$empty = true;
        return false;
        }
        if (!is_dir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/") ) {
                mkdir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/", 0777);
            }
        if (!is_dir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/") ) {
                mkdir("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/", 0777);
        } else {
            self::$error = true;
            return false;
        }
            
        $target_dir = "" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/ssl/". $rootdir ."/";
            
        $uploadwcrt    = $target_dir . $domain . ".crt";
        $uploadkey    = $target_dir . $domain . ".key";
        $uploadicrt    = $target_dir . $domain . ".ca-bundle";
            
        move_uploaded_file($_FILES["inWCA"]["tmp_name"], $uploadwcrt);
        move_uploaded_file($_FILES["inKEY"]["tmp_name"], $uploadkey);
        move_uploaded_file($_FILES["inICA"]["tmp_name"], $uploadicrt);

        // Get the values ​​of PHP memory limit their module in the package
        $rows = $zdbh->prepare("SELECT * FROM x_quotas WHERE qt_package_fk=" . $currentuser['packageid']);
        $rows->execute();
        $quotasinfo = $rows->fetch();        

        // Writing ssl configuration file
        $handle = fopen("C:/AWServer/bin/apache/conf/ssl-vhost/". $domain .".conf", "w+");
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = "# Generated by AWServer with ZPanelX SSL VHost configurations below #\n";
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = " \n";
        fwrite($handle, $write);
        $write = "NameVirtualHost *:443\n";
        fwrite($handle, $write);
        $write = " \n";
        fwrite($handle, $write);
        $write = "<VirtualHost *:443>\n";
        fwrite($handle, $write);
        $write = "    ServerName $domain\n";
        fwrite($handle, $write);
        $write = "    ServerAlias $domain www.$domain\n";
        fwrite($handle, $write);
        $write = "    ServerAdmin $currentuser[email]\n";
        fwrite($handle, $write);
        $write = "    SSLEngine On\n";
        fwrite($handle, $write);
        $write = "    SSLCertificateFile \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/ssl/$rootdir/$domain.crt\"\n";
        fwrite($handle, $write);
        $write = "    SSLCertificateKeyFile \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/ssl/$rootdir/$domain.key\"\n";
        fwrite($handle, $write);
        $write = "    SSLCertificateChainFile    \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/ssl/$rootdir/$domain.ca-bundle\"\n";            
        fwrite($handle, $write);
        $write = "    php_admin_value open_basedir \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir" . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/tmp" . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('openbase_temp') . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('pear_path') . ctrl_options::GetSystemOption('openbase_seperator') . ctrl_options::GetSystemOption('imagick_path') . "\"\n";
        fwrite($handle, $write);
        $write = "    " . ctrl_options::GetSystemOption('suhosin_value') . "\n";
        fwrite($handle, $write);
        $write = "    php_admin_value upload_tmp_dir \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/tmp\"\n";
        fwrite($handle, $write);
        $write = "    php_admin_value session.save_path \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/tmp\"\n";
        fwrite($handle, $write);
        $write = "    php_admin_value memory_limit " . $quotasinfo['qt_memlimit_mb'] . "M"."\n";
        fwrite($handle, $write);
        $write = "    ErrorLog \"" . ctrl_options::GetSystemOption('log_dir') . "domains/$currentuser[username]/$domain-error.log\"\n";
        fwrite($handle, $write);
        $write = "    CustomLog \"" . ctrl_options::GetSystemOption('log_dir') . "domains/$currentuser[username]/$domain-access.log\" " . ctrl_options::GetSystemOption('access_log_format') . "\n";
        fwrite($handle, $write);
        $write = "    CustomLog \"" . ctrl_options::GetSystemOption('log_dir') . "domains/$currentuser[username]/$domain-bandwidth.log\" " . ctrl_options::GetSystemOption('bandwidth_log_format') . "\n";
        fwrite($handle, $write);
        $write = "    DocumentRoot \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir/\"\n";
        fwrite($handle, $write);
        $write = "<Directory \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir/\">\n";
        fwrite($handle, $write);
        $write = "    Options FollowSymLinks\n";
        fwrite($handle, $write);
        $write = "    AllowOverride All\n";
        fwrite($handle, $write);
        $write = "    Order Allow,Deny\n";
        fwrite($handle, $write);
        $write = "    Allow from all\n";
        fwrite($handle, $write);
        $write = "</Directory>\n";
        fwrite($handle, $write);
        $write = "    ". ctrl_options::GetSystemOption('dir_index') . "\n";
        fwrite($handle, $write);
        $write = "    ". ctrl_options::GetSystemOption('php_handler') . "\n";
        fwrite($handle, $write);
        $write = "    ScriptAlias /cgi-bin/ \"" . ctrl_options::GetSystemOption('hosted_dir') . "$currentuser[username]/public_html/$rootdir/_cgi-bin\"\n";
        fwrite($handle, $write);
        $write = "" . ctrl_options::GetSystemOption('cgi_handler') . "\n";
        fwrite($handle, $write);
        $write = " \n";
        fwrite($handle, $write);
        $write = "    # Custom global settings are loaded below this line (if any exist)\n";
        fwrite($handle, $write);
        $write = "    ". ctrl_options::GetSystemOption('global_vhcustom') . "\n";
        fwrite($handle, $write);
        $write = "</VirtualHost>\n";
        fwrite($handle, $write);
        fclose($handle);

        // Writing .htaccess file
        $handle = fopen("" . ctrl_options::GetSystemOption('hosted_dir') . $currentuser["username"] ."/public_html/". $rootdir ."/".".htaccess", "w+");
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = "# Generated by AWServer with ZPanelX SSL VHost configurations below #\n";
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        $write = " \n";
        $write = "RewriteEngine On\n";
        fwrite($handle, $write);
        $write = "RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]\n";
        fwrite($handle, $write);
        $write = "RewriteRule ^(.*)$ http://%1/$1 [R=301,L]\n";
        fwrite($handle, $write);
        $write = "RewriteCond %{SERVER_PORT} !^443$\n";
        fwrite($handle, $write);
        $write = "RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]\n";
        fwrite($handle, $write);
        $write = "#####################################################################\n";
        fwrite($handle, $write);
        fclose($handle);
        
        // Restart apache during the next start daemon
        self::SetWriteApacheConfigTrue();
        self::$ok = true;
        return true;
    }

    static function doMakeNewSSL()
   {
       global $controller;
       runtime_csfr::Protect();
       $currentuser = ctrl_users::GetUserDetail();
       $formvars = $controller->GetAllControllerRequests('FORM');
        if (empty($formvars['inDomain']) || empty($formvars['inName']) || empty($formvars['inAddress']) || empty($formvars['inCity']) || empty($formvars['inCountry'])) {
        self::$empty = true;
        return false; }
       if (self::ExecuteMakeSSL($formvars['inDomain'], $formvars['inName'], $formvars['inAddress'], $formvars['inCity'], $formvars['inCountry']))
       return true;
   }

    static function doMakeCSR()
   {
       global $controller;
       runtime_csfr::Protect();
       $currentuser = ctrl_users::GetUserDetail();
       $formvars = $controller->GetAllControllerRequests('FORM');
        if (empty($formvars['inDomain']) || empty($formvars['inName']) || empty($formvars['inAddress']) || empty($formvars['inCity']) || empty($formvars['inCountry']) || empty($formvars['inCompany']) || empty($formvars['inDepartment'])) {
        self::$empty = true;
        return false; }
       if (self::ExecuteCSR($formvars['inDomain'], $formvars['inName'], $formvars['inAddress'], $formvars['inCity'], $formvars['inCountry'], $formvars['inCompany'], $formvars['inDepartment']))
       return true;
   }    
    
    static function doDeleteSSL()
    {
        global $controller;
        runtime_csfr::Protect();
        $currentuser = ctrl_users::GetUserDetail();
        $formvars = $controller->GetAllControllerRequests('FORM');
        if (self::ExecuteDeleteSSL($formvars['inName'], $currentuser["username"]))
        return true;
   }
    
    static function getSSLList()
    {
        $currentuser = ctrl_users::GetUserDetail();
        return self::ListSSL($currentuser['username']);
    }
    
    static function getDomainList()
    {
        $currentuser = ctrl_users::GetUserDetail();
        return self::ListDomains($currentuser['userid']);
    }
    
    static function getCountryList()
    {
        $res = '<option value="AX"> Aland Islands </option><option value="AD"> Andorra </option><option value="AE"> United Arab Emirates </option>option value="AF"> Afghanistan </option><option value="AG"> Antigua and Barbuda </option><option value="AI"> Anguilla </option><option value="AL"> Albania </option><option value="AM"> Armenia </option><option value="AN"> Netherlands Antilles </option><option value="AO"> Angola </option><option value="AQ"> Antarctica </option><option value="AR"> Argentina </option><option value="AS"> American Samoa </option><option value="AT"> Austria </option><option value="AU"> Australia </option><option value="AW"> Aruba </option><option value="AZ"> Azerbaijan </option><option value="BA"> Bosnia and Herzegovina </option><option value="BB"> Barbados </option><option value="BD"> Bangladesh </option><option value="BE"> Belgium </option><option value="BF"> Burkina Faso </option><option value="BG"> Bulgaria </option><option value="BH"> Bahrain </option><option value="BI"> Burundi </option><option value="BJ"> Benin </option><option value="BM"> Bermuda </option><option value="BN"> Brunei Darussalam </option><option value="BO"> Bolivia </option><option value="BR"> Brazil </option><option value="BS"> Bahamas </option><option value="BT"> Bhutan </option><option value="BV"> Bouvet Island </option><option value="BW"> Botswana </option><option value="BZ"> Belize </option><option value="CA"> Canada </option><option value="CC"> Cocos Islands </option><option value="CF"> Central African Republic </option><option value="CH"> Switzerland </option><option value="CI"> Cote D\'Ivoire </option><option value="CK"> Cook Islands </option><option value="CL"> Chile </option><option value="CM"> Cameroon </option><option value="CN"> China </option><option value="CO"> Colombia </option><option value="CR"> Costa Rica </option><option value="CS"> Czechoslovakia </option><option value="CV"> Cape Verde </option><option value="CX"> Christmas Island </option><option value="CY"> Cyprus </option><option value="CZ"> Czech Republic </option><option value="DE"> Germany </option><option value="DJ"> Djibouti </option><option value="DK"> Denmark </option><option value="DM"> Dominica </option><option value="DO"> Dominican Republic </option><option value="DZ"> Algeria </option><option value="EC"> Ecuador </option><option value="EE"> Estonia </option><option value="EG"> Egypt </option><option value="EH"> Western Sahara </option><option value="ER"> Eritrea </option><option value="ES"> Spain </option><option value="ET"> Ethiopia </option><option value="FI"> Finland </option><option value="FJ"> Fiji </option><option value="FK"> Falkland Islands </option><option value="FM"> Micronesia </option><option value="FO"> Faroe Islands </option><option value="FR"> France </option><option value="FX"> France, Metropolitan </option><option value="GA"> Gabon </option><option value="GB"> Great Britain (UK) </option><option value="GD"> Grenada </option><option value="GE"> Georgia </option><option value="GF"> French Guiana </option><option value="GG"> Guernsey </option><option value="GH"> Ghana </option><option value="GI"> Gibraltar </option><option value="GL"> Greenland </option><option value="GM"> Gambia </option><option value="GN"> Guinea </option><option value="GP"> Guadeloupe </option><option value="GQ"> Equatorial Guinea </option><option value="GR"> Greece </option><option value="GT"> Guatemala </option><option value="GU"> Guam </option><option value="GW"> Guinea-Bissau </option><option value="GY"> Guyana </option><option value="HK"> Hong Kong </option><option value="HN"> Honduras </option><option value="HR"> Croatia (Hrvatska) </option><option value="HT"> Haiti </option><option value="HU"> Hungary </option><option value="ID"> Indonesia </option><option value="IE">Ireland </option><option value="IL"> Israel </option><option value="IM"> Isle of Man </option><option value="IN"> India </option><option value="IS"> Iceland </option><option value="IT"> Italy </option><option value="JE"> Jersey </option><option value="JM"> Jamaica </option><option value="JO"> Jordan </option><option value="JP"> Japan </option><option value="KE"> Kenya </option><option value="KG"> Kyrgyzstan </option><option value="KH"> Cambodia </option><option value="KI"> Kiribati </option><option value="KM"> Comoros </option><option value="KN"> Saint Kitts and Nevis </option><option value="KR"> Korea (South) </option><option value="KW"> Kuwait </option><option value="KY"> Cayman Islands </option><option value="KZ"> Kazakhstan </option><option value="LA"> Laos </option><option value="LC"> Saint Lucia </option><option value="LI"> Liechtenstein </option><option value="LK"> Sri Lanka </option><option value="LS"> Lesotho </option><option value="LT"> Lithuania </option><option value="LU"> Luxembourg </option><option value="LV"> Latvia </option><option value="LY"> Libya </option><option value="MA"> Morocco </option><option value="MC"> Monaco </option><option value="MD"> Moldova </option><option value="ME"> Montenegro </option><option value="MG"> Madagascar </option><option value="MH"> Marshall Islands </option><option value="MK"> Macedonia </option><option value="ML"> Mali </option><option value="MM"> Myanmar </option><option value="MN"> Mongolia </option><option value="MO"> Macau </option><option value="MP"> Northern Mariana Islands </option><option value="MQ"> Martinique </option><option value="MR"> Mauritania </option><option value="MS"> Montserrat </option><option value="MT"> Malta </option><option value="MU"> Mauritius </option><option value="MV"> Maldives </option><option value="MW"> Malawi </option><option value="MX"> Mexico </option><option value="MY"> Malaysia </option><option value="MZ"> Mozambique </option><option value="NA"> Namibia </option><option value="NC"> New Caledonia </option><option value="NE"> Niger </option><option value="NF"> Norfolk Island </option><option value="NG"> Nigeria </option><option value="NI"> Nicaragua </option><option value="NL"> Netherlands </option><option value="NO"> Norway </option><option value="NP"> Nepal </option><option value="NR"> Nauru </option><option value="NT"> Neutral Zone </option><option value="NU"> Niue </option><option value="NZ"> New Zealand </option><option value="OM"> Oman </option><option value="PA"> Panama </option><option value="PE"> Peru </option><option value="PF"> French Polynesia </option><option value="PG">Papua New Guinea </option><option value="PH"> Philippines </option><option value="PK"> Pakistan </option><option value="PL"> Poland </option><option value="PM"> St. Pierre and Miquelon </option><option value="PN"> Pitcairn </option><option value="PR"> Puerto Rico </option><option value="PS"> Palestinian Territory </option><option value="PT"> Portugal </option><option value="PW"> Palau </option><option value="PY"> Paraguay </option><option value="QA"> Qatar </option><option value="RE"> Reunion </option><option value="RO"> Romania </option><option value="RS"> Serbia </option><option value="RU"> Russian Federation </option><option value="RW"> Rwanda </option><option value="SA"> Saudi Arabia </option><option value="SB"> Solomon Islands </option><option value="SC"> Seychelles </option><option value="SE"> Sweden </option><option value="SG"> Singapore </option><option value="SH"> St. Helena </option><option value="SI"> Slovenia </option><option value="SK"> Slovak Republic </option><option value="SL"> Sierra Leone </option><option value="SM"> San Marino </option><option value="SN"> Senegal </option><option value="SR"> Suriname </option><option value="ST"> Sao Tome and Principe </option><option value="SU"> USSR </option><option value="SV"> El Salvador </option><option value="SZ"> Swaziland </option><option value="TC"> Turks and Caicos Islands </option><option value="TD"> Chad </option><option value="TG"> Togo </option><option value="TH"> Thailand </option><option value="TJ"> Tajikistan </option><option value="TK"> Tokelau </option><option value="TM"> Turkmenistan </option><option value="TN"> Tunisia </option><option value="TO"> Tonga </option><option value="TP"> East Timor </option><option value="TR"> Turkey </option><option value="TT"> Trinidad and Tobago </option><option value="TV"> Tuvalu </option><option value="TW"> Taiwan </option><option value="TZ"> Tanzania </option><option value="UA"> Ukraine </option><option value="UG"> Uganda </option><option value="US"> United States </option><option value="UY"> Uruguay </option><option value="UZ"> Uzbekistan </option><option value="VA"> Vatican City State</option><option value="VE"> Venezuela </option><option value="VG"> Virgin Islands </option><option value="VN"> Viet Nam </option><option value="VU"> Vanuatu </option><option value="WS"> Samoa </option><option value="YE"> Yemen </option><option value="YT"> Mayotte </option><option value="ZA"> South Africa </option><option value="ZM"> Zambia </option>';
        return $res;
    }
    
    static function getModuleName()
    {
        $module_name = ui_language::translate(ui_module::GetModuleName());
        return $module_name;
   }
    
   static function getModuleIcon()
    {
       global $controller;
       $module_icon = "modules/" . $controller->GetControllerRequest('URL', 'module') . "/assets/icon.png";
       return $module_icon;
   }

   static function getModulePath()
    {
       global $controller;
       $module_path = "modules/" . $controller->GetControllerRequest('URL', 'module') . "/";
       return $module_path;
   }

   static function getModuleDesc()
    {
       $message = ui_language::translate(ui_module::GetModuleDescription());
       return $message;
   }
    
   static function getCSFR_Tag()
    {
       return runtime_csfr::Token();
   }
    
    static function getResult()
   {
         if (self::$ok) {
           return ui_sysmessage::shout(ui_language::translate("Your SSL certificate is installed. A secure connection will be available within an hour."), "zannounceok");
       }
        if (self::$error) {
           return ui_sysmessage::shout(ui_language::translate("A certificate with that name already exists."), "zannounceerror");
       }
        if (self::$empty) {
           return ui_sysmessage::shout(ui_language::translate("An empty field is not allowed."), "zannounceerror");
       }
        if (self::$reqadd) {
           return ui_sysmessage::shout(ui_language::translate("Certificate Signing Request was made and sent to the mail you have entered."), "zannounceok");
       }
        if (self::$del) {
           return ui_sysmessage::shout(ui_language::translate("The selected certificate has been deleted."), "zannounceerror");
       }
       return;
   }
    
}

?>

i will  Work on a update that Works on Windows i hope
Sentora 1.0.3 on [Image: DO_Logo_Horizontal_Blue-3db19536.png]

-= Github =-  -= My Repo =-

My Modules
Reply
Thanks given by:
#30
RE: [Module] Certificate Manager
(10-11-2015, 11:31 PM)Diablo925 Wrote: open your httpd-vhost.conf

copy yourr domain to notepad ad make it like this

but use your own config
Code:
</virtualhost>
<virtualhost *:443>
ServerName Domain.tld
ServerAlias  www.Domain.tld
ServerAdmin carsten@alio.dk
DocumentRoot "/var/sentora/hostdata/zadmin/public_html/Doamin.tld/patchtoadminpart"
ErrorLog "/var/sentora/logs/domains/zadmin/domain.tld-error.log"
CustomLog "/var/sentora/logs/domains/zadmin/domain.tld.log" combined
CustomLog "/var/sentora/logs/domains/zadmin/domain.tld.log" common
<Directory "/var/sentora/hostdata/zadmin/public_html/Doamin.tld/patchtoadminpart">
 Options +FollowSymLinks -Indexes
 AllowOverride All
 Require all granted
</Directory>
AddType application/x-httpd-php .php3 .php
ErrorDocument 500 /_errorpages/500.html
ErrorDocument 403 /_errorpages/403.html
ErrorDocument 404 /_errorpages/404.html
ErrorDocument 510 /_errorpages/510.html
DirectoryIndex index.html index.htm index.php index.asp index.aspx index.jsp index.jspa index.shtml index.shtm
SSLEngine On
SSLCertificateFile /var/sentora/hostdata/zadmin/ssl/alio_dk/domain.tld.crt
SSLCertificateKeyFile /var/sentora/hostdata/zadmin/ssl/domain.tld/domain.tld.key
SSLCACertificateFile /var/sentora/hostdata/zadmin/ssl/domain.tld/intermediate.crt
SSLProtocol All -SSLv2 -SSLv3
SSLHonorCipherOrder on
SSLCipherSuite "EECDH+ECDSA+AESGCM EECDH+aRSA+AESGCM EECDH+ECDSA+SHA384 EECDH+ECDSA+SHA256 EECDH+aRSA+SHA384 EECDH+aRSA+SHA256 EECDH+AESGCM EECDH EDH+AESGCM EDH+aRSA HIGH !MEDIUM !LOW !aNULL !eNUL$
open your apache config in the panel
open Module Admin -> Apache Config -> select your domain
Remove 443 from Port Override
uncheck Forward Port 80 to Overriden Port
remove the line between # Made from Cert manager start and # Made from Cert manager end
and add the line in your notepad and wait 5 min

Remember to use your own vhost file

Centos and ubuntu vhost are not the same

I have done this ad it has stopped the SSL from front end but gives error: ERR_CONNECTION_REFUSED when trying to access admin or secure pages
Reply
Thanks given by:


Possibly Related Threads…
Thread Author Replies Views Last Post
[Module] ELFileManager (build on elfinder) Diablo925 94 289 ,219 05-30-2024, 05:25 AM
Last Post: TGates
[MODULE] phpMyAdmin-AU (Auto-Update) TGates 14 44 ,960 06-15-2021, 06:54 AM
Last Post: TGates
[MODULE] SenBrand - Basic Branding module for Sentora TGates 20 49 ,473 06-04-2021, 11:47 AM
Last Post: ccr1969

Forum Jump:


Users browsing this thread: 3 Guest(s)