~/wc/university $ diff bachelorprojekt/src/httpd.conf.dist bachelorprojekt/src/httpd.py 17a18,21 > # Check if the configuration file exists > if not os.path.exists("httpd.conf"): > print "Cofiguration file httpd.conf does not exist! Quitting!" > sys.exit(1) 26,30c30,31 < < < #server_root = os.getcwd() < server_root = config["httpd.serverroot"] < cgi_root = config["httpd.cgiroot"] --- > server_root = config["httpd.serverroot"] > cgi_root = config["httpd.cgiroot"] 32,35c33,36 < cert_root = config["httpd.certificateroot"] < user = config["httpd.user"] < group = config["httpd.group"] < server_port = int(config["httpd.listen"]) --- > cert_root = config["httpd.certificateroot"] > user = config["httpd.user"] > group = config["httpd.group"] > server_port = int(config["httpd.listen"]) 42c43 < cgi_root_alias = config["httpd.cgialias"] --- > cgi_root_alias = config["httpd.cgialias"] 50,51c51 < < --- > 55,62c55,72 < < # Set up server certificate and key < #server_key = os.path.join(cert_root, 'server.key') < #server_cert = os.path.join(cert_root, 'server.crt') < < server_key = cert_root + '/server.key' < server_cert = cert_root + '/server.crt' < --- > # Set up server certificate and key > server_key = os.path.join(cert_root, 'server.key') > server_cert = os.path.join(cert_root, 'server.crt') > ca_cert = os.path.join(cert_root, 'cacert.pem') > > # Check if server key and certificates exist > if not os.path.exists(server_key): > print "Server key does not exist! Quitting!" > sys.exit(1) > > if not os.path.exists(server_cert): > print "Server certificate does not exist! Quitting!" > sys.exit(1) > > if not os.path.exists(ca_cert): > print "CA certificate does not exist! Quitting!" > sys.exit(1) > 66,67d75 < ca_cert = os.path.join(cert_root, 'cacert.pem') < 70d77 < 72d78 < 75a82 > 76a84 > #try: 79,80d86 < return ok < 81a88,95 > # Setting environment variables > subj = cert.get_subject() > common_name = getattr(subj,"CN") > os.environ["SSL_CLIENT_S_DN_CN"] = common_name > os.environ["HTTPS"] = "on" > #except Exception, err: > # print "OpenSSL error: %s" % err > return ok 85,87c99 < #self.cgi_directories = ["/cgi-bin"] < self.cgi_directories = [cgi_root_alias] < --- > self.cgi_directories = [cgi_root_alias] 90d101 < 94,96d104 < def logmsg(self, msg): < print "[CGIHTTPSRequestHandler] %s" % (msg) < 108,109d115 < self.logmsg( "Incomming path-request: " + path ) < 115c121 < self.logmsg("CGI-request, setting correct cgi-bin directory") --- > # CGI-request, setting correct cgi-bin directory 118,120d123 < self.logmsg("New CGI-dir is: "+path) < < #return server_root + path 126c129 < #path = os.getcwd() --- > # Make sure we serve documents from document_root 133,137d135 < < < self.logmsg( "Final path:") < self.logmsg(path ) < 143d140 < 148,149c145 < new_gid = grp.getgrnam(group)[2] < --- > new_gid = grp.getgrnam(group)[2] 157d152 < # Do nothing 164,168c159,161 < print server_address < httpd = CGIHTTPSServer(server_address, CGIHTTPSRequestHandler) < < sa = httpd.socket.getsockname() < print "Serving HTTPS on", sa[0], "port", sa[1], "..." --- > httpd = CGIHTTPSServer(server_address, CGIHTTPSRequestHandler) > socket_info = httpd.socket.getsockname() > print "Listening on", socket_info[0], "port", socket_info[1] 171d163 < print "privileges dropped!" 172a165,166 > except socket.error: > print "Socket error. Do you have permission to bind on this port?" 174c168 < print '^C received, shutting down server' --- > print 'Terminating server.' 176,177c170 < < --- > (tdn@bart) (07-05-09 23:46) (P:0 L:1) [1] [ 23:46:46 up 18:38, 1 user, load average: 0.00, 0.03, 0.06] ~/wc/university $