<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 10/10/13 10:52 AM, Jan Lieskovsky
      wrote:<br>
    </div>
    <blockquote
      cite="mid:1494505829.4045764.1381416769395.JavaMail.root@redhat.com"
      type="cite">
      <div class="moz-text-plain" wrap="true" graphical-quote="true"
        style="font-family: -moz-fixed; font-size: 12px;"
        lang="x-unicode">
        <pre wrap="">This patch introduces new 'Accounts and Access Control' section
for Fedora content. Also convert four existing RHEL-6 rules from
'Protect Accounts by Restricting Password-Based Login' and include
them into Fedora.

Please review.

Thank you &amp;&amp; Regards, Jan.
--
Jan iankko Lieskovsky / Red Hat Security Technologies Team</pre>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"><legend
          class="mimeAttachmentHeaderName">0001-Fedora-Introduce-Accounts-and-Access-Control-Section.patch</legend></fieldset>
      <br>
      <div class="moz-text-plain" wrap="true" graphical-quote="true"
        style="font-family: -moz-fixed; font-size: 12px;"
        lang="x-western">
        <pre wrap="">From d5049e0baca827e33de5dbd7da28cf037c2eed40 Mon Sep 17 00:00:00 2001
From: Jan Lieskovsky <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:jlieskov@redhat.com">&lt;jlieskov@redhat.com&gt;</a>
Date: Thu, 10 Oct 2013 16:40:14 +0200
Subject: [PATCH] [Fedora] Introduce 'Accounts and Access Control Section'.
 Convert four RHEL-6 rules from its 'Verify Proper Storage'
 subsection to Fedora


Signed-off-by: Jan Lieskovsky <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:jlieskov@redhat.com">&lt;jlieskov@redhat.com&gt;</a>
---
 .../checks/accounts_password_all_shadowed.xml      |  24 +++++
 Fedora/input/checks/no_empty_passwords.xml         |  22 +++++
 Fedora/input/checks/no_netrc_files.xml             |  22 +++++
 Fedora/input/guide.xslt                            |  15 +++
 Fedora/input/profiles/common.xml                   |   4 +
 Fedora/input/system/accounts/accounts.xml          |  11 +++
 .../accounts/restrictions/password_storage.xml     | 107 +++++++++++++++++++++
 .../system/accounts/restrictions/restrictions.xml  |  13 +++
 Fedora/scap-security-guide.spec                    |  11 ++-
 9 files changed, 228 insertions(+), 1 deletion(-)
 create mode 100644 Fedora/input/checks/accounts_password_all_shadowed.xml
 create mode 100644 Fedora/input/checks/no_empty_passwords.xml
 create mode 100644 Fedora/input/checks/no_netrc_files.xml
 create mode 100644 Fedora/input/system/accounts/accounts.xml
 create mode 100644 Fedora/input/system/accounts/restrictions/password_storage.xml
 create mode 100644 Fedora/input/system/accounts/restrictions/restrictions.xml

