Skip to content

Commit 59362b7

Browse files
committed
feat: change htpasswd to openssl
1 parent 9687e9e commit 59362b7

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

backend/internal/access-list.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,13 @@ const internalAccessList = {
507507
if (typeof item.password !== 'undefined' && item.password.length) {
508508
logger.info('Adding: ' + item.username);
509509

510-
utils.execFile('/usr/bin/htpasswd', ['-b', htpasswd_file, item.username, item.password])
511-
.then((/*result*/) => {
510+
utils.execFile('openssl', ['passwd', '-apr1', item.password])
511+
.then((res) => {
512+
try {
513+
fs.appendFileSync(htpasswd_file, item.username + ':' + res + '\n', {encoding: 'utf8'});
514+
} catch (err) {
515+
reject(err);
516+
}
512517
next();
513518
})
514519
.catch((err) => {

0 commit comments

Comments
 (0)