| Dmitry Teselkin | a0d31d1 | 2018-09-04 14:43:09 +0300 | [diff] [blame] | 1 | {%- from "linux/map.jinja" import login_defs with context -%} |
| 2 | # This file is managed by Salt, do not edit |
| 3 | {%- set allowed_options = [ |
| 4 | 'CHFN_RESTRICT', |
| 5 | 'CONSOLE_GROUPS', |
| 6 | 'CREATE_HOME', |
| 7 | 'DEFAULT_HOME', |
| 8 | 'ENCRYPT_METHOD', |
| 9 | 'ENV_HZ', |
| 10 | 'ENV_PATH', |
| 11 | 'ENV_SUPATH', |
| 12 | 'ERASECHAR', |
| 13 | 'FAIL_DELAY', |
| 14 | 'FAKE_SHELL', |
| 15 | 'GID_MAX', |
| 16 | 'GID_MIN', |
| 17 | 'HUSHLOGIN_FILE', |
| 18 | 'KILLCHAR', |
| 19 | 'LOG_OK_LOGINS', |
| 20 | 'LOG_UNKFAIL_ENAB', |
| 21 | 'LOGIN_RETRIES', |
| 22 | 'LOGIN_TIMEOUT', |
| 23 | 'MAIL_DIR', |
| 24 | 'MAIL_FILE', |
| 25 | 'MAX_MEMBERS_PER_GROUP', |
| 26 | 'MD5_CRYPT_ENAB', |
| 27 | 'PASS_MAX_DAYS', |
| 28 | 'PASS_MIN_DAYS', |
| 29 | 'PASS_WARN_AGE', |
| 30 | 'SHA_CRYPT_MIN_ROUNDS', |
| 31 | 'SHA_CRYPT_MAX_ROUNDS', |
| 32 | 'SULOG_FILE', |
| 33 | 'SU_NAME', |
| 34 | 'SUB_GID_MIN', |
| 35 | 'SUB_GID_MAX', |
| 36 | 'SUB_GID_COUNT', |
| 37 | 'SUB_UID_MIN', |
| 38 | 'SUB_UID_MAX', |
| 39 | 'SUB_UID_COUNT', |
| 40 | 'SYS_GID_MAX', |
| 41 | 'SYS_GID_MIN', |
| 42 | 'SYS_UID_MAX', |
| 43 | 'SYS_UID_MIN', |
| 44 | 'SYSLOG_SG_ENAB', |
| 45 | 'SYSLOG_SU_ENAB', |
| 46 | 'TTYGROUP', |
| 47 | 'TTYPERM', |
| 48 | 'TTYTYPE_FILE', |
| 49 | 'UID_MAX', |
| 50 | 'UID_MIN', |
| 51 | 'UMASK', |
| 52 | 'USERDEL_CMD', |
| Anton Samoylov | 8fd00ac | 2018-10-05 23:25:44 +0400 | [diff] [blame] | 53 | 'USERGROUPS_ENAB' |
| Dmitry Teselkin | a0d31d1 | 2018-09-04 14:43:09 +0300 | [diff] [blame] | 54 | ] %} |
| Dmitry Teselkin | 8e90356 | 2019-02-21 16:40:23 +0300 | [diff] [blame] | 55 | {# |
| 56 | 'defaults' could be passed externally, in this case it should be dictionary |
| 57 | #} |
| 58 | {%- if defaults is not defined %} |
| 59 | {%- set defaults = {} %} |
| 60 | {%- endif %} |
| 61 | {# |
| 62 | Override values in 'defaults' with those defined in system:login_defs as they |
| 63 | are of highest priority. |
| 64 | #} |
| Dmitry Teselkin | a0d31d1 | 2018-09-04 14:43:09 +0300 | [diff] [blame] | 65 | {%- for opt_name in allowed_options %} |
| 66 | {%- if opt_name in login_defs %} |
| 67 | {%- set opt_params = login_defs.get(opt_name) %} |
| 68 | {%- if opt_params.get('enabled', true) %} |
| Dmitry Teselkin | 8e90356 | 2019-02-21 16:40:23 +0300 | [diff] [blame] | 69 | {%- do defaults.update({opt_name: opt_params.value}) %} |
| Dmitry Teselkin | a0d31d1 | 2018-09-04 14:43:09 +0300 | [diff] [blame] | 70 | {%- endif %} |
| 71 | {%- endif %} |
| 72 | {%- endfor %} |
| Dmitry Teselkin | 8e90356 | 2019-02-21 16:40:23 +0300 | [diff] [blame] | 73 | {# |
| 74 | Now we can write merged data to file, keeping order of items as in the list above |
| 75 | #} |
| 76 | {%- for opt_name in allowed_options %} |
| 77 | {%- set value = defaults.get(opt_name, None) %} |
| 78 | {%- if value != None %} |
| 79 | {{ opt_name.ljust(20) }} {{ value }} |
| 80 | {%- endif %} |
| 81 | {%- endfor %} |