1 |
On 01/12/2014 05:30 AM, Sven Vermeulen wrote: |
2 |
> On Sat, Jan 11, 2014 at 11:34:43PM -0600, Dustin C. Hatch wrote: |
3 |
>> My understanding is that in order to be able to control services, one |
4 |
>> needs to have the system_r role[1]. I don't know how to get there, though: |
5 |
> |
6 |
> You shouldn't directly mention system_r (as role) in sudo at any point as |
7 |
> far as I know. Either a role is granted the right to start services directly |
8 |
> (which is used for the services that use what I call "named init scripts") |
9 |
> or the role is allowed the run_init_t domain and calls it through |
10 |
> run_init. |
11 |
> |
12 |
That's what I thought; these were really just stabs in the dark. |
13 |
> In Gentoo, OpenRC calls run_init internally so you don't need to pass it on |
14 |
> directly when invoked through a shell. But it does require the policy change |
15 |
> as you mentioned (but you don't need to add it yourself, it should already |
16 |
> be in the Gentoo policy). |
17 |
> |
18 |
I should have mentioned that even as root, with or without pam_rootok, I |
19 |
can't call rc-service without run_init first. |
20 |
> ... |
21 |
> Seems that the trick from the blog post doesn't work for sudo. As far as I |
22 |
> can see, the transition to the sysadm_r role and sysadm_t domain work |
23 |
> nicely, and rc-service is a regular bin_t (so it's not about mismatching |
24 |
> transitions). |
25 |
> |
26 |
Again, forgot to mention that not only sudo suffers from this problem. |
27 |
Even logged in as root (on the console or via SSH and then newrole), I |
28 |
need run_init to control services. |
29 |
> In the mean time you can use "sudo run_init rc-service nfsmount" and grant |
30 |
> the user the rights for it in the sudoers file. You can also directly enter |
31 |
> the ROLE= and TYPE= parameters in the sudoers file so that you don't need to |
32 |
> pass it on directly. |
33 |
> |
34 |
In my original tests, I was using ROLE= and TYPE= in sudoers; I switched |
35 |
to command line arguments in order to be explicit on this message. |
36 |
> Wkr, |
37 |
> Sven Vermeulen |
38 |
> |
39 |
Thanks for your help. |
40 |
|
41 |
-- |
42 |
♫Dustin |
43 |
http://dustin.hatch.name/ |