diff --git a/10.10/Dockerfile b/10.10/Dockerfile index 013a9ceb..803f9aba 100644 --- a/10.10/Dockerfile +++ b/10.10/Dockerfile @@ -123,6 +123,7 @@ RUN set -ex; \ VOLUME /var/lib/mysql COPY healthcheck.sh /usr/local/bin/healthcheck.sh +COPY password_2_hash.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/10.10/password_2_hash.sh b/10.10/password_2_hash.sh new file mode 100755 index 00000000..d29c5770 --- /dev/null +++ b/10.10/password_2_hash.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -eo pipefail +shopt -s nullglob + +command -v openssl >/dev/null || { + echo "openssl command not found" + exit 1 +} + +command -v awk >/dev/null || { + echo "awk command not found" + exit 1 +} + +function hash_pw() { + openssl sha1 -binary | openssl sha1 -hex | awk '{print "*"toupper($0)}' +} + +function test_hash() { + gen_hash=$(echo -n "$1" | hash_pw) + if [ "$gen_hash" != "$2" ]; then + exit 1 + fi +} + +test_hash 'mariadb' '*54958E764CE10E50764C2EECBB71D01F08549980' + +function ask_pw() { + stty -echo + head -n 1 | tr -d '\n' + stty echo +} + +echo -n "Password: " +ask_pw | hash_pw diff --git a/10.3/Dockerfile b/10.3/Dockerfile index 884f4b6b..f9d6edf0 100644 --- a/10.3/Dockerfile +++ b/10.3/Dockerfile @@ -125,6 +125,7 @@ RUN set -ex; \ VOLUME /var/lib/mysql COPY healthcheck.sh /usr/local/bin/healthcheck.sh +COPY password_2_hash.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/ RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/10.3/password_2_hash.sh b/10.3/password_2_hash.sh new file mode 100755 index 00000000..d29c5770 --- /dev/null +++ b/10.3/password_2_hash.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -eo pipefail +shopt -s nullglob + +command -v openssl >/dev/null || { + echo "openssl command not found" + exit 1 +} + +command -v awk >/dev/null || { + echo "awk command not found" + exit 1 +} + +function hash_pw() { + openssl sha1 -binary | openssl sha1 -hex | awk '{print "*"toupper($0)}' +} + +function test_hash() { + gen_hash=$(echo -n "$1" | hash_pw) + if [ "$gen_hash" != "$2" ]; then + exit 1 + fi +} + +test_hash 'mariadb' '*54958E764CE10E50764C2EECBB71D01F08549980' + +function ask_pw() { + stty -echo + head -n 1 | tr -d '\n' + stty echo +} + +echo -n "Password: " +ask_pw | hash_pw diff --git a/10.4/Dockerfile b/10.4/Dockerfile index acf612c2..bc429619 100644 --- a/10.4/Dockerfile +++ b/10.4/Dockerfile @@ -125,6 +125,7 @@ RUN set -ex; \ VOLUME /var/lib/mysql COPY healthcheck.sh /usr/local/bin/healthcheck.sh +COPY password_2_hash.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/ RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/10.4/password_2_hash.sh b/10.4/password_2_hash.sh new file mode 100755 index 00000000..d29c5770 --- /dev/null +++ b/10.4/password_2_hash.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -eo pipefail +shopt -s nullglob + +command -v openssl >/dev/null || { + echo "openssl command not found" + exit 1 +} + +command -v awk >/dev/null || { + echo "awk command not found" + exit 1 +} + +function hash_pw() { + openssl sha1 -binary | openssl sha1 -hex | awk '{print "*"toupper($0)}' +} + +function test_hash() { + gen_hash=$(echo -n "$1" | hash_pw) + if [ "$gen_hash" != "$2" ]; then + exit 1 + fi +} + +test_hash 'mariadb' '*54958E764CE10E50764C2EECBB71D01F08549980' + +function ask_pw() { + stty -echo + head -n 1 | tr -d '\n' + stty echo +} + +echo -n "Password: " +ask_pw | hash_pw diff --git a/10.5/Dockerfile b/10.5/Dockerfile index a4a85843..a15bcc62 100644 --- a/10.5/Dockerfile +++ b/10.5/Dockerfile @@ -125,6 +125,7 @@ RUN set -ex; \ VOLUME /var/lib/mysql COPY healthcheck.sh /usr/local/bin/healthcheck.sh +COPY password_2_hash.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/10.5/password_2_hash.sh b/10.5/password_2_hash.sh new file mode 100755 index 00000000..d29c5770 --- /dev/null +++ b/10.5/password_2_hash.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -eo pipefail +shopt -s nullglob + +command -v openssl >/dev/null || { + echo "openssl command not found" + exit 1 +} + +command -v awk >/dev/null || { + echo "awk command not found" + exit 1 +} + +function hash_pw() { + openssl sha1 -binary | openssl sha1 -hex | awk '{print "*"toupper($0)}' +} + +function test_hash() { + gen_hash=$(echo -n "$1" | hash_pw) + if [ "$gen_hash" != "$2" ]; then + exit 1 + fi +} + +test_hash 'mariadb' '*54958E764CE10E50764C2EECBB71D01F08549980' + +function ask_pw() { + stty -echo + head -n 1 | tr -d '\n' + stty echo +} + +echo -n "Password: " +ask_pw | hash_pw diff --git a/10.6/Dockerfile b/10.6/Dockerfile index 9be3a41a..4ecdfbce 100644 --- a/10.6/Dockerfile +++ b/10.6/Dockerfile @@ -125,6 +125,7 @@ RUN set -ex; \ VOLUME /var/lib/mysql COPY healthcheck.sh /usr/local/bin/healthcheck.sh +COPY password_2_hash.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/10.6/password_2_hash.sh b/10.6/password_2_hash.sh new file mode 100755 index 00000000..d29c5770 --- /dev/null +++ b/10.6/password_2_hash.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -eo pipefail +shopt -s nullglob + +command -v openssl >/dev/null || { + echo "openssl command not found" + exit 1 +} + +command -v awk >/dev/null || { + echo "awk command not found" + exit 1 +} + +function hash_pw() { + openssl sha1 -binary | openssl sha1 -hex | awk '{print "*"toupper($0)}' +} + +function test_hash() { + gen_hash=$(echo -n "$1" | hash_pw) + if [ "$gen_hash" != "$2" ]; then + exit 1 + fi +} + +test_hash 'mariadb' '*54958E764CE10E50764C2EECBB71D01F08549980' + +function ask_pw() { + stty -echo + head -n 1 | tr -d '\n' + stty echo +} + +echo -n "Password: " +ask_pw | hash_pw diff --git a/10.7/Dockerfile b/10.7/Dockerfile index 365b52a6..ef07153a 100644 --- a/10.7/Dockerfile +++ b/10.7/Dockerfile @@ -125,6 +125,7 @@ RUN set -ex; \ VOLUME /var/lib/mysql COPY healthcheck.sh /usr/local/bin/healthcheck.sh +COPY password_2_hash.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/10.7/password_2_hash.sh b/10.7/password_2_hash.sh new file mode 100755 index 00000000..d29c5770 --- /dev/null +++ b/10.7/password_2_hash.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -eo pipefail +shopt -s nullglob + +command -v openssl >/dev/null || { + echo "openssl command not found" + exit 1 +} + +command -v awk >/dev/null || { + echo "awk command not found" + exit 1 +} + +function hash_pw() { + openssl sha1 -binary | openssl sha1 -hex | awk '{print "*"toupper($0)}' +} + +function test_hash() { + gen_hash=$(echo -n "$1" | hash_pw) + if [ "$gen_hash" != "$2" ]; then + exit 1 + fi +} + +test_hash 'mariadb' '*54958E764CE10E50764C2EECBB71D01F08549980' + +function ask_pw() { + stty -echo + head -n 1 | tr -d '\n' + stty echo +} + +echo -n "Password: " +ask_pw | hash_pw diff --git a/10.8/Dockerfile b/10.8/Dockerfile index e8e1cef4..f7d78894 100644 --- a/10.8/Dockerfile +++ b/10.8/Dockerfile @@ -125,6 +125,7 @@ RUN set -ex; \ VOLUME /var/lib/mysql COPY healthcheck.sh /usr/local/bin/healthcheck.sh +COPY password_2_hash.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/10.8/password_2_hash.sh b/10.8/password_2_hash.sh new file mode 100755 index 00000000..d29c5770 --- /dev/null +++ b/10.8/password_2_hash.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -eo pipefail +shopt -s nullglob + +command -v openssl >/dev/null || { + echo "openssl command not found" + exit 1 +} + +command -v awk >/dev/null || { + echo "awk command not found" + exit 1 +} + +function hash_pw() { + openssl sha1 -binary | openssl sha1 -hex | awk '{print "*"toupper($0)}' +} + +function test_hash() { + gen_hash=$(echo -n "$1" | hash_pw) + if [ "$gen_hash" != "$2" ]; then + exit 1 + fi +} + +test_hash 'mariadb' '*54958E764CE10E50764C2EECBB71D01F08549980' + +function ask_pw() { + stty -echo + head -n 1 | tr -d '\n' + stty echo +} + +echo -n "Password: " +ask_pw | hash_pw diff --git a/10.9/Dockerfile b/10.9/Dockerfile index 579cce08..7e8ebd4d 100644 --- a/10.9/Dockerfile +++ b/10.9/Dockerfile @@ -123,6 +123,7 @@ RUN set -ex; \ VOLUME /var/lib/mysql COPY healthcheck.sh /usr/local/bin/healthcheck.sh +COPY password_2_hash.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/ ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/10.9/password_2_hash.sh b/10.9/password_2_hash.sh new file mode 100755 index 00000000..d29c5770 --- /dev/null +++ b/10.9/password_2_hash.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -eo pipefail +shopt -s nullglob + +command -v openssl >/dev/null || { + echo "openssl command not found" + exit 1 +} + +command -v awk >/dev/null || { + echo "awk command not found" + exit 1 +} + +function hash_pw() { + openssl sha1 -binary | openssl sha1 -hex | awk '{print "*"toupper($0)}' +} + +function test_hash() { + gen_hash=$(echo -n "$1" | hash_pw) + if [ "$gen_hash" != "$2" ]; then + exit 1 + fi +} + +test_hash 'mariadb' '*54958E764CE10E50764C2EECBB71D01F08549980' + +function ask_pw() { + stty -echo + head -n 1 | tr -d '\n' + stty echo +} + +echo -n "Password: " +ask_pw | hash_pw diff --git a/Dockerfile.template b/Dockerfile.template index efd55520..b7618ca7 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -125,6 +125,7 @@ RUN set -ex; \ VOLUME /var/lib/mysql COPY healthcheck.sh /usr/local/bin/healthcheck.sh +COPY password_2_hash.sh /usr/local/bin/ COPY docker-entrypoint.sh /usr/local/bin/ RUN ln -s usr/local/bin/docker-entrypoint.sh / # backwards compat ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/password_2_hash.sh b/password_2_hash.sh new file mode 100755 index 00000000..51e975ea --- /dev/null +++ b/password_2_hash.sh @@ -0,0 +1,39 @@ +#!/bin/bash +set -eo pipefail +shopt -s nullglob + +command -v openssl >/dev/null || { + echo "openssl command not found" + exit 1 +} + +command -v awk >/dev/null || { + echo "awk command not found" + exit 1 +} + +function hash_pw() { + openssl sha1 -binary | openssl sha1 -hex -r | awk -F ' ' '{print "*"toupper($1)}' +} + +function test_hash() { + gen_hash=$(echo -n "$1" | hash_pw) + if [ "$gen_hash" != "$2" ]; then + exit 1 + fi +} + +test_hash 'mariadb' '*54958E764CE10E50764C2EECBB71D01F08549980' + +function ask_pw() { + if tty -s; then + stty -echo + fi + head -n 1 | tr -d '\n' + if tty -s; then + stty echo + fi +} + +echo -n "Password: " +ask_pw | hash_pw diff --git a/update.sh b/update.sh index 34c63893..a750de11 100755 --- a/update.sh +++ b/update.sh @@ -43,7 +43,7 @@ update_version() cp Dockerfile.template "$version/Dockerfile" - cp docker-entrypoint.sh healthcheck.sh "$version/" + cp docker-entrypoint.sh healthcheck.sh password_2_hash.sh "$version/" chmod a+x "$version"/healthcheck.sh sed -i \ -e 's!%%MARIADB_VERSION%%!'"$fullVersion"'!g' \