Hardware FixRecommendedDevice not working? Your driver may be the problemCheck updates for common hardware issues.Fix DriversHalloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan Now×
Skip to content
World desk12 min

How to Set Up an Intrusion Prevention System on a Linux VPS

A practical, lockout-safe guide to deploying Fail2Ban or CrowdSec on a Linux VPS, from attack-surface inventory and SSH hardening through firewall remediation, verification, and maintenance.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A dependable Linux VPS intrusion-prevention setup has two separate jobs: a detector reads authentication or application events and decides that an address is abusive; an enforcement component then blocks that address at the firewall, reverse proxy, or web server. Fail2Ban combines those jobs in a compact, local log-based service. CrowdSec separates its Security Engine from remediation components, enabling behavior-based scenarios and optional shared intelligence. Whichever stack you choose, keep a second administrative path open, protect SSH with strong authentication, and verify that both detection and blocking work before you trust the setup.

What an intrusion-prevention system does on a VPS

An IPS for a server is not one package or one firewall rule. It is a feedback loop:

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Detection: a service reads logs or events, parses them, and counts behavior such as repeated failed SSH logins.
  2. Decision: the detector creates a temporary or permanent decision for an IP address, account, or request pattern.
  3. Enforcement: a firewall, reverse proxy, web server, or application applies the decision.
  4. Verification: you confirm that the event appeared in the intended log, the detector changed state, and the enforcement layer actually blocked traffic.

These layers matter because a detector without enforcement only produces alerts. CrowdSec states this explicitly: its Security Engine is a detection engine and “will not block anything” without a Remediation Component. Fail2Ban normally updates firewall rules itself, but it still depends on correctly formatted, readable logs.

An IPS reduces automated attack noise and buys time; it does not make weak credentials safe. The Fail2Ban project warns: “Though Fail2Ban is able to reduce the rate of incorrect authentication attempts, it cannot eliminate the risk presented by weak authentication.” Use key-based or otherwise strong SSH authentication, remove unnecessary services, and treat bans as an additional control.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Choose Fail2Ban or CrowdSec

Decision point Fail2Ban CrowdSec
Detection model Local log filters count failures and trigger jails. Behavior-based scenarios parse events through the Security Engine; optional community intelligence can inform decisions.
Architecture One daemon with jails and firewall actions. Separate detector, Local API, and remediation components.
Typical enforcement Firewall bans are the normal action for SSH and similar services. Firewall bouncers handle IP-level services; WAF-capable bouncers handle HTTP inspection and application-layer blocking.
Configuration effort Usually smaller for a single VPS and a few log files. More components to install and monitor, but a broader model for multiple services.
Monitoring and testing Use fail2ban-client to inspect jails, counters, and bans. Use cscli, the engine and bouncer service state, decisions, and firewall sets.
Published performance comparison No fair, universal CPU, false-positive, or blocking-efficacy benchmark is established by the project documentation used here. Select on architecture and operational fit, not an invented speed ranking.

Choose Fail2Ban when you want a compact, local, log-driven control for a small number of services. Choose CrowdSec when you need scenario-based detection, optional shared intelligence, or different enforcement paths for infrastructure traffic and HTTP traffic. You can run only one primary banning system for a given service at first; overlapping systems make troubleshooting and whitelist management harder.

Prepare the VPS without locking yourself out

Inventory the attack surface

List every listening service and decide whether it must be reachable from the public internet:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • SSH and any alternate administration port
  • HTTP and HTTPS
  • Mail services such as SMTP
  • Databases, caches, and message brokers
  • Control panels, monitoring endpoints, and deployment agents

Remove or stop services you do not need. For services that must exist but do not need public access, restrict them to a private network or trusted administrator addresses. Apply restrictions in both the VPS provider firewall and the host firewall; the provider layer can stop traffic before it reaches the machine, while the host layer still protects the operating system and local services.

Keep an administrative fallback

Before changing firewall or ban rules, establish at least one independent recovery path:

  • Keep a second SSH session open from a trusted client.
  • Confirm that the VPS provider’s out-of-band console works.
  • Record the real SSH port and the administrator addresses that must never be banned.
  • Have a way to disable the service or remove a firewall set from the console if a rule is wrong.

Do not test a new jail or scenario from the only SSH session. A ban can apply to your source address immediately and make an otherwise correct configuration inaccessible.

Back up and identify the firewall backend

Save current firewall rules and the relevant Fail2Ban or CrowdSec configuration before editing. Determine whether the distribution uses nftables or iptables, and whether the provider’s image has a pre-existing firewall manager. Select a remediation package and action that matches that backend; a rule written for the wrong subsystem can appear active while blocking nothing.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

Harden SSH before adding bans

Use public-key or another strong authentication method, disable password login when all required accounts have a tested key-based path, and disable direct root login where your administration model permits. Keep one tested privileged account or an approved escalation path before making those changes. Rate limiting cannot compensate for a guessable password or an exposed, unnecessary account.

Confirm the effective SSH port in the running daemon configuration and in the provider firewall. If SSH listens on a nonstandard port, use that port in the jail or scenario configuration; banning the default port while leaving the real one unprotected is a common configuration error.

