summaryrefslogtreecommitdiffstats
path: root/base/all/root/scripts/tasks/setup_node_nas.sh
blob: 65fd9660d5075426928442328cefe659b45ab2a8 (plain)
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
#!/bin/bash

# Per-node NAS cluster configuration steps

set -e

conf_file="/root/scripts/nas.conf"

auth_type=$(sed -r -n -e 's@^auth_method[[:space:]]*=[[:space:]]*(files|winbind)[[:space:]]*$@\1@p' "$conf_file")

case "$auth_type" in
    winbind|files) : ;;
    *)
	echo "Unsupported authentication type \"${auth_type}\""
	usage
esac

domain=$(sed -r -n -e 's@^domain[[:space:]]*=[[:space:]]*([^ ]*)[[:space:]]*$@\1@p' "$conf_file" | tr '[a-z]' '[A-Z]')

kdc=$(sed -r -n -e 's@^kdc[[:space:]]*=[[:space:]]*([^ ]*)[[:space:]]*$@\1@p' "$conf_file")

case "$auth_type" in
    winbind)
	echo "Setting up NSS, PAM, KRB5..."
	authconfig --update --nostart \
	    --enablewinbindauth --enablewinbind \
	    --disablekrb5 --krb5kdc=$kdc.$domain  --krb5realm=$domain
	;;
    files)
	echo "Setting up NSS, PAM, KRB5..."
	authconfig --update --nostart \
	    --disablewinbindauth --disablewinbind \
	    --disablekrb5 --krb5kdc=$kdc.$domain  --krb5realm=$domain
	;;
esac

echo "Configuring services..."
(cd scripts/cluster_configure && \
    ./cluster-configure.py -t "templates/rhel/" -vv "$conf_file")