diff --git a/Fedora/input/checks/accounts_password_all_shadowed.xml b/Fedora/input/checks/accounts_password_all_shadowed.xml
new file mode 100644
index 0000000..42b7482
--- /dev/null
+++ b/Fedora/input/checks/accounts_password_all_shadowed.xml
@@ -0,0 +1,24 @@
+&lt;def-group&gt;
+  &lt;definition class="compliance" id="accounts_password_all_shadowed" version="1"&gt;
+    &lt;metadata&gt;
+      &lt;title&gt;All Password Hashes Shadowed&lt;/title&gt;
+      &lt;affected family="unix"&gt;
+        &lt;platform&gt;Fedora 19&lt;/platform&gt;
+      &lt;/affected&gt;
+      &lt;description&gt;All password hashes should be shadowed.&lt;/description&gt;
+    &lt;/metadata&gt;
+    &lt;criteria&gt;
+      &lt;criterion comment="password hashes are shadowed" test_ref="test_accounts_password_all_shadowed" /&gt;
+    &lt;/criteria&gt;
+  &lt;/definition&gt;
+  &lt;unix:password_test check="all" comment="password hashes are shadowed" id="test_accounts_password_all_shadowed" version="1"&gt;
+    &lt;unix:object object_ref="object_accounts_password_all_shadowed" /&gt;
+    &lt;unix:state state_ref="state_accounts_password_all_shadowed" /&gt;
+  &lt;/unix:password_test&gt;
+  &lt;unix:password_object id="object_accounts_password_all_shadowed" version="1"&gt;
+    &lt;unix:username operation="pattern match"&gt;.*&lt;/unix:username&gt;
+  &lt;/unix:password_object&gt;
+  &lt;unix:password_state id="state_accounts_password_all_shadowed" version="1"&gt;
+    &lt;unix:password&gt;x&lt;/unix:password&gt;
+  &lt;/unix:password_state&gt;
+&lt;/def-group&gt;
diff --git a/Fedora/input/checks/no_empty_passwords.xml b/Fedora/input/checks/no_empty_passwords.xml
new file mode 100644
index 0000000..054d643
--- /dev/null
+++ b/Fedora/input/checks/no_empty_passwords.xml
@@ -0,0 +1,22 @@
+&lt;def-group&gt;
+  &lt;definition class="compliance" id="no_empty_passwords" version="1"&gt;
+    &lt;metadata&gt;
+      &lt;title&gt;No nullok Option in /etc/pam.d/system-auth&lt;/title&gt;
+      &lt;affected family="unix"&gt;
+        &lt;platform&gt;Fedora 19&lt;/platform&gt;
+      &lt;/affected&gt;
+      &lt;description&gt;The file /etc/pam.d/system-auth should not contain the nullok option&lt;/description&gt;
+    &lt;/metadata&gt;
+    &lt;criteria&gt;
+      &lt;criterion comment="make sure the nullok option is not used in /etc/pam.d/system-auth" test_ref="test_no_empty_passwords" /&gt;
+    &lt;/criteria&gt;
+  &lt;/definition&gt;
+  &lt;ind:textfilecontent54_test check="all" check_existence="none_exist" comment="make sure nullok is not used in /etc/pam.d/system-auth" id="test_no_empty_passwords" version="1"&gt;
+    &lt;ind:object object_ref="object_no_empty_passwords" /&gt;
+  &lt;/ind:textfilecontent54_test&gt;
+  &lt;ind:textfilecontent54_object id="object_no_empty_passwords" version="1"&gt;
+    &lt;ind:filepath&gt;/etc/pam.d/system-auth&lt;/ind:filepath&gt;
+    &lt;ind:pattern operation="pattern match"&gt;\s*nullok\s*&lt;/ind:pattern&gt;
+    &lt;ind:instance datatype="int"&gt;1&lt;/ind:instance&gt;
+  &lt;/ind:textfilecontent54_object&gt;
+&lt;/def-group&gt;
diff --git a/Fedora/input/checks/no_netrc_files.xml b/Fedora/input/checks/no_netrc_files.xml
new file mode 100644
index 0000000..740a98b
--- /dev/null
+++ b/Fedora/input/checks/no_netrc_files.xml
@@ -0,0 +1,22 @@
+&lt;def-group&gt;
+  &lt;definition class="compliance" id="no_netrc_files" version="1"&gt;
+    &lt;metadata&gt;
+      &lt;title&gt;Verify No netrc Files Exist&lt;/title&gt;
+      &lt;affected family="unix"&gt;
+        &lt;platform&gt;Fedora 19&lt;/platform&gt;
+      &lt;/affected&gt;
+      &lt;description&gt;The .netrc files contain login information used to auto-login into FTP servers and reside in the user's home directory. Any .netrc files should be removed.&lt;/description&gt;
+    &lt;/metadata&gt;
+    &lt;criteria&gt;
+      &lt;criterion test_ref="test_no_netrc_files_home" negate="true" /&gt;
+    &lt;/criteria&gt;
+  &lt;/definition&gt;
+  &lt;unix:file_test check="all" check_existence="at_least_one_exists" comment="look for .netrc in /home" id="test_no_netrc_files_home" version="1"&gt;
+    &lt;unix:object object_ref="object_no_netrc_files_home" /&gt;
+  &lt;/unix:file_test&gt;
+  &lt;unix:file_object comment="look for .netrc in /home" id="object_no_netrc_files_home" version="1"&gt;
+    &lt;unix:behaviors recurse="directories" recurse_direction="down" max_depth="1" recurse_file_system="all" /&gt;
+    &lt;unix:path operation="equals"&gt;/home&lt;/unix:path&gt;
+    &lt;unix:filename operation="pattern match"&gt;^\.netrc$&lt;/unix:filename&gt;
+  &lt;/unix:file_object&gt;
+&lt;/def-group&gt;
diff --git a/Fedora/input/guide.xslt b/Fedora/input/guide.xslt
index a24bdd9..8bdf86e 100644
--- a/Fedora/input/guide.xslt
+++ b/Fedora/input/guide.xslt
@@ -24,6 +24,7 @@
     &lt;xsl:copy&gt;
       &lt;xsl:copy-of select="@*|node()" /&gt;
       &lt;xsl:apply-templates select="document('system/software/software.xml')" /&gt;