Install and configure Fail2Ban

1. Install the package

On Debian or Ubuntu, install the distribution package and inspect the installed version and action files:

sudo apt update
sudo apt install fail2ban
fail2ban-client version

Other distributions use their native package manager. Package names, service names, and available firewall actions vary, so inspect the files shipped by your distribution rather than copying an action name that is not installed.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Create a local override

Fail2Ban recommends leaving shipped .conf files unchanged. Put local changes in /etc/fail2ban/jail.local or a file under /etc/fail2ban/jail.d/. The following is an example for a systemd-based VPS using nftables and SSH on port 22; adjust each value to your policy and verify that the action exists on the host:

[DEFAULT]
bantime = 1h
findtime = 10m
maxretry = 5
backend = systemd
banaction = nftables-multiport

[sshd]
enabled = true
port = 22

findtime is the counting window, maxretry is the number of matching failures allowed in that window, and bantime is the initial ban duration. These are policy examples, not universal safe defaults. A public service with legitimate users may need a longer window or a lower retry count; a development host may need shorter temporary bans.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

If your system writes authentication events to a file such as /var/log/auth.log, configure the jail’s logpath instead of, or in addition to, the systemd journal backend. The filter must match the actual service log format. A jail that reads the wrong file will show zero matches even while attacks continue.

3. Start the service and inspect the jail

sudo systemctl enable --now fail2ban
sudo systemctl status fail2ban --no-pager
sudo fail2ban-client status
sudo fail2ban-client status sshd

The jail status should show the configured port, log source, current failure count, and current bans. If the service fails to start, read its journal, correct the configuration syntax or action name, and restart only after validating the file. Keep the second session open while doing this.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Add other services deliberately

Enable a web-server, mail, or administration-panel jail only after confirming that its filter matches real logs and that the action is appropriate for the service. Start with one service, observe its counters, and then add another. Do not enable every shipped jail: an inactive service can produce confusing errors, and an overly broad filter can ban legitimate clients.

5. Manage exceptions carefully

Use a narrowly scoped trusted-address list for fixed administrator or monitoring addresses. Do not whitelist an entire corporate or cloud range unless you control its egress and understand the risk. A permanent exception bypasses the protection for every host in that range.

Install and configure CrowdSec

1. Install the Security Engine

On Debian or Ubuntu, the official Linux instructions begin with the CrowdSec package family:

sudo apt update
sudo apt install crowdsec
sudo systemctl enable --now crowdsec
sudo systemctl status crowdsec --no-pager

Use the package source and collection versions supported by your distribution. Names and compatibility can change between releases, so review the candidate package and the installed hub content before enabling production decisions.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

2. Install the matching remediation component

For SSH, databases, SMTP, and other infrastructure services, install the firewall bouncer that matches the VPS backend:

sudo apt install crowdsec-firewall-bouncer-nftables

Use crowdsec-firewall-bouncer-iptables instead when the host deliberately uses iptables. Do not install both as competing enforcement paths without a specific design. Enable and inspect the bouncer service using the service name supplied by the package.

For Nginx, OpenResty, Traefik, or HAProxy, use the matching WAF-capable bouncer when the requirement is HTTP inspection, virtual patching, or application-layer blocking. A firewall bouncer can block an IP, but it cannot inspect an HTTP request after the connection has been accepted by the web stack.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

3. Install and connect the right collections and logs

CrowdSec acquisitions and parsers must point to the logs for the services you actually run. Use the installed cscli hub commands to update content and install the supported SSH or web-server collection for your release. Then confirm that acquisition files reference the correct journal or log path. A detector cannot create useful decisions from a file it cannot read or parse.

sudo cscli hub update
sudo cscli hub list
sudo cscli metrics
sudo cscli decisions list

Collection names, parser requirements, and scenario behavior are version-sensitive. Check the package’s current compatibility information before enabling a collection, particularly after a major distribution or CrowdSec upgrade.

4. Understand the Local API and metrics endpoints

CrowdSec documents 6060/tcp for Prometheus metrics and 8080/tcp for the API. They are normally bound to loopback. Leave them private unless a deliberate distributed architecture requires remote access, and then restrict access with network controls and authentication. Never open these ports to the public internet merely to make monitoring convenient.

5. Know the bouncer operating modes

The firewall bouncer’s managed mode creates the required tables, chains, sets, and rules. Set-only mode leaves the surrounding firewall structure to you and writes decisions into the sets your rules reference. Managed mode is simpler on a dedicated VPS; set-only mode is useful when another firewall manager owns the policy. Configure separate IPv4 and IPv6 behavior so that an address is not blocked on one protocol while remaining reachable on the other.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Put enforcement at the correct layer

