Bläddra i källkod

feat(config): add secrets config to store sensitive settings (#3080)

* feat(config): add secrets.cfg

* changed name of config

* updated wording
Daniel Gibbs 5 år sedan
förälder
incheckning
d0ecddfcbb

+ 5 - 0
lgsm/config-default/config-lgsm/secrets-common-template.cfg

@@ -0,0 +1,5 @@
+##################################
+######## Common Secrets ##########
+##################################
+# PLACE GLOBAL SECRET SETTINGS HERE
+## These settings will apply to all instances.

+ 5 - 0
lgsm/config-default/config-lgsm/secrets-instance-template.cfg

@@ -0,0 +1,5 @@
+##################################
+####### Instance Secrets #########
+##################################
+# PLACE INSTANCE SECRET SETTINGS HERE
+## These settings will apply to a specific instance.

+ 18 - 0
linuxgsm.sh

@@ -412,6 +412,15 @@ else
 			# shellcheck source=/dev/null
 			source "${configdirserver}/common.cfg"
 		fi
+		# Load the secrets-common.cfg config. If missing download it.
+		if [ ! -f "${configdirserver}/secrets-common.cfg" ]; then
+			fn_fetch_config "lgsm/config-default/config-lgsm" "secrets-common-template.cfg" "${configdirserver}" "secrets-common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-common.cfg"
+		else
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-common.cfg"
+		fi
 		# Load the instance.cfg config. If missing download it.
 		if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then
 			fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
@@ -421,6 +430,15 @@ else
 			# shellcheck source=/dev/null
 			source "${configdirserver}/${selfname}.cfg"
 		fi
+		# Load the secrets-instance.cfg config. If missing download it.
+		if [ ! -f "${configdirserver}/secrets-${selfname}.cfg" ]; then
+			fn_fetch_config "lgsm/config-default/config-lgsm" "secrets-instance-template.cfg" "${configdirserver}" "secrets-${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-${selfname}.cfg"
+		else
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-${selfname}.cfg"
+		fi
 
 		# Load the linuxgsm.sh in to tmpdir. If missing download it.
 		if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then

+ 18 - 0
tests/tests_fctrserver.sh

@@ -421,6 +421,15 @@ else
 			# shellcheck source=/dev/null
 			source "${configdirserver}/common.cfg"
 		fi
+		# Load the secrets-common.cfg config. If missing download it.
+		if [ ! -f "${configdirserver}/secrets-common.cfg" ]; then
+			fn_fetch_config "lgsm/config-default/config-lgsm" "secrets-common-template.cfg" "${configdirserver}" "secrets-common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-common.cfg"
+		else
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-common.cfg"
+		fi
 		# Load the instance.cfg config. If missing download it.
 		if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then
 			fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
@@ -430,6 +439,15 @@ else
 			# shellcheck source=/dev/null
 			source "${configdirserver}/${selfname}.cfg"
 		fi
+		# Load the secrets-instance.cfg config. If missing download it.
+		if [ ! -f "${configdirserver}/secrets-${selfname}.cfg" ]; then
+			fn_fetch_config "lgsm/config-default/config-lgsm" "secrets-instance-template.cfg" "${configdirserver}" "secrets-${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-${selfname}.cfg"
+		else
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-${selfname}.cfg"
+		fi
 
 		# Load the linuxgsm.sh in to tmpdir. If missing download it.
 		if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then

+ 18 - 0
tests/tests_jc2server.sh

@@ -422,6 +422,15 @@ else
 			# shellcheck source=/dev/null
 			source "${configdirserver}/common.cfg"
 		fi
+		# Load the secrets-common.cfg config. If missing download it.
+		if [ ! -f "${configdirserver}/secrets-common.cfg" ]; then
+			fn_fetch_config "lgsm/config-default/config-lgsm" "secrets-common-template.cfg" "${configdirserver}" "secrets-common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-common.cfg"
+		else
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-common.cfg"
+		fi
 		# Load the instance.cfg config. If missing download it.
 		if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then
 			fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
@@ -431,6 +440,15 @@ else
 			# shellcheck source=/dev/null
 			source "${configdirserver}/${selfname}.cfg"
 		fi
+		# Load the secrets-instance.cfg config. If missing download it.
+		if [ ! -f "${configdirserver}/secrets-${selfname}.cfg" ]; then
+			fn_fetch_config "lgsm/config-default/config-lgsm" "secrets-instance-template.cfg" "${configdirserver}" "secrets-${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-${selfname}.cfg"
+		else
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-${selfname}.cfg"
+		fi
 
 		# Load the linuxgsm.sh in to tmpdir. If missing download it.
 		if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then

+ 18 - 0
tests/tests_mcserver.sh

@@ -422,6 +422,15 @@ else
 			# shellcheck source=/dev/null
 			source "${configdirserver}/common.cfg"
 		fi
+		# Load the secrets-common.cfg config. If missing download it.
+		if [ ! -f "${configdirserver}/secrets-common.cfg" ]; then
+			fn_fetch_config "lgsm/config-default/config-lgsm" "secrets-common.cfg" "${configdirserver}" "secrets-common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-common.cfg"
+		else
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-common.cfg"
+		fi
 		# Load the instance.cfg config. If missing download it.
 		if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then
 			fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
@@ -431,6 +440,15 @@ else
 			# shellcheck source=/dev/null
 			source "${configdirserver}/${selfname}.cfg"
 		fi
+		# Load the secrets-instance.cfg config. If missing download it.
+		if [ ! -f "${configdirserver}/secrets-${selfname}.cfg" ]; then
+			fn_fetch_config "lgsm/config-default/config-lgsm" "secrets-instance-template.cfg" "${configdirserver}" "secrets-${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-${selfname}.cfg"
+		else
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-${selfname}.cfg"
+		fi
 
 		# Load the linuxgsm.sh in to tmpdir. If missing download it.
 		if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then

+ 18 - 0
tests/tests_ts3server.sh

@@ -422,6 +422,15 @@ else
 			# shellcheck source=/dev/null
 			source "${configdirserver}/common.cfg"
 		fi
+		# Load the secrets-common.cfg config. If missing download it.
+		if [ ! -f "${configdirserver}/secrets-common.cfg" ]; then
+			fn_fetch_config "lgsm/config-default/config-lgsm" "secrets-common-template.cfg" "${configdirserver}" "secrets-common.cfg" "${chmodx}" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-common.cfg"
+		else
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-common.cfg"
+		fi
 		# Load the instance.cfg config. If missing download it.
 		if [ ! -f "${configdirserver}/${selfname}.cfg" ]; then
 			fn_fetch_config "lgsm/config-default/config-lgsm" "instance-template.cfg" "${configdirserver}" "${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
@@ -431,6 +440,15 @@ else
 			# shellcheck source=/dev/null
 			source "${configdirserver}/${selfname}.cfg"
 		fi
+		# Load the secrets-instance.cfg config. If missing download it.
+		if [ ! -f "${configdirserver}/secrets-${selfname}.cfg" ]; then
+			fn_fetch_config "lgsm/config-default/config-lgsm" "secrets-instance-template.cfg" "${configdirserver}" "secrets-${selfname}.cfg" "nochmodx" "norun" "noforcedl" "nomd5"
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-${selfname}.cfg"
+		else
+			# shellcheck source=/dev/null
+			source "${configdirserver}/secrets-${selfname}.cfg"
+		fi
 
 		# Load the linuxgsm.sh in to tmpdir. If missing download it.
 		if [ ! -f "${tmpdir}/linuxgsm.sh" ]; then