← Blog
Guide : securiser un serveur Ubuntu en 2026
22/04/20265 min
Introduction
En 2026, securiser un serveur Ubuntu est plus critique que jamais. Les cyberattaques automatisees scannent des millions d'adresses IP chaque jour, ciblant les serveurs mal configures. Ce guide couvre les etapes essentielles pour proteger votre infrastructure, des bases SSH jusqu'a la securisation avancee de Docker et Nginx.
Securisation SSH : la premiere ligne de defense
SSH est le point d'entree principal de votre serveur. Verrouillez-le correctement :
Desactiver l'authentification par mot de passe et n'autoriser que les cles SSH :
# /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
Port 2222
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
Installer et configurer Fail2ban pour bloquer les tentatives de brute force :
sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
Editez /etc/fail2ban/jail.local :
[sshd]
enabled = true
port = 2222
maxretry = 3
bantime = 3600
findtime = 600
Pare-feu avec UFW
UFW (Uncomplicated Firewall) simplifie la gestion du pare-feu sous Ubuntu :
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp comment 'SSH'
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'
sudo ufw enable
sudo ufw status verbose
Verifiez regulierement les regles actives avec sudo ufw status numbered et supprimez celles qui ne sont plus necessaires.
Securisation de Docker
Docker est omniprescent sur les serveurs modernes, mais il necessite une attention particuliere :
# docker-compose.yml - bonnes pratiques
services:
app:
image: myapp:latest
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
cap_add:
- NET_BIND_SERVICE
read_only: true
tmpfs:
- /tmp
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
Regles essentielles pour Docker :
- Ne jamais executer de conteneurs en mode
--privileged
- Toujours utiliser
no-new-privileges et cap_drop: ALL
- Limiter les ressources (CPU, memoire) pour chaque conteneur
- Utiliser des images officielles et les mettre a jour regulierement
- Scanner les images avec
docker scout cves ou Trivy
Headers de securite Nginx
Ajoutez ces en-tetes de securite dans votre configuration Nginx :
# /etc/nginx/conf.d/security-headers.conf
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:;" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
SSL/TLS avec Let's Encrypt
Le HTTPS est obligatoire en 2026. Utilisez Certbot pour obtenir et renouveler automatiquement vos certificats :
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d votre-domaine.com -d www.votre-domaine.com
sudo certbot renew --dry-run
Certbot configure automatiquement le renouvellement via un timer systemd. Verifiez avec systemctl list-timers | grep certbot.
Mises a jour automatiques
Activez les mises a jour de securite automatiques :
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure -plow unattended-upgrades
Verifiez la configuration dans /etc/apt/apt.conf.d/50unattended-upgrades pour vous assurer que seules les mises a jour de securite sont appliquees automatiquement.
Surveillance des logs
La surveillance proactive est essentielle. Configurez des alertes :
# Verifier les connexions SSH echouees
sudo journalctl -u ssh --since "1 hour ago" | grep "Failed"
# Surveiller les modifications de fichiers critiques
sudo apt install aide -y
sudo aideinit
sudo aide --check
Utilisez des outils comme Logwatch, GoAccess ou Grafana+Loki pour une visibilite complete sur vos logs.
ShadowRoot AI pour l'audit de securite
ShadowRoot AI peut vous aider a auditer la securite de votre serveur. Utilisez le chat IA pour :
- Analyser vos fichiers de configuration et detecter les failles
- Generer des regles de pare-feu optimisees pour votre cas d'usage
- Verifier la conformite de vos Docker Compose avec les bonnes pratiques
- Ecrire des scripts de surveillance automatises
- Obtenir des recommandations personnalisees pour votre stack
Rendez-vous sur shadowroot.ai/chat et demandez un audit de securite complet de votre configuration.
Checklist de securite
- SSH : cle uniquement, port change, Fail2ban actif
- Pare-feu : UFW active avec regles strictes
- Docker : no-new-privileges, cap_drop ALL, limites de ressources
- Nginx : en-tetes de securite, HSTS active
- SSL : Let's Encrypt avec renouvellement automatique
- Updates : mises a jour automatiques activees
- Logs : surveillance et alertes configurees
- Backups : sauvegardes regulieres et testees
Conclusion
La securisation d'un serveur Ubuntu est un processus continu, pas une tache ponctuelle. Appliquez ces recommandations, surveillez vos logs regulierement et utilisez ShadowRoot AI pour automatiser vos audits de securite. La securite parfaite n'existe pas, mais une bonne hygiene reduit considerablement les risques. Commencez des maintenant sur shadowroot.ai.
Introduction
In 2026, securing an Ubuntu server is more critical than ever. Automated cyberattacks scan millions of IP addresses daily, targeting misconfigured servers. This guide covers the essential steps to protect your infrastructure, from SSH basics to advanced Docker and Nginx hardening.
SSH hardening: the first line of defense
SSH is the primary entry point to your server. Lock it down properly:
Disable password authentication and only allow SSH keys:
# /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
Port 2222
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
Install and configure Fail2ban to block brute force attempts:
sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
Edit /etc/fail2ban/jail.local:
[sshd]
enabled = true
port = 2222
maxretry = 3
bantime = 3600
findtime = 600
Firewall with UFW
UFW (Uncomplicated Firewall) simplifies firewall management on Ubuntu:
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp comment 'SSH'
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'
sudo ufw enable
sudo ufw status verbose
Regularly check active rules with sudo ufw status numbered and remove those that are no longer needed.
Docker security
Docker is ubiquitous on modern servers, but it requires special attention:
# docker-compose.yml - best practices
services:
app:
image: myapp:latest
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
cap_add:
- NET_BIND_SERVICE
read_only: true
tmpfs:
- /tmp
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
Essential Docker security rules:
- Never run containers in
--privileged mode
- Always use
no-new-privileges and cap_drop: ALL
- Limit resources (CPU, memory) for each container
- Use official images and update them regularly
- Scan images with
docker scout cves or Trivy
Nginx security headers
Add these security headers to your Nginx configuration:
# /etc/nginx/conf.d/security-headers.conf
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data: https:;" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
SSL/TLS with Let's Encrypt
HTTPS is mandatory in 2026. Use Certbot to automatically obtain and renew your certificates:
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com -d www.your-domain.com
sudo certbot renew --dry-run
Certbot automatically configures renewal via a systemd timer. Verify with systemctl list-timers | grep certbot.
Automatic updates
Enable automatic security updates:
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure -plow unattended-upgrades
Check the configuration in /etc/apt/apt.conf.d/50unattended-upgrades to ensure only security updates are applied automatically.
Log monitoring
Proactive monitoring is essential. Set up alerts:
# Check failed SSH logins
sudo journalctl -u ssh --since "1 hour ago" | grep "Failed"
# Monitor critical file changes
sudo apt install aide -y
sudo aideinit
sudo aide --check
Use tools like Logwatch, GoAccess, or Grafana+Loki for complete visibility into your logs.
ShadowRoot AI for security auditing
ShadowRoot AI can help you audit your server security. Use the AI chat to:
- Analyze your configuration files and detect vulnerabilities
- Generate optimized firewall rules for your use case
- Verify your Docker Compose files against best practices
- Write automated monitoring scripts
- Get personalized recommendations for your stack
Visit shadowroot.ai/chat and request a complete security audit of your configuration.
Security checklist
- SSH: key-only, port changed, Fail2ban active
- Firewall: UFW enabled with strict rules
- Docker: no-new-privileges, cap_drop ALL, resource limits
- Nginx: security headers, HSTS enabled
- SSL: Let's Encrypt with automatic renewal
- Updates: automatic security updates enabled
- Logs: monitoring and alerts configured
- Backups: regular and tested backups
Conclusion
Securing an Ubuntu server is an ongoing process, not a one-time task. Apply these recommendations, monitor your logs regularly, and use ShadowRoot AI to automate your security audits. Perfect security does not exist, but good hygiene significantly reduces risks. Get started now at shadowroot.ai.
简介
2026年,保护Ubuntu服务器比以往任何时候都更加关键。自动化网络攻击每天扫描数百万个IP地址,针对配置不当的服务器。本指南涵盖了保护基础设施的基本步骤,从SSH基础到Docker和Nginx的高级安全加固。
SSH安全加固:第一道防线
SSH是服务器的主要入口点。正确锁定它:
禁用密码认证,只允许SSH密钥:
# /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
Port 2222
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
安装并配置Fail2ban来阻止暴力破解尝试:
sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
编辑 /etc/fail2ban/jail.local:
[sshd]
enabled = true
port = 2222
maxretry = 3
bantime = 3600
findtime = 600
UFW防火墙
UFW(简化防火墙)简化了Ubuntu上的防火墙管理:
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp comment 'SSH'
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'
sudo ufw enable
sudo ufw status verbose
定期使用 sudo ufw status numbered 检查活动规则,删除不再需要的规则。
Docker安全
Docker在现代服务器上无处不在,但需要特别关注:
# docker-compose.yml - 最佳实践
services:
app:
image: myapp:latest
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
cap_add:
- NET_BIND_SERVICE
read_only: true
tmpfs:
- /tmp
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
Docker基本安全规则:
- 永远不要以
--privileged 模式运行容器
- 始终使用
no-new-privileges 和 cap_drop: ALL
- 限制每个容器的资源(CPU、内存)
- 使用官方镜像并定期更新
- 使用
docker scout cves 或 Trivy 扫描镜像
Nginx安全头
在Nginx配置中添加这些安全头:
# /etc/nginx/conf.d/security-headers.conf
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline';" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
使用Let's Encrypt配置SSL/TLS
2026年HTTPS是必须的。使用Certbot自动获取和续期证书:
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com -d www.your-domain.com
sudo certbot renew --dry-run
Certbot通过systemd定时器自动配置续期。使用 systemctl list-timers | grep certbot 验证。
自动更新
启用自动安全更新:
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure -plow unattended-upgrades
检查 /etc/apt/apt.conf.d/50unattended-upgrades 中的配置,确保只自动应用安全更新。
日志监控
主动监控至关重要。设置警报:
# 检查SSH登录失败
sudo journalctl -u ssh --since "1 hour ago" | grep "Failed"
# 监控关键文件变更
sudo apt install aide -y
sudo aideinit
sudo aide --check
使用Logwatch、GoAccess或Grafana+Loki等工具全面了解日志。
使用ShadowRoot AI进行安全审计
ShadowRoot AI可以帮助您审计服务器安全。使用AI聊天来:
- 分析配置文件并检测漏洞
- 为您的用例生成优化的防火墙规则
- 验证Docker Compose文件是否符合最佳实践
- 编写自动化监控脚本
- 获取针对您技术栈的个性化建议
访问 shadowroot.ai/chat 请求对您的配置进行完整的安全审计。
安全检查清单
- SSH:仅密钥认证、端口已更改、Fail2ban已激活
- 防火墙:UFW已启用且规则严格
- Docker:no-new-privileges、cap_drop ALL、资源限制
- Nginx:安全头、HSTS已启用
- SSL:Let's Encrypt自动续期
- 更新:自动安全更新已启用
- 日志:监控和警报已配置
- 备份:定期且经过测试的备份
总结
保护Ubuntu服务器是一个持续的过程,而非一次性任务。应用这些建议,定期监控日志,并使用ShadowRoot AI自动化安全审计。完美的安全不存在,但良好的安全习惯可以显著降低风险。立即在 shadowroot.ai 开始。
Introduccion
En 2026, securizar un servidor Ubuntu es mas critico que nunca. Los ciberataques automatizados escanean millones de direcciones IP diariamente, apuntando a servidores mal configurados. Esta guia cubre los pasos esenciales para proteger tu infraestructura, desde lo basico de SSH hasta la seguridad avanzada de Docker y Nginx.
Endurecimiento SSH: la primera linea de defensa
SSH es el punto de entrada principal a tu servidor. Aseguralo correctamente:
Desactivar la autenticacion por contrasena y solo permitir claves SSH:
# /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
Port 2222
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
Instalar y configurar Fail2ban para bloquear intentos de fuerza bruta:
sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
Edita /etc/fail2ban/jail.local:
[sshd]
enabled = true
port = 2222
maxretry = 3
bantime = 3600
findtime = 600
Cortafuegos con UFW
UFW (Uncomplicated Firewall) simplifica la gestion del cortafuegos en Ubuntu:
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp comment 'SSH'
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'
sudo ufw enable
sudo ufw status verbose
Revisa regularmente las reglas activas con sudo ufw status numbered y elimina las que ya no sean necesarias.
Seguridad de Docker
Docker es omnipresente en los servidores modernos, pero requiere atencion especial:
# docker-compose.yml - buenas practicas
services:
app:
image: myapp:latest
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
cap_add:
- NET_BIND_SERVICE
read_only: true
tmpfs:
- /tmp
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
Reglas esenciales de seguridad Docker:
- Nunca ejecutar contenedores en modo
--privileged
- Siempre usar
no-new-privileges y cap_drop: ALL
- Limitar recursos (CPU, memoria) para cada contenedor
- Usar imagenes oficiales y actualizarlas regularmente
- Escanear imagenes con
docker scout cves o Trivy
Cabeceras de seguridad Nginx
Agrega estas cabeceras de seguridad en tu configuracion de Nginx:
# /etc/nginx/conf.d/security-headers.conf
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
SSL/TLS con Let's Encrypt
HTTPS es obligatorio en 2026. Usa Certbot para obtener y renovar certificados automaticamente:
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d tu-dominio.com -d www.tu-dominio.com
sudo certbot renew --dry-run
Actualizaciones automaticas
Activa las actualizaciones de seguridad automaticas:
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure -plow unattended-upgrades
Monitoreo de logs
El monitoreo proactivo es esencial:
# Verificar conexiones SSH fallidas
sudo journalctl -u ssh --since "1 hour ago" | grep "Failed"
# Monitorear cambios en archivos criticos
sudo apt install aide -y
sudo aideinit
sudo aide --check
ShadowRoot AI para auditoria de seguridad
ShadowRoot AI puede ayudarte a auditar la seguridad de tu servidor:
- Analizar archivos de configuracion y detectar vulnerabilidades
- Generar reglas de cortafuegos optimizadas para tu caso
- Verificar tus archivos Docker Compose contra buenas practicas
- Escribir scripts de monitoreo automatizados
- Obtener recomendaciones personalizadas para tu stack
Visita shadowroot.ai/chat y solicita una auditoria de seguridad completa.
Lista de verificacion de seguridad
- SSH: solo clave, puerto cambiado, Fail2ban activo
- Cortafuegos: UFW activado con reglas estrictas
- Docker: no-new-privileges, cap_drop ALL, limites de recursos
- Nginx: cabeceras de seguridad, HSTS activado
- SSL: Let's Encrypt con renovacion automatica
- Updates: actualizaciones automaticas activadas
- Logs: monitoreo y alertas configurados
- Backups: respaldos regulares y probados
Conclusion
Securizar un servidor Ubuntu es un proceso continuo. Aplica estas recomendaciones, monitorea tus logs y usa ShadowRoot AI para automatizar tus auditorias. Comienza en shadowroot.ai.
परिचय
2026 में, Ubuntu सर्वर को सुरक्षित करना पहले से कहीं अधिक महत्वपूर्ण है। स्वचालित साइबर हमले प्रतिदिन लाखों IP पतों को स्कैन करते हैं, गलत कॉन्फ़िगर किए गए सर्वरों को लक्षित करते हैं। यह गाइड SSH की बुनियादी बातों से लेकर Docker और Nginx की उन्नत सुरक्षा तक, आपके बुनियादी ढांचे की सुरक्षा के आवश्यक कदमों को कवर करता है।
SSH सुदृढ़ीकरण: रक्षा की पहली पंक्ति
SSH आपके सर्वर का प्राथमिक प्रवेश बिंदु है। इसे सही ढंग से लॉक करें:
पासवर्ड प्रमाणीकरण अक्षम करें और केवल SSH कुंजियों की अनुमति दें:
# /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
Port 2222
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
Fail2ban इंस्टॉल और कॉन्फ़िगर करें ब्रूट फोर्स प्रयासों को ब्लॉक करने के लिए:
sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
/etc/fail2ban/jail.local संपादित करें:
[sshd]
enabled = true
port = 2222
maxretry = 3
bantime = 3600
findtime = 600
UFW फ़ायरवॉल
UFW (Uncomplicated Firewall) Ubuntu पर फ़ायरवॉल प्रबंधन को सरल बनाता है:
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp comment 'SSH'
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'
sudo ufw enable
Docker सुरक्षा
आधुनिक सर्वरों पर Docker सर्वव्यापी है, लेकिन विशेष ध्यान की आवश्यकता है:
# docker-compose.yml - सर्वोत्तम प्रथाएं
services:
app:
image: myapp:latest
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
read_only: true
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
Docker सुरक्षा के आवश्यक नियम:
- कभी भी
--privileged मोड में कंटेनर न चलाएं
- हमेशा
no-new-privileges और cap_drop: ALL उपयोग करें
- प्रत्येक कंटेनर के लिए संसाधन (CPU, मेमोरी) सीमित करें
- आधिकारिक इमेज का उपयोग करें और नियमित रूप से अपडेट करें
Nginx सुरक्षा हेडर
अपनी Nginx कॉन्फ़िगरेशन में ये सुरक्षा हेडर जोड़ें:
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
Let's Encrypt के साथ SSL/TLS
2026 में HTTPS अनिवार्य है। स्वचालित प्रमाणपत्र के लिए Certbot का उपयोग करें:
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com
sudo certbot renew --dry-run
स्वचालित अपडेट
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure -plow unattended-upgrades
लॉग निगरानी
sudo journalctl -u ssh --since "1 hour ago" | grep "Failed"
sudo apt install aide -y
sudo aideinit
sudo aide --check
सुरक्षा ऑडिट के लिए ShadowRoot AI
ShadowRoot AI आपके सर्वर सुरक्षा का ऑडिट करने में मदद कर सकता है:
- कॉन्फ़िगरेशन फ़ाइलों का विश्लेषण और कमजोरियों का पता लगाना
- आपके उपयोग के लिए अनुकूलित फ़ायरवॉल नियम बनाना
- Docker Compose फ़ाइलों की सर्वोत्तम प्रथाओं के विरुद्ध जांच
- स्वचालित निगरानी स्क्रिप्ट लिखना
shadowroot.ai/chat पर जाएं और पूर्ण सुरक्षा ऑडिट का अनुरोध करें।
सुरक्षा चेकलिस्ट
- SSH: केवल कुंजी, पोर्ट बदला, Fail2ban सक्रिय
- फ़ायरवॉल: सख्त नियमों के साथ UFW सक्षम
- Docker: no-new-privileges, cap_drop ALL, संसाधन सीमाएं
- Nginx: सुरक्षा हेडर, HSTS सक्षम
- SSL: स्वचालित नवीनीकरण के साथ Let's Encrypt
- अपडेट: स्वचालित सुरक्षा अपडेट सक्षम
- लॉग: निगरानी और अलर्ट कॉन्फ़िगर
- बैकअप: नियमित और परीक्षित बैकअप
निष्कर्ष
Ubuntu सर्वर को सुरक्षित करना एक निरंतर प्रक्रिया है। इन सिफारिशों को लागू करें, नियमित रूप से अपने लॉग की निगरानी करें, और सुरक्षा ऑडिट स्वचालित करने के लिए ShadowRoot AI का उपयोग करें। shadowroot.ai पर अभी शुरू करें।
المقدمة
في عام 2026، أصبح تأمين خادم Ubuntu أكثر أهمية من أي وقت مضى. تقوم الهجمات الإلكترونية الآلية بمسح ملايين عناوين IP يومياً، مستهدفة الخوادم سيئة التكوين. يغطي هذا الدليل الخطوات الأساسية لحماية بنيتك التحتية، من أساسيات SSH إلى تأمين Docker و Nginx المتقدم.
تقوية SSH: خط الدفاع الأول
SSH هو نقطة الدخول الرئيسية لخادمك. قم بتأمينه بشكل صحيح:
تعطيل المصادقة بكلمة المرور والسماح فقط بمفاتيح SSH:
# /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
Port 2222
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
تثبيت وتكوين Fail2ban لحظر محاولات القوة الغاشمة:
sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
حرر /etc/fail2ban/jail.local:
[sshd]
enabled = true
port = 2222
maxretry = 3
bantime = 3600
findtime = 600
جدار الحماية مع UFW
UFW يبسط إدارة جدار الحماية على Ubuntu:
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp comment 'SSH'
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'
sudo ufw enable
أمان Docker
Docker منتشر في كل مكان على الخوادم الحديثة، لكنه يتطلب اهتماماً خاصاً:
# docker-compose.yml - أفضل الممارسات
services:
app:
image: myapp:latest
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
read_only: true
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
قواعد أمان Docker الأساسية:
- لا تشغل أبداً الحاويات في وضع
--privileged
- استخدم دائماً
no-new-privileges و cap_drop: ALL
- حدد الموارد (CPU، الذاكرة) لكل حاوية
- استخدم الصور الرسمية وقم بتحديثها بانتظام
- افحص الصور باستخدام
docker scout cves أو Trivy
رؤوس أمان Nginx
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
SSL/TLS مع Let's Encrypt
HTTPS إلزامي في 2026. استخدم Certbot للحصول على الشهادات وتجديدها تلقائياً:
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com
sudo certbot renew --dry-run
التحديثات التلقائية
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure -plow unattended-upgrades
مراقبة السجلات
sudo journalctl -u ssh --since "1 hour ago" | grep "Failed"
sudo apt install aide -y
sudo aideinit
sudo aide --check
ShadowRoot AI لتدقيق الأمان
يمكن لـ ShadowRoot AI مساعدتك في تدقيق أمان خادمك:
- تحليل ملفات التكوين واكتشاف الثغرات
- إنشاء قواعد جدار حماية مُحسّنة لحالة استخدامك
- التحقق من ملفات Docker Compose وفقاً لأفضل الممارسات
- كتابة سكربتات مراقبة آلية
- الحصول على توصيات مخصصة لمجموعتك التقنية
قم بزيارة shadowroot.ai/chat واطلب تدقيقاً أمنياً كاملاً.
قائمة التحقق الأمنية
- SSH: مفتاح فقط، المنفذ مُغيّر، Fail2ban نشط
- جدار الحماية: UFW مُفعّل بقواعد صارمة
- Docker: no-new-privileges، cap_drop ALL، حدود الموارد
- Nginx: رؤوس الأمان، HSTS مُفعّل
- SSL: Let's Encrypt مع التجديد التلقائي
- التحديثات: التحديثات الأمنية التلقائية مُفعّلة
- السجلات: المراقبة والتنبيهات مُهيّأة
- النسخ الاحتياطي: نسخ احتياطية منتظمة ومُختبرة
الخلاصة
تأمين خادم Ubuntu هو عملية مستمرة. طبّق هذه التوصيات، راقب سجلاتك بانتظام، واستخدم ShadowRoot AI لأتمتة تدقيقاتك الأمنية. ابدأ الآن على shadowroot.ai.
Introducao
Em 2026, proteger um servidor Ubuntu e mais critico do que nunca. Ataques ciberneticos automatizados escaneiam milhoes de enderecos IP diariamente, visando servidores mal configurados. Este guia abrange os passos essenciais para proteger a sua infraestrutura, desde o basico de SSH ate a seguranca avancada de Docker e Nginx.
Endurecimento SSH: a primeira linha de defesa
SSH e o ponto de entrada principal do seu servidor. Proteja-o corretamente:
Desativar autenticacao por senha e permitir apenas chaves SSH:
# /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
Port 2222
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
Instalar e configurar o Fail2ban para bloquear tentativas de forca bruta:
sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
Edite /etc/fail2ban/jail.local:
[sshd]
enabled = true
port = 2222
maxretry = 3
bantime = 3600
findtime = 600
Firewall com UFW
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp comment 'SSH'
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'
sudo ufw enable
Seguranca Docker
# docker-compose.yml - boas praticas
services:
app:
image: myapp:latest
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
read_only: true
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
Regras essenciais de seguranca Docker:
- Nunca executar containers em modo
--privileged
- Sempre usar
no-new-privileges e cap_drop: ALL
- Limitar recursos (CPU, memoria) para cada container
- Usar imagens oficiais e atualiza-las regularmente
- Escanear imagens com
docker scout cves ou Trivy
Cabecalhos de seguranca Nginx
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
SSL/TLS com Let's Encrypt
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d seu-dominio.com
sudo certbot renew --dry-run
Atualizacoes automaticas
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure -plow unattended-upgrades
Monitoramento de logs
sudo journalctl -u ssh --since "1 hour ago" | grep "Failed"
sudo apt install aide -y
sudo aideinit
sudo aide --check
ShadowRoot AI para auditoria de seguranca
O ShadowRoot AI pode ajuda-lo a auditar a seguranca do seu servidor:
- Analisar ficheiros de configuracao e detectar vulnerabilidades
- Gerar regras de firewall otimizadas para o seu caso
- Verificar ficheiros Docker Compose contra boas praticas
- Escrever scripts de monitoramento automatizados
- Obter recomendacoes personalizadas para o seu stack
Visite shadowroot.ai/chat e solicite uma auditoria completa.
Lista de verificacao de seguranca
- SSH: apenas chave, porta alterada, Fail2ban ativo
- Firewall: UFW ativado com regras rigorosas
- Docker: no-new-privileges, cap_drop ALL, limites de recursos
- Nginx: cabecalhos de seguranca, HSTS ativado
- SSL: Let's Encrypt com renovacao automatica
- Updates: atualizacoes automaticas ativadas
- Logs: monitoramento e alertas configurados
- Backups: backups regulares e testados
Conclusao
Proteger um servidor Ubuntu e um processo continuo. Aplique estas recomendacoes, monitorize os seus logs e use o ShadowRoot AI para automatizar auditorias. Comece em shadowroot.ai.
Введение
В 2026 году защита сервера Ubuntu важнее, чем когда-либо. Автоматизированные кибератаки ежедневно сканируют миллионы IP-адресов, нацеливаясь на неправильно настроенные серверы. Это руководство охватывает основные шаги по защите вашей инфраструктуры — от основ SSH до продвинутой защиты Docker и Nginx.
Укрепление SSH: первая линия обороны
SSH — основная точка входа на ваш сервер. Защитите её правильно:
Отключите парольную аутентификацию и разрешите только SSH-ключи:
# /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
Port 2222
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
Установите и настройте Fail2ban для блокировки попыток перебора:
sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
Отредактируйте /etc/fail2ban/jail.local:
[sshd]
enabled = true
port = 2222
maxretry = 3
bantime = 3600
findtime = 600
Файрвол с UFW
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp comment 'SSH'
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'
sudo ufw enable
Безопасность Docker
# docker-compose.yml - лучшие практики
services:
app:
image: myapp:latest
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
read_only: true
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
Основные правила безопасности Docker:
- Никогда не запускайте контейнеры в режиме
--privileged
- Всегда используйте
no-new-privileges и cap_drop: ALL
- Ограничивайте ресурсы (CPU, память) для каждого контейнера
- Используйте официальные образы и обновляйте их регулярно
- Сканируйте образы с помощью
docker scout cves или Trivy
Заголовки безопасности Nginx
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
SSL/TLS с Let's Encrypt
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com
sudo certbot renew --dry-run
Автоматические обновления
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure -plow unattended-upgrades
Мониторинг логов
sudo journalctl -u ssh --since "1 hour ago" | grep "Failed"
sudo apt install aide -y
sudo aideinit
sudo aide --check
ShadowRoot AI для аудита безопасности
ShadowRoot AI поможет провести аудит безопасности вашего сервера:
- Анализ конфигурационных файлов и обнаружение уязвимостей
- Генерация оптимизированных правил файрвола для вашего случая
- Проверка файлов Docker Compose на соответствие лучшим практикам
- Написание автоматизированных скриптов мониторинга
- Персонализированные рекомендации для вашего стека
Посетите shadowroot.ai/chat и запросите полный аудит безопасности.
Чеклист безопасности
- SSH: только ключи, порт изменён, Fail2ban активен
- Файрвол: UFW включён со строгими правилами
- Docker: no-new-privileges, cap_drop ALL, лимиты ресурсов
- Nginx: заголовки безопасности, HSTS включён
- SSL: Let's Encrypt с автоматическим продлением
- Обновления: автоматические обновления безопасности включены
- Логи: мониторинг и оповещения настроены
- Бэкапы: регулярные и проверенные резервные копии
Заключение
Защита сервера Ubuntu — непрерывный процесс. Применяйте эти рекомендации, регулярно проверяйте логи и используйте ShadowRoot AI для автоматизации аудитов безопасности. Начните на shadowroot.ai.
はじめに
2026年、Ubuntuサーバーのセキュリティ確保はかつてないほど重要です。自動化されたサイバー攻撃は毎日何百万ものIPアドレスをスキャンし、設定が不適切なサーバーを標的にしています。このガイドでは、SSHの基本からDockerとNginxの高度なセキュリティ強化まで、インフラを保護するための必須ステップを解説します。
SSHの強化:防御の最前線
SSHはサーバーへの主要なエントリーポイントです。適切にロックダウンしましょう:
パスワード認証を無効化し、SSHキーのみ許可:
# /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
Port 2222
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
Fail2banをインストール・設定してブルートフォース攻撃をブロック:
sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
/etc/fail2ban/jail.localを編集:
[sshd]
enabled = true
port = 2222
maxretry = 3
bantime = 3600
findtime = 600
UFWファイアウォール
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp comment 'SSH'
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'
sudo ufw enable
Dockerセキュリティ
# docker-compose.yml - ベストプラクティス
services:
app:
image: myapp:latest
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
read_only: true
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
Docker セキュリティの基本ルール:
--privilegedモードでコンテナを実行しない
- 常に
no-new-privilegesとcap_drop: ALLを使用
- 各コンテナのリソース(CPU、メモリ)を制限
- 公式イメージを使用し、定期的に更新
docker scout cvesまたはTrivyでイメージをスキャン
Nginxセキュリティヘッダー
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
Let's EncryptによるSSL/TLS
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com
sudo certbot renew --dry-run
自動アップデート
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure -plow unattended-upgrades
ログ監視
sudo journalctl -u ssh --since "1 hour ago" | grep "Failed"
sudo apt install aide -y
sudo aideinit
sudo aide --check
ShadowRoot AIによるセキュリティ監査
ShadowRoot AIはサーバーセキュリティの監査に役立ちます:
- 設定ファイルの分析と脆弱性の検出
- ユースケースに最適化されたファイアウォールルールの生成
- Docker Composeファイルのベストプラクティス準拠チェック
- 自動監視スクリプトの作成
- 技術スタックに合わせたパーソナライズされた推奨事項
shadowroot.ai/chatで完全なセキュリティ監査をリクエストしてください。
セキュリティチェックリスト
- SSH:キーのみ、ポート変更済み、Fail2banアクティブ
- ファイアウォール:厳格なルールでUFW有効
- Docker:no-new-privileges、cap_drop ALL、リソース制限
- Nginx:セキュリティヘッダー、HSTS有効
- SSL:自動更新のLet's Encrypt
- アップデート:自動セキュリティアップデート有効
- ログ:監視とアラート設定済み
- バックアップ:定期的でテスト済みのバックアップ
まとめ
Ubuntuサーバーの保護は継続的なプロセスです。これらの推奨事項を適用し、定期的にログを監視し、ShadowRoot AIでセキュリティ監査を自動化しましょう。shadowroot.aiで今すぐ始めましょう。
บทนำ
ในปี 2026 การรักษาความปลอดภัยเซิร์ฟเวอร์ Ubuntu มีความสำคัญมากกว่าที่เคย การโจมตีทางไซเบอร์แบบอัตโนมัติสแกน IP หลายล้านรายการทุกวัน โดยมุ่งเป้าไปที่เซิร์ฟเวอร์ที่กำหนดค่าไม่ถูกต้อง คู่มือนี้ครอบคลุมขั้นตอนสำคัญในการปกป้องโครงสร้างพื้นฐานของคุณ ตั้งแต่พื้นฐาน SSH ไปจนถึงการรักษาความปลอดภัยขั้นสูงของ Docker และ Nginx
การเสริมความแข็งแกร่ง SSH: แนวป้องกันด่านแรก
SSH เป็นจุดเข้าหลักของเซิร์ฟเวอร์ ล็อคมันให้ถูกต้อง:
ปิดการยืนยันตัวตนด้วยรหัสผ่าน และอนุญาตเฉพาะคีย์ SSH:
# /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
Port 2222
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
ติดตั้งและกำหนดค่า Fail2ban เพื่อบล็อกการโจมตีแบบ brute force:
sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
แก้ไข /etc/fail2ban/jail.local:
[sshd]
enabled = true
port = 2222
maxretry = 3
bantime = 3600
findtime = 600
ไฟร์วอลล์ด้วย UFW
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp comment 'SSH'
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'
sudo ufw enable
ความปลอดภัย Docker
# docker-compose.yml - แนวปฏิบัติที่ดี
services:
app:
image: myapp:latest
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
read_only: true
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
กฎความปลอดภัย Docker ที่จำเป็น:
- อย่ารัน container ในโหมด
--privileged
- ใช้
no-new-privileges และ cap_drop: ALL เสมอ
- จำกัดทรัพยากร (CPU, หน่วยความจำ) สำหรับแต่ละ container
- ใช้ image อย่างเป็นทางการและอัปเดตเป็นประจำ
- สแกน image ด้วย
docker scout cves หรือ Trivy
เฮดเดอร์ความปลอดภัย Nginx
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
SSL/TLS ด้วย Let's Encrypt
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com
sudo certbot renew --dry-run
อัปเดตอัตโนมัติ
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure -plow unattended-upgrades
การตรวจสอบ log
sudo journalctl -u ssh --since "1 hour ago" | grep "Failed"
sudo apt install aide -y
sudo aideinit
sudo aide --check
ShadowRoot AI สำหรับการตรวจสอบความปลอดภัย
ShadowRoot AI สามารถช่วยตรวจสอบความปลอดภัยเซิร์ฟเวอร์ของคุณ:
- วิเคราะห์ไฟล์การกำหนดค่าและตรวจจับช่องโหว่
- สร้างกฎไฟร์วอลล์ที่ปรับให้เหมาะกับกรณีการใช้งานของคุณ
- ตรวจสอบไฟล์ Docker Compose ตามแนวปฏิบัติที่ดี
- เขียนสคริปต์ตรวจสอบอัตโนมัติ
เยี่ยมชม shadowroot.ai/chat และขอการตรวจสอบความปลอดภัยอย่างครบถ้วน
รายการตรวจสอบความปลอดภัย
- SSH: คีย์เท่านั้น, พอร์ตเปลี่ยนแล้ว, Fail2ban ทำงาน
- ไฟร์วอลล์: UFW เปิดใช้งานด้วยกฎเข้มงวด
- Docker: no-new-privileges, cap_drop ALL, จำกัดทรัพยากร
- Nginx: เฮดเดอร์ความปลอดภัย, HSTS เปิดใช้งาน
- SSL: Let's Encrypt ต่ออายุอัตโนมัติ
- อัปเดต: อัปเดตความปลอดภัยอัตโนมัติ
- Log: การตรวจสอบและแจ้งเตือนกำหนดค่าแล้ว
- สำรองข้อมูล: สำรองข้อมูลสม่ำเสมอและทดสอบแล้ว
สรุป
การรักษาความปลอดภัยเซิร์ฟเวอร์ Ubuntu เป็นกระบวนการต่อเนื่อง ใช้คำแนะนำเหล่านี้ ตรวจสอบ log เป็นประจำ และใช้ ShadowRoot AI เพื่อตรวจสอบความปลอดภัยอัตโนมัติ เริ่มต้นที่ shadowroot.ai
Gioi thieu
Trong nam 2026, bao mat may chu Ubuntu quan trong hon bao gio het. Cac cuoc tan cong mang tu dong quet hang trieu dia chi IP moi ngay, nham vao cac may chu cau hinh sai. Huong dan nay bao gom cac buoc thiet yeu de bao ve co so ha tang cua ban, tu co ban SSH den bao mat nang cao Docker va Nginx.
Gia co SSH: tuyen phong thu dau tien
SSH la diem truy cap chinh vao may chu. Khoa no dung cach:
Vo hieu hoa xac thuc bang mat khau va chi cho phep khoa SSH:
# /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
Port 2222
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
Cai dat va cau hinh Fail2ban de chan cac no luc brute force:
sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
Chinh sua /etc/fail2ban/jail.local:
[sshd]
enabled = true
port = 2222
maxretry = 3
bantime = 3600
findtime = 600
Tuong lua voi UFW
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp comment 'SSH'
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'
sudo ufw enable
Bao mat Docker
# docker-compose.yml - thuc hanh tot nhat
services:
app:
image: myapp:latest
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
read_only: true
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
Cac quy tac bao mat Docker thiet yeu:
- Khong bao gio chay container o che do
--privileged
- Luon su dung
no-new-privileges va cap_drop: ALL
- Gioi han tai nguyen (CPU, bo nho) cho moi container
- Su dung image chinh thuc va cap nhat thuong xuyen
- Quet image bang
docker scout cves hoac Trivy
Header bao mat Nginx
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
SSL/TLS voi Let's Encrypt
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com
sudo certbot renew --dry-run
Cap nhat tu dong
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure -plow unattended-upgrades
Giam sat log
sudo journalctl -u ssh --since "1 hour ago" | grep "Failed"
sudo apt install aide -y
sudo aideinit
sudo aide --check
ShadowRoot AI cho kiem tra bao mat
ShadowRoot AI co the giup ban kiem tra bao mat may chu:
- Phan tich file cau hinh va phat hien lo hong
- Tao quy tac tuong lua toi uu cho truong hop su dung cua ban
- Kiem tra file Docker Compose theo thuc hanh tot nhat
- Viet script giam sat tu dong
- Nhan khuyen nghi ca nhan hoa cho stack cua ban
Truy cap shadowroot.ai/chat va yeu cau kiem tra bao mat day du.
Danh sach kiem tra bao mat
- SSH: chi khoa, port da doi, Fail2ban hoat dong
- Tuong lua: UFW bat voi quy tac nghiem ngat
- Docker: no-new-privileges, cap_drop ALL, gioi han tai nguyen
- Nginx: header bao mat, HSTS bat
- SSL: Let's Encrypt tu dong gia han
- Cap nhat: cap nhat bao mat tu dong
- Log: giam sat va canh bao da cau hinh
- Sao luu: sao luu thuong xuyen va da kiem tra
Ket luan
Bao mat may chu Ubuntu la qua trinh lien tuc. Ap dung cac khuyen nghi nay, giam sat log thuong xuyen va su dung ShadowRoot AI de tu dong hoa kiem tra bao mat. Bat dau tai shadowroot.ai.
ভূমিকা
২০২৬ সালে, Ubuntu সার্ভার সুরক্ষিত করা আগের চেয়ে অনেক বেশি গুরুত্বপূর্ণ। স্বয়ংক্রিয় সাইবার আক্রমণ প্রতিদিন লক্ষ লক্ষ IP ঠিকানা স্ক্যান করে, ভুলভাবে কনফিগার করা সার্ভারগুলিকে লক্ষ্য করে। এই গাইড SSH-এর মূল বিষয় থেকে Docker এবং Nginx-এর উন্নত সুরক্ষা পর্যন্ত আপনার অবকাঠামো রক্ষার প্রয়োজনীয় পদক্ষেপগুলি কভার করে।
SSH শক্তিশালীকরণ: প্রতিরক্ষার প্রথম সারি
SSH আপনার সার্ভারের প্রাথমিক প্রবেশ বিন্দু। সঠিকভাবে লক করুন:
পাসওয়ার্ড প্রমাণীকরণ নিষ্ক্রিয় করুন এবং শুধুমাত্র SSH কী অনুমতি দিন:
# /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
Port 2222
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
Fail2ban ইনস্টল ও কনফিগার করুন ব্রুট ফোর্স প্রচেষ্টা ব্লক করতে:
sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
/etc/fail2ban/jail.local সম্পাদনা করুন:
[sshd]
enabled = true
port = 2222
maxretry = 3
bantime = 3600
findtime = 600
UFW ফায়ারওয়াল
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp comment 'SSH'
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'
sudo ufw enable
Docker নিরাপত্তা
# docker-compose.yml - সেরা অনুশীলন
services:
app:
image: myapp:latest
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
read_only: true
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
Docker নিরাপত্তার অপরিহার্য নিয়ম:
- কখনো
--privileged মোডে কন্টেইনার চালাবেন না
- সবসময়
no-new-privileges এবং cap_drop: ALL ব্যবহার করুন
- প্রতিটি কন্টেইনারের জন্য রিসোর্স (CPU, মেমোরি) সীমিত করুন
- অফিসিয়াল ইমেজ ব্যবহার করুন এবং নিয়মিত আপডেট করুন
docker scout cves বা Trivy দিয়ে ইমেজ স্ক্যান করুন
Nginx নিরাপত্তা হেডার
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
Let's Encrypt দিয়ে SSL/TLS
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com
sudo certbot renew --dry-run
স্বয়ংক্রিয় আপডেট
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure -plow unattended-upgrades
লগ পর্যবেক্ষণ
sudo journalctl -u ssh --since "1 hour ago" | grep "Failed"
sudo apt install aide -y
sudo aideinit
sudo aide --check
নিরাপত্তা অডিটের জন্য ShadowRoot AI
ShadowRoot AI আপনার সার্ভার নিরাপত্তা অডিট করতে সাহায্য করতে পারে:
- কনফিগারেশন ফাইল বিশ্লেষণ এবং দুর্বলতা সনাক্তকরণ
- আপনার ব্যবহারের ক্ষেত্রে অপ্টিমাইজড ফায়ারওয়াল নিয়ম তৈরি
- সেরা অনুশীলনের বিপরীতে Docker Compose ফাইল যাচাই
- স্বয়ংক্রিয় মনিটরিং স্ক্রিপ্ট লেখা
- আপনার স্ট্যাকের জন্য ব্যক্তিগতকৃত সুপারিশ
shadowroot.ai/chat-এ যান এবং সম্পূর্ণ নিরাপত্তা অডিটের অনুরোধ করুন।
নিরাপত্তা চেকলিস্ট
- SSH: শুধুমাত্র কী, পোর্ট পরিবর্তিত, Fail2ban সক্রিয়
- ফায়ারওয়াল: কঠোর নিয়মে UFW সক্ষম
- Docker: no-new-privileges, cap_drop ALL, রিসোর্স সীমা
- Nginx: নিরাপত্তা হেডার, HSTS সক্ষম
- SSL: স্বয়ংক্রিয় নবায়নে Let's Encrypt
- আপডেট: স্বয়ংক্রিয় নিরাপত্তা আপডেট সক্ষম
- লগ: মনিটরিং এবং অ্যালার্ট কনফিগার করা
- ব্যাকআপ: নিয়মিত এবং পরীক্ষিত ব্যাকআপ
উপসংহার
Ubuntu সার্ভার সুরক্ষিত করা একটি চলমান প্রক্রিয়া। এই সুপারিশগুলি প্রয়োগ করুন, নিয়মিত লগ পর্যবেক্ষণ করুন এবং নিরাপত্তা অডিট স্বয়ংক্রিয় করতে ShadowRoot AI ব্যবহার করুন। shadowroot.ai-এ এখনই শুরু করুন।
소개
2026년, Ubuntu 서버 보안은 그 어느 때보다 중요합니다. 자동화된 사이버 공격이 매일 수백만 개의 IP 주소를 스캔하며 잘못 구성된 서버를 노리고 있습니다. 이 가이드는 SSH 기초부터 Docker 및 Nginx의 고급 보안 강화까지, 인프라를 보호하기 위한 필수 단계를 다룹니다.
SSH 강화: 첫 번째 방어선
SSH는 서버의 주요 진입점입니다. 올바르게 잠그세요:
비밀번호 인증을 비활성화하고 SSH 키만 허용:
# /etc/ssh/sshd_config
PasswordAuthentication no
PubkeyAuthentication yes
PermitRootLogin no
Port 2222
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
Fail2ban 설치 및 구성으로 무차별 대입 공격 차단:
sudo apt install fail2ban -y
sudo cp /etc/fail2ban/jail.conf /etc/fail2ban/jail.local
/etc/fail2ban/jail.local 편집:
[sshd]
enabled = true
port = 2222
maxretry = 3
bantime = 3600
findtime = 600
UFW 방화벽
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow 2222/tcp comment 'SSH'
sudo ufw allow 80/tcp comment 'HTTP'
sudo ufw allow 443/tcp comment 'HTTPS'
sudo ufw enable
Docker 보안
# docker-compose.yml - 모범 사례
services:
app:
image: myapp:latest
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
read_only: true
deploy:
resources:
limits:
memory: 512M
cpus: '0.5'
Docker 보안의 필수 규칙:
--privileged 모드로 컨테이너를 절대 실행하지 마세요
- 항상
no-new-privileges와 cap_drop: ALL을 사용하세요
- 각 컨테이너의 리소스(CPU, 메모리)를 제한하세요
- 공식 이미지를 사용하고 정기적으로 업데이트하세요
docker scout cves 또는 Trivy로 이미지를 스캔하세요
Nginx 보안 헤더
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" always;
Let's Encrypt로 SSL/TLS
sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d your-domain.com
sudo certbot renew --dry-run
자동 업데이트
sudo apt install unattended-upgrades -y
sudo dpkg-reconfigure -plow unattended-upgrades
로그 모니터링
sudo journalctl -u ssh --since "1 hour ago" | grep "Failed"
sudo apt install aide -y
sudo aideinit
sudo aide --check
보안 감사를 위한 ShadowRoot AI
ShadowRoot AI는 서버 보안 감사를 도와줄 수 있습니다:
- 구성 파일 분석 및 취약점 탐지
- 사용 사례에 최적화된 방화벽 규칙 생성
- 모범 사례에 따른 Docker Compose 파일 검증
- 자동화된 모니터링 스크립트 작성
- 기술 스택에 맞는 맞춤형 권장 사항
shadowroot.ai/chat을 방문하여 완전한 보안 감사를 요청하세요.
보안 체크리스트
- SSH: 키 전용, 포트 변경됨, Fail2ban 활성
- 방화벽: 엄격한 규칙으로 UFW 활성화
- Docker: no-new-privileges, cap_drop ALL, 리소스 제한
- Nginx: 보안 헤더, HSTS 활성화
- SSL: 자동 갱신되는 Let's Encrypt
- 업데이트: 자동 보안 업데이트 활성화
- 로그: 모니터링 및 알림 구성됨
- 백업: 정기적이고 테스트된 백업
결론
Ubuntu 서버 보안은 지속적인 과정입니다. 이러한 권장 사항을 적용하고, 정기적으로 로그를 모니터링하며, ShadowRoot AI를 사용하여 보안 감사를 자동화하세요. shadowroot.ai에서 지금 시작하세요.