+      &lt;xsl:apply-templates select="document('system/accounts/accounts.xml')" /&gt;
     &lt;/xsl:copy&gt;
   &lt;/xsl:template&gt;
 
@@ -34,6 +35,20 @@
     &lt;/xsl:copy&gt;
   &lt;/xsl:template&gt;
 
+  &lt;xsl:template match="Group[@id='accounts']"&gt;
+    &lt;xsl:copy&gt;
+      &lt;xsl:copy-of select="@*|node()" /&gt;
+      &lt;xsl:apply-templates select="document('system/accounts/restrictions/restrictions.xml')" /&gt;
+    &lt;/xsl:copy&gt;
+  &lt;/xsl:template&gt;
+
+  &lt;xsl:template match="Group[@id='accounts-restrictions']"&gt;
+    &lt;xsl:copy&gt;
+      &lt;xsl:copy-of select="@*|node()" /&gt;
+      &lt;xsl:apply-templates select="document('system/accounts/restrictions/password_storage.xml')" /&gt;
+    &lt;/xsl:copy&gt;
+  &lt;/xsl:template&gt;
+
   &lt;!-- copy everything else through to final output --&gt;
   &lt;xsl:template match="@*|node()"&gt;
     &lt;xsl:copy&gt;
diff --git a/Fedora/input/profiles/common.xml b/Fedora/input/profiles/common.xml
index 18c8f3e..2739a33 100644
--- a/Fedora/input/profiles/common.xml
+++ b/Fedora/input/profiles/common.xml
@@ -4,5 +4,9 @@
 
 &lt;select idref="ensure_gpgcheck_globally_activated" selected="true"/&gt;
 &lt;select idref="ensure_gpgcheck_never_disabled" selected="true"/&gt;
+&lt;select idref="no_empty_passwords" selected="true"/&gt;
+&lt;select idref="no_hashes_outside_shadow" selected="true"/&gt;
+&lt;select idref="gid_passwd_group_same" selected="true"/&gt;
+&lt;select idref="no_netrc_files" selected="true"/&gt;
 
 &lt;/Profile&gt;
