Skip to content

Commit

Permalink
multi-factor-authentication: Ensure we have permissions to delete goo…
Browse files Browse the repository at this point in the history
…gle authenticator configuration when resetting it

Signed-off-by: Tobias K <[email protected]>
  • Loading branch information
theCalcaholic committed Dec 17, 2019
1 parent 419ccd6 commit 9f7aa2b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion bin/ncp/SECURITY/multi-factor-authentication.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,12 @@ setup_totp_secret() {

[[ "$reset_totp_secret" == "yes" ]] \
&& [[ -f "$ssh_user_home/.google_authenticator" ]] \
&& su "$ssh_user" -c "rm '${ssh_user_home}/.google_authenticator'"
&& {
echo "Deleting google authenticator configuration"
su "$ssh_user" -c "chmod u+w '${ssh_user_home}/.google_authenticator'"
su "$ssh_user" -c "rm '${ssh_user_home}/.google_authenticator'"
}


if [[ "$enable_totp_and_pw" == "yes" ]] && [[ ! -f "${ssh_user_home}/.google_authenticator" ]]
then
Expand Down
2 changes: 1 addition & 1 deletion etc/ncp-config.d/multi-factor-authentication.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"type": "bool"
},
{
"id": "RESET_TOTP SECRET",
"id": "RESET_TOTP_SECRET",
"name": "reset-TOTP-secret",
"value": "no",
"type": "bool"
Expand Down

0 comments on commit 9f7aa2b

Please sign in to comment.