forked from idp-installer-manager/idp-installer-global
-
Notifications
You must be signed in to change notification settings - Fork 4
/
deploy_idp.sh
executable file
·233 lines (174 loc) · 7.3 KB
/
deploy_idp.sh
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
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
#!/bin/bash
# UTF-8
HELP="
##############################################################################
# Federated Identity Deployer Tools script by: #
# Anders Lördal, SWAMID #
# Chris Phillips, CANARIE #
# #
# #
# Version 2.6 #
# #
# Deploys a working IDP for SWAMID on an Ubuntu, CentOS or Redhat system #
# SAML2 Uses: tomcat6 #
# shibboleth-identityprovider-2.4.0 #
# cas-client-3.2.1-release #
# mysql-connector-java-5.1.27 (for EPTID) #
# apache-maven-3.1.1 (for building FTICKS plugin) #
# eduroam uses: #
# freeRADIUS-2.1.12 #
# samba-3.6.9 (to connect to AD for MS-CHAPv2) #
# #
# Templates are provided for CAS and LDAP authentication #
# #
# To disable the whiptail gui run with argument '-c' #
# To keep generated files run with argument '-k' #
# NOTE! some of theese files WILL contain cleartext passwords. #
# #
# To add a new template for another authentication, just add a new directory #
# under the 'prep' directory, add the neccesary .diff files and add any #
# special hanlding of those files to the script. #
# #
# You can pre-set configuration values in the file 'config' #
# #
# Please send questions and improvements to: [email protected] #
##############################################################################
"
# Copyright 2011, 2012, 2013, 2014
# Anders Lördal, SWAMID
# Chris Phillips, CANARIE
#
#
# This file is part of IDP-Deployer
#
# IDP-Deployer is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# IDP-Deployer is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with IDP-Deployer. If not, see <http://www.gnu.org/licenses/>.
if [ "${USERNAME}" != "root" -a "${USER}" != "root" ]; then
echo "Run as root!"
exit
fi
Spath="$(cd "$(dirname "$0")" && pwd)"
# load boostrap functions needed early on in this process
. ${Spath}/files/script.messages.sh
. ${Spath}/files/script.bootstrap.functions.sh
setEcho
# (validateConfig)
guessLinuxDist
setDistCommands
${Echo} "\n\n\nStarting up.\n\n\n"
${Echo} "Live logging can be seen by this command in another window:\ntail -f ${statusFile}"
${Echo} "Sleeping for 4 sec and then beginning processing..."
${Echo} "==============================================================================="
sleep 4
# bootstrapping step from minimal install
#
# bindutils to get the basic host info from machine
# dos2unix to ensure we have a clean include of hand managed files
#
if [ ! -f "/usr/bin/host" -o ! -f "/usr/bin/dos2unix" ]; then
${Echo} "\nAdding a few packages that we will use during the installation process..."
${Echo} "Package updates on the machine which could take a few minutes."
if [ "${dist}" = "ubuntu" ]; then
apt-get update --fix-missing &> >(tee -a ${statusFile})
# apt-get -y upgrade &> >(tee -a ${statusFile})
apt-get -y install dos2unix ntpdate &> >(tee -a ${statusFile})
service ntp status > /dev/null 2>&1
ntpCheck=$?
if [ ${ntpCheck} -eq 0 ]; then
service ntp stop
fi
elif [ "${dist}" = "sles" ]; then
zypper -n install -l bind-utils net-tools lsb-release ntp dos2unix &> >(tee -a ${statusFile})
else
yum -y install bind-utils net-tools ntpdate dos2unix &> >(tee -a ${statusFile})
fi
fi
if [ "${dist}" = "ubuntu" ]; then
service ntp status > /dev/null 2>&1
ntpCheck=$?
if [ ${ntpCheck} -eq 0 ]; then
service ntp stop
fi
elif [ "${dist}" = "sles" ]; then
service ntpd status > /dev/null 2>&1
ntpCheck=$?
if [ ${ntpCheck} -eq 0 ]; then
service ntpd stop
fi
fi
# read config file as early as we can so we may use the variables
# use dos2unix on file first however in case it has some mad ^M in it
if [ -s "${Spath}/config" ]
then
dos2unix ${Spath}/config
. ${Spath}/config # dynamically (or by hand) editted config file
. ${Spath}/config_descriptions # descriptive terms for each element - uses associative array cfgDesc[varname]
ValidateConfig
if [ -z "${installer_interactive}" ]
then
installer_interactive="y"
fi
if echo "${installer_section0_buildComponentList}" | grep -q "shibboleth"; then
validateConnectivity ${installer_section0_version}
checkEptidDb
fi
else
${Echo} "Sorry, this tool requires a configuration file to operate properly. \nPlease use ~/wwww/appconfig/<your_federation>/index.html to create one. Now exiting"
exit
fi
. ${Spath}/files/script.functions.sh
. ${Spath}/files/script.eduroam.functions.sh
# import the federation override file. It must exist even if it is empty.
federationSpecificInstallerOverrides="${Spath}/files/${my_ctl_federation}/script.override.functions.sh"
if [ -f "${federationSpecificInstallerOverrides}" ]
then
${Echo} "Adding federation specific overrides for the install process from ${federationSpecificInstallerOverrides}" >> ${statusFile} 2>&1
. ${federationSpecificInstallerOverrides}
else
${Echo} "\n\nNo federation specific overrides detected for federation: ${my_ctl_federation} (if this was blank, the config file does not contain BASH variable my_ctl_federation)"
${Echo} "\n\nIf there was a value set, but no override file exists, then this installer may be incomplete for that federation. \nPlease refer to the developer docs in ~/docs, exiting now"
exit
fi
setBackTitle
# parse options
options=$(getopt -o ckh -l "help" -- "$@")
eval set -- "${options}"
while [ $# -gt 0 ]; do
case "$1" in
-c)
GUIen="n"
;;
-k)
cleanUp="0"
;;
-h | --help)
${Echo} "${HELP}"
exit
;;
esac
shift
done
$Echo "" >> ${statusFile}
#################################
#################################
#setDistCommands
setHostnames
setInstallStatus
while [ "${mainMenuExitFlag}" -eq 0 ]; do
displayMainMenu
done
#################################
#################################
cleanupFilesRoutine
notifyUserBeforeExit
showAndCleanupMessagesFile