Ensure correct permissions and file ownership of Apache NSS database

451098
This commit is contained in:
Rob Crittenden
2008-07-01 15:06:59 -04:00
parent 6cce2f45e8
commit ec597b0ef1
@@ -19,6 +19,8 @@
#
import sys
import os
import pwd
import traceback
@@ -144,6 +146,16 @@ def main():
print server_cert
set_http_cert_name(server_cert[0])
# Fix the database permissions
os.chmod(NSS_DIR + "/cert8.db", 0640)
os.chmod(NSS_DIR + "/key3.db", 0640)
os.chmod(NSS_DIR + "/secmod.db", 0640)
pent = pwd.getpwnam("apache")
os.chown(NSS_DIR + "/cert8.db", 0, pent.pw_gid )
os.chown(NSS_DIR + "/key3.db", 0, pent.pw_gid )
os.chown(NSS_DIR + "/secmod.db", 0, pent.pw_gid )
except Exception, e:
print "an unexpected error occurred: %s" % str(e)
traceback.print_exc()