प्रोडक्शन लिनक्स सर्वर हार्डनिंग चेकलिस्ट: SSH, UFW, Fail2ban और CIS बेंचमार्क

डिफेंसिव हार्डनिंग के बिना सार्वजनिक लिनक्स VPS को तैनात करने से यह ऑनलाइन आने के कुछ ही मिनटों के भीतर स्वचालित क्रेडेंशियल स्टफिंग, ब्रूट फोर्स स्कैन और विशेषाधिकार वृद्धि (प्रिविलेज एस्केलेशन) शोषण के प्रति संवेदनशील हो जाता है। इस चेकलिस्ट में, हम एक गहराई से सुरक्षा (डिफेंस-इन-डेप्थ) सुरक्षा वास्तुकला लागू करते हैं जो सेंटर फॉर इंटरनेट सिक्योरिटी (CIS) लेवल 1 बेंचमार्क के अनुरूप है।

Enterprise Linux Server Hardening & Defense-in-Depth Architecture
चित्र 1: 4-परत डिफेंस-इन-डेप्थ: क्रिप्टोग्राफिक SSH, इनग्रेस UFW, Fail2ban जैल & CIS कर्नेल ऑडिट।

1. चरण 1: क्रिप्टोग्राफिक SSH कुंजी प्रवर्तन

सभी पासवर्ड-आधारित SSH प्रमाणीकरण को अक्षम करें और आधुनिक एलिसिप्टिक कर्व कुंजियों को बलपूर्वक लागू करें /etc/ssh/sshd_config:

# /etc/ssh/sshd_config Hardening
PasswordAuthentication no
ChallengeResponseAuthentication no
PermitRootLogin prohibit-password
PubkeyAuthentication yes
X11Forwarding no
MaxAuthTries 3
ClientAliveInterval 300
ClientAliveCountMax 2
KexAlgorithms curve25519-sha256,curve25519-sha256@libssh.org
Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com
MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com

अपनी स्थानीय वर्कस्टेशन पर कुंजियाँ जनरेट करें ssh-keygen -t ed25519 -a 100 का उपयोग करके और के माध्यम से SSH डेमॉन को पुनरारंभ करने से पहले कनेक्शन सत्यापित करें sudo systemctl reload sshd.

2. चरण 2: अनकॉम्प्लिकेटेड फ़ायरवॉल (UFW) इनग्रेस आइसोलेशन

एक सख्त डिफ़ॉल्ट-डिनाय इनग्रेस पॉलिसी लागू करें और केव�� आवश्यक सार्वजनिक वेब सेवाओं को उजागर करें:

# Reset and enforce default deny
sudo ufw default deny incoming
sudo ufw default allow outgoing

# Allow HTTP and HTTPS
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

# Restrict SSH to custom management subnet if applicable
sudo ufw allow 22/tcp

# Enable and inspect
sudo ufw enable
sudo ufw status verbose

3. चरण 3: Fail2ban के साथ स्वचालित रेट लिमिटिंग

प्रमाणीकरण लॉग और Nginx HTTP त्रुटि धाराओं की निगरानी के लिए Fail2ban को कॉन्फ़िगर करें, जो iptables के माध्यम से उल्लंघन करने वाले IP पतों को स्वचालित रूप से हटा देता है:

# /etc/fail2ban/jail.local
[DEFAULT]
bantime = 86400
findtime = 600
maxretry = 3
banaction = ufw

[sshd]
enabled = true
port = 22
filter = sshd
logpath = /var/log/auth.log

