Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ssh+pam replaced /root/.google-authenticator with a zero-sized file #177

Open
mathieu-lacage opened this issue Aug 5, 2020 · 4 comments
Labels

Comments

@mathieu-lacage
Copy link

Someone on the team managed to make ssh+pam+google authenticator to replace a good /root/.google-authenticator file with a zero-sized one.

I have no idea how they managed this but I have a log that you might find helpful:

auth.log

I suspect you guess what happened after .google-authenticator was zero-sized: no one could connect anymore on the that box: I had to use a console attached to the VM to put it back to a working state...

@mathieu-lacage
Copy link
Author

mathieu-lacage commented Aug 5, 2020

Note: I found the whole idea of storing the last connection attempt timestamp in the configuration file somewhat fragile. i.e., trying to rewrite dynamically the configuration file sounds like a potential source of endless problems. Maybe it would make sense to store this somewhere else.

@ThomasHabets
Copy link
Collaborator

Strange. That should not happen. Looking at the code now I don't see how a zero byte file can be created, even in the presence of failures. This was a local filesystem, or something like NFS?

Could you try reproducing this with code at HEAD, where I have added some more logging for these failures?

If you can, while doing this, keep a separate terminal logged in so that you can fix the problem if you do manage to reproduce it.

@mathieu-lacage
Copy link
Author

Strange. That should not happen. Looking at the code now I don't see how a zero byte file can be created, even in the presence of failures. This was a local filesystem, or something like NFS?

This is a local filesystem, ext4:
/dev/sda1 on / type ext4 (rw,relatime,data=ordered)

kernel:
Linux ssh1 4.15.0-112-generic #113-Ubuntu SMP Thu Jul 9 23:41:39 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

This happened twice over the past 2 weeks on this server.

Could you try reproducing this with code at HEAD, where I have added some more logging for these failures?

If you can, while doing this, keep a separate terminal logged in so that you can fix the problem if you do manage to reproduce it.

Will get back to you with new logs if we manage to do this.

@mathieu-lacage
Copy link
Author

This is reproducible multiple times per day now. I have depoyed the HEAD version and will report on /var/log/auth.log when it is triggered

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants