~openstack-charmers-next/charms/xenial/nova-compute/trunk

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/hardening/host/templates/login.defs

  • Committer: Edward Hope-Morley
  • Date: 2016-03-24 11:18:41 UTC
  • mto: This revision was merged to the branch mainline in revision 211.
  • Revision ID: edward.hope-morley@canonical.com-20160324111841-99ruo5hjzrpqktlx
Add hardening support

Add charmhelpers.contrib.hardening and calls to install,
config-changed, upgrade-charm and update-status hooks.
Also add new config option to allow one or more hardening
modules to be applied at runtime.

Change-Id: I525c15a14662175f2a68cdcd25a3ab2c92237850

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
###############################################################################
 
2
# WARNING: This configuration file is maintained by Juju. Local changes may
 
3
#          be overwritten.
 
4
###############################################################################
 
5
#
 
6
# /etc/login.defs - Configuration control definitions for the login package.
 
7
#
 
8
# Three items must be defined:  MAIL_DIR, ENV_SUPATH, and ENV_PATH.
 
9
# If unspecified, some arbitrary (and possibly incorrect) value will
 
10
# be assumed.  All other items are optional - if not specified then
 
11
# the described action or option will be inhibited.
 
12
#
 
13
# Comment lines (lines beginning with "#") and blank lines are ignored.
 
14
#
 
15
# Modified for Linux.  --marekm
 
16
 
 
17
# REQUIRED for useradd/userdel/usermod
 
18
#   Directory where mailboxes reside, _or_ name of file, relative to the
 
19
#   home directory.  If you _do_ define MAIL_DIR and MAIL_FILE,
 
20
#   MAIL_DIR takes precedence.
 
21
#
 
22
#   Essentially:
 
23
#      - MAIL_DIR defines the location of users mail spool files
 
24
#        (for mbox use) by appending the username to MAIL_DIR as defined
 
25
#        below.
 
26
#      - MAIL_FILE defines the location of the users mail spool files as the
 
27
#        fully-qualified filename obtained by prepending the user home
 
28
#        directory before $MAIL_FILE
 
29
#
 
30
# NOTE: This is no more used for setting up users MAIL environment variable
 
31
#       which is, starting from shadow 4.0.12-1 in Debian, entirely the
 
32
#       job of the pam_mail PAM modules
 
33
#       See default PAM configuration files provided for
 
34
#       login, su, etc.
 
35
#
 
36
# This is a temporary situation: setting these variables will soon
 
37
# move to /etc/default/useradd and the variables will then be
 
38
# no more supported
 
39
MAIL_DIR        /var/mail
 
40
#MAIL_FILE      .mail
 
41
 
 
42
#
 
43
# Enable logging and display of /var/log/faillog login failure info.
 
44
# This option conflicts with the pam_tally PAM module.
 
45
#
 
46
FAILLOG_ENAB            yes
 
47
 
 
48
#
 
49
# Enable display of unknown usernames when login failures are recorded.
 
50
#
 
51
# WARNING: Unknown usernames may become world readable. 
 
52
# See #290803 and #298773 for details about how this could become a security
 
53
# concern
 
54
LOG_UNKFAIL_ENAB        no
 
55
 
 
56
#
 
57
# Enable logging of successful logins
 
58
#
 
59
LOG_OK_LOGINS           yes
 
60
 
 
61
#
 
62
# Enable "syslog" logging of su activity - in addition to sulog file logging.
 
63
# SYSLOG_SG_ENAB does the same for newgrp and sg.
 
64
#
 
65
SYSLOG_SU_ENAB          yes
 
66
SYSLOG_SG_ENAB          yes
 
67
 
 
68
#
 
69
# If defined, all su activity is logged to this file.
 
70
#
 
71
#SULOG_FILE     /var/log/sulog
 
72
 
 
73
#
 
74
# If defined, file which maps tty line to TERM environment parameter.
 
75
# Each line of the file is in a format something like "vt100  tty01".
 
76
#
 
77
#TTYTYPE_FILE   /etc/ttytype
 
78
 
 
79
#
 
80
# If defined, login failures will be logged here in a utmp format
 
81
# last, when invoked as lastb, will read /var/log/btmp, so...
 
82
#
 
83
FTMP_FILE       /var/log/btmp
 
84
 
 
85
#
 
86
# If defined, the command name to display when running "su -".  For
 
87
# example, if this is defined as "su" then a "ps" will display the
 
88
# command is "-su".  If not defined, then "ps" would display the
 
89
# name of the shell actually being run, e.g. something like "-sh".
 
90
#
 
91
SU_NAME         su
 
92
 
 
93
#
 
94
# If defined, file which inhibits all the usual chatter during the login
 
95
# sequence.  If a full pathname, then hushed mode will be enabled if the
 
96
# user's name or shell are found in the file.  If not a full pathname, then
 
97
# hushed mode will be enabled if the file exists in the user's home directory.
 
98
#
 
99
HUSHLOGIN_FILE  .hushlogin
 
100
#HUSHLOGIN_FILE /etc/hushlogins
 
101
 
 
102
#
 
103
# *REQUIRED*  The default PATH settings, for superuser and normal users.
 
104
#
 
105
# (they are minimal, add the rest in the shell startup files)
 
106
ENV_SUPATH      PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
 
107
ENV_PATH        PATH=/usr/local/bin:/usr/bin:/bin{% if additional_user_paths %}{{ additional_user_paths }}{% endif %}
 
108
 
 
109
#
 
110
# Terminal permissions
 
111
#
 
112
#       TTYGROUP        Login tty will be assigned this group ownership.
 
113
#       TTYPERM         Login tty will be set to this permission.
 
114
#
 
115
# If you have a "write" program which is "setgid" to a special group
 
116
# which owns the terminals, define TTYGROUP to the group number and
 
117
# TTYPERM to 0620.  Otherwise leave TTYGROUP commented out and assign
 
118
# TTYPERM to either 622 or 600.
 
119
#
 
120
# In Debian /usr/bin/bsd-write or similar programs are setgid tty
 
121
# However, the default and recommended value for TTYPERM is still 0600
 
122
# to not allow anyone to write to anyone else console or terminal
 
123
 
 
124
# Users can still allow other people to write them by issuing 
 
125
# the "mesg y" command.
 
126
 
 
127
TTYGROUP        tty
 
128
TTYPERM         0600
 
129
 
 
130
#
 
131
# Login configuration initializations:
 
132
#
 
133
#       ERASECHAR       Terminal ERASE character ('\010' = backspace).
 
134
#       KILLCHAR        Terminal KILL character ('\025' = CTRL/U).
 
135
#       UMASK           Default "umask" value.
 
136
#
 
137
# The ERASECHAR and KILLCHAR are used only on System V machines.
 
138
 
139
# UMASK is the default umask value for pam_umask and is used by
 
140
# useradd and newusers to set the mode of the new home directories.
 
141
# 022 is the "historical" value in Debian for UMASK
 
142
# 027, or even 077, could be considered better for privacy
 
143
# There is no One True Answer here : each sysadmin must make up his/her
 
144
# mind.
 
145
#
 
146
# If USERGROUPS_ENAB is set to "yes", that will modify this UMASK default value
 
147
# for private user groups, i. e. the uid is the same as gid, and username is
 
148
# the same as the primary group name: for these, the user permissions will be
 
149
# used as group permissions, e. g. 022 will become 002.
 
150
#
 
151
# Prefix these values with "0" to get octal, "0x" to get hexadecimal.
 
152
#
 
153
ERASECHAR       0177
 
154
KILLCHAR        025
 
155
UMASK           {{ umask }}
 
156
 
 
157
# Enable setting of the umask group bits to be the same as owner bits (examples: `022` -> `002`, `077` -> `007`) for non-root users, if the uid is the same as gid, and username is the same as the primary group name.
 
158
# If set to yes, userdel will remove the user´s group if it contains no more members, and useradd will create by default a group with the name of the user.
 
159
USERGROUPS_ENAB yes
 
160
 
 
161
#
 
162
# Password aging controls:
 
163
#
 
164
#       PASS_MAX_DAYS   Maximum number of days a password may be used.
 
165
#       PASS_MIN_DAYS   Minimum number of days allowed between password changes.
 
166
#       PASS_WARN_AGE   Number of days warning given before a password expires.
 
167
#
 
168
PASS_MAX_DAYS   {{ pwd_max_age }}
 
169
PASS_MIN_DAYS   {{ pwd_min_age }}
 
170
PASS_WARN_AGE   7
 
171
 
 
172
#
 
173
# Min/max values for automatic uid selection in useradd
 
174
#
 
175
UID_MIN                  {{ uid_min }}
 
176
UID_MAX                 60000
 
177
# System accounts
 
178
SYS_UID_MIN               {{ sys_uid_min }}
 
179
SYS_UID_MAX               {{ sys_uid_max }}
 
180
 
 
181
# Min/max values for automatic gid selection in groupadd
 
182
GID_MIN                  {{ gid_min }}
 
183
GID_MAX                 60000
 
184
# System accounts
 
185
SYS_GID_MIN               {{ sys_gid_min }}
 
186
SYS_GID_MAX               {{ sys_gid_max }}
 
187
 
 
188
#
 
189
# Max number of login retries if password is bad. This will most likely be
 
190
# overriden by PAM, since the default pam_unix module has it's own built
 
191
# in of 3 retries. However, this is a safe fallback in case you are using
 
192
# an authentication module that does not enforce PAM_MAXTRIES.
 
193
#
 
194
LOGIN_RETRIES           {{ login_retries }}
 
195
 
 
196
#
 
197
# Max time in seconds for login
 
198
#
 
199
LOGIN_TIMEOUT           {{ login_timeout }}
 
200
 
 
201
#
 
202
# Which fields may be changed by regular users using chfn - use
 
203
# any combination of letters "frwh" (full name, room number, work
 
204
# phone, home phone).  If not defined, no changes are allowed.
 
205
# For backward compatibility, "yes" = "rwh" and "no" = "frwh".
 
206
 
207
{% if chfn_restrict %}
 
208
CHFN_RESTRICT           {{ chfn_restrict }}
 
209
{% endif %}
 
210
 
 
211
#
 
212
# Should login be allowed if we can't cd to the home directory?
 
213
# Default in no.
 
214
#
 
215
DEFAULT_HOME    {% if allow_login_without_home %} yes {% else %} no {% endif %}
 
216
 
 
217
#
 
218
# If defined, this command is run when removing a user.
 
219
# It should remove any at/cron/print jobs etc. owned by
 
220
# the user to be removed (passed as the first argument).
 
221
#
 
222
#USERDEL_CMD    /usr/sbin/userdel_local
 
223
 
 
224
#
 
225
# Enable setting of the umask group bits to be the same as owner bits
 
226
# (examples: 022 -> 002, 077 -> 007) for non-root users, if the uid is
 
227
# the same as gid, and username is the same as the primary group name.
 
228
#
 
229
# If set to yes, userdel will remove the user´s group if it contains no
 
230
# more members, and useradd will create by default a group with the name
 
231
# of the user.
 
232
#
 
233
USERGROUPS_ENAB yes
 
234
 
 
235
#
 
236
# Instead of the real user shell, the program specified by this parameter
 
237
# will be launched, although its visible name (argv[0]) will be the shell's.
 
238
# The program may do whatever it wants (logging, additional authentification,
 
239
# banner, ...) before running the actual shell.
 
240
#
 
241
# FAKE_SHELL /bin/fakeshell
 
242
 
 
243
#
 
244
# If defined, either full pathname of a file containing device names or
 
245
# a ":" delimited list of device names.  Root logins will be allowed only
 
246
# upon these devices.
 
247
#
 
248
# This variable is used by login and su.
 
249
#
 
250
#CONSOLE        /etc/consoles
 
251
#CONSOLE        console:tty01:tty02:tty03:tty04
 
252
 
 
253
#
 
254
# List of groups to add to the user's supplementary group set
 
255
# when logging in on the console (as determined by the CONSOLE
 
256
# setting).  Default is none.
 
257
#
 
258
# Use with caution - it is possible for users to gain permanent
 
259
# access to these groups, even when not logged in on the console.
 
260
# How to do it is left as an exercise for the reader...
 
261
#
 
262
# This variable is used by login and su.
 
263
#
 
264
#CONSOLE_GROUPS         floppy:audio:cdrom
 
265
 
 
266
#
 
267
# If set to "yes", new passwords will be encrypted using the MD5-based
 
268
# algorithm compatible with the one used by recent releases of FreeBSD.
 
269
# It supports passwords of unlimited length and longer salt strings.
 
270
# Set to "no" if you need to copy encrypted passwords to other systems
 
271
# which don't understand the new algorithm.  Default is "no".
 
272
#
 
273
# This variable is deprecated. You should use ENCRYPT_METHOD.
 
274
#
 
275
MD5_CRYPT_ENAB  no
 
276
 
 
277
#
 
278
# If set to MD5 , MD5-based algorithm will be used for encrypting password
 
279
# If set to SHA256, SHA256-based algorithm will be used for encrypting password
 
280
# If set to SHA512, SHA512-based algorithm will be used for encrypting password
 
281
# If set to DES, DES-based algorithm will be used for encrypting password (default)
 
282
# Overrides the MD5_CRYPT_ENAB option
 
283
#
 
284
# Note: It is recommended to use a value consistent with
 
285
# the PAM modules configuration.
 
286
#
 
287
ENCRYPT_METHOD SHA512
 
288
 
 
289
#
 
290
# Only used if ENCRYPT_METHOD is set to SHA256 or SHA512.
 
291
#
 
292
# Define the number of SHA rounds.
 
293
# With a lot of rounds, it is more difficult to brute forcing the password.
 
294
# But note also that it more CPU resources will be needed to authenticate
 
295
# users.
 
296
#
 
297
# If not specified, the libc will choose the default number of rounds (5000).
 
298
# The values must be inside the 1000-999999999 range.
 
299
# If only one of the MIN or MAX values is set, then this value will be used.
 
300
# If MIN > MAX, the highest value will be used.
 
301
#
 
302
# SHA_CRYPT_MIN_ROUNDS 5000
 
303
# SHA_CRYPT_MAX_ROUNDS 5000
 
304
 
 
305
################# OBSOLETED BY PAM ##############
 
306
#                                               #
 
307
# These options are now handled by PAM. Please  #
 
308
# edit the appropriate file in /etc/pam.d/ to   #
 
309
# enable the equivelants of them.
 
310
#
 
311
###############
 
312
 
 
313
#MOTD_FILE
 
314
#DIALUPS_CHECK_ENAB
 
315
#LASTLOG_ENAB
 
316
#MAIL_CHECK_ENAB
 
317
#OBSCURE_CHECKS_ENAB
 
318
#PORTTIME_CHECKS_ENAB
 
319
#SU_WHEEL_ONLY
 
320
#CRACKLIB_DICTPATH
 
321
#PASS_CHANGE_TRIES
 
322
#PASS_ALWAYS_WARN
 
323
#ENVIRON_FILE
 
324
#NOLOGINS_FILE
 
325
#ISSUE_FILE
 
326
#PASS_MIN_LEN
 
327
#PASS_MAX_LEN
 
328
#ULIMIT
 
329
#ENV_HZ
 
330
#CHFN_AUTH
 
331
#CHSH_AUTH
 
332
#FAIL_DELAY
 
333
 
 
334
################# OBSOLETED #######################
 
335
#                                                 #
 
336
# These options are no more handled by shadow.    #
 
337
#                                                 #
 
338
# Shadow utilities will display a warning if they #
 
339
# still appear.                                   #
 
340
#                                                 #
 
341
###################################################
 
342
 
 
343
# CLOSE_SESSIONS
 
344
# LOGIN_STRING
 
345
# NO_PASSWORD_CONSOLE
 
346
# QMAIL_DIR
 
347
 
 
348
 
 
349