/usr/share/sadms-2.0.15/tests.sh is in sadms 2.0.15.repack-0ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | #!/bin/bash
# bbou@ac-toulouse.fr
# 2007-04-04 17:10
# tests.sh
# shell main install entry point for tests
# -f <settings file>
# -t <conf|pre|post|auth> default is pre
# parameters can also be passed on command line
# 1 kerberos real
# 2 dns domain
# 3 kdc
# 4 netbios domain
# 5 netbios server name for host
# 6 ou for host
# 7 AD admin name
# 8 AD users container
# 9 hosts allow
# 10 wins server
# R U N A S R O O T C H E C K
who=`id -u`
if [ "${who}" != "0" ]; then
echo "must be run as root"
exit 1
fi
# P A R S E C O M M A N D L I N E
hasfile=
stage="pre"
oprev=
for o ;do
# if the previous option needs an argument, assign it.
if [ -n "${oprev}" ]; then
eval "${oprev}=\${o}"
oprev=
continue
fi
case "${o}" in
-f)
oprev=file
hasfile=true
shift
;;
-t)
oprev=stage
shift
;;
esac
done
if [ ! -z "${hasfile}" ]; then
[ -n "${file}" ] || file="sadms.settings"
i=0
while read line; do
name=`echo ${line} | awk 'BEGIN{FS="="}{print $1}'`
value=`echo ${line} | awk 'BEGIN{FS="="}{print $2}'`
#echo "+${line} = ${name} + ${value}"
case ${name} in
realm) MYREALM="${value}" ; i=$(( i + 1 )) ;;
dns) MYDNS="${value}" ; i=$(( i + 1 )) ;;
kdc) MYKDC="${value}" ; i=$(( i + 1 )) ;;
domain) MYDOMAIN="${value}" ; i=$(( i + 1 )) ;;
server) MYSERVER="${value}" ; i=$(( i + 1 )) ;;
hostOu)MYOU="${value}" ; i=$(( i + 1 )) ;;
users) MYUSERS="${value}" ; i=$(( i + 1 )) ;;
hostsAllow) MYHOSTALLOW="${value}" ; i=$(( i + 1 )) ;;
winsServer) MYWINSSERVER="${value}" ; i=$(( i + 1 )) ;;
administrator) MYADMIN="${value}" ; i=$(( i + 1 )) ;;
administratorPassword) MYADMINPWD="${value}" ; i=$(( i + 1 )) ;;
esac
MYNARGS=${i}
done < ${file}
echo "+read ${MYNARGS} settings from ${file}"
echo
else
# echo no file
MYNARGS=$#
MYREALM="$1"
MYDNS="$2"
MYKDC="$3"
MYDOMAIN="$4"
MYSERVER="$5"
MYOU="$6"
MYADMIN="$7"
MYUSERS="$8"
MYHOSTALLOW="$9"
shift
MYWINSSERVER="$9"
fi
echo "-------------------------------------------------------------------------------"
echo "S A D M S `cat version | head -n 1`"
echo "Samba as Active Directory Member Server"
echo "bbou@ac-toulouse.fr"
echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -"
echo "tests [${stage}]"
echo "-------------------------------------------------------------------------------"
if [ -z "${MYREALM}" ]; then
read -p 'Kerberos realm (ex:LYC-CHAMPOLLION-FIGEAC.AC-TOULOUSE.FR): ' MYREALM
fi
if [ -z "${MYDNS}" ]; then
read -p 'DNS (ex:lyc-champollion-figeac.ac-toulouse.fr): ' MYDNS
fi
if [ -z "${MYKDC}" ]; then
read -p 'Kerberos KDC-Active Directory Controller (ex:ksi): ' MYKDC
fi
if [ -z "${MYDOMAIN}" ]; then
read -p 'Netbios domain (ex:CHAMPOL): ' MYDOMAIN
fi
if [ -z "${MYSERVER}" ]; then
read -p 'Netbios name for this host: ' MYSERVER
fi
if [ -z "${MYOU}" ]; then
read -p 'Organizational Unit for this server (ex:Computers): ' MYOU
fi
if [ -z "${MYADMIN}" ]; then
read -p 'Admin login (ex:administrator): ' MYADMIN
fi
if [ -z "${MYUSERS}" ]; then
read -p 'Domain Users group (ex:Domain users): ' MYUSERS
fi
if [ -z "${MYHOSTALLOW}" ]; then
read -p 'Host allow (ex:10.): ' MYHOSTALLOW
fi
if [ -z "${MYWINSSERVER}" ]; then
read -p 'Wins Server (ex:10.0.0.1): ' MYWINSSERVER
fi
# make sure realm is uppercase
realm=`echo "${MYREALM}" | tr '[:lower:]' '[:upper:]'`
echo
echo 'Kerberos realm: ' ${MYREALM}
echo 'DNS: ' ${MYDNS}
echo 'Kerberos KDC-Active Directory Controller: ' ${MYKDC}
echo 'Netbios domain: ' ${MYDOMAIN}
echo 'Netbios host:' ${MYSERVER}
echo 'Organizational Unit: ' ${MYOU}
echo 'Domain users group: ' ${MYUSERS}
echo 'Host allow: ' ${MYHOSTALLOW}
echo 'Wins server: ' ${MYWINSSERVER}
echo 'Admin login: ' ${MYADMIN}
echo
read -p 'Do you want to proceed with tests (y/n) ?: ' yes
case ${yes} in
y*|Y*)
if [ -z "${MYADMINPWD}" ]; then
read -s -p 'AD Admin login password : ' MYADMINPWD
echo
fi
case ${stage} in
pre)
./_test-network.sh -v "${MYDNS}" "${MYDOMAIN}" "${MYKDC}" "${MYSERVER}" "${MYHOSTALLOW}" "${MYWINSSERVER}"
./_test-dns.sh -v "${MYDNS}" "${MYKDC}"
./_test-kerberos.sh -v "${MYREALM}" "${MYDNS}" "${MYKDC}" "${MYADMIN}" "${MYADMINPWD}"
;;
post)
./_test-domain.sh -v "${MYREALM}" "${MYDNS}" "${MYKDC}" "${MYADMINPWD}" "${MYUSERS}"
./_test-nmb.sh -v "${MYDNS}" "${MYDOMAIN}" "${MYKDC}" "${MYSERVER}" "${MYHOSTALLOW}" "${MYWINSSERVER}"
;;
auth)
read -p 'Authenticating user : ' MYUSER
read -s -p 'Authenticating user password : ' MYUSERPWD
echo
read -p 'Share to connect to : ' MYSHARE
./_test-smb.sh "${MYSERVER}" "${MYSHARE}" "${MYDOMAIN}" "${MYUSER}" "${MYUSERPWD}"
./_test-auth.sh "${MYUSER}" "${MYUSERPWD}" "${MYDOMAIN}" "${MYREALM}"
;;
conf)
./_install-kerberos.sh "${MYREALM}" "${MYDNS}" "${MYKDC}"
./_install-smb.sh "${MYREALM}" "${MYDOMAIN}" "${MYSERVER}" "${MYADMIN}" "${MYUSERS}" "${MYHOSTALLOW}" "${MYWINSSERVER}"
./_sync-clocks.sh "${MYKDC}"
;;
esac
exit 1
;;
*)
exit
;;
esac
|