You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support SELinux via configurations and documentation #4937
RStudio Edition : Server
RStudio Version : 1.2.1335
OS Version : Fedora 30
R Version : 3.5.3
Steps to reproduce the problem
Install rstudio-server and attempt to log in at localhost:8787 with SELinux in enforcing mode (default on Fedora and others). Login will fail due to SELinux denial.
Describe the problem in detail
SELinux prevents RStudio Server from functioning. Setting SELinux in permissive mode works fine, albeit with dozens of SELinux alerts.
Describe the behavior you expected
RStudio Server allowing user login and working normally with SELinux enabled in enforcing mode.
Reacted by Etienne Jacquot, McClelland, Cole Arendt and Andreas Fritz
Using RStudio with SELinux will require you to give RStudio the appropriate privileges to run -- it's not a bug that it e.g. requires network access. If you need help configuring the server with SELinux, please use the R Admins section of our community forum:
If you feel that there's a specific SELinux capability that RStudio should not require for operation but does, we're happy to discuss those individually.
If RStudio is missing SELinux policy configuration to have it run properly, I would consider that a bug. I doubt users should be doing that manually, or at least clear instructions could be provided to do it correctly.
This gives the binaries the right context, since they are for some reason in a directory for libraries. It was pointed out that this step would not be needed at all if Filesystem Hierarchy Standards were followed in packaging RStudio Server.
However, this solution lets RStudio Server run unconstrained since no targeted policy exists for it. Ideally, a selinux policy should be created to protect system integrity in case the process is compromised.
It would be good to have the input of RStudio developers, and/or those with a good understanding of how RStudio Server works, in creating a suitable selinux policy. The #selinux IRC channel has shown great willingness to help. I'm happy to help test.
Needless to say, I do think this issue should be reopened.
It packages binaries into /usr/libexec. I have not tested much yet, but so far RStudio and Rstudio Server seem to be working fine without SELinux issues.
Hopefully other distro maintainers will follow. Rstudio developers now have a guide to improve their packaging and avoid SELinux issues.
I am experiencing the issue - which someone has previously posted on StackOverflow - which is caused by SELinux policy not set properly. I'm using Red Hat Enterprise Linux Server release 7.8 (Maipo), so not too different from the op's setup, and RStudio Version 1.2.5042.
In Sys.timezone() the call to system("timedatectl", intern = TRUE) waits for about a minute before it returns with an error - this is not nice behaviour. Is it at all possible to check if the action is permitted by the SELinux policy before attempting it???
Despite the error message the call to Sys.timezone() succeeds because a subsequent step in the function (checking the symlink /etc/localtime) is able to determine the timezone. The timezone value is then cached in the R session so subsequent calls to Sys.timezone() return immediately and without any error message. Higher-level functions Sys.time() and lubridate::now() are affected by this issue.
The solution posted on SO is to update the SELinux policy. Unfortunately I'm not an administrator so I don't know the details of the policy.
Activity
jmcphers commentedon Jun 12, 2019
Can you be more specific about the SELinux denial and alerts you're seeing?
adatum commentedon Jun 12, 2019
There's a long list of them. The first was
Setting SELinux to permissive mode logged a lot more:

There is also a Japanese blog that describes this exact issue: https://bitwalk.blogspot.com/2018/08/rstudio-server-selinux-fedora.html
jmkekala commentedon Jun 13, 2019
Hi,
You'll have to permit following policies:
httpd_can_network_connect
httpd_can_network_relay
edit:
Or was it that httpd_can_network_connect was sufficient.
BR,
Juha
adatum commentedon Jun 13, 2019
I enabled both
httpd_can_network_connectandhttpd_can_network_relaybooleans but it still failed. Also, are those needed for localhost?jmcphers commentedon Jun 13, 2019
Using RStudio with SELinux will require you to give RStudio the appropriate privileges to run -- it's not a bug that it e.g. requires network access. If you need help configuring the server with SELinux, please use the R Admins section of our community forum:
https://community.rstudio.com/c/r-admin
If you feel that there's a specific SELinux capability that RStudio should not require for operation but does, we're happy to discuss those individually.
adatum commentedon Jun 13, 2019
If RStudio is missing SELinux policy configuration to have it run properly, I would consider that a bug. I doubt users should be doing that manually, or at least clear instructions could be provided to do it correctly.
I did already post on the community forum 11 days ago but there has been not a single reply there. https://community.rstudio.com/t/selinux-errors-with-rstudio-server/32229
adatum commentedon Jun 27, 2019
Thanks to help from the #selinux IRC channel, a solution was found:
sudo chcon -R -t bin_t /usr/lib/rstudio-server/bin/This gives the binaries the right context, since they are for some reason in a directory for libraries. It was pointed out that this step would not be needed at all if Filesystem Hierarchy Standards were followed in packaging RStudio Server.
However, this solution lets RStudio Server run unconstrained since no targeted policy exists for it. Ideally, a selinux policy should be created to protect system integrity in case the process is compromised.
It would be good to have the input of RStudio developers, and/or those with a good understanding of how RStudio Server works, in creating a suitable selinux policy. The #selinux IRC channel has shown great willingness to help. I'm happy to help test.
Needless to say, I do think this issue should be reopened.
jmcphers commentedon Jul 3, 2019
See also: #1750
adatum commentedon Mar 13, 2020
Some good news, at least for Fedora users.
Today
rstudio,rstudio-desktop, andrstudio-serverpackages became available in Fedora's repos, thanks to maintainer iucar: https://bodhi.fedoraproject.org/updates/FEDORA-2020-65ff671dbaIt packages binaries into /usr/libexec. I have not tested much yet, but so far RStudio and Rstudio Server seem to be working fine without SELinux issues.
Hopefully other distro maintainers will follow. Rstudio developers now have a guide to improve their packaging and avoid SELinux issues.
casa-henrym commentedon Jun 12, 2020
I am experiencing the issue - which someone has previously posted on StackOverflow - which is caused by SELinux policy not set properly. I'm using Red Hat Enterprise Linux Server release 7.8 (Maipo), so not too different from the op's setup, and RStudio Version 1.2.5042.
In
Sys.timezone()the call tosystem("timedatectl", intern = TRUE)waits for about a minute before it returns with an error - this is not nice behaviour. Is it at all possible to check if the action is permitted by the SELinux policy before attempting it???Despite the error message the call to
Sys.timezone()succeeds because a subsequent step in the function (checking the symlink /etc/localtime) is able to determine the timezone. The timezone value is then cached in the R session so subsequent calls toSys.timezone()return immediately and without any error message. Higher-level functionsSys.time()andlubridate::now()are affected by this issue.The solution posted on SO is to update the SELinux policy. Unfortunately I'm not an administrator so I don't know the details of the policy.
54 remaining items
j-lubega commentedon Oct 2, 2024
ZD ticket affected by this: #110538
pyltime commentedon Nov 22, 2024
ZD ticket affected by this: #112382
lachlansimpson commentedon Feb 20, 2025
Hi @MariaSemple @adamhigerd , I can see this is tagged Patch 2024.12.1 - but I'm not seeing this update in the 2024.12.1 NEWS.
I can see that #15675 is merged already.
Can we confirm that the change went into the latest patch release? Thanks
gtritchie commentedon Feb 20, 2025
MariaSemple commentedon Feb 20, 2025
Thanks for fixing that Gary! Yes, that's correct. It went into M.O.