diff --git a/Fedora/input/system/accounts/accounts.xml b/Fedora/input/system/accounts/accounts.xml
new file mode 100644
index 0000000..044d85d
--- /dev/null
+++ b/Fedora/input/system/accounts/accounts.xml
@@ -0,0 +1,11 @@
+&lt;Group id="accounts"&gt;
+&lt;title&gt;Account and Access Control&lt;/title&gt;
+&lt;description&gt;In traditional Unix security, if an attacker gains
+shell access to a certain login account, they can perform any action
+or access any file to which that account has access. Therefore,
+making it more difficult for unauthorized people to gain shell
+access to accounts, particularly to privileged accounts, is a
+necessary part of securing a system. This section introduces
+mechanisms for restricting access to accounts under Fedora.
+&lt;/description&gt;
+&lt;/Group&gt;
diff --git a/Fedora/input/system/accounts/restrictions/password_storage.xml b/Fedora/input/system/accounts/restrictions/password_storage.xml
new file mode 100644
index 0000000..d1bbcd3
--- /dev/null
+++ b/Fedora/input/system/accounts/restrictions/password_storage.xml
@@ -0,0 +1,107 @@
+&lt;Group id="password_storage"&gt;
+&lt;title&gt;Verify Proper Storage and Existence of Password
+Hashes&lt;/title&gt;
+&lt;description&gt;
+By default, password hashes for local accounts are stored
+in the second field (colon-separated) in
+&lt;tt&gt;/etc/shadow&lt;/tt&gt;. This file should be readable only by
+processes running with root credentials, preventing users from
+casually accessing others' password hashes and attempting
+to crack them.
+However, it remains possible to misconfigure the system
+and store password hashes
+in world-readable files such as &lt;tt&gt;/etc/passwd&lt;/tt&gt;, or
+to even store passwords themselves in plaintext on the system.
+Using system-provided tools for password change/creation
+should allow administrators to avoid such misconfiguration.
+&lt;/description&gt;
+
+&lt;Rule id="no_empty_passwords" severity="high"&gt;
+&lt;title&gt;Prevent Log In to Accounts With Empty Password&lt;/title&gt;
+&lt;description&gt;If an account is configured for password authentication
+but does not have an assigned password, it may be possible to log
+into the account without authentication. Remove any instances of the &lt;tt&gt;nullok&lt;/tt&gt;
+option in &lt;tt&gt;/etc/pam.d/system-auth&lt;/tt&gt; to
+prevent logins with empty passwords.
+&lt;/description&gt;
+&lt;ocil clause="NULL passwords can be used"&gt;
+To verify that null passwords cannot be used, run the following command:
+&lt;pre&gt;# grep nullok /etc/pam.d/system-auth&lt;/pre&gt;
+If this produces any output, it may be possible to log into accounts
+with empty passwords.
+&lt;/ocil&gt;
+&lt;rationale&gt;
+If an account has an empty password, anyone could log in and
+run commands with the privileges of that account. Accounts with
+empty passwords should never be used in operational
+environments.
+&lt;/rationale&gt;
+&lt;oval id="no_empty_passwords" /&gt;
+&lt;ref nist="IA-5(b),IA-5(c),IA-5(1)(a)" /&gt;
+&lt;/Rule&gt;
+
+&lt;Rule id="no_hashes_outside_shadow" severity="medium"&gt;
+&lt;title&gt;Verify All Account Password Hashes are Shadowed&lt;/title&gt;
+&lt;description&gt;
+If any password hashes are stored in &lt;tt&gt;/etc/passwd&lt;/tt&gt; (in the second field,
+instead of an &lt;tt&gt;x&lt;/tt&gt;), the cause of this misconfiguration should be
+investigated.  The account should have its password reset and the hash should be
+properly stored, or the account should be deleted entirely.
+&lt;/description&gt;
+&lt;ocil clause="any stored hashes are found in /etc/passwd"&gt;
+To check that no password hashes are stored in
+&lt;tt&gt;/etc/passwd&lt;/tt&gt;, run the following command:
+&lt;pre&gt;# awk -F: '($2 != "x") {print}' /etc/passwd&lt;/pre&gt;
+If it produces any output, then a password hash is
+stored in &lt;tt&gt;/etc/passwd&lt;/tt&gt;.
+&lt;/ocil&gt;
+&lt;rationale&gt;
+The hashes for all user account passwords should be stored in
+the file &lt;tt&gt;/etc/shadow&lt;/tt&gt; and never in &lt;tt&gt;/etc/passwd&lt;/tt&gt;,
+which is readable by all users.
+&lt;/rationale&gt;
+&lt;oval id="accounts_password_all_shadowed" /&gt;
+&lt;ref nist="IA-5(h)" disa="201" /&gt;
+&lt;/Rule&gt;
+
+&lt;Rule id="gid_passwd_group_same"&gt;
+&lt;title&gt;All GIDs referenced in /etc/passwd must be defined in /etc/group&lt;/title&gt;
+&lt;description&gt;
+Add a group to the system for each GID referenced without a corresponding group.
+&lt;/description&gt;
+&lt;ocil clause="there is output"&gt;
+To ensure all GIDs referenced in &lt;tt&gt;/etc/passwd&lt;/tt&gt; are defined in &lt;tt&gt;/etc/group&lt;/tt&gt;, 
+run the following command:
+&lt;pre&gt;# pwck -qr&lt;/pre&gt;
+There should be no output.
+&lt;/ocil&gt;
+&lt;rationale&gt;
+Inconsistency in GIDs between &lt;tt&gt;/etc/passwd&lt;/tt&gt; and &lt;tt&gt;/etc/group&lt;/tt&gt; could lead to a user having unintended rights.
+&lt;/rationale&gt;
+&lt;ref disa="366" /&gt;
+&lt;/Rule&gt;
+
+&lt;Rule id="no_netrc_files" severity="medium"&gt;
+&lt;title&gt;Verify No netrc Files Exist&lt;/title&gt;
+&lt;description&gt;The &lt;tt&gt;.netrc&lt;/tt&gt; files contain login information
+used to auto-login into FTP servers and reside in the user's home
+directory. These files may contain unencrypted passwords to
+remote FTP servers making them susceptible to access by unauthorized
+users and should not be used.  Any &lt;tt&gt;.netrc&lt;/tt&gt; files should be removed.
+&lt;/description&gt;
+&lt;ocil clause="any .netrc files exist"&gt;
+To check the system for the existence of any &lt;tt&gt;.netrc&lt;/tt&gt; files,
+run the following command:
+&lt;pre&gt;# find /home -xdev -name .netrc&lt;/pre&gt;
+&lt;!-- needs fixup to limit search to home dirs --&gt;
+&lt;/ocil&gt;
+&lt;rationale&gt;
+Unencrypted passwords for remote FTP servers may be stored in &lt;tt&gt;.netrc&lt;/tt&gt;
+files. DoD policy requires passwords be encrypted in storage and not used
+in access scripts.
+&lt;/rationale&gt;
+&lt;oval id="no_netrc_files" /&gt;
+&lt;ref nist="IA-5(h)" disa="196" /&gt;
+&lt;/Rule&gt;
+
+&lt;/Group&gt;
diff --git a/Fedora/input/system/accounts/restrictions/restrictions.xml b/Fedora/input/system/accounts/restrictions/restrictions.xml
new file mode 100644
index 0000000..febead6
--- /dev/null
+++ b/Fedora/input/system/accounts/restrictions/restrictions.xml
@@ -0,0 +1,13 @@
+&lt;Group id="accounts-restrictions"&gt;
+&lt;title&gt;Protect Accounts by Restricting Password-Based Login&lt;/title&gt;
+&lt;description&gt;Conventionally, Unix shell accounts are accessed by
+providing a username and password to a login program, which tests
+these values for correctness using the &lt;tt&gt;/etc/passwd&lt;/tt&gt; and
+&lt;tt&gt;/etc/shadow&lt;/tt&gt; files. Password-based login is vulnerable to
+guessing of weak passwords, and to sniffing and man-in-the-middle
+attacks against passwords entered over a network or at an insecure
+console. Therefore, mechanisms for accessing accounts by entering
+usernames and passwords should be restricted to those which are
+operationally necessary.&lt;/description&gt;
+
+&lt;/Group&gt;
diff --git a/Fedora/scap-security-guide.spec b/Fedora/scap-security-guide.spec
index 4ef3713..73eab57 100644
--- a/Fedora/scap-security-guide.spec
+++ b/Fedora/scap-security-guide.spec
@@ -5,7 +5,7 @@
 # file one level up - in the main scap-security-guide directory (instead of
 # this one).
 
