This commit is contained in:
Bryan Ashby 2023-01-06 14:17:16 -07:00
parent 7380ef571a
commit 41867c73d5
No known key found for this signature in database
GPG Key ID: C2C1B501E4EFD994
3 changed files with 14 additions and 12 deletions

View File

@ -65,9 +65,10 @@ module.exports = class Log {
//
return JSON.parse(
JSON.stringify(obj).replace(
/"(password|passwordConfirm|key|authCode|private_key_main)"\s?:\s?"([^"]+)"/,
(match, valueName) => {
return `"${valueName}":"********"`;
// note that we match against key names here
/"(password|passwordConfirm|key|authCode)"\s?:\s?"([^"]+)"/,
(match, keyName) => {
return `"${keyName}":"********"`;
}
)
);

View File

@ -503,6 +503,11 @@ module.exports = class User {
}
);
},
function setKeyPair(trans, callback) {
self.updateMainKeyPairProperties(err => {
return callback(err, trans);
});
},
function setInitialGroupMembership(trans, callback) {
// Assign initial groups. Must perform a clone: #235 - All users are sysops (and I can't un-sysop them)
self.groups = [...config.users.defaultGroups];
@ -547,11 +552,6 @@ module.exports = class User {
async.series(
[
function setKeyPair(callback) {
self.generateMainKeyPair(err => {
return callback(err);
});
},
function saveProps(callback) {
self.persistProperties(self.properties, trans, err => {
return callback(err);
@ -643,7 +643,7 @@ module.exports = class User {
);
}
generateMainKeyPair(cb) {
updateMainKeyPairProperties(cb) {
crypto.generateKeyPair(
'rsa',
{

View File

@ -66,6 +66,7 @@ module.exports = {
AuthFactor2OTP: 'auth_factor2_otp', // If present, OTP type for 2FA. See OTPTypes
AuthFactor2OTPSecret: 'auth_factor2_otp_secret', // Secret used in conjunction with OTP 2FA
AuthFactor2OTPBackupCodes: 'auth_factor2_otp_backup', // JSON array of backup codes
PublicKeyMain: 'public_key_main', // RSA public key for user
PrivateKeyMain: 'private_key_main', // RSA private key (corresponding to PublicKeyMain)
PublicKeyMain: 'public_key_main_rsa_2048', // RSA public key for user
PrivateKeyMain: 'private_key_main_rsa_2048', // RSA private key (corresponding to PublicKeyMain)
};