From 6803cccf70f9ca0726d242d8838b739e798eb0ed Mon Sep 17 00:00:00 2001 From: levasseur Date: Mon, 21 Feb 2022 16:17:27 +0100 Subject: [PATCH] conf_ceph.sh: made it more secure with required tests --- modules/conf_ceph.sh | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/modules/conf_ceph.sh b/modules/conf_ceph.sh index 9df3077..3fc0fe9 100644 --- a/modules/conf_ceph.sh +++ b/modules/conf_ceph.sh @@ -27,6 +27,11 @@ conf_ceph() local success=undef local fstabchanged=false + if [[ $SYS_ARCH == "x86_64" || $SYS_ARCH == "i386" ]]; then + export CEPH_STATUS=ceph + else + export CEPH_STATUS=smb + fi if [[ $CEPH_STATUS == ceph ]]; then # Install ceph package pkginst ceph-common @@ -107,10 +112,29 @@ precheck_conf_ceph() { if [[ $SYS_ARCH == "x86_64" || $SYS_ARCH == "i386" ]]; then prnt I "Installing ceph client package..." - CEPH_STATUS=ceph + if [[ -n $CEPH_SRV_NAMES ]]; then + prnt I "We will use the following CEPH servers:" + for srv in $CEPH_SRV_NAMES; do + if [[ -z "$(eval echo \$CEPHIP_$srv)" ]]; then + prnt E "The IP for CEPH server \"$srv\" is not declared." + die 180 + else + prnt m " * $srv with IP $(eval echo \$CEPHIP_$srv)" + fi + done + if [[ -z $CEPH_SECRET ]]; then + prnt E "CEPH secret key is not declared, can't continue!" + prnt I "If you don't want to put tour CEPH secret in configuration file," + prnt m "you need to export it temporarily in your environment, using the" + prnt m "\"CEPH_SECRET\" variable." + exit 181 + fi + else + prnt E "No CEPH server declared!" + die 182 + fi else prnt W "System incompatible with ceph, falling back to samba..." - CEPH_STATUS=smb fi }