-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbastion_config.template.sh
46 lines (41 loc) · 2.41 KB
/
bastion_config.template.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
#!/bin/bash
# ------------------------------------------------------------------------------
# Trivadis - Part of Accenture, Platform Factory - Transactional Data Platform
# Saegereistrasse 29, 8152 Glattbrugg, Switzerland
# ------------------------------------------------------------------------------
# Name.......: bastion_config.template.sh
# Author.....: Stefan Oehrli (oes) [email protected]
# Editor.....: Stefan Oehrli
# Date.......: 2023.04.19
# Revision...:
# Purpose....: Script to configure the bastion host after bootstrap
# Notes......: --
# Reference..: --
# License....: Apache License Version 2.0, January 2004 as shown
# at http://www.apache.org/licenses/
# ------------------------------------------------------------------------------
# - Customization --------------------------------------------------------------
HOST=${HOST:-$(hostname)}
# - End of Customization -------------------------------------------------------
# - Default Values -------------------------------------------------------------
# source genric environment variables and functions
export SCRIPT_NAME=$(basename $0) # script name
export SCRIPT_BIN_DIR=$(dirname $0) # script bin directory
# define logfile and logging
export LOG_BASE="/var/log" # Use script directory as default logbase
TIMESTAMP=$(date "+%Y.%m.%d_%H%M%S") # timestamp used for the log file
readonly LOGFILE="$LOG_BASE/$(basename $SCRIPT_NAME .sh)_$TIMESTAMP.log" # absolute logfile name
# - EOF Default Values ---------------------------------------------------------
# - Initialization -------------------------------------------------------------
# Define a bunch of bash option see
# https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html
set -o nounset # stop script after 1st cmd failed
set -o errexit # exit when 1st unset variable found
set -o pipefail # pipefail exit after 1st piped commands failed
# initialize logfile
touch $LOGFILE 2>/dev/null
exec &> >(tee -a "$LOGFILE") # Open standard out at `$LOG_FILE` for write.
exec 2>&1
echo "INFO: Start post bootstrap bastion configuration on host $(hostname) at $(date)"
echo "INFO: Finish post bootstrap bastion configuration on host $(hostname) at $(date)"
# --- EOF ----------------------------------------------------------------------