# HG changeset patch # User paulb # Date 1114955823 0 # Node ID a6ed8b165e9e28cfb52fac4adc84fcc27d163457 # Parent 7bdc478e80b39c4cbb6d26a0f1d777f68e54d2d9 [project @ 2005-05-01 13:57:03 by paulb] Added permissions configuration for CGI applications. diff -r 7bdc478e80b3 -r a6ed8b165e9e tools/Apache/config.py --- a/tools/Apache/config.py Sun May 01 13:56:53 2005 +0000 +++ b/tools/Apache/config.py Sun May 01 13:57:03 2005 +0000 @@ -168,6 +168,31 @@ except ImportError: print "Not configuring the sessions directory ownership." + # Check the permissions on the application. + + if app_type == "CGI": + try: + import stat + details = os.stat(app_location) + mode = stat.S_IMODE(details[stat.ST_MODE]) + + # Check for incorrect permissions. + + flags = stat.S_IRUSR|stat.S_IXUSR|stat.S_IRGRP|stat.S_IXGRP|stat.S_IROTH|stat.S_IXOTH + + # Set correct permissions. + + if mode & flags == flags: + print "Correct permissions found were", oct(mode), "for", app_location + else: + answer = raw_input("Change the permissions on %s? (Y|N) " % app_location) + if answer.upper() == "Y": + print "Setting mode", oct(flags), "on", app_location + os.chmod(app_location, flags) + + except ImportError: + print "Not changing the permissions on the application." + print "--------" print "Configuration completed." print "You may need to run an administrative tool to add the new site '%s' to Apache." % site_name