summaryrefslogtreecommitdiffstats
path: root/satellit_installer/includes/10-password_helper.inc
diff options
context:
space:
mode:
authorSimon Rettberg2019-10-29 10:36:41 +0100
committerSimon Rettberg2019-10-29 10:36:41 +0100
commitb09c4a7b7deecfee90576c131dcf3e676b3891d1 (patch)
tree3459c1ae8e787b12e736acd486c95517dbcd9c06 /satellit_installer/includes/10-password_helper.inc
parent[SSPS] WTF? (diff)
downloadsetup-scripts-b09c4a7b7deecfee90576c131dcf3e676b3891d1.tar.gz
setup-scripts-b09c4a7b7deecfee90576c131dcf3e676b3891d1.tar.xz
setup-scripts-b09c4a7b7deecfee90576c131dcf3e676b3891d1.zip
[SSPS] Mitm Buschmesser durch! (remove unused code)
Diffstat (limited to 'satellit_installer/includes/10-password_helper.inc')
-rw-r--r--satellit_installer/includes/10-password_helper.inc25
1 files changed, 25 insertions, 0 deletions
diff --git a/satellit_installer/includes/10-password_helper.inc b/satellit_installer/includes/10-password_helper.inc
new file mode 100644
index 0000000..30eece9
--- /dev/null
+++ b/satellit_installer/includes/10-password_helper.inc
@@ -0,0 +1,25 @@
+
+generate_password() {
+ local password="$(< /dev/urandom tr -dc A-Za-z0-9_ | head -c${1:-16};)"
+ echo "$password"
+}
+
+# This routine has to be used only in conjunction with the prepare_firstrun-script, which
+# will enforce the setting of good passwords on first root login after server start.
+set_passwords() {
+ echo -n "# Setting passwords..."
+ OPENSLX_PASS="$(generate_password)"
+ MYSQL_ROOT_PASS="$(generate_password)"
+ MYSQL_OPENSLX_PASS="$(generate_password)"
+ MYSQL_SAT_PASS="$(generate_password)"
+
+ # Keep in mind the passwords stored here will be valid only temporary,
+ # as they will be changed by the dropper script.
+ # If you need the permanently valid password, you will need to
+ # decrypt static_files/new_passwords.encrypted.
+ echo "OPENSLX_PASS=$OPENSLX_PASS" > "$CONFIGDIR"/config
+ echo "MYSQL_ROOT_PASS=$MYSQL_ROOT_PASS" >> "$CONFIGDIR"/config
+ echo "MYSQL_OPENSLX_PASS=$MYSQL_OPENSLX_PASS" >> "$CONFIGDIR"/config
+ echo "MYSQL_SAT_PASS=$MYSQL_SAT_PASS" >> "$CONFIGDIR"/config
+ echo "ok."
+}