| Summary: | selinux denials for application data located under user home directory in ECC certicom setup | |||
|---|---|---|---|---|
| Product: | [Retired] Dogtag Certificate System | Reporter: | Kashyap Chamarthy <kchamart> | |
| Component: | SELinux | Assignee: | Christina Fu <cfu> | |
| Status: | CLOSED NEXTRELEASE | QA Contact: | Chandrasekar Kannan <ckannan> | |
| Severity: | medium | Docs Contact: | ||
| Priority: | high | |||
| Version: | 9.0 | CC: | alee, benl, cfu, dlackey, dominick.grift, dpal, dwalsh, enewland, jgalipea, jmagne, mgrepl, mharmsen, mniranja, nkinder | |
| Target Milestone: | 9.0 | |||
| Target Release: | --- | |||
| Hardware: | Unspecified | |||
| OS: | Linux | |||
| Whiteboard: | ||||
| Fixed In Version: | Doc Type: | Bug Fix | ||
| Doc Text: | Story Points: | --- | ||
| Clone Of: | ||||
| : | 746756 (view as bug list) | Environment: | ||
| Last Closed: | 2014-08-29 01:33:18 UTC | Type: | --- | |
| Regression: | --- | Mount Type: | --- | |
| Documentation: | --- | CRM: | ||
| Verified Versions: | Category: | --- | ||
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | ||
| Cloudforms Team: | --- | Target Upstream Version: | ||
| Bug Depends On: | ||||
| Bug Blocks: | 703312, 746756, 754280 | |||
|
Description
Kashyap Chamarthy
2011-10-17 14:55:20 UTC
Reassigning to cfu. This is not really a selinux problem - as much as a problem of ECC setup. Certicom setup should be standardized so that any required files are located in the appropriate location for selinux to pick them up. i.e. for example in the /var/lib/pki-ca tree. Or alternatively, the right selinux fcontext commands should be documented. The following is the result of discussion and experiment with Nathan: The following commands will allow ECC servers to startup as well as read/write to certicom token to work, such as the pkiconsole cert renewal procedure mentioned in the report (I've tested on both my CA and DRM ECC instances). # Assuming the certicom is installed under the user pkiuser, whose $HOME # is /usr/share/pki /usr/sbin/semanage fcontext -a -t pki_common_t /usr/share/pki/.certicom\(/.*\)? restorecon -r -v /usr/share/pki/.certicom The above needs to go into various documentations, including how to setup ECC. *** Bug 508003 has been marked as a duplicate of this bug. *** set to MODIFIED for QE to test. Affected document should be updated after successful verification. (In reply to comment #5) > The following is the result of discussion and experiment with Nathan: > > The following commands will allow ECC servers to startup as well as read/write > to certicom token to work, such as the pkiconsole cert renewal procedure > mentioned in the report (I've tested on both my CA and DRM ECC instances). > > # Assuming the certicom is installed under the user pkiuser, whose $HOME > # is /usr/share/pki > /usr/sbin/semanage fcontext -a -t pki_common_t > /usr/share/pki/.certicom\(/.*\)? > restorecon -r -v /usr/share/pki/.certicom two things: 1. the formatting in comment #5 had an extra carriage return so it looks like two lines for the semanage command. It should read: /usr/sbin/semanage fcontext -a -t pki_common_t /usr/share/pki/.certicom\(/.*\)? restorecon -r -v /usr/share/pki/.certicom 2. if you install a new instance on the same machine (say, another ca instance), then it looks like /usr/share/pki and /user/share/pki/pki-<subsystem> gets overwritten. So you need to reply again: chcon -R -t usr_t /usr/share/pki /usr/sbin/semanage fcontext -a -t pki_common_t /usr/share/pki/.certicom\(/.*\)? restorecon -r -v /usr/share/pki/.certicom (In reply to comment #9) > (In reply to comment #5) > > The following is the result of discussion and experiment with Nathan: > > > > The following commands will allow ECC servers to startup as well as read/write > > to certicom token to work, such as the pkiconsole cert renewal procedure > > mentioned in the report (I've tested on both my CA and DRM ECC instances). > > > > # Assuming the certicom is installed under the user pkiuser, whose $HOME > > # is /usr/share/pki > > /usr/sbin/semanage fcontext -a -t pki_common_t > > /usr/share/pki/.certicom\(/.*\)? > > restorecon -r -v /usr/share/pki/.certicom > > two things: > 1. the formatting in comment #5 had an extra carriage return so it looks > like two lines for the semanage command. It should read: > /usr/sbin/semanage fcontext -a -t pki_common_t > /usr/share/pki/.certicom\(/.*\)? > restorecon -r -v /usr/share/pki/.certicom Christina, I think you meant there: (while appropriately replacing 'pkiuser3' with whatever user the PKI instance was created with) $ semanage fcontext -a -t pki_common_t /usr/share/pki/pkiuser3/.certicom\(/.*\)? $ restorecon -r -v /usr/share/pki/pkiuser3/.certicom (because there wouldn't be any .certicom directory under the absolute path /usr/share/pki) > > 2. if you install a new instance on the same machine (say, another ca > instance), then it looks like /usr/share/pki and > /user/share/pki/pki-<subsystem> gets overwritten. So you need to reply > again: > chcon -R -t usr_t /usr/share/pki > /usr/sbin/semanage fcontext -a -t pki_common_t > /usr/share/pki/.certicom\(/.*\)? > restorecon -r -v /usr/share/pki/.certicom Some verification info with SELinux Enforcing:
Version Info:
#----------------------------------------------------------------------------#
[root@nocp5 ~]# rpm -qi pki-ca
Name : pki-ca Relocations: (not relocatable)
Version : 8.1.1 Vendor: Red Hat, Inc.
Release : 1.ecc.el5pki Build Date: Sat 17 Nov 2012 02:56:42 PM EST
#----------------------------------------------------------------------------#
[root@nocp5 ~]# rpm -qi pki-selinux
Name : pki-selinux Relocations: (not relocatable)
Version : 8.1.0 Vendor: Red Hat, Inc.
Release : 2.ecc.el5pki Build Date: Sat 17 Nov 2012 02:54:49 PM EST
Install Date: Sun 18 Nov 2012 02:04:46 PM EST Build Host: payday.dsdev.sjc.redhat.com
#----------------------------------------------------------------------------#
#----------------------------------------------------------------------------#[root@nocp5 pkiuser2]# getenforce
Enforcing
#----------------------------------------------------------------------------#[root@nocp5 pkiuser2]# service pki-ca-nov18-nocp5 restart
Stopping pki-ca-nov18-nocp5: ..............................[ OK ]
Starting pki-ca-nov18-nocp5:
Using Java Security Manager
Constructing 'pki-ca-nov18-nocp5.policy' Security Policy
Starting pki-ca-nov18-nocp5: [ OK ]
pki-ca-nov18-nocp5 (pid 11872) is running ...
Unsecure Port = http://nocp5.dsdev.sjc.redhat.com:51180/ca/ee/ca
Secure Agent Port = https://nocp5.dsdev.sjc.redhat.com:51143/ca/agent/ca
Secure EE Port = https://nocp5.dsdev.sjc.redhat.com:51144/ca/ee/ca
Secure Admin Port = https://nocp5.dsdev.sjc.redhat.com:51145/ca/services
EE Client Auth Port = https://nocp5.dsdev.sjc.redhat.com:51146/ca/eeca/ca
PKI Console Port = pkiconsole https://nocp5.dsdev.sjc.redhat.com:51145/ca
Tomcat Port = 51101 (for shutdown)
PKI Instance Name: pki-ca-nov18-nocp5
PKI Subsystem Type: Root CA (Security Domain)
Registered PKI Security Domain Information:
==========================================================================
Name: DsdevSjcRedhat Domain-nov18-2012
URL: https://nocp5.dsdev.sjc.redhat.com:51145
==========================================================================
#----------------------------------------------------------------------------#
[root@nocp5 pkiuser2]# cat /var/log/audit/audit.log | audit2allow -R
[root@nocp5 pkiuser2]#
#----------------------------------------------------------------------------#
[root@nocp5 pkiuser2]# ls -lZ /usr/share/pki/
drwxr-xr-x root root system_u:object_r:usr_t ca
drwxr-xr-x root root system_u:object_r:usr_t ca-ui
drwxr-xr-x root root system_u:object_r:usr_t common-ui
drwxr-xr-x root root system_u:object_r:usr_t java-tools
drwxr-xr-x root root system_u:object_r:usr_t kra
drwxr-xr-x root root system_u:object_r:usr_t kra-ui
drwxr-xr-x root root system_u:object_r:usr_t md5sum
drwxr-xr-x root root system_u:object_r:usr_t ocsp
drwxr-xr-x root root system_u:object_r:usr_t ocsp-ui
drwxr-xr-x pkiuser1 pkiuser1 system_u:object_r:usr_t pkiuser1
drwxr-xr-x pkiuser2 pkiuser2 system_u:object_r:usr_t pkiuser2
drwxr-xr-x root root system_u:object_r:usr_t ra
drwxr-xr-x root root system_u:object_r:usr_t ra-ui
drwxr-xr-x root root system_u:object_r:usr_t scripts
drwxr-xr-x root root system_u:object_r:usr_t setup
drwxr-xr-x root root system_u:object_r:usr_t silent
drwxr-xr-x root root system_u:object_r:usr_t templates
drwxr-xr-x root root system_u:object_r:usr_t tks
drwxr-xr-x root root system_u:object_r:usr_t tks-ui
drwxr-xr-x root root system_u:object_r:usr_t tps
drwxr-xr-x root root system_u:object_r:usr_t tps-ui
[root@nocp5 pkiuser2]#
#----------------------------------------------------------------------------#
[root@nocp5 pkiuser2]# ls -lZ /home/test/.certicom/
drwxr-x--- test test root:object_r:user_home_t sbcp
[root@nocp5 pkiuser2]#
#----------------------------------------------------------------------------#
[root@nocp5 pkiuser2]# cat /var/log/audit/audit.log | audit2allow -R
[root@nocp5 pkiuser2]#
#----------------------------------------------------------------------------#
It could be noted from the above, with a successful ECC CA( w/ certicom) configuration, restarting the CA doesn't produce any AVCs
Version Info:
|------------------------------------------------------------------------------------------------------------------|
[root@nocp4 ~]# rpm -qi pki-ca
Name : pki-ca Relocations: (not relocatable)
Version : 8.1.1 Vendor: Red Hat, Inc.
Release : 1.ecc.el5pki Build Date: Sun 13 Jan 2013 02:56:02 PM EST
|------------------------------------------------------------------------------------------------------------------|
[root@nocp4 ~]# rpm -qi pki-selinux
Name : pki-selinux Relocations: (not relocatable)
Version : 8.1.0 Vendor: Red Hat, Inc.
Release : 2.ecc.el5pki Build Date: Sun 13 Jan 2013 02:54:08 PM EST
|------------------------------------------------------------------------------------------------------------------|
[root@nocp4 ~]# getenforce
Enforcing
|------------------------------------------------------------------------------------------------------------------|
[root@nocp4 pki]# ls -ldZ pkiuser1
drwx------ pkiuser1 pkiuser1 system_u:object_r:usr_t pkiuser1
[root@nocp4 pki]# ls -lZ pkiuser1/.certicom/
drwxr-x--- pkiuser1 pkiuser1 system_u:object_r:pki_common_t sbcp
[root@nocp4 pki]# ls -lRZ pkiuser1/.certicom/
pkiuser1/.certicom/:
drwxr-x--- pkiuser1 pkiuser1 system_u:object_r:pki_common_t sbcp
pkiuser1/.certicom/sbcp:
drwx------ pkiuser1 pkiuser1 system_u:object_r:pki_common_t sbcppri.db
drwx------ pkiuser1 pkiuser1 system_u:object_r:pki_common_t sbcppub.db
drwx------ pkiuser1 pkiuser1 system_u:object_r:pki_common_t sbcpso.db
drwx------ pkiuser1 pkiuser1 system_u:object_r:pki_common_t sbcpuser.db
pkiuser1/.certicom/sbcp/sbcppri.db:
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x00
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x01000000
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x02000000
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x03000000
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x04000000
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x05000000
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x06000000
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x07000000
pkiuser1/.certicom/sbcp/sbcppub.db:
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x00
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x01000000
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x02000000
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x03000000
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x04000000
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x05000000
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x06000000
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x07000000
pkiuser1/.certicom/sbcp/sbcpso.db:
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x00
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x01000000
pkiuser1/.certicom/sbcp/sbcpuser.db:
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x00
-rw------- pkiuser1 pkiuser1 system_u:object_r:pki_common_t x01000000
[root@nocp4 pki]#
|------------------------------------------------------------------------------------------------------------------|
[root@nocp4 ~]# service pki-ca-feb8-inst1-nocp4 restart
Stopping pki-ca-feb8-inst1-nocp4: ...............................[ OK ]
Starting pki-ca-feb8-inst1-nocp4:
Using Java Security Manager
Constructing 'pki-ca-feb8-inst1-nocp4.policy' Security Policy
Starting pki-ca-feb8-inst1-nocp4: [ OK ]
pki-ca-feb8-inst1-nocp4 (pid 19410) is running ...
Unsecure Port = http://nocp4.dsdev.sjc.redhat.com:9180/ca/ee/ca
Secure Agent Port = https://nocp4.dsdev.sjc.redhat.com:9443/ca/agent/ca
Secure EE Port = https://nocp4.dsdev.sjc.redhat.com:9444/ca/ee/ca
Secure Admin Port = https://nocp4.dsdev.sjc.redhat.com:9445/ca/services
EE Client Auth Port = https://nocp4.dsdev.sjc.redhat.com:9446/ca/eeca/ca
PKI Console Port = pkiconsole https://nocp4.dsdev.sjc.redhat.com:9445/ca
Tomcat Port = 9701 (for shutdown)
PKI Instance Name: pki-ca-feb8-inst1-nocp4
PKI Subsystem Type: Root CA (Security Domain)
Registered PKI Security Domain Information:
==========================================================================
Name: pki-ca-ecc-08022013-1
URL: https://nocp4.dsdev.sjc.redhat.com:9445
==========================================================================
|------------------------------------------------------------------------------------------------------------------|
There were no selinux denial messages even while trying to add a new SSL Certificate through java console.
|