News for hackers. Stuff that matters.
Re:Practical Linux Hardening Guide by yjftsjthsd-h on Thursday January 24, 2019 @05:11PM (#18993557)
This is less of a hardening tip and more of a log quieting tip.
Re:Practical Linux Hardening Guide by leeoniya on Thursday January 24, 2019 @05:13PM (#18993572)
it cuts down the drive-by noise by 97%. which lets you not overlook anomalies in the remaining 3%.

we also had a bunch of scanners probing for common php scripts on the http server (we don't run php). simply returning a 404 header and disabling logging in nginx for \.php$ uris cut down a bunch of garbage (mostly from China). additionally, using ngx_http_limit_req_module reduced the effects of numerous DoS-type scanners.

so far, this + iptables for only 80/443/ssh has been a superior solution to instaling fail2ban that continually scans bloated log files and performs constant iptables banning/unbanning foo.

clean logs are essential, not just nice to haves.

Re:Practical Linux Hardening Guide by Someone1234 on Thursday January 24, 2019 @05:17PM (#18993600)
Well said.

"Log noise" is a legitimate security concern all by itself. It is actually disappointing how rarely it is discussed, and how in this world of "AI everywhere" there's no great smart AI log analysers to reduce the signal:noise.

Moving the SSH port might "only" reduce noise, but that's a legitimate security goal in its own right.

Re:Practical Linux Hardening Guide by seanwilson on Friday January 25, 2019 @09:10AM (#18997944)
> "Log noise" is a legitimate security concern all by itself. It is actually disappointing how rarely it is discussed, and how in this world of "AI everywhere" there's no great smart AI log analysers to reduce the signal:noise.

That's because after many people learn about not using "security through obscurity" they apply the rule without thinking as if obscurity never has any benefit for anything.

Re:Practical Linux Hardening Guide by thaumaturgy on Thursday January 24, 2019 @06:36PM (#18994150)
That's because people can't agree on what is or isn't valuable.

For instance, if I (or my software anyway) see a bunch of sshd login attempts from some IP, and then that IP decides to try imap ... yeah, that's getting insta-blocked.

And that's hard to do if you decide to just ignore the sshd attempts.

Re:Practical Linux Hardening Guide by hawski on Friday January 25, 2019 @03:57AM (#18996550)
Could additional honey pot on 22 help? Run sshd on non-standard port and honey pot on 22. Then automatically ban all the hosts that would connect to it. There could be a concern for a mistake, so then ban for limited time at first or something.
Re:Practical Linux Hardening Guide by tempfs on Thursday January 24, 2019 @09:19PM (#18995012)
Nothing externally accessible should allow password login at all.

SSH key-based logins are so much more secure and convenient as heck once you invest the time to learn how they work.

Re:Practical Linux Hardening Guide by systematical on Friday January 25, 2019 @01:27AM (#18995986)
For PCI you still need two factor. Its overkill, but we kept password logins even after having keys.
Re:Practical Linux Hardening Guide by amaccuish on Sunday January 27, 2019 @04:38PM (#19013937)
A smartcard is still fairly convenient and allows you to tick the two-factor box (card + pin)
Re:Practical Linux Hardening Guide by hackbinary on Thursday January 24, 2019 @07:12PM (#18994356)
What about tarpitting known spurious attacks? Possibly proxying/forwarding to a different host?
Re:Practical Linux Hardening Guide by dokument on Thursday January 24, 2019 @05:45PM (#18993824)
Additionally having a non-standard port does help defend against 0day exploits before patches are available or before you are able to disable the port.
Re:Practical Linux Hardening Guide by Wintereise on Thursday January 24, 2019 @07:36PM (#18994460)
The proper solution to this is having a separate management network that already requires authentication for getting into.

However, indeed. Minimized log noise is great for analyzing anomalies manually.

Re:Practical Linux Hardening Guide by tptacek on Thursday January 24, 2019 @05:48PM (#18993842)
When was the last preauth remote vulnerability in OpenSSH?
Re:Practical Linux Hardening Guide by leeoniya on Thursday January 24, 2019 @05:53PM (#18993882)
nevertheless, past performance is not an indicator of future outcomes, right?
Re:Practical Linux Hardening Guide by tptacek on Thursday January 24, 2019 @06:10PM (#18994000)
Past performance doesn't guarantee future performance. It's usually a very strong indicator.

Putting SSH on a nonstandard port is pretty silly.

Re:Practical Linux Hardening Guide by leeoniya on Thursday January 24, 2019 @06:25PM (#18994085)
> Putting SSH on a nonstandard port is pretty silly.

what's the alternative while still keeping ssh logs that aren't filled with thousands of login attempts from bots per day? afaik there isnt any solution that is both as simple and as effective as changing the port.

Re:Practical Linux Hardening Guide by viraptor on Thursday January 24, 2019 @08:19PM (#18994687)
Access behind VPN connection. Or deal with the logs in a better way. If SSH noise bothers you, you can either direct it to a different file, or setup a log aggregator where it's trivial to see what you want (or filter out what you don't by default)
Re:Practical Linux Hardening Guide by deathanatos on Thursday January 24, 2019 @07:07PM (#18994326)
fail2ban will cut down on log noise signficantly, while still allowing you to operate on the standard port. It also thwarts brute-force login attempts, if you're using password authentication. (Which you shouldn't, without good reason. Use public key authentication.)
Re:Practical Linux Hardening Guide by tyingq on Thursday January 24, 2019 @07:34PM (#18994450)
I like pam_shield a bit better than fail2ban. It's directly tied to pam, versus trolling logs, so the configuration and operation is cleaner.
Re:Practical Linux Hardening Guide by philg_jr on Friday January 25, 2019 @10:00AM (#18998455)
https://github.com/jtniehof/pam_shield

Last commit June 2012? Does it work with modern distros?

Re:Practical Linux Hardening Guide by tyingq on Friday January 25, 2019 @10:10AM (#18998567)
Yes. Using it now with Ubuntu 18.04. Available via apt-get.
Re:Practical Linux Hardening Guide by ryanlol on Saturday January 26, 2019 @08:45AM (#19006250)
Not sure if it’s sad or hilarious that people recommend fail2ban as a solution to log spam (or as a solution to anything really)

Do you really think making firewalling decisions based on unstructured attacker-controlled log data is a good idea?

Re:Practical Linux Hardening Guide by romeisendcoming on Monday January 28, 2019 @01:34PM (#19019824)
You control what fail2ban does with said log data and what actually gets logged. There are better ways than fail2ban of course but it's not the worst solution on the planet.
Re:Practical Linux Hardening Guide by ryanlol on Wednesday January 30, 2019 @10:36AM (#19035868)
If you're using regex to parse attacker controlled files I'm not entirely sure if you're in control.

Many unexpected things can happen, as a simple example SSH can generate log entries like this

  Jan 30 17:37:04 server sshd[26695]: Invalid user root from 127.0.0.1 from 10.0.0.1
The default rules can deal with this specific example, but this is certainly a path I wouldn't want to go down myself.
Re:Practical Linux Hardening Guide by zdkl on Thursday January 24, 2019 @06:48PM (#18994215)
Could you please expand on your point ? I understand that security by obscurity is not optimal, but I don't see a good reason not to switch ports.
Re:Practical Linux Hardening Guide by leeoniya on Thursday January 24, 2019 @06:53PM (#18994258)
i think the main argument for leaving it default is [1] for any additional/new sysadmin that has to touch the system. but imo this goes both ways; i'd rather not have my house key hidden under my doormat, where every burglar can check for it in a few seconds. if i taped the key to a random tree branch (even in plain sight), it would be a much safer bet.

[1] https://en.wikipedia.org/wiki/Principle_of_least_astonishmen...

Re:Practical Linux Hardening Guide by throwawaymath on Thursday January 24, 2019 @07:33PM (#18994443)
If you're going to insist on a security analogy involving keys and doors in the real world, a better one would be that the attacker has to search every single atom of the doormat to find the key. If you have PubKeyAuthentication enabled and PasswordAuthentication disabled, the world will end before the attacker finds your key (in expectation).

Changing SSH to a non-standard port is an inelegant solution and doesn't actually bolster security.

Re:Practical Linux Hardening Guide by killaken2000 on Thursday January 24, 2019 @11:52PM (#18995660)
Does it _harm_ security?
Re:Practical Linux Hardening Guide by xorcist on Friday January 25, 2019 @07:33AM (#18997382)
Perahaps not directly, but it does add to cognitive overhead and makes securing the system as a whole more difficult.

If your environment contains multiple ssh servers running on non-standard ports you would not notice when something out of the ordinary happens.

Something listening to an unexpected port should be something you must look into, not shrug at.

Re:Practical Linux Hardening Guide by romeisendcoming on Monday January 28, 2019 @01:37PM (#19019851)
So standardize on a non-standard port, document it and when you do have ssh probes assume it's targeted rather than just another l33t child running du-jour crack(x).

Moving to non-standard means more sophisticated discovery and possibly a more sophisticated attempt.

Re:Practical Linux Hardening Guide by throwawaymath on Friday January 25, 2019 @12:34AM (#18995825)
No, but it is non-standard. Why do things you don't need to?
Re:Practical Linux Hardening Guide by dx87 on Thursday January 24, 2019 @07:02PM (#18994297)
One reason is because setting it to a random high port allows non-root users to turn on the SSH server if the admin turned it off. Probably not super likely to happen, but it's possible.
Re:Practical Linux Hardening Guide by bch on Thursday January 24, 2019 @07:40PM (#18994482)
It doesn’t need to be on a random high port, just not port 22. 222, for example.
Re:Practical Linux Hardening Guide by romeisendcoming on Monday January 28, 2019 @01:32PM (#19019808)
This is a silly opinion. Of course it's helpful and very useful when used in conjunction with other hardening measures.