Skip to content

Commit 381a66a

Browse files
committed
fix(auth): upgrade SFTP password hash from MD5-crypt to SHA-512 and tighten auth.env permissions
- Replace openssl passwd -1 (MD5-crypt) with -6 (SHA-512-crypt) for SFTP credential - Change auth.env file permissions from 0644 to 0600 (owner read/write only) - Update .justfile, docs, and argparse help string to reflect new hash algorithm
1 parent c2550a7 commit 381a66a

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

.justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ auth-setup:
216216
--auth-generate-postgres-password "${AUTH_GENERATE_POSTGRES_PASSWORD:-false}" \
217217
--auth-generate-keycloak-db-password "${AUTH_GENERATE_KEYCLOAK_DB_PASSWORD:-true}" \
218218
--auth-admin-username "${AUTH_ADMIN_USERNAME}" \
219-
--auth-admin-password-openssl "$(echo -n "${AUTH_ADMIN_PASSWORD}" | openssl passwd -1 --stdin)" \
219+
--auth-admin-password-openssl "$(echo -n "${AUTH_ADMIN_PASSWORD}" | openssl passwd -6 --stdin)" \
220220
--auth-admin-password-htpasswd "$(echo -n "${AUTH_ADMIN_PASSWORD}" | htpasswd -i -n -B username | cut -d: -f2 | head -n 1)" \
221221
--auth-arkime-password "${AUTH_ARKIME_PASSWORD:-Malcolm}" \
222222
--auth-generate-webcerts "${AUTH_GENERATE_WEBCERTS:-true}" \

docs/authsetup.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ Authentication Setup:
492492
--auth-admin-username <string>
493493
Administrator username (for --auth-noninteractive)
494494
--auth-admin-password-openssl <string>
495-
Administrator password hash from "openssl -passwd -1" (for --auth-noninteractive)
495+
Administrator password hash from "openssl -passwd -6" (for --auth-noninteractive)
496496
--auth-admin-password-htpasswd <string>
497497
Administrator password hash from "htpasswd -n -B username | cut -d: -f2" (for --auth-noninteractive)
498498
--auth-arkime-password <string>
@@ -536,7 +536,7 @@ Authentication Setup:
536536
537537
```
538538

539-
In order to avoid specifying passwords as command line arguments, when setting the administrator password noninteractively the user must instead provide hashes generated by [`openssl -passwd -1`](https://www.openssl.org/docs/man1.1.1/man1/openssl-passwd.html) and [`htpasswd -n -B username`](https://httpd.apache.org/docs/2.4/programs/htpasswd.html).
539+
In order to avoid specifying passwords as command line arguments, when setting the administrator password noninteractively the user must instead provide hashes generated by [`openssl -passwd -6`](https://www.openssl.org/docs/man1.1.1/man1/openssl-passwd.html) and [`htpasswd -n -B username`](https://httpd.apache.org/docs/2.4/programs/htpasswd.html).
540540

541541
# <a name="LoggingOut"></a>Log Out of Malcolm
542542

scripts/control.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2111,7 +2111,7 @@ def authSetup():
21112111
passwordEncrypted = args.authPasswordOpenssl
21122112
else:
21132113
err, out = run_process(
2114-
[opensslBin, 'passwd', '-1', '-stdin'],
2114+
[opensslBin, 'passwd', '-6', '-stdin'],
21152115
stdin=password,
21162116
stderr=False,
21172117
debug=log_level_is_debug(args.verbose),
@@ -2137,7 +2137,7 @@ def authSetup():
21372137
b64encode(passwordEncrypted.encode()).decode("ascii"),
21382138
),
21392139
],
2140-
stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH,
2140+
stat.S_IRUSR | stat.S_IWUSR,
21412141
)
21422142

21432143
# create or update the htpasswd file
@@ -3290,7 +3290,7 @@ def main():
32903290
metavar='<string>',
32913291
type=str,
32923292
default='',
3293-
help='Administrator password hash from "openssl -passwd -1" (for --auth-noninteractive)',
3293+
help='Administrator password hash from "openssl -passwd -6" (for --auth-noninteractive)',
32943294
)
32953295
authSetupGroup.add_argument(
32963296
'--auth-admin-password-htpasswd',

0 commit comments

Comments
 (0)