I, recently, started running a Lemmy instance. I am, also, new to Linux servers.

At the advisement of some tech acquaintances, I’ve installed UnnattendedUpgrades and Fail2ban.

What would you recommend?

gofoss.net
link
fedilink
103Y

Below a couple of ideas, some building on what has already been stated. It’s all detailed here:

Feedback really welcomed, as there’s always something to be learned in server security :)

General hardening:

  • set up a firewall (ufw)
  • make sure your system time is correct (ntp)
  • enable unattended upgrades
  • limit privileged access (sudo)
  • hide process information (/proc)
  • enforce strict password policy (pam, login.defs)
  • enforce stricter permissions (umask)
  • close all unused ports (check with nmap)
  • install a malware scanner (lmd)
  • install an antivirus (clamav)
  • disable core dumps
  • disable unused kernel modules
  • add legal banner

SSH:

  • change the port
  • limit the nb of login attempts
  • limit access to admin users
  • enable access logs
  • forbid remote access to root
  • use auth keys with instead of password auth
  • disconnect after inactivity period
  • remove short encryption keys

MySQL (if applicable):

  • run a hardening script
  • disable remote access
  • prevent unauthorised access to local files
  • create separate users with limited privileges for each app

Apache (if applicable):

  • enable security modules
  • hide http headers
  • set up modsecurity, a web app firewall

PHP (if applicable):

  • hide php version in headers
  • disable remote code execution
  • disable potentially harmful functions
  • limit script runtime & memory allocation

Network security (sysctl):

  • ip spoofing protection
  • ignore icmp broadcasts & redirects
  • disable source paket routing
  • block syn attacks
  • log martians
  • ignore pings

Is all of this really necessary?

krolden
link
fedilink
6
edit-2
3Y

Not really. Especially the antivirus. Its pretty easy to avoid such things by not installing any untrusted aoftware. Not to mentionitf youd likely be ransomwared before you detectedanhthing.

But hosting publicly facing services is always a risk.

@suspended@lemmy.ml
creator
link
fedilink
43Y

Fantastic answer! Thanks so much :)

Create a post

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word “Linux” in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

  • 0 users online
  • 5 users / day
  • 20 users / week
  • 27 users / month
  • 16 users / 6 months
  • 20 subscribers
  • 684 Posts
  • 1.7K Comments
  • Modlog