Bug 693420

Summary: /dev/random inaccessible by ssh-keygen
Product: Red Hat Enterprise Linux 6 Reporter: Stephan Mueller <smueller>
Component: selinux-policyAssignee: Miroslav Grepl <mgrepl>
Status: CLOSED ERRATA QA Contact: Miroslav Vadkerti <mvadkert>
Severity: high Docs Contact:
Priority: urgent    
Version: 6.1CC: dwalsh, ebenes, mmalik, mvadkert, sgrubb, syeghiay
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: selinux-policy-3.7.19-81.el6 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-19 12:27:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 584498, 846801, 846802    

Description Stephan Mueller 2011-04-04 15:36:59 UTC
Description of problem:

sshd does not start as the /etc/init.d/sshd ssh-keygen script is not able to access /dev/random for the host key generation. Note, in the evaluated configuration SSH_USE_STRONG_RNG is 1 which requires /dev/random.

ssh-keygen is not able to access /dev/random when run as user either. 

Version-Release number of selected component (if applicable):
RHEL6.1 ISO of Mar 30.

Expected results:
All OpenSSH applications must be able to access /dev/random.

Additional info:

A simple cat /dev/random works, so the policy most likely needs updating.

Comment 2 RHEL Program Management 2011-04-04 15:43:21 UTC
Since RHEL 6.1 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 3 Daniel Walsh 2011-04-04 19:15:13 UTC
+dev_read_rand(ssh_keygen_t)


Are you seeing errors about anything other then ssh_keygen_t?

Comment 4 Stephan Mueller 2011-04-05 11:24:52 UTC
> Are you seeing errors about anything other then ssh_keygen_t?

I did not try anything else, but all OpenSSH applications (ssh, sshd, ssh-keygen) which have access to /dev/urandom must also be granted access to /dev/random as a THE central DRNG mechanism which is used by all the OpenSSH applications that need randomness can be switched from /dev/urandom to /dev/random.

Comment 5 Miroslav Vadkerti 2011-04-05 12:14:23 UTC
I can see problem with ssh also:

type=AVC msg=audit(1301987422.876:3827): avc:  denied  { getattr } for  pid=7359 comm="ssh" path="/dev/random" dev=devtmpfs ino=3687 scontext=staff_u:sysadm_r:ssh_t:s0-s15:c0.c1023 tcontext=system_u:object_r:random_device_t:s0 tclass=chr_file
type=AVC msg=audit(1301987562.162:3829): avc:  denied  { getattr } for  pid=7378 comm="ssh" path="/dev/random" dev=devtmpfs ino=3687 scontext=staff_u:sysadm_r:ssh_t:s0-s15:c0.c1023 tcontext=system_u:object_r:random_device_t:s0 tclass=chr_file

Comment 6 Daniel Walsh 2011-04-05 14:20:46 UTC
Miroslav Grepl, lets also add

dev_read_rand(ssh_t)
dev_read_rand(ssh_keysign_t)

Comment 7 Miroslav Grepl 2011-04-05 14:32:43 UTC
Yes, I added it.

Comment 10 Miroslav Grepl 2011-04-05 19:13:29 UTC
Fixed in selinux-policy-3.7.19-81.el6

Comment 12 Miroslav Vadkerti 2011-04-07 11:38:44 UTC
This seems to be fixed in selinux-policy-mls-3.7.19-82.el6

ssh:
[root/sysadm_r/SystemLow@ibm-dx360m2-01 ~]# export SSH_USE_STRONG_RNG=1
[root/sysadm_r/SystemLow@ibm-dx360m2-01 ~]# ssh eal@localhost
Last login: Thu Apr  7 01:35:00 2011 from freedom.brq.redhat.com
[eal/staff_r/SystemLow@ibm-dx360m2-01 ~]$

ssh-keygen:
[eal/staff_r/SystemLow@ibm-dx360m2-01 ~]$  export SSH_USE_STRONG_RNG=1
[eal/staff_r/SystemLow@ibm-dx360m2-01 ~]$ ssh-keygen 
Generating public/private rsa key pair.
Enter file in which to save the key (/home/eal/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /home/eal/.ssh/id_rsa.
Your public key has been saved in /home/eal/.ssh/id_rsa.pub.
The key fingerprint is:
70:e6:c9:fe:d1:06:22:8d:e0:40:e8:8b:f7:60:24:a9 eal.eng.bos.redhat.com
The key's randomart image is:
+--[ RSA 2048]----+
| ..              |
|..               |
|... . . o        |
|o..o . O .       |
|oo. . o S .      |
|E.+    o . o     |
| o o    . . o    |
|    .    . o     |
|          .      |
+-----------------+

sshd:
[root/sysadm_r/SystemLow@ibm-dx360m2-01 ~]# run_init service sshd restart
Authenticating eal.
Password: 
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]

Comment 14 errata-xmlrpc 2011-05-19 12:27:31 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2011-0526.html