properly write rsyslog configuration as 0640

see: https://github.com/ansible/tower/issues/4383
This commit is contained in:
Ryan Petrello 2020-06-04 15:10:14 -04:00
parent 3ded30411f
commit c53e5bdbcf
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

@ -1,6 +1,6 @@
import os
import shutil
import tempfile
import tempfile
import urllib.parse as urlparse
from django.conf import settings
@ -117,6 +117,7 @@ def reconfigure_rsyslog():
with tempfile.TemporaryDirectory(prefix='rsyslog-conf-') as temp_dir:
path = temp_dir + '/rsyslog.conf.temp'
with open(path, 'w') as f:
os.chmod(path, 0o640)
f.write(tmpl + '\n')
shutil.move(path, '/var/lib/awx/rsyslog/rsyslog.conf')
supervisor_service_command(command='restart', service='awx-rsyslogd')