Bug 1496274 - SELinux policy provides no way for 'tor' to run its pluggable transports
Summary: SELinux policy provides no way for 'tor' to run its pluggable transports
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 29
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Lukas Vrabec
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-09-26 21:11 UTC by Hedayat Vatankhah
Modified: 2018-09-12 02:56 UTC (History)
7 users (show)

Fixed In Version: selinux-policy-3.14.2-15.fc29 selinux-policy-3.14.2-34.fc29
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-09-12 02:56:39 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Hedayat Vatankhah 2017-09-26 21:11:14 UTC
Description of problem:
Tor supports 'pluggable transports', and a common method to use them is to configure tor to run the plugin which is a regular binary (e.g. obfs4proxy).
However, the default SELinux policy doesn't allow tor to run any binaries, and I didn't find any suitable label to make it work. 

Using the audit2allow command, I created the following policy which enables tor to run any binaries:
----------------------------------------------
module my-tor 1.0;

require {
        type tor_t;
        type bin_t;
        class file { execute execute_no_trans };
}

#============= tor_t ==============
allow tor_t bin_t:file { execute execute_no_trans };

----------------------------------------------

Anyway, we need a way to let tor run its pluggable transports. Either the above policy should be added to selinux-policy-targeted or a new tor-selinux package, or we should be able to use a special SELinux label on the binaries which we want tor to be able to run.

Comment 1 Hedayat Vatankhah 2017-09-29 22:16:30 UTC
I'm going to add obfs4 transport to Fedora. This bug should be fixed so that this package will function properly when SELinux is enabled.

Comment 2 Hedayat Vatankhah 2017-10-02 20:47:11 UTC
The package is in its way to repositories. For now, I've created a COPR package with the above policy, but I hope it'll be properly fixed in Fedora soon.

Comment 3 Hedayat Vatankhah 2017-10-21 22:12:08 UTC
Apparently, in Fedora 27 it needs also 'map' permission:

SELinux is preventing obfs4proxy from 'map' accesses on the file /usr/bin/obfs4proxy.


Additional Information:
Source Context                system_u:system_r:tor_t:s0
Target Context                system_u:object_r:bin_t:s0
Target Objects                /usr/bin/obfs4proxy [ file ]
Source                        obfs4proxy
Source Path                   obfs4proxy
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           
Target RPM Packages           obfs4-0.0.7-1.fc27.x86_64
Policy RPM                    selinux-policy-3.13.1-283.10.fc27.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed) 4.13.8-300.fc27.x86_64 #1 SMP Wed
                              Oct 18 15:32:19 UTC 2017 x86_64 x86_64
Alert Count                   1
First Seen                    2017-10-22 01:34:42 +0330
Last Seen                     2017-10-22 01:34:42 +0330
Local ID                      f3e71023-f57e-4485-a67d-68293fb0a9fb

Raw Audit Messages
type=AVC msg=audit(1508623482.392:509): avc:  denied  { map } for  pid=9778 comm="obfs4proxy" path="/usr/bin/obfs4proxy" dev="sda9" ino=1744533 scontext=system_u:system_r:tor_t:s0 tcontext=system_u:object_r:bin_t:s0 tclass=file permissive=0


Hash: obfs4proxy,tor_t,bin_t,file,map

Comment 4 Hedayat Vatankhah 2018-02-06 07:31:38 UTC
If there is anything missing from the report, please let me know.

Comment 5 Fedora End Of Life 2018-02-20 15:27:20 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 28 development cycle.
Changing version to '28'.

Comment 6 Jan Kurik 2018-08-14 11:20:42 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.

Comment 7 Fedora Update System 2018-09-11 12:50:22 UTC
selinux-policy-3.14.2-34.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2018-db240a1726

Comment 8 Fedora Update System 2018-09-12 02:56:39 UTC
selinux-policy-3.14.2-34.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.