mirror of
https://github.com/ovh/the-bastion.git
synced 2026-05-09 08:25:27 +02:00
[GH-ISSUE #26] [SELinux] TOTP don't seems to work #9
Labels
No labels
answered
bug
documentation
enhancement
enhancement
feature
feature
kept-open-for-info
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/the-bastion#9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doubleailes on GitHub (Oct 31, 2020).
Original GitHub issue: https://github.com/ovh/the-bastion/issues/26
I set TOTP on my account.
But after the sucessfull registration, all my verification are refused.
Is there any way to get my account back?
With the scratch code?
@speed47 commented on GitHub (Oct 31, 2020):
The scratch codes can help if for some reason you no longer have the TOTP app or it no longer works correctly. Each code can only be used once, however.
To disable TOTP for your account you can use the
--osh selfMFAResetTOTPcommand. It requires the TOTP of course, but you might want to try a scratch code there.Once you've unlocked yourself, to be able to help you better, please describe the steps you followed to enable TOTP on your account.
@doubleailes commented on GitHub (Oct 31, 2020):
Ok i tried the
--osh selfMFAResetTOTPand insert my scratch code but i did not workOf course i tried a couple ones in the list.
I'm running Centos8 in VM. My timedate seems update.
I used the command
--osh selfMFASetupTOTPand get the result:
@speed47 commented on GitHub (Oct 31, 2020):
Did you install
pamtester?Can you give a screenshot of the error you get when trying to login with the TOTP?
@doubleailes commented on GitHub (Oct 31, 2020):
nope i did install
pamtestershould it be install on the bastion?here is the login exemple:
@doubleailes commented on GitHub (Oct 31, 2020):
I just checked.
pamtesteris install into my bastion.@speed47 commented on GitHub (Oct 31, 2020):
There might be something wrong on the configuration of the google_authenticator PAM module on your centos machine. When there is something wrong in its config, it'll always deny authentication. Centos 8 is part of the OSes that are automatically tested on each release, including for MFA, so it should work if the configuration is ok and the proper packages are installed.
If there is the "debug" keyword on the google_authenticator pam module line in
/etc/pam.d/sshdfile, you should get some diagnostic information in the system logs, that should give a hint about the problem.@doubleailes commented on GitHub (Oct 31, 2020):
There is no real equivalent of system logs in CentOs8 can you be more specific in which log it will be store.
the only line talking about google_authenticator is:
auth [success=ok new_authok_reqd=ok ignore=ignore default=bad module_unknow=ignore] pam_google_authenticator.so secret=~/.otpI guess debug should be add here:
auth [success=ok new_authok_reqd=ok ignore=ignore default=bad module_unknow=ignore] pam_google_authenticator.so debug secret=~/.otp@speed47 commented on GitHub (Oct 31, 2020):
Just booted a brand new CentOS 8 VM to be sure, and I can indeed get OTP to work by following the documentation (just wanted to be sure).
You are right, the "debug" keyword is to be added to the line you specified.
When you've done this, your PAM will log using your system's syslog, under the "debug" level. Here's what I get with mine:
The location of the file will depend on your system's syslog configuration.
On my test system I've just put up, I installed syslog-ng, and added these 2 configuration lines to get all the logs into the same file:
(at the end of /etc/syslog-ng/syslog-ng.conf)
@doubleailes commented on GitHub (Oct 31, 2020):
ok it's a permission issue.
@speed47 commented on GitHub (Nov 1, 2020):
Indeed, it seems your user can't write to its own home directory. I suppose you fixed it successfully?
@doubleailes commented on GitHub (Nov 1, 2020):
Nope. I change folder permission other than 700 the TOTP check is refuse.
@doubleailes commented on GitHub (Nov 1, 2020):
How can i be sure the pam process is running under my user?
@speed47 commented on GitHub (Nov 1, 2020):
It's running under your user when
pamtesteris called, which is what the bastion does:github.com/ovh/the-bastion@b0eaf15bdb/bin/shell/osh.pl (L878)You can try it manually this way, running it directly on your centos machine under your user:
@doubleailes commented on GitHub (Nov 1, 2020):
It worked.
So i checked my home user folder is 700 and my .opt is 600
@doubleailes commented on GitHub (Nov 1, 2020):
Did change selinux on your centos8 VM?
@doubleailes commented on GitHub (Nov 1, 2020):
I changed selinux to permissive and it worked.
@speed47 commented on GitHub (Nov 1, 2020):
Ah! Interesting.
This isn't catched during the tests because we use Docker to test on several distro flavors, so of course SELinux doesn't apply there.
We never stumbled upon that because we use Debian in production. Falling back to
permissiveis not acceptable for a security asset, so I think we'll have to take some time to write a proper SELinux policy.@doubleailes commented on GitHub (Nov 1, 2020):
Thank for all your help.
It's really a great tool.
I'll be happy to put it in production when the policy will be written.
@speed47 commented on GitHub (Nov 6, 2020):
pam, called bysshd, needs to be able to write the otp files. The following policy seems to be sufficient with our tests: