Skip to content

Commit

Permalink
fix permissions for fastcgi socket file (get rid chmod)
Browse files Browse the repository at this point in the history
  • Loading branch information
anru committed Jun 16, 2013
1 parent f00e995 commit aee2631
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
9 changes: 3 additions & 6 deletions pwl/fastcgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@
daemonize=true pidfile=/var/run/django-fcgi.pid
"""
from application import app

def_umask = '002'

FASTCGI_OPTIONS = {
'protocol': 'fcgi',
Expand All @@ -84,8 +81,8 @@
'debug': False,
'outlog': None,
'errlog': None,
'umask': app.config.get('FCGI_UMASK', def_umask)
}
'umask': '002'
}


def fastcgi_help(message=None):
Expand All @@ -95,7 +92,7 @@ def fastcgi_help(message=None):
return False


def runfastcgi(argset=[], **kwargs):
def runfastcgi(app, argset=[], **kwargs):
options = FASTCGI_OPTIONS.copy()
options.update(kwargs)
for x in argset:
Expand Down
3 changes: 2 additions & 1 deletion rsted.fcgi
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ fcgi_opts = {
'socket': os.path.join(full_run_path, app.config.get('SOCKET_FILE', 'rsted.sock')),
'workdir': app.config.root_path,
'maxrequests': 100,
'umask': app.config.get('FCGI_UMASK', '002')
}

run_as = app.config.get('RUN_AS')
if run_as:
fcgi_opts['run_as'] = run_as

args=[]
runfastcgi(args, **fcgi_opts)
runfastcgi(app, args, **fcgi_opts)
7 changes: 0 additions & 7 deletions sbin/rsted
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ class RstedDaemon(BaseDaemon):
self.delpid()
self.start()

chmod_socket = app.config.get('CHMOD_SOCKET')
socket_file = os.path.join(run_path, app.config.get('SOCKET_FILE', 'rsted.sock'))

if chmod_socket:
chmod_socket = str(chmod_socket)
os.popen("chmod %s %s" % (chmod_socket, socket_file))

pidfile = J(run_path, 'fastcgi.pid')
daemon = RstedDaemon(pidfile)

Expand Down
2 changes: 1 addition & 1 deletion settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
RUN_PATH = 'var/run'
PID_FILE = 'fastcgi.pid'
SOCKET_FILE = 'rsted.sock'
CHMOD_SOCKET = '0777' # you can override this in settings_local.py if you wish
FCGI_UMASK = '000' # you can override this in settings_local.py if you wish

try:
from settings_local import *
Expand Down

0 comments on commit aee2631

Please sign in to comment.