[nginx-botsearch]
enabled = true
port = http,https
filter = nginx-botsearch
logpath = /var/log/nginx/*error.log
maxretry = 2

4. चरण 4: CIS ऑडिटिंग & बिना देखरेख के सुरक्षा अपग्रेड (अनअटेंडेड सिक्योरिटी अपग्रेड्स)

स्वचालित अनअटेंडेड सुरक्षा पैचिंग सक्षम करें और समय-समय पर अनुपालन ऑडिटिंग करें:

# Enable automated security updates
sudo apt install unattended-upgrades update-notifier-common
sudo dpkg-reconfigure --priority=low unattended-upgrades

# Verify /etc/apt/apt.conf.d/50unattended-upgrades
Unattended-Upgrade::Allowed-Origins {
    "${distro_id}:${distro_codename}-security";
};
Unattended-Upgrade::AutoFixInterruptedDpkg "true";
Unattended-Upgrade::MinimalSteps "true";
Unattended-Upgrade::Automatic-Reboot "false";

5. चरण 5: शेयर्ड मेमोरी & फ़ाइल सिस्टम माउंट हार्डनिंग

प्रतिबंधित शेल एक्सेस प्राप्त करने वाले हमलावर अक्सर दुनिया भर में लिखने योग्य निर्देशिकाओं जैसे कि /tmp और /dev/shmसे दुर्भावनापूर्ण बाइनरी निष्पादित करते हैं। में रक्षात्मक फ़्लैग जोड़कर इन माउंटपॉइंट्स की सुरक्षा करें /etc/fstab:

# /etc/fstab Hardening
tmpfs /tmp tmpfs defaults,nosuid,nodev,noexec,mode=1777 0 0
tmpfs /var/tmp tmpfs defaults,nosuid,nodev,noexec,mode=1777 0 0
tmpfs /dev/shm tmpfs defaults,nosuid,nodev,noexec 0 0

यह noexec फ़्लैग सीधे निर्देशिका से किसी भी बाइनरी या स्क्रिप्ट के निष्पादन को रोकता है, जिससे सामान्य वेब एप्लिकेशन शेल ड���रॉप्स निष्प्रभावी हो जाते हैं।

6. चरण 6: कर्नेल स्व-सुरक्षा & Sysctl के माध्यम से नेटवर्क सुरक्षा

IP स्पूफ़िंग, SYN फ़्लड हमलों और ICMP रीडायरेक्ट हेरफेर के खिलाफ लिनक्स नेटवर्क स्टैक को कॉन्फ़िगर करके सुरक्षित करें /etc/sysctl.d/50-security.conf:

# Reverse Path Filtering (Mitigate IP Spoofing)
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1

# Ignore ICMP Broadcast Requests & Smurf Attacks
net.ipv4.icmp_echo_ignore_broadcasts = 1

# Disable ICMP Redirect Acceptance (Mitigate Man-in-the-Middle)
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv6.conf.all.accept_redirects = 0

# Prevent Rogue Source-Routed Packets
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0

# Protect Hardlinks and Symlinks against TOCTOU Race Conditions
fs.protected_hardlinks = 1
fs.protected_symlinks = 1

# Maximize Address Space Layout Randomization (ASLR)
kernel.randomize_va_space = 2

7. चरण 7: Lynis के साथ स्वचालित अनुपालन ऑडिटिंग

एक ओपन-सोर्स सुरक्षा ऑडिटिंग टूल, Lynis का उपयोग करके CIS बेंचमार्क के खिलाफ सिस्टम अनुपालन की नियमित रूप से ऑडिट करें:

# Install and run Lynis security audit
sudo apt install lynis
sudo lynis audit system --quick

# Review Lynis hardening index and generated warnings
grep "Hardening index" /var/log/lynis.log
grep "WARNING" /var/log/lynis.log

प्रोडक्शन वेब होस्टिंग वातावरण पर 80 या उससे अधिक के Lynis हार्डनिंग इंडेक्स स्कोर का लक्ष्य रखें।

अक्सर पूछे जाने वाले प्रश्न

क्या सर्वर सुरक्षा के लिए डिफ़ॉल्ट SSH पोर्ट (22) बदलना पर्याप्त है?

SSH पोर्ट को गैर-मानक पोर्ट (जैसे, 2222) में बदलने से एक्सेस लॉग में स्वचालित बॉट स्कैन कम हो जाते हैं, लेकिन यह केवल अस्पष्टता के माध्यम से सुरक्षा है। Nmap के साथ एक साधारण पोर्ट स्कैन सुनने वाली SSH सेवा का तुरंत पता लगा लेगा। क्रिप्टोग्राफिक कुंजी प्रवर्तन, रूट पासवर्ड लॉगिन को अक्षम करना और Fail2ban रेट लिमिटिंग वास��तविक सुरक्षा प्रदान करते हैं।

Fail2ban द्वारा गलती से लॉक किए गए एडमिनिस्ट्रेटर IP पते को अनबैन कैसे करें?

यदि कोई एडमिनिस्ट्रेटर गलत क्रेडेंशियल दर्ज करता है और जेल बैन ट्रिगर करता है, तो द्वितीयक व्हाइटलिस्टेड IP या होस्टिंग प्रदाता आउट-ऑफ़-बैंड कंसोल से कनेक्ट करें, फिर निष्पादित करें:

sudo fail2ban-client set sshd unbanip 203.0.113.50

आप व्यवस्थापकीय कार्यालय IP सबनेट को निर्देश में जोड़कर उन्हें स्थायी रूप से व्हाइटलिस्ट भी कर सकते हैं ignoreip निर्देश में /etc/fail2ban/jail.local.

CIS बेंचमार्क ल��वल 1 और लेवल 2 के बीच क्या अंतर है?

CIS लेवल 1 रक्षात्मक सुरक्षा नियंत्रण प्रदान करता है जिन्हें सामान्य ऑपरेटिंग सॉफ़्टवेयर को तोड़ने के न्यूनतम जोखिम के साथ लागू किया जा सकता है। लेवल 2 गहराई से सुरक्षा के उपायों (जैसे सख्त अनिवार्य एक्सेस कंट्रोल नीतियां, प्रतिबंधित कर्नेल मॉड्यूल और आक्रामक फ़ाइल सिस्टम आइसोलेशन) को लागू करता है जिसके लिए परिचालन संघर्षों को रोकने के लिए अनुकूलित एप्लिकेशन ट्यूनिंग की आवश्यकता होती है।

एड्रेस स्पेस लेआउट रैंडमराइजेशन (ASLR = 2) क्यों महत्वपूर्ण ह���?

सेटिंग kernel.randomize_va_space = 2 स्टैक, VDSO पेज, शेयर्ड मेमोरी लाइब्रेरी और डेटा सेगमेंट के मेमोरी पतों को रैंडम बनाता है। यह मेमोरी करप्शन एक्सप्लॉइट्स (जैसे बफर ओवरफ़्लो और रिटर्न-ओरिएंटेड प्रोग्रामिंग हमले) को निष्पादन योग्य मेमोरी लक्ष्यों की भविष्यवाणी करने से रोकता है।

सारांश & क्लाउड सुरक्षा बेसलाइन

लिनक्स सर्वर को सुरक्षित करने के लिए एक स्तरीकृत रक्षात्मक रुख की आवश्यकता होती है। क्रिप्टोग्राफिक SSH कुंजी जोड़े, सख्त इनग्रेस फ़ायरवॉल आइसोलेशन, Fail2ban घुसपैठ की रोकथाम, सुरक्षित शेयर्ड मेमोरी माउंट और CIS बेंचमार्क ऑडिट को लागू करके, सिस्टम प्रशासक यह सुनिश्चित करते हैं कि प्रोडक्शन इंस्टेंस स्वचालित शोषण के खिलाफ लचीले बने रहें।

प्री-हार्डेंड क्लाउड VPS तैनात करें

WinWinHost पर अंतर्निहित DDoS फ़िल्टरिंग, NVMe स्टोरेज और पृथक्कृत वर्चुअल नेटवर्क के साथ हार्डेंड लिनक्स इंस्टेंस तैनात करें।

हार्डेंड क्लाउड VPS का अन्वेषण करें →

WinWinHost News & Tutorials

Unlimited Website Edits via Autonomous AI

WinWinHost launches Unlimited Website Edits powered by autonomous AI engineering. Get continuous content revisions, mobile UI polish, technical SEO, and Core Web Vitals optimization with zero hourly fees and zero downtime.

New Product: Autonomous AI Web Developer Agent for $10/mo

WinWinHost introduces autonomous AI Web Developer Agents for just $10/month per domain. Each dedicated agent continuously monitors site health, resolves layout regressions, optimizes PageSpeed scores, and executes code updates with zero developer hourly fees.

Link Directory Plugin Released

Link Directory Plugin was released and we hope that this can help you to make a link directory website from your wordpress installation in just a few minutes.Right now the plugin has a lot of features but we are working to make even more options available to you.

Monetize Your Website

If you want to monetize your website via a payday loan affiliate network then you should know that are some nice networks out there like WinWinHost Network that can be a profitable way for your business.

Payday Loan Affiliate Plugin Released

Now you can earn money by generating leads with your wordpress website. We have created an wordpress plugin that adds a Payday Loan form to your website that you can customize in many ways.

What you can do with a domain name

Getting your own domain is really a huge step for anyone who wants to have an online presence. It changes the whole way a person work. Many people get domain names for individual reasons

The Shift to Edge Computing and Its Impact on Web Hosting

Explore how edge computing and distributed content delivery networks are redefining the speed, security, and scalability of modern web hosting.

WordPress Stats and Global Use

WordPress powers over 43% of the web. Learn more about the latest CMS market share growth metrics and global usage stats.

Google+ - The New Social Network

Google said it would begin the project of building a social networking platform that can compete against the more known Facebook and makes online communication a reality today.

Microsoft Office 365

Microsoft announced the launch of a cloud service called Office 365 which will bring together Microsoft Office, Microsoft Lync Online, Microsoft Exchange Online, and Microsoft SharePoint Online.

How to maintain your web hosting reseller account

One of the most efficient business on the Internet at this moment is selling web space known as web hosting reseller. It is the perfect solution for those who want to sell web space with a small investment.

Advantages of reselling Windows server space

Generally when you want to become a web hosting reseller you should consider everything carefully before starting to provide such services. It is better to decide if it is in your advantage to provide space on a Windows server.

About SEO

All the companies/individuals who have contact with the online environment and manage to make profit from its activities on the Internet, always want to improve the performance of his websites and this can be best done by using SEO.

ICANN approves new suffixes

ICANN (Internet Corporation for Assigned Names and Numbers) approved the measure after which anyone can register domains with custom suffixes.

Need Help?

Have questions about our hosting plans or custom software development? Reach out to our experts anytime.