TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How to secure Ubuntu VPS in 2022?

20 点作者 lukaszwojtow超过 3 年前
So obvious things spring to mind: 1. Uninstall what&#x27;s not needed 2. Firewall 3. Strong root&#x27;s and main user&#x27;s passwords<p>What else?

9 条评论

franga2000超过 3 年前
One rather specific thing that may or may not apply to you, but I see very often on Ubuntu servers:<p>Docker containers completely bypass UFW rules (the default firewall on Ubuntu Server). Even if a port isn&#x27;t open, if a docker forwards it to a container it will be acceptable from the outside. So if you&#x27;re running Docker, make sure your container port forwards are only bound to localhost (apart from the ones you want to expose intentionally of course) and&#x2F;or that you use the appropriate patches&#x2F;scripts that fix this issue (there&#x27;s a few different ways floating around the web).
评论 #29988891 未加载
franga2000超过 3 年前
Here&#x27;s my checklist (some of these are the default on Ubuntu):<p>- disabled root account password - ssh rejects root, allows only key-based auth, listens on non-standard port - fail2ban is installed and active - firewall is enabled and all ports are &quot;closed&quot; by default
codegeek超过 3 年前
Bare minimum:<p>1. Security updates&#x2F;unattended upgrades<p>2. Sudo user (don&#x27;t use root directly)<p>3. Log Rotation<p>4. SSH. Key based only. Ideally with a passphrase. No root login<p>5. Firewall. Only open ports that are needed (80,443 etc)<p>Then you can do other things as needed (private network etc).
strzibny超过 3 年前
You need to secure the system as a whole (SSH, sudo, logs, firewalls, SELinux) and then each individual component (db access). For example, here&#x27;s my thread on basic firewalld configuration[0] (yes I know firewalld is not Ubuntu&#x27;s default, but it&#x27;s in the repository and can be used).<p>There is a lot to go through for a comment answer. I think little bit of Google will reveal some decent Ubuntu articles. I&#x27;ll say at least this. Scratch root access completely, and set up an admin account with SSH-keys auth. That would be a good start to replace password-access.<p>If you want to be more confident in system configuration, I wrote a book on the topic[0]. It uses enterprise Linux rather than Ubuntu, so I can teach SELinux too (which is actually a big security improvement).<p>[0] <a href="https:&#x2F;&#x2F;twitter.com&#x2F;strzibnyj&#x2F;status&#x2F;1480494670299815939" rel="nofollow">https:&#x2F;&#x2F;twitter.com&#x2F;strzibnyj&#x2F;status&#x2F;1480494670299815939</a> [1] <a href="https:&#x2F;&#x2F;deploymentfromscratch.com" rel="nofollow">https:&#x2F;&#x2F;deploymentfromscratch.com</a>
hakanderyal超过 3 年前
Have a look at <a href="https:&#x2F;&#x2F;github.com&#x2F;dev-sec&#x2F;ansible-collection-hardening" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;dev-sec&#x2F;ansible-collection-hardening</a>
0xdeadb00f超过 3 年前
Further than strong root account would be to dissalow root login altogether. Rather, create a dedicated admin user with a strong password that&#x27;s able to do privileged actions via sudo. This leaves an audit trail in case the admin account is compromised.
mobilio超过 3 年前
Here is everything that you need: <a href="https:&#x2F;&#x2F;ubuntu.com&#x2F;server&#x2F;docs&#x2F;security-introduction" rel="nofollow">https:&#x2F;&#x2F;ubuntu.com&#x2F;server&#x2F;docs&#x2F;security-introduction</a>
评论 #29988899 未加载
cpach超过 3 年前
Never allow password-based login for SSH.
评论 #29984554 未加载
crate_barre超过 3 年前
Install fail2ban