File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,8 +8,16 @@ API_KEY=""
88BINARY_PATH=" "
99
1010gen_apikey () {
11- SUFFIX=` tr -dc A-Za-z0-9 < /dev/urandom | head -c 8`
12- API_KEY=` cscli bouncers add cs-custom-bouncer-${SUFFIX} -o raw`
11+ which cscli > /dev/null
12+ if [[ $? == 0 ]]; then
13+ echo " cscli found, generating bouncer api key."
14+ SUFFIX=` tr -dc A-Za-z0-9 < /dev/urandom | head -c 8`
15+ API_KEY=` cscli bouncers add cs-custom-bouncer-${SUFFIX} -o raw`
16+ READY=" yes"
17+ else
18+ echo " cscli not found, you will need to generate api key."
19+ READY=" no"
20+ fi
1321}
1422
1523gen_binary_path () {
@@ -34,7 +42,7 @@ gen_config_file() {
3442
3543
3644if ! [ $( id -u) = 0 ]; then
37- log_err " Please run the install script as root or with sudo"
45+ echo " Please run the install script as root or with sudo"
3846 exit 1
3947fi
4048echo " Installing cs-custom-bouncer"
@@ -48,5 +56,11 @@ if ! [ -f "$BINARY_PATH" ]; then
4856 echo " Please edit ${CONFIG_DIR} cs-custom-bouncer.yaml with a real binary path and run 'sudo systemctl start cs-custom-bouncer'."
4957 exit 1
5058fi
51- systemctl start cs-custom-bouncer.service
59+
60+ if [ " $READY " = " yes" ]; then
61+ systemctl start cs-custom-bouncer.service
62+ else
63+ echo " service not started. You need to get an API key and configure it in ${CONFIG_DIR} cs-firewall-bouncer.yaml"
64+ fi
65+
5266echo " cs-custom-bouncer service has been installed!"
You can’t perform that action at this time.
0 commit comments