Edgewall Software
Modify

Opened 12 years ago

Closed 10 years ago

Last modified 10 years ago

#7958 closed enhancement (fixed)

[PATCH] Options for tracd to drop privileges

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

Attachments (2)

trac-drop-privileges.patch (1.5 KB ) - added by eugene.prokopiev@… 12 years ago.
drop privileges patch
priv-tracd-7958.patch (2.7 KB ) - added by Thijs Triemstra 10 years ago.
against 0.12-stable r10380

Download all attachments as: .zip

Change History (14)

by eugene.prokopiev@…, 12 years ago

Attachment: trac-drop-privileges.patch added

drop privileges patch

comment:1 by Emmanuel Blot, 12 years ago

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

comment:2 by Emmanuel Blot, 12 years ago

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

comment:3 by anonymous, 12 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, 12 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, 12 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, 12 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, 12 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, 10 years ago

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

comment:9 by Thijs Triemstra, 10 years ago

Owner: set to Thijs Triemstra
Status: newassigned

by Thijs Triemstra, 10 years ago

Attachment: priv-tracd-7958.patch added

against 0.12-stable r10380

comment:10 by Thijs Triemstra, 10 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, 10 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).

in reply to:  11 comment:12 by Thijs Triemstra, 10 years ago

Replying to rblank:

  • 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).

Yeah, I took them from twistd.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Thijs Triemstra.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Thijs Triemstra to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.