1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-14 02:42:40 +01:00
phorge-phorge/src/applications/config
epriestley 476b27d9c8 Add "phd.user" with sudo hooks for SSH/HTTP writes
Summary:
Ref T2230. When fully set up, we have up to three users who all need to write into the repositories:

  - The webserver needs to write for HTTP receives.
  - The SSH user needs to write for SSH receives.
  - The daemons need to write for "git fetch", "git clone", etc.

These three users don't need to be different, but in practice they are often not likely to all be the same user. If for no other reason, making them all the same user requires you to "git clone httpd@host.com", and installs are likely to prefer "git clone git@host.com".

Using three different users also allows better privilege separation. Particularly, the daemon user can be the //only// user with write access to the repositories. The webserver and SSH user can accomplish their writes through `sudo`, with a whitelisted set of commands. This means that even if you compromise the `ssh` user, you need to find a way to escallate from there to the daemon user in order to, e.g., write arbitrary stuff into the repository or bypass commit hooks.

This lays some of the groundwork for a highly-separated configuration where the SSH and HTTP users have the fewest privileges possible and use `sudo` to interact with repositories. Some future work which might make sense:

  - Make `bin/phd` respect this (require start as the right user, or as root and drop privileges, if this configuration is set).
  - Execute all `git/hg/svn` commands via sudo?

Users aren't expected to configure this yet so I haven't written any documentation.

Test Plan:
Added an SSH user ("dweller") and gave it sudo by adding this to `/etc/sudoers`:

   dweller ALL=(epriestley) SETENV: NOPASSWD: /usr/bin/git-upload-pack, /usr/bin/git-receive-pack

Then I ran git pushes and pulls over SSH via "dweller@localhost". They successfully interacted with the repository on disk as the "epriestley" user.

Reviewers: btrahan

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2230

Differential Revision: https://secure.phabricator.com/D7589
2013-11-18 08:58:35 -08:00
..
application Button to ignore setup issues + refractoring 2013-03-06 14:14:10 -08:00
check Remove differential.anonymous-access 2013-11-11 16:05:19 -08:00
controller Implement an approval queue 2013-11-13 11:24:56 -08:00
custom Allow configuration to have custom UI types 2013-06-07 12:36:18 -07:00
editor Add a config setting for storing application settings 2013-10-03 12:39:30 -07:00
exception Allow configuration to be explicitly validated, including validation of complex attributes 2013-01-01 18:15:03 -08:00
issue Fixed T2630 2013-04-10 13:11:22 -07:00
json Mask remaining config values, and implement set type 2013-01-16 15:06:07 -08:00
management Make UX for misspelled or delted config much less bad 2013-06-26 11:01:19 -07:00
option Add "phd.user" with sudo hooks for SSH/HTTP writes 2013-11-18 08:58:35 -08:00
phid Lock policy queries to their applications 2013-10-21 17:20:27 -07:00
query Lock policy queries to their applications 2013-10-21 17:20:27 -07:00
response [SECURITY] Prevented PhabricatorSetupIssueView from exposing sensitive config options. 2013-04-06 00:39:53 -07:00
storage Make PhabricatorPolicyInterface require a getPHID() method 2013-10-14 14:35:47 -07:00
view Show host information on setup issue screen 2013-08-29 14:22:05 -07:00