{"description": "Ensure that SSH will display the date and time of the last successful account logon.\n<br/>\nThe default SSH configuration enables print of the date and time of the last login.\nThe appropriate configuration is used if no value is set for <tt>PrintLastLog</tt>.\n<br/>\nTo explicitly enable LastLog in SSH, add or correct the following line in\n\n\n<tt>/etc/ssh/sshd_config.d/00-complianceascode-hardening.conf</tt>:\n\n<pre>PrintLastLog yes</pre>", "rationale": "Providing users feedback on when account accesses last occurred facilitates user\nrecognition and reporting of unauthorized account use.", "severity": "medium", "references": {"cis-csc": ["1", "12", "15", "16"], "cobit5": ["DSS05.04", "DSS05.10", "DSS06.10"], "isa-62443-2009": ["4.3.3.6.1", "4.3.3.6.2", "4.3.3.6.3", "4.3.3.6.4", "4.3.3.6.5", "4.3.3.6.6", "4.3.3.6.7", "4.3.3.6.8", "4.3.3.6.9"], "isa-62443-2013": ["SR 1.1", "SR 1.10", "SR 1.2", "SR 1.5", "SR 1.7", "SR 1.8", "SR 1.9"], "iso27001-2013": ["A.18.1.4", "A.9.2.1", "A.9.2.4", "A.9.3.1", "A.9.4.2", "A.9.4.3"], "nist": ["AC-9", "AC-9(1)"], "nist-csf": ["PR.AC-7"], "srg": ["SRG-OS-000480-GPOS-00227"], "ism": ["0582", "0846"]}, "control_references": {"ism": ["0582", "0846"]}, "components": [], "identifiers": {}, "ocil_clause": "the required value is not set", "ocil": "To determine how the SSH daemon's <tt>PrintLastLog</tt> option is set, run the following command:\n\n<pre>$ sudo grep -i PrintLastLog /etc/ssh/sshd_config.d/00-complianceascode-hardening.conf</pre>\n<pre>$ sudo grep -i PrintLastLog /etc/ssh/sshd_config.d/01-complianceascode-reinforce-os-defaults.conf</pre>\n\nIf a line indicating <tt>yes</tt> is returned, then the required value is set.\n", "oval_external_content": null, "fixtext": "To configure the system add or modify the following line in \"/etc/ssh/sshd_config.d/00-complianceascode-hardening.conf\".\nPrintLastLog yes\nRestart the SSH daemon for the settings to take effect:\n$ sudo systemctl restart sshd.service", "checktext": "", "vuldiscussion": "", "srg_requirement": "Ubuntu 22.04 must display the date and time of the last successful account logon upon an SSH logon.", "warnings": [], "conflicts": [], "requires": [], "policy_specific_content": {"stig": {"srg_requirement": "Ubuntu 22.04 SSH daemon must display the date and time of the last successful account logon upon an SSH logon.", "vuldiscussion": "Providing users feedback on when account accesses last occurred facilitates user recognition and reporting of unauthorized account use.", "checktext": "Verify the SSH daemon provides users with feedback on when account accesses last occurred with the following command:\n\n$ sudo /usr/sbin/sshd -dd 2&gt;&1 | awk '/filename/ {print $4}' | tr -d '\\r' | tr '\\n' ' ' | xargs sudo grep -iH '^\\s*printlastlog'\n\nPrintLastLog yes\n\nIf the \"PrintLastLog\" keyword is set to \"no\", the returned line is commented out, or no output is returned, this is a finding.", "fixtext": "Configure the SSH daemon to provide users with feedback on when account accesses last occurred.\n\nAdd the following line to \"/etc/ssh/sshd_config\" or to a file in \"/etc/ssh/sshd_config.d\", or uncomment the line and set the value to \"yes\":\n\nPrintLastLog yes\n\nThe SSH service must be restarted for changes to take effect:\n\n$ sudo systemctl restart sshd.service"}}, "platform": null, "platforms": [], "sce_metadata": {}, "inherited_platforms": ["system_with_kernel"], "cpe_platform_names": [], "inherited_cpe_platform_names": ["system_with_kernel"], "bash_conditional": null, "fixes": {}, "title": "Enable SSH Print Last Log", "definition_location": "/aptdata/openscap/scap-security-guide/linux_os/guide/services/ssh/ssh_server/sshd_print_last_log/rule.yml", "template": {"name": "sshd_lineinfile", "vars": {"parameter": "PrintLastLog", "value": "yes", "datatype": "string", "is_default_value": "true"}, "backends": {}}}