Requirement Appropriate layer Reason
Stop repeated SSH authentication failures nftables or iptables remediation SSH is an infrastructure service and an IP-level ban can reject the connection before authentication.
Protect a database or SMTP service Host firewall remediation These services generally need connection-level blocking, not HTTP request inspection.
Inspect malicious HTTP paths or apply virtual patches WAF-capable bouncer at the web layer The web component can evaluate HTTP requests and virtual-host context that a network firewall cannot see.
Reduce exposure before traffic reaches the VPS Provider firewall plus host firewall Two independent layers reduce the reachable attack surface and limit mistakes in either layer.

Use one clear owner for each firewall table or chain. If a provider agent, container platform, and IPS all rewrite the same rules, a restart can remove a ban or reorder an allow rule. Document which component owns the rules and how to restore them.

Verify detection and blocking safely

Use a separate trusted client

From a second client whose address is not on a broad permanent allowlist, perform a controlled test. Do not run a large password loop. Generate only enough failed authentication attempts to cross the configured threshold, or use the product’s documented test facility. Keep your primary administration session on a different trusted path.

Trace the event through every layer

  1. Confirm that the failed attempt appears in the SSH or application log with the timestamp and source address you expect.
  2. For Fail2Ban, run fail2ban-client status sshd and verify that the failure counter and ban list change.
  3. For CrowdSec, inspect cscli metrics and cscli decisions list; verify that the engine created a decision and that the bouncer is connected.
  4. Inspect the nftables set or iptables chain owned by the remediation component. A decision in the API without a corresponding firewall entry means enforcement is not functioning.
  5. From the test client, verify that the expected connection is rejected. Test both IPv4 and IPv6 if the VPS has both.
  6. Remove the test ban or decision immediately after verification.

Do not declare success because a daemon is running. The useful proof is an observable event, a changed detector state, and a matching enforcement rule.

Troubleshoot the failures that matter most

Symptom Likely cause Correction
Jail or scenario stays at zero matches Wrong journal, log path, parser, or service format. Generate one known event, locate it in the actual log, and point the filter or acquisition at that source.
Detector shows a ban but traffic still connects No remediation component, wrong firewall backend, or a rule placed after an allow rule. Check the bouncer/action package, inspect the active chain or set, and verify rule order for both address families.
Service will not start after editing Invalid option, malformed section, or unavailable action name. Read the service journal, compare options with the installed files, fix one error at a time, and restart from the console or second session.
Legitimate administrators are banned Shared NAT address, an overly aggressive threshold, or a broad filter. Remove the decision, add only verified fixed addresses to a narrow allowlist, and tune the filter or threshold after reviewing the event.
IPv4 is blocked but IPv6 remains open Only one firewall family was configured. Enable and inspect separate IPv4 and IPv6 settings, then repeat the controlled test over both protocols.
Bans disappear after reboot or firewall reload The IPS and firewall manager do not restore state in the same order. Enable the services at boot, confirm dependency ordering, and test a reboot in a maintenance window.
CrowdSec API or metrics are reachable from the internet Loopback binding was changed or a firewall rule exposed ports 6060 or 8080. Restore private binding or restrict access to the intended monitoring network; do not publish these endpoints casually.

Operate the IPS as a maintained control

Review bans and false positives

Temporary bans should be reviewed as signals, not treated as proof of malicious identity. Check whether the source is a shared office, mobile carrier, scanner, or your own monitoring system. Keep a record of exceptions and the reason for each one. Remove stale allowlist entries when staff, networks, or providers change.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Update packages and content deliberately

Operating-system updates can change service names, journal fields, log formats, firewall backends, and package defaults. After an update, inspect Fail2Ban action files or CrowdSec collections and bouncer compatibility before restarting production protection. Re-run the controlled verification whenever the firewall, SSH daemon, web server, or IPS package changes.

Monitor the detector and the enforcer

Alert on stopped services, parser errors, a sudden drop to zero events, and an unexpected growth in bans. For CrowdSec, monitor the engine, Local API, and remediation component separately. For Fail2Ban, monitor the daemon and each enabled jail. A healthy process with unreadable logs is still a failed IPS.

Keep recovery documented

Write down the console path, the commands to stop the IPS, the location of local overrides, and the firewall sets or chains that must be cleared to remove an accidental ban. Store this procedure where an on-call administrator can reach it without relying on the protected VPS.

A practical selection checklist

  • Use Fail2Ban for a straightforward, local log-based setup protecting SSH and a few conventional services.
  • Use CrowdSec when you need behavior-based scenarios, optional community intelligence, or separate firewall and WAF enforcement.
  • Use a host firewall for SSH, databases, and SMTP; use a WAF-capable component for HTTP-specific inspection.
  • Keep SSH keys, a tested fallback path, and a narrow administrator allowlist ready before enabling aggressive thresholds.
  • Confirm logs, decisions, firewall rules, and IPv4/IPv6 behavior with a controlled test before considering the deployment complete.

Bottom line

Install an IPS only after the VPS attack surface and recovery path are understood. Fail2Ban is the shorter path to local log-driven bans; CrowdSec offers a detector-plus-remediation architecture that can extend from firewall blocking to HTTP-aware enforcement. In either case, the security result comes from the complete chain—correct logs, a sensible decision policy, a compatible firewall or WAF component, and a test proving that an actual connection is stopped.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.