-%global        fedorassgrelease        2.rc1
+%global        fedorassgrelease        2.rc2
 
 Name:                scap-security-guide
 Version:        0.1
@@ -50,6 +50,15 @@ rm -rf $RPM_BUILD_ROOT
 %{_datadir}/xml/scap/ssg/fedora/19/*
 
 %changelog
+* Thu Oct 10 2013 Jan iankko Lieskovsky <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:jlieskov@redhat.com">&lt;jlieskov@redhat.com&gt;</a> 0.1-2.rc2
+- Introduce 'Account and Access Control' section
+- Convert following "Verify Proper Storage and Existence of Password Hashes" section
+  rules to Fedora:
+  * Prevent Log In to Accounts With Empty Password
+  * Verify All Account Password Hashes are Shadowed
+  * All GIDs referenced in /etc/passwd must be defined in /etc/group
+  * Verify No netrc Files Exist
+
 * Wed Oct 02 2013 Jan iankko Lieskovsky <a moz-do-not-send="true" class="moz-txt-link-rfc2396E" href="mailto:jlieskov@redhat.com">&lt;jlieskov@redhat.com&gt;</a> 0.1-2.rc1
 - Set proper name of the build directory in the spec's %setup macro.
 - Replace hard-wired paths with macros. Preserve attributes when copying files.
<div class="moz-txt-sig">-- 
1.7.11.7

</div></pre>
      </div>
    </blockquote>
    <br>
    ack<br>
  </body>
</html>