vogelor
2009-05-28 d1086fc4f86cbcbc013b0981b639ee92892069ec
Fixed a bug in creating ssl on multiserver-environments (NO security bug, only a "handling" bug!)
1 files modified
12 ■■■■■ changed files
server/plugins-available/apache2_plugin.inc.php 12 ●●●●● patch | view | raw | blame | history
server/plugins-available/apache2_plugin.inc.php
@@ -146,8 +146,12 @@
            @unlink($rand_file);
            $ssl_request = file_get_contents($csr_file);
            $ssl_cert = file_get_contents($crt_file);
            /* Update the DB of the (local) Server */
            $app->db->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert' WHERE domain = '".$data["new"]["domain"]."'");
            $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data["new"]["domain"]."'");
            /* Update also the master-DB of the Server-Farm */
            $app->dbmaster->query("UPDATE web_domain SET ssl_request = '$ssl_request', ssl_cert = '$ssl_cert' WHERE domain = '".$data["new"]["domain"]."'");
            $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data["new"]["domain"]."'");
        }
        
        //* Save a SSL certificate to disk
@@ -160,7 +164,10 @@
            file_put_contents($csr_file,$data["new"]["ssl_request"]);
            file_put_contents($crt_file,$data["new"]["ssl_cert"]);
            if(trim($data["new"]["ssl_bundle"]) != '') file_put_contents($bundle_file,$data["new"]["ssl_bundle"]);
            /* Update the DB of the (local) Server */
            $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data["new"]["domain"]."'");
            /* Update also the master-DB of the Server-Farm */
            $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data["new"]["domain"]."'");
            $app->log("Saving SSL Cert for: $domain",LOGLEVEL_DEBUG);
        }
        
@@ -174,7 +181,12 @@
            unlink($csr_file);
            unlink($crt_file);
            unlink($bundle_file);
            /* Update the DB of the (local) Server */
            $app->db->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = '".$data["new"]["domain"]."'");
            $app->db->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data["new"]["domain"]."'");
            /* Update also the master-DB of the Server-Farm */
            $app->dbmaster->query("UPDATE web_domain SET ssl_request = '', ssl_cert = '' WHERE domain = '".$data["new"]["domain"]."'");
            $app->dbmaster->query("UPDATE web_domain SET ssl_action = '' WHERE domain = '".$data["new"]["domain"]."'");
            $app->log("Deleting SSL Cert for: $domain",LOGLEVEL_DEBUG);
        }