Fix issues from review

- Put chmod argument to os.chmod (oops)
- Add permissions adjustments for challenge files, too
This commit is contained in:
Luca Beltrame
2015-11-24 10:15:18 +01:00
parent 768c7cd9c0
commit a71c3ed90c
+8 -7
View File
@@ -101,13 +101,7 @@ to serve all files under specified web root ({0})."""
os.makedirs(self.full_roots[name])
# Set permissions as parent directory (GH #1389)
filemode = stat.S_IMODE(os.stat(path).st_mode)
os.chmod(self.full_roots[name])
# Make permissions valid for files, too
for root, dirs, files in os.walk(self.full_roots[name]):
for filename in files:
# No need for exec permissions
os.chmod(filename, filemode & ~stat.S_IEXEC)
os.chmod(self.full_roots[name], filemode)
except OSError as exception:
if exception.errno != errno.EEXIST:
@@ -132,6 +126,13 @@ to serve all files under specified web root ({0})."""
logger.debug("Attempting to save validation to %s", path)
with open(path, "w") as validation_file:
validation_file.write(validation.encode())
# Set permissions as parent directory (GH #1389)
parent_path = self.full_roots[achall.domain]
filemode = stat.S_IMODE(os.stat(parent_path).st_mode)
# Remove execution bit (not needed for this file)
os.chmod(path, filemode & ~stat.S_IEXEC)
return response
def cleanup(self, achalls): # pylint: disable=missing-docstring