summaryrefslogtreecommitdiffstats
path: root/security/shadow/CONFIGURE
blob: ed1bef64a04c0b6563282e26839a06ddaed045a0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# There's a bug introduced by the solution of bug 8834:
# if you said "n" to $SHADOW_CONV, you ended up with the state pw/grpunconv
# left on dispelling old shadow.
# Introducing the temporary SHADOW_RECONV to support fixing that situation.

if [[ "$SHADOW_CONV" == n ]] && [[ -z "$SHADOW_RECONV" ]]; then
  message "Checking passwd for shadowness (there could have been an unwanted run of pwunconv/grpunconv, see bug #8834)." &&
  if ! grep -q '^root:x:' "$INSTALL_ROOT/etc/passwd"; then
    message "${PROBLEM_COLOR}Your passwd file contains password hashes, resuggesting conversion to shadow." &&
    message "${MESSAGE_COLOR}You can still say n to the upcoming query but make sure to run pwconv / grpconv yourself if you want existing passwords shadowed." &&
    config_query SHADOW_RECONV "One-time query: convert/fix accounts (with installed shadow utils) this time" n
  fi
else
  config_query SHADOW_CONV "Attempt to convert/fix accounts (with installed shadow utils)" n
fi &&
if [[ "$SHADOW_CONV" == y ]] || [[ "$SHADOW_RECONV" == y ]]; then
  message "OK, checking your user and group accounts" &&
  grpck -r ||
  {
    message "there are problems with group... runinng grpck 
interactively" &&
    grpck
  }
  pwck -q -r ||
  {
    message "there are problems with passwd... runinng pwpck 
interactively" &&
    pwck
  }
fi
# the tools give negative return even after successfully fixing stuff
true &&
# Unsure about TRACK_ROOT here
local default_home=/home/users &&
local old_home=$(grep '^HOME=' $INSTALL_ROOT/etc/default/useradd 2>/dev/null | sed 's/HOME=//') &&
if [[ -n "$old_home" ]]; then
  default_home=$old_home
fi &&
config_query_string SHADOW_HOME "base directory for user homes:" "$default_home" &&
if ! [[ -e "$INSTALL_ROOT/$SHADOW_HOME" ]]; then
  message "$SHADOW_HOME does not seem to exist, it's up to you to take care of 
that..."
fi