id: pwpolicy_max_lifetime_enforce
title: Restrict Maximum Password Lifetime to $ODV Days
discussion: |
  The macOS _MUST_ be configured to enforce a maximum password lifetime limit of at least $ODV days.

  This rule ensures that users are forced to change their passwords frequently enough to prevent malicious users from gaining and maintaining access to the system.

  NOTE: To comply with Executive Order 14028, “Improving the Nation's Cybersecurity”, OMB M-22-09, “Moving the U.S. Government Toward Zero Trust Cybersecurity Principles”, and NIST SP-800-63b, “Digital Identity Guidelines: Authentication and Lifecycle Management” federal, military, and intelligence communities must adopt the following configuration settings. Password policies must not require the use of complexity policies such as upper characters, lower characters, or special characters. Password policies must also not require the use of regular rotation. Password policies should define a minimum length. Multifactor authentication should be used where ever possible.
check: |
  /usr/bin/pwpolicy -getaccountpolicies 2> /dev/null | /usr/bin/tail +2 | /usr/bin/xmllint --xpath '//dict/key[text()="policyAttributeExpiresEveryNDays"]/following-sibling::*[1]/text()' - | /usr/bin/awk '{ if ($1 <= $ODV ) {print "pass"} else {print "fail"}}' | /usr/bin/uniq
result:
  string: "pass"
fix: |
  This is implemented by a Configuration Profile.
references:
  cce:
    - CCE-94339-9
  cci:
    - CCI-000199
    - CCI-004066
  800-53r5:
    - IA-5
  800-53r4:
    - IA-5
    - IA-5(1)
  srg:
    - SRG-OS-000076-GPOS-00044
    - SRG-OS-000775-GPOS-00230
  disa_stig:
    - APPL-15-003008
  800-171r3:
    - 03.05.12
  cis:
    benchmark:
      - 5.2.7 (level 1)
    controls v8:
      - 5.3
  cmmc:
    - IA.L2-3.5.8
    - IA.L2-3.5.9
macOS:
  - '15.0'
odv:
  hint: Number of days.
  recommended: 60
  cis_lvl1: 365
  cis_lvl2: 365
  stig: 60
tags:
  - cis_lvl1
  - cis_lvl2
  - cisv8
  - cnssi-1253_low
  - cnssi-1253_high
  - cmmc_lvl2
  - stig
  - cnssi-1253_moderate
severity: medium
mobileconfig: true
mobileconfig_info:
  com.apple.mobiledevice.passwordpolicy:
    maxPINAgeInDays: $ODV
ddm_info:
  declarationtype: com.apple.configuration.passcode.settings
  ddm_key: MaximumPasscodeAgeInDays
  ddm_value: $ODV