Skip to content

Commit 9f7aa2b

Browse files
committed
multi-factor-authentication: Ensure we have permissions to delete google authenticator configuration when resetting it
Signed-off-by: Tobias K <[email protected]>
1 parent 419ccd6 commit 9f7aa2b

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

bin/ncp/SECURITY/multi-factor-authentication.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,12 @@ setup_totp_secret() {
136136

137137
[[ "$reset_totp_secret" == "yes" ]] \
138138
&& [[ -f "$ssh_user_home/.google_authenticator" ]] \
139-
&& su "$ssh_user" -c "rm '${ssh_user_home}/.google_authenticator'"
139+
&& {
140+
echo "Deleting google authenticator configuration"
141+
su "$ssh_user" -c "chmod u+w '${ssh_user_home}/.google_authenticator'"
142+
su "$ssh_user" -c "rm '${ssh_user_home}/.google_authenticator'"
143+
}
144+
140145

141146
if [[ "$enable_totp_and_pw" == "yes" ]] && [[ ! -f "${ssh_user_home}/.google_authenticator" ]]
142147
then

etc/ncp-config.d/multi-factor-authentication.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"type": "bool"
3232
},
3333
{
34-
"id": "RESET_TOTP SECRET",
34+
"id": "RESET_TOTP_SECRET",
3535
"name": "reset-TOTP-secret",
3636
"value": "no",
3737
"type": "bool"

0 commit comments

Comments
 (0)