Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 10.10/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
35 changes: 35 additions & 0 deletions 10.10/password_2_hash.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions 10.3/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
35 changes: 35 additions & 0 deletions 10.3/password_2_hash.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions 10.4/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
35 changes: 35 additions & 0 deletions 10.4/password_2_hash.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions 10.5/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
35 changes: 35 additions & 0 deletions 10.5/password_2_hash.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions 10.6/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
35 changes: 35 additions & 0 deletions 10.6/password_2_hash.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions 10.7/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
35 changes: 35 additions & 0 deletions 10.7/password_2_hash.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions 10.8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
35 changes: 35 additions & 0 deletions 10.8/password_2_hash.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions 10.9/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
35 changes: 35 additions & 0 deletions 10.9/password_2_hash.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions Dockerfile.template
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
39 changes: 39 additions & 0 deletions password_2_hash.sh
Original file line number Diff line number Diff line change
@@ -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
Loading