Edgewall Software

Opened 15 years ago

Closed 13 years ago

Last modified 13 years ago

#7958 closed enhancement (fixed)

[PATCH] Options for tracd to drop privileges — at Version 11

Reported by: eugene.prokopiev@… Owned by: Thijs Triemstra
Priority: normal Milestone: 1.0
Component: web frontend/tracd Version: 0.11.2
Severity: normal Keywords: patch consider bitesized
Cc: Branch:
Release Notes:

Added options to tracd to drop privileges.

API Changes:
Internal Changes:

Description

Patch is attached

Change History (13)

by eugene.prokopiev@…, 15 years ago

Attachment: trac-drop-privileges.patch added

drop privileges patch

comment:1 by Emmanuel Blot, 15 years ago

Cannot be applied as is: it requires OS host specific modules (Unix): pwd, grp

comment:2 by Emmanuel Blot, 15 years ago

Please also specify the Trac version, especially when you submit a patch.

comment:3 by anonymous, 15 years ago

daemonize() is OS specific too but it is used. It was written for Trac 0.11.2

in reply to:  3 comment:4 by Emmanuel Blot, 15 years ago

Version: none0.11.2

Replying to anonymous:

It was written for Trac 0.11.2

That's what the 'version' field is for

in reply to:  3 ; comment:5 by Emmanuel Blot, 15 years ago

Replying to anonymous:

daemonize() is OS specific too but it is used.

Yeah, but it does not unconditionally import Unix-specific modules

in reply to:  5 comment:6 by Emmanuel Blot, 15 years ago

Replying to eblot:

Replying to anonymous:

daemonize() is OS specific too but it is used.

Yeah, but it does not unconditionally import Unix-specific modules

Here is why this patch is not valid as-is:

Python 2.5.4 (r254:67916, Dec 23 2008, 15:10:54) [MSC v.1310 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import grp
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named grp
>>> import pwd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named pwd
>>>

Import of grp and pwd modules should be conditional (i.e. depends on the OS)

comment:7 by Christian Boos, 15 years ago

Keywords: patch consider added
Milestone: 0.13

Please update the patch as requested by eblot if you still like to get the patch accepted.

comment:8 by Remy Blank, 14 years ago

Keywords: bitesized added
Milestone: next-major-0.1Xunscheduled

comment:9 by Thijs Triemstra, 13 years ago

Owner: set to Thijs Triemstra
Status: newassigned

by Thijs Triemstra, 13 years ago

Attachment: priv-tracd-7958.patch added

against 0.12-stable r10380

comment:10 by Thijs Triemstra, 13 years ago

Milestone: unscheduled0.13
Summary: Options for tracd to drop privileges[PATCH] Options for tracd to drop privileges

attached patch checks for the import and throws an error for incorrect uid/gid values.

comment:11 by Remy Blank, 13 years ago

Release Notes: modified (diff)
Resolution: fixed
Status: assignedclosed

Improved patch applied in [10388], with the following changes:

  • Allow numerical user and group IDs.
  • Print any errors occurring when dropping privileges.
  • Reverted to --user and --group instead of --uid and --gid, as I find it clearer. I have seen the same names in other programs (e.g. openvpn).
Note: See TracTickets for help on using tickets.