provide ability to switch on SSH support per container
This commit is contained in:
parent
9ab581b79a
commit
f98b89c44a
19
docker-run
19
docker-run
@ -19,6 +19,14 @@ if [ "$1" == "--port" ]; then
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ENABLE_SSH=""
|
||||||
|
if [ "$1" == "--enable-ssh" ]; then
|
||||||
|
|
||||||
|
ENABLE_SSH="true"
|
||||||
|
shift
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
# generate random UUID for new SUV
|
# generate random UUID for new SUV
|
||||||
# thanks https://stackoverflow.com/questions/34328759
|
# thanks https://stackoverflow.com/questions/34328759
|
||||||
# SUV_ID=$(hexdump -vn8 -e'2/4 "%08x" 1 "\n"' /dev/urandom)
|
# SUV_ID=$(hexdump -vn8 -e'2/4 "%08x" 1 "\n"' /dev/urandom)
|
||||||
@ -69,9 +77,11 @@ sleep 3
|
|||||||
# docker inspect $SUV_NAME
|
# docker inspect $SUV_NAME
|
||||||
SUV_IP=$(docker container exec $SUV_NAME hostname -i)
|
SUV_IP=$(docker container exec $SUV_NAME hostname -i)
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
Q=$?
|
||||||
|
if [ $Q -ne 0 ]; then
|
||||||
|
|
||||||
echo "Something went wrong; please check your configuration"
|
echo "Something went wrong; please check your configuration"
|
||||||
|
exit $Q
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
@ -81,3 +91,10 @@ else
|
|||||||
echo "$SUV_NAME : $SUV_IP"
|
echo "$SUV_NAME : $SUV_IP"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$ENABLE_SSH" == "true" ]; then
|
||||||
|
|
||||||
|
docker container exec $SUV_NAME /usr/lib/mocha/create_suv_users
|
||||||
|
docker container exec $SUV_NAME service ssh start
|
||||||
|
|
||||||
|
fi
|
||||||
|
|||||||
21
mocha-suv/common/libexec/create_suv_users
Executable file
21
mocha-suv/common/libexec/create_suv_users
Executable file
@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# rm /var/www/html/index.html
|
||||||
|
|
||||||
|
# set up mocha user accounts
|
||||||
|
addgroup webmasters
|
||||||
|
|
||||||
|
PASS1=$(pwgen 16 1)
|
||||||
|
useradd -p $(openssl passwd -6 $PASS1) -g webmasters webmaster
|
||||||
|
|
||||||
|
PASS2=$(pwgen 16 1)
|
||||||
|
useradd -p $(openssl passwd -6 $PASS2) zqadmin
|
||||||
|
|
||||||
|
echo "webmaster: $PASS1
|
||||||
|
zqadmin: $PASS2" > /etc/mocha/passwd
|
||||||
|
|
||||||
|
chown --recursive zqadmin /etc/mocha /usr/lib/mocha /usr/share/mocha /var/mocha
|
||||||
|
chgrp --recursive zqadmin /etc/mocha /usr/lib/mocha /usr/share/mocha /var/mocha
|
||||||
|
|
||||||
|
chown --recursive webmaster /var/www /var/mocha/uploads
|
||||||
|
chgrp --recursive webmasters /var/www /var/mocha/uploads
|
||||||
@ -1,5 +1,5 @@
|
|||||||
FROM ubuntu
|
FROM ubuntu
|
||||||
RUN apt update && apt upgrade -y && apt install -y php php-mbstring php-curl php-xml pwgen dotnet-runtime-8.0
|
RUN apt update && apt upgrade -y && apt install -y php php-mbstring php-curl php-xml pwgen dotnet-runtime-8.0 openssh-server
|
||||||
|
|
||||||
RUN rm /var/www/html/index.html && a2enmod ssl && a2enmod rewrite && service apache2 restart
|
RUN rm /var/www/html/index.html && a2enmod ssl && a2enmod rewrite && service apache2 restart
|
||||||
|
|
||||||
@ -30,4 +30,3 @@ COPY mocha-suv/docker/site.conf /etc/apache2/sites-available/000-default.conf
|
|||||||
EXPOSE 443
|
EXPOSE 443
|
||||||
|
|
||||||
CMD [ "mochactl", "start" ]
|
CMD [ "mochactl", "start" ]
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user