diff options
author | Xin Ouyang <Xin.Ouyang@windriver.com> | 2012-09-11 14:42:56 +0800 |
---|---|---|
committer | Xin Ouyang <Xin.Ouyang@windriver.com> | 2012-10-18 11:07:44 +0800 |
commit | 9a9acff6c74ade48986f85b6147e930edf0267c4 (patch) | |
tree | 04db6c2b2c67a92aafce8d8e842a29b0c5d81f07 | |
parent | 36edcd0e47ea39881ae0554bc0591edc8202a52c (diff) | |
download | meta-selinux-9a9acff6c74ade48986f85b6147e930edf0267c4.tar.gz |
openssh: enable pam and selinux.
sshd_config file from oe-core to set "UsePAM yes".
sshd file (pam config for sshd) from oe-core to add pam_selinux module.
Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
-rw-r--r-- | recipes-connectivity/openssh/files/sshd | 24 | ||||
-rw-r--r-- | recipes-connectivity/openssh/files/sshd_config | 119 | ||||
-rw-r--r-- | recipes-connectivity/openssh/openssh_6.0p1.bbappend | 4 |
3 files changed, 146 insertions, 1 deletions
diff --git a/recipes-connectivity/openssh/files/sshd b/recipes-connectivity/openssh/files/sshd new file mode 100644 index 0000000..72303eb --- /dev/null +++ b/recipes-connectivity/openssh/files/sshd | |||
@@ -0,0 +1,24 @@ | |||
1 | #%PAM-1.0 | ||
2 | |||
3 | auth include common-auth | ||
4 | account required pam_nologin.so | ||
5 | |||
6 | # SELinux needs to be the first session rule. This ensures that any | ||
7 | # lingering context has been cleared. Without out this it is possible | ||
8 | # that a module could execute code in the wrong domain. | ||
9 | # When the module is present, "required" would be sufficient (When SELinux | ||
10 | # is disabled, this returns success.) | ||
11 | session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so close | ||
12 | |||
13 | account include common-account | ||
14 | password include common-password | ||
15 | session optional pam_keyinit.so force revoke | ||
16 | session include common-session | ||
17 | session required pam_loginuid.so | ||
18 | |||
19 | # SELinux needs to intervene at login time to ensure that the process | ||
20 | # starts in the proper default security context. Only sessions which are | ||
21 | # intended to run in the user's context should be run after this. | ||
22 | # When the module is present, "required" would be sufficient (When SELinux | ||
23 | # is disabled, this returns success.) | ||
24 | session [success=ok ignore=ignore module_unknown=ignore default=bad] pam_selinux.so open | ||
diff --git a/recipes-connectivity/openssh/files/sshd_config b/recipes-connectivity/openssh/files/sshd_config new file mode 100644 index 0000000..c5c0905 --- /dev/null +++ b/recipes-connectivity/openssh/files/sshd_config | |||
@@ -0,0 +1,119 @@ | |||
1 | # $OpenBSD: sshd_config,v 1.80 2008/07/02 02:24:18 djm Exp $ | ||
2 | |||
3 | # This is the sshd server system-wide configuration file. See | ||
4 | # sshd_config(5) for more information. | ||
5 | |||
6 | # This sshd was compiled with PATH=/usr/bin:/bin:/usr/sbin:/sbin | ||
7 | |||
8 | # The strategy used for options in the default sshd_config shipped with | ||
9 | # OpenSSH is to specify options with their default value where | ||
10 | # possible, but leave them commented. Uncommented options change a | ||
11 | # default value. | ||
12 | |||
13 | #Port 22 | ||
14 | #AddressFamily any | ||
15 | #ListenAddress 0.0.0.0 | ||
16 | #ListenAddress :: | ||
17 | |||
18 | # Disable legacy (protocol version 1) support in the server for new | ||
19 | # installations. In future the default will change to require explicit | ||
20 | # activation of protocol 1 | ||
21 | Protocol 2 | ||
22 | |||
23 | # HostKey for protocol version 1 | ||
24 | #HostKey /etc/ssh/ssh_host_key | ||
25 | # HostKeys for protocol version 2 | ||
26 | #HostKey /etc/ssh/ssh_host_rsa_key | ||
27 | #HostKey /etc/ssh/ssh_host_dsa_key | ||
28 | |||
29 | # Lifetime and size of ephemeral version 1 server key | ||
30 | #KeyRegenerationInterval 1h | ||
31 | #ServerKeyBits 1024 | ||
32 | |||
33 | # Logging | ||
34 | # obsoletes QuietMode and FascistLogging | ||
35 | #SyslogFacility AUTH | ||
36 | #LogLevel INFO | ||
37 | |||
38 | # Authentication: | ||
39 | |||
40 | #LoginGraceTime 2m | ||
41 | #PermitRootLogin yes | ||
42 | #StrictModes yes | ||
43 | #MaxAuthTries 6 | ||
44 | #MaxSessions 10 | ||
45 | |||
46 | #RSAAuthentication yes | ||
47 | #PubkeyAuthentication yes | ||
48 | #AuthorizedKeysFile .ssh/authorized_keys | ||
49 | |||
50 | # For this to work you will also need host keys in /etc/ssh/ssh_known_hosts | ||
51 | #RhostsRSAAuthentication no | ||
52 | # similar for protocol version 2 | ||
53 | #HostbasedAuthentication no | ||
54 | # Change to yes if you don't trust ~/.ssh/known_hosts for | ||
55 | # RhostsRSAAuthentication and HostbasedAuthentication | ||
56 | #IgnoreUserKnownHosts no | ||
57 | # Don't read the user's ~/.rhosts and ~/.shosts files | ||
58 | #IgnoreRhosts yes | ||
59 | |||
60 | # To disable tunneled clear text passwords, change to no here! | ||
61 | #PasswordAuthentication yes | ||
62 | #PermitEmptyPasswords no | ||
63 | |||
64 | # Change to no to disable s/key passwords | ||
65 | #ChallengeResponseAuthentication yes | ||
66 | |||
67 | # Kerberos options | ||
68 | #KerberosAuthentication no | ||
69 | #KerberosOrLocalPasswd yes | ||
70 | #KerberosTicketCleanup yes | ||
71 | #KerberosGetAFSToken no | ||
72 | |||
73 | # GSSAPI options | ||
74 | #GSSAPIAuthentication no | ||
75 | #GSSAPICleanupCredentials yes | ||
76 | |||
77 | # Set this to 'yes' to enable PAM authentication, account processing, | ||
78 | # and session processing. If this is enabled, PAM authentication will | ||
79 | # be allowed through the ChallengeResponseAuthentication and | ||
80 | # PasswordAuthentication. Depending on your PAM configuration, | ||
81 | # PAM authentication via ChallengeResponseAuthentication may bypass | ||
82 | # the setting of "PermitRootLogin without-password". | ||
83 | # If you just want the PAM account and session checks to run without | ||
84 | # PAM authentication, then enable this but set PasswordAuthentication | ||
85 | # and ChallengeResponseAuthentication to 'no'. | ||
86 | UsePAM yes | ||
87 | |||
88 | #AllowAgentForwarding yes | ||
89 | #AllowTcpForwarding yes | ||
90 | #GatewayPorts no | ||
91 | #X11Forwarding no | ||
92 | #X11DisplayOffset 10 | ||
93 | #X11UseLocalhost yes | ||
94 | #PrintMotd yes | ||
95 | #PrintLastLog yes | ||
96 | #TCPKeepAlive yes | ||
97 | #UseLogin no | ||
98 | UsePrivilegeSeparation yes | ||
99 | #PermitUserEnvironment no | ||
100 | Compression no | ||
101 | ClientAliveInterval 15 | ||
102 | ClientAliveCountMax 4 | ||
103 | #UseDNS yes | ||
104 | #PidFile /var/run/sshd.pid | ||
105 | #MaxStartups 10 | ||
106 | #PermitTunnel no | ||
107 | #ChrootDirectory none | ||
108 | |||
109 | # no default banner path | ||
110 | #Banner none | ||
111 | |||
112 | # override default of no subsystems | ||
113 | Subsystem sftp /usr/libexec/sftp-server | ||
114 | |||
115 | # Example of overriding settings on a per-user basis | ||
116 | #Match User anoncvs | ||
117 | # X11Forwarding no | ||
118 | # AllowTcpForwarding no | ||
119 | # ForceCommand cvs server | ||
diff --git a/recipes-connectivity/openssh/openssh_6.0p1.bbappend b/recipes-connectivity/openssh/openssh_6.0p1.bbappend index 396feae..103a6ac 100644 --- a/recipes-connectivity/openssh/openssh_6.0p1.bbappend +++ b/recipes-connectivity/openssh/openssh_6.0p1.bbappend | |||
@@ -1,4 +1,6 @@ | |||
1 | PR .= ".1" | 1 | PR .= ".2" |
2 | |||
3 | FILESEXTRAPATHS_prepend := "${THISDIR}/files:" | ||
2 | 4 | ||
3 | DEPENDS += "${@base_contains('DISTRO_FEATURES', 'selinux', 'libselinux', '', d)}" | 5 | DEPENDS += "${@base_contains('DISTRO_FEATURES', 'selinux', 'libselinux', '', d)}" |
4 | 6 | ||