| {%- from "linux/map.jinja" import login_defs with context -%} |
| # This file is managed by Salt, do not edit |
| {%- set allowed_options = [ |
| 'CHFN_RESTRICT', |
| 'CONSOLE_GROUPS', |
| 'CREATE_HOME', |
| 'DEFAULT_HOME', |
| 'ENCRYPT_METHOD', |
| 'ENV_HZ', |
| 'ENV_PATH', |
| 'ENV_SUPATH', |
| 'ERASECHAR', |
| 'FAIL_DELAY', |
| 'FAKE_SHELL', |
| 'GID_MAX', |
| 'GID_MIN', |
| 'HUSHLOGIN_FILE', |
| 'KILLCHAR', |
| 'LOG_OK_LOGINS', |
| 'LOG_UNKFAIL_ENAB', |
| 'LOGIN_RETRIES', |
| 'LOGIN_TIMEOUT', |
| 'MAIL_DIR', |
| 'MAIL_FILE', |
| 'MAX_MEMBERS_PER_GROUP', |
| 'MD5_CRYPT_ENAB', |
| 'PASS_MAX_DAYS', |
| 'PASS_MIN_DAYS', |
| 'PASS_WARN_AGE', |
| 'SHA_CRYPT_MIN_ROUNDS', |
| 'SHA_CRYPT_MAX_ROUNDS', |
| 'SULOG_FILE', |
| 'SU_NAME', |
| 'SUB_GID_MIN', |
| 'SUB_GID_MAX', |
| 'SUB_GID_COUNT', |
| 'SUB_UID_MIN', |
| 'SUB_UID_MAX', |
| 'SUB_UID_COUNT', |
| 'SYS_GID_MAX', |
| 'SYS_GID_MIN', |
| 'SYS_UID_MAX', |
| 'SYS_UID_MIN', |
| 'SYSLOG_SG_ENAB', |
| 'SYSLOG_SU_ENAB', |
| 'TTYGROUP', |
| 'TTYPERM', |
| 'TTYTYPE_FILE', |
| 'UID_MAX', |
| 'UID_MIN', |
| 'UMASK', |
| 'USERDEL_CMD', |
| 'USERGROUPS_ENAB' |
| ] %} |
| {# |
| 'defaults' could be passed externally, in this case it should be dictionary |
| #} |
| {%- if defaults is not defined %} |
| {%- set defaults = {} %} |
| {%- endif %} |
| {# |
| Override values in 'defaults' with those defined in system:login_defs as they |
| are of highest priority. |
| #} |
| {%- for opt_name in allowed_options %} |
| {%- if opt_name in login_defs %} |
| {%- set opt_params = login_defs.get(opt_name) %} |
| {%- if opt_params.get('enabled', true) %} |
| {%- do defaults.update({opt_name: opt_params.value}) %} |
| {%- endif %} |
| {%- endif %} |
| {%- endfor %} |
| {# |
| Now we can write merged data to file, keeping order of items as in the list above |
| #} |
| {%- for opt_name in allowed_options %} |
| {%- set value = defaults.get(opt_name, None) %} |
| {%- if value != None %} |
| {{ opt_name.ljust(20) }} {{ value }} |
| {%- endif %} |
| {%- endfor %} |