maddy

Fork https://github.com/foxcpp/maddy

git clone git://git.lin.moe/go/maddy.git

 1## maddy-shadow-helper
 2
 3External helper binary for interaction with shadow passwords database.
 4Unlike maddy-pam-helper it supports only local shadow database but it does
 5not have any C dependencies.
 6
 7### Installation
 8
 9maddy-shadow-helper is kinda dangerous binary and should not be allowed to be
10executed by everybody but maddy's user. At the same moment it needs to have
11access to read-protected files. For this reason installation should be done
12very carefully to make sure to not introduce any security "holes".
13
14#### First method
15
16```shell
17chown maddy: /usr/bin/maddy-shadow-helper
18chmod u+x,g-x,o-x /usr/bin/maddy-shadow-helper
19```
20
21Also maddy-shadow-helper needs access to /etc/shadow, one of the ways to provide
22it is to set file capability CAP_DAC_READ_SEARCH:
23```
24setcap cap_dac_read_search+ep /usr/bin/maddy-shadow-helper
25```
26
27#### Second method
28
29Another, less restrictive is to make it setuid-root (assuming you have both maddy user and group):
30```
31chown root:maddy /usr/bin/maddy-shadow-helper
32chmod u+xs,g+x,o-x /usr/bin/maddy-shadow-helper
33```
34
35#### Third method
36
37The best way actually is to create `shadow` group and grant access to
38/etc/shadow to it and then make maddy-shadow-helper setgid-shadow:
39```
40groupadd shadow
41chown :shadow /etc/shadow
42chmod g+r /etc/shadow
43chown maddy:shadow /usr/bin/maddy-shadow-helper
44chmod u+x,g+xs /usr/bin/maddy-shadow-helper
45```
46
47Pick what works best for you.