mirror of
https://github.com/konstruktoid/hardening.git
synced 2026-04-27 01:35:55 +03:00
[GH-ISSUE #5] Too many authentication failures #3
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 @pascalandy on GitHub (Jul 20, 2017).
Original GitHub issue: https://github.com/konstruktoid/hardening/issues/5
Hi,
Everything looks to install normally. I use Packet.net. When I reboot and log (via SSH of course) I get this error:
I guess there is some rule that are too severe. I looked at the scripts but didn't see how I could fix this.
Thank you!
@pascalandy commented on GitHub (Jul 20, 2017):
Looks like https://github.com/konstruktoid/hardening/blob/master/ubuntu.sh#L24 should call https://github.com/konstruktoid/hardening/blob/master/scripts/02_ufw
Curious to know why the names are different.
@konstruktoid commented on GitHub (Aug 4, 2017):
Thanks for the report @pascalandy and sorry for such a late reply, but
f_firewallis present asfunction f_firewallin https://github.com/konstruktoid/hardening/blob/master/scripts/02_ufw. Regarding the naming; functions can't be numbers, since it's not a valid identifier.Please increase
MaxAuthTries(https://github.com/konstruktoid/hardening/blob/master/scripts/18_sshdconfig#L25-L29) and see if the problem persists.@pascalandy commented on GitHub (Sep 4, 2017):
I'm actually provisioning new machines.
I think you should use branches to develop feature and ensure master is always your golden copy :)
@pascalandy commented on GitHub (Sep 4, 2017):
Same error.
I also saw few error when the scripts started:
It's sad as I would love to use your template. I really enjoy the way you organized this project. Keep up the good work.
Cheers!
@konstruktoid commented on GitHub (Sep 5, 2017):
Hi again @pascalandy, I find it odd you're missing
nf_conntrack/parameters/hashsizeanddmidecode. Could you provide more details about the machines you are provisioning?And regarding branches; you're absolutely right, I've just been lazy when it comes to my own repositories. Will start a develop branch right away.
@konstruktoid commented on GitHub (Sep 5, 2017):
Using the Vagrantfile for testing, I'm not having any issues with
nf_conntrack/parameters/hashsizeordmidecodeon Xenial, Zesty, Yakkety or Artful.@pascalandy commented on GitHub (Sep 5, 2017):
I know there is always little subtle differences between cloud providers that break my scripts. I'm not using Ansible or Terraform at this point.
As I said, I provision bare-metal server on packet.net (type 0). If you want, I would be glad to do a live session with. We we could provision machines on the spot and test till we find the issue.
I use a standard Ubuntu 16.04 fresh install each time. Packet is known to have fresh images.
@konstruktoid commented on GitHub (Sep 5, 2017):
Adding test if
nf_conntrack/parameters/hashsizeordmidecodeare missing.Just to verify, can you check if the
nf_conntrackkernel module is loaded?@konstruktoid commented on GitHub (Sep 5, 2017):
Tests added and dmidecode replaced with dmesg;
github.com/konstruktoid/hardening@e5d51ab15b@pascalandy commented on GitHub (Sep 6, 2017):
Not sure if I should do something here.
@konstruktoid commented on GitHub (Sep 6, 2017):
Any failures after
github.com/konstruktoid/hardening@e5d51ab15b?And
nf_conntrack/parameters/hashsizeis only present if thenf_conntrackmodule is loaded.@pascalandy commented on GitHub (Sep 6, 2017):
OK will try !
@pascalandy commented on GitHub (Sep 6, 2017):
Same error. Btw I use root to login. Is it ok?
@konstruktoid commented on GitHub (Sep 7, 2017):
No,
rootis not allowed to log in.https://github.com/konstruktoid/hardening/blob/master/scripts/18_sshdconfig#L11
@pascalandy commented on GitHub (Sep 7, 2017):
Ok. In this case, which user should I use?
@konstruktoid commented on GitHub (Sep 7, 2017):
It's all about how you provision your servers,
rootshould never be allowed to login and can be locked (https://github.com/konstruktoid/hardening/blob/master/scripts/36_lockroot), create a user and usesudoto gain superuser privileges instead. If not possible, changePermitRootLogintoyesin the sshd-config file and unlock therootuser.@pascalandy commented on GitHub (Sep 7, 2017):
Alright, I thought this project was creating a new user somewhere along the line. So all my
maybe due to the fact I was using root :-p Will let you know !
@pascalandy commented on GitHub (Sep 14, 2017):
in /etc/ssh/sshd_config I changed update PermitRootLogin no to PermitRootLogin yes
and I'm still locked down.
EDIT: I also tried to bypass https://raw.githubusercontent.com/konstruktoid/hardening/master/scripts/36_lockroot
same result.
@konstruktoid commented on GitHub (Sep 15, 2017):
Does it work if you create a normal user and try to connect?
@pascalandy commented on GitHub (Sep 15, 2017):
I did start to create a user but then many thing breaks ... At this point I can't confirm.
@konstruktoid commented on GitHub (Sep 18, 2017):
What did break?
@konstruktoid commented on GitHub (Sep 18, 2017):
Since the
rootuser shouldn't be allowed to remotely access a system or be used as a normal user, there are multiple configurations that need to be changed, eg:https://github.com/konstruktoid/hardening/blob/master/scripts/16_rootaccess#L4
https://github.com/konstruktoid/hardening/blob/master/scripts/18_sshdconfig#L11
https://github.com/konstruktoid/hardening/blob/master/scripts/36_lockroot#L4
@pascalandy commented on GitHub (Sep 18, 2017):
Mostly my existing scripts, ssh keys.
@pascalandy commented on GitHub (Sep 18, 2017):
I see the 3 lines you point out are SEDs.
Should I just delete those lines and
rootwill stays untouched@konstruktoid commented on GitHub (Sep 18, 2017):
Without logs it's pretty tricky to pinpoint the exact cause of the failures.
I believe so, but consider not using the root account at all.
@pascalandy commented on GitHub (Sep 18, 2017):
I'm OK with using root at the moment. Fully aware that I must move on with a new another user in the future.
I'll try https://github.com/konstruktoid/hardening/issues/5#issuecomment-330149495
@konstruktoid commented on GitHub (Oct 31, 2017):
Closing due to inactivity.
@rams3sh commented on GitHub (May 9, 2022):
I faced a similar issue and I dont login with root but with another custom user using certificate based login.
SSH has a default behaviour of trying through all ssh keys present as part of your default
~/.ssh/folder before trying the one passed using-ioption. This tweet explains the issue and also has a solution which was helpful for me in solving the problem.Posting it here just in case if it helps anyone else who faces a similar issue as myself in future.
Link: https://twitter.com/podalirius_/status/1422123401855049730
@konstruktoid commented on GitHub (May 9, 2022):
Thanks @rams3sh!
ssh -i ./keys/id_rsa user@remote.host.org -v -o IdentitiesOnly=trueis the TL;DR