1 |
On Thu, Dec 01, 2016 at 10:24:21AM +0000, Robert Sharp wrote: |
2 |
> Hi, |
3 |
> |
4 |
> |
5 |
> I've looked at the Gentoo SELinux web pages etc, the SELinux Handbook |
6 |
> and through the Reference Policy and I cannot find the answer to a |
7 |
> simple question. |
8 |
> |
9 |
> I am writing a small policy for my backup system and I want to be able |
10 |
> to a) access a MongoDB running on remote servers, and b) use rsync. I |
11 |
> can see two AVCs relating to my port use and I know how I can fix the |
12 |
> problem from the command line, but surely I should be able to address |
13 |
> this in the policy? I think there is an rsync interface I need to call |
14 |
> (rsync_entry_type(mytype_t)) and I assume this will run rsync in the |
15 |
> right domain? |
16 |
> |
17 |
> Mongo has a policy but the only interface is admin. All I need to do |
18 |
> locally is connect to the port. Can I use "portcon" in a policy to do |
19 |
> this or do I need to do something else? |
20 |
> |
21 |
> Thanks, |
22 |
> |
23 |
> Robert Sharp |
24 |
|
25 |
What port number is it using? does that port already have a label? if it |
26 |
does then you use the corenet stuff, eg: |
27 |
|
28 |
corenet_tcp_connect_mysqld_port(foo_t) would allow foo_t to connect to |
29 |
these ports: |
30 |
|
31 |
# semanage port -l | grep mysql |
32 |
mysqld_port_t tcp 1186, 3306, 63132-63164 |
33 |
|
34 |
if there is no good label on the port currently, you can define your own |
35 |
with semanage port. or it can be added to the base policy, because of |
36 |
the way pp files work, you cannot do portcon in a module. If there is a |
37 |
port that is missing a label, we can add it to the base in both refpol |
38 |
and gentoos policy. |
39 |
|
40 |
Look at policy/modules/kernel/corenetwork.te.in in the policy for |
41 |
adding a new one. |
42 |
|
43 |
As for rsync, if you want your script to be able to run it without |
44 |
changing domain, you probably want rsync_exec(), if you want to transition |
45 |
to rsync_t, then rsync_domtrans() |
46 |
|
47 |
-- Jason |