Skip to content

Commit

Permalink
fix idaholab#110, sftp upload broken due to dollar sign(s) in openssl…
Browse files Browse the repository at this point in the history
…-encrypted password
  • Loading branch information
mmguero committed Aug 1, 2022
1 parent 11d7557 commit 305a266
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions file-upload/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

if [[ -z $SITE_NAME || -z $MALCOLM_USERNAME || -z $MALCOLM_PASSWORD ]]
then
echo "Please set the site name, username and (openssl-encrypted) password by adding the following arguments to docker run/create:"
echo "Please set the site name, username and (openssl-encrypted then base64-encoded) password by adding the following arguments to docker run/create:"
echo " -e SITE_NAME='...'"
echo " -e MALCOLM_USERNAME='...'"
echo " -e MALCOLM_PASSWORD='...'"
Expand All @@ -19,7 +19,7 @@ then
dpkg-reconfigure openssh-server

useradd -g $PGROUP -d /var/www/upload/server/php/chroot -s /sbin/nologin "$MALCOLM_USERNAME"
usermod --password "$MALCOLM_PASSWORD" "$MALCOLM_USERNAME"
usermod --password "$(echo -n "$MALCOLM_PASSWORD" | base64 -d)" "$MALCOLM_USERNAME"
chown :$PGROUP /var/www/upload/server/php/chroot/files
chmod 775 /var/www/upload/server/php/chroot/files

Expand Down
3 changes: 2 additions & 1 deletion scripts/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import sys

from malcolm_common import *
from base64 import b64encode
from collections import defaultdict, namedtuple
from subprocess import PIPE, STDOUT, Popen, check_call, CalledProcessError

Expand Down Expand Up @@ -649,7 +650,7 @@ def authSetup(wipe=False):
"# Malcolm Administrator username and encrypted password for nginx reverse proxy (and upload server's SFTP access)\n"
)
f.write(f'MALCOLM_USERNAME={username}\n')
f.write(f'MALCOLM_PASSWORD={passwordEncrypted}\n')
f.write(f'MALCOLM_PASSWORD={b64encode(passwordEncrypted.encode()).decode("ascii")}\n')
os.chmod(authEnvFile, stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH)

# create or update the htpasswd file
Expand Down

0 comments on commit 305a266

Please sign in to comment.