From 6707db40319fb8c10ce8cc881a91d3320103c88d Mon Sep 17 00:00:00 2001 From: Christian Rößler Date: Tue, 29 Oct 2019 16:02:34 +0100 Subject: [SSPS] mysql has no root passwd anymore, pump not avaliable anymore --- satellit_installer/includes/10-handle_mysql.inc | 17 ++---- satellit_installer/includes/10-password_helper.inc | 3 -- satellit_installer/includes/30-setup_dhcp.inc | 60 ---------------------- satellit_installer/satellit_installer | 5 +- satellit_installer/static_files/rclocal_script.sh | 8 --- 5 files changed, 7 insertions(+), 86 deletions(-) delete mode 100644 satellit_installer/includes/30-setup_dhcp.inc diff --git a/satellit_installer/includes/10-handle_mysql.inc b/satellit_installer/includes/10-handle_mysql.inc index 822a2b9..5b99719 100644 --- a/satellit_installer/includes/10-handle_mysql.inc +++ b/satellit_installer/includes/10-handle_mysql.inc @@ -1,13 +1,6 @@ -preset_mysql_root() { - # Presetting a root password for mysql so installer keeps quiet: - echo "Presetting root password for mysql: $MYSQL_ROOT_PASS" - debconf-set-selections <<< "mysql-server mysql-server/root_password password $MYSQL_ROOT_PASS" - debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $MYSQL_ROOT_PASS" -} - mysql_add_db() { echo "# Creating mysql database $1..." - echo "create database $1;" | mysql -u root -p"$MYSQL_ROOT_PASS" + echo "create database $1;" | mysql -u root ERR=$? if [ "$ERR" -ne 0 ]; then perror "Could not create mysql database $1!" @@ -17,7 +10,7 @@ mysql_add_db() { mysql_delete_db() { # $1 database; $2 password echo "# Deleting mysql database $1..." - echo "drop database if exists $1;" | mysql -u root -p"${2}" + echo "drop database if exists $1;" | mysql -u root ERR=$? if [ "$ERR" -ne 0 ]; then perror "Could not delete mysql user $1!" @@ -28,7 +21,7 @@ mysql_delete_db() { mysql_add_user() { # $1=user, $2=database, $3=privileges, $4=password echo "# Adding user $1 for database $2, privileges $3..." - mysql -u root -p"$MYSQL_ROOT_PASS" <<-CMDS + mysql -u root <<-CMDS CREATE USER '$1'@'localhost' IDENTIFIED BY '$4'; GRANT $3 ON $2.* TO '$1'@'localhost'; CMDS @@ -42,7 +35,7 @@ mysql_add_user() { mysql_add_privs() { # $1=user, $2=database, $3=privileges echo "# Adding privileges $3 for user $1 on database $2..." - mysql -u root -p"$MYSQL_ROOT_PASS" <<-CMDS + mysql -u root <<-CMDS GRANT $3 ON $2 TO '$1'@'localhost'; CMDS @@ -65,7 +58,7 @@ mysql_delete_user() { mysql_import_dump() { # $1: dump file, $2: database echo "# Importing sql dump file $1..." - mysql -u root -p"$MYSQL_ROOT_PASS" -h localhost "$2" < "$1" + mysql -u root -h localhost "$2" < "$1" ERR=$? if [ "$ERR" -ne 0 ]; then perror "Could not import sql dump file $1!" diff --git a/satellit_installer/includes/10-password_helper.inc b/satellit_installer/includes/10-password_helper.inc index 30eece9..0f52185 100644 --- a/satellit_installer/includes/10-password_helper.inc +++ b/satellit_installer/includes/10-password_helper.inc @@ -1,4 +1,3 @@ - generate_password() { local password="$(< /dev/urandom tr -dc A-Za-z0-9_ | head -c${1:-16};)" echo "$password" @@ -9,7 +8,6 @@ generate_password() { 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)" @@ -18,7 +16,6 @@ set_passwords() { # 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." diff --git a/satellit_installer/includes/30-setup_dhcp.inc b/satellit_installer/includes/30-setup_dhcp.inc deleted file mode 100644 index 14e2d54..0000000 --- a/satellit_installer/includes/30-setup_dhcp.inc +++ /dev/null @@ -1,60 +0,0 @@ -install_dhclient() { - echo -n "# Installing dhclient (isc-dhclient)..." - apt-get install isc-dhcp-client 2>/dev/null 1>&2 - if [ "$ERR" -ne 0 ]; then - echo - echo "# WARNING: Could not re-install dhclient (isc-dhcp-client)!" - echo "# This should not happen. I give up." - echo "# Please keep in mind this problem has to be solved" - echo "# before the next boot, as the server will most likely" - echo "# not receive an IP (if not set statically)." - else - echo " ok." - fi -} - -install_pump() { - if [ ! $(which pump) ]; then - echo -n "# Installing pump..." - apt-get install pump 2>/dev/null 1>&2 - if [ "$ERR" -ne 0 ]; then - echo - echo "# WARNING: Could not install pump! This is a problem, as pump" - echo "# is an essential package. The server install will" - echo "# continue, but keep in mind this problem has to be" - echo "# solved before the server will work correctly." - echo "# Now re-installing dhclient (isc-dhcp-client)..." - install_dhclient - else - echo " ok." - fi - fi -} - -uninstall_dhclient() { - echo -n "# Uninstalling dhclient (isc-dhclient)..." - dpkg --remove isc-dhcp-client 2>/dev/null 1>&2 - if [ "$ERR" -ne 0 ]; then - echo - echo "# WARNING: Could not uninstall dhclient (isc-dhcp-client)!" - echo "# This should not happen. I give up." - echo "# Please keep in mind this problem has to be solved" - echo "# before the next boot, as the server will most likely" - echo "# not receive an IP (if not set statically)." - echo "# pump will be installed anyway, but keep an eye on possible problems." - else - echo " ok." - fi -} - -setup_dhcp() { - echo "#" - echo "# First: let's see whether the package isc-dhcp-client is installed," - echo "# as we do not like it due to udp checksum failures using virtIO." - echo "# Checking dhcp configuration / utilities..." - if [ $(which dhclient) ]; then - echo "# dhclient detected. dhclient will be uninstalled due to virtIO-problems." - uninstall_dhclient - fi - install_pump -} diff --git a/satellit_installer/satellit_installer b/satellit_installer/satellit_installer index eee72c4..61065aa 100755 --- a/satellit_installer/satellit_installer +++ b/satellit_installer/satellit_installer @@ -81,7 +81,8 @@ install_packages "$PACKAGELIST_SCRIPT" # Packages needed for script get_files_http [ "${ERR}" -ne 0 ] && exit 1 -setup_dhcp # dhcp: no dhclient but pump +# until pump is available again: +# setup_dhcp # dhcp: no dhclient but pump uninstall_packages mpt-status @@ -93,8 +94,6 @@ set_passwords # only to be used within certain circumstances - set_version_string # Writing version string for rc.local-script -preset_mysql_root # so mysqld keeps quiet when installing - add_repos # Adding repos: backports install_packages NOREC "$PACKAGELIST_SERVER" # Packages needed for server installable without diff --git a/satellit_installer/static_files/rclocal_script.sh b/satellit_installer/static_files/rclocal_script.sh index 91bf30d..2fc4235 100644 --- a/satellit_installer/static_files/rclocal_script.sh +++ b/satellit_installer/static_files/rclocal_script.sh @@ -25,8 +25,6 @@ echo "$(basename $0) gestartet: $(date "+%Y-%m-%d %H:%m:%S")" >> /root/init.log source "/root/installer/config" || { echo "Fehler beim Sourcen der firstrun-config." >> /root/init.log; exit 1; } -[ -z "$MYSQL_ROOT_PASS" ] && perror "Installationsfehler: WARNUNG: Aktuelles MySQL-root-Passwort nicht bekannt!" - generate_password() { tr -dc _A-Za-z0-9 < /dev/urandom | head -c 16 } @@ -58,11 +56,6 @@ export LANG=de_DE.UTF-8 echo "Generiere intern genutzte Passwörter (z.B. MySQL-Zugänge) neu ..." >> /root/init.log umask 0077 -MYSQL_ROOT_NEW=$(generate_password) -mysqladmin -u root -p"${MYSQL_ROOT_PASS}" password "${MYSQL_ROOT_NEW}" || perror "Neusetzen des root-MySQL-Passworts fehlgeschlagen" -# Just in case... -sed -i "s/^MYSQL_ROOT_PASS=.*\$/MYSQL_ROOT_PASS=${MYSQL_ROOT_NEW}/g" "/root/installer/config" - MYSQL_SAT_NEW=$(generate_password) echo "SET PASSWORD FOR 'sat'@'localhost' = PASSWORD('$MYSQL_SAT_NEW');" | mysql -u root -p"${MYSQL_ROOT_NEW}" || perror "Neusetzen des sat-MySQL-Passworts fehlgeschlagen." @@ -78,7 +71,6 @@ if grep -q debian-sys-maint /etc/mysql/debian.cnf; then fi # Store mysql root pass in root's home -echo "$MYSQL_ROOT_NEW" > /root/mysqlpass chmod 600 /root/mysqlpass echo -n "Konfigurationsdateien werden aktualisiert..." >> /root/init.log -- cgit v1.2.3-55-g7522