Skip to main content

One-command backend Linux server security: firewall, SSH hardening, DDoS protection, integrity checks and more.

Project description

🛡️ SafeMe

SafeMe is a one-command Linux server security tool that automates critical hardening tasks such as setting up firewalls, securing SSH access, mitigating DDoS attacks, monitoring file integrity, and locking down kernel-level network configurations — all via a simple CLI or Python API.


Motivate maintainer

UPI PayPal

✅ Features

  • 🔐 Harden SSH server (disables root login and password-based auth)
  • ⚙️ UFW firewall with configurable open ports
  • 🧱 Secure kernel parameters via sysctl
  • 🔥 Basic DDoS protection using iptables (rate limiting, connection limiting)
  • 🧬 Monitor file integrity using aide
  • 🧩 Designed as both a CLI tool and importable Python module
  • ⚡ Runs fast and enforces security persistently across reboots

💾 Installation

pip install safeme

Requires sudo access and tested only on Debian/Ubuntu-based systems.


🚀 Quick Start (CLI)

Run all security modules with one command:

sudo safeme secure --ports 22,443,8000

What this does:

  • Enables UFW and opens only ports 22, 443, and 8000
  • Disables root login and password authentication for SSH
  • Applies kernel security policies via /etc/sysctl.d/
  • Adds rate limiting and connection throttling via iptables
  • Installs and initializes AIDE for file integrity monitoring

🔧 CLI Commands (Full Reference)

Command Usage Example Description
secure sudo safeme secure --ports 22,443 Run all hardening modules (firewall, SSH, sysctl, DDoS, integrity)
setup-firewall sudo safeme setup-firewall --ports 22 Set up UFW with specified allowed ports; everything else is blocked
harden-ssh sudo safeme harden-ssh Disables root login and password auth in /etc/ssh/sshd_config
apply-sysctl sudo safeme apply-sysctl Adds safe networking defaults via sysctl, e.g., disables source routing
lavawall sudo safeme lavawall Adds iptables rules to limit incoming connections and protect against DoS
install-integrity sudo safeme install-integrity Installs AIDE and initializes its file DB for integrity monitoring
integrity sudo safeme integrity Runs a file integrity scan using AIDE

Use --help after any command to see detailed usage.


🐍 Python Usage

SafeMe can also be used programmatically in any Python automation or deployment script.

Secure the system with all protections:

from safeme import api

api.secure_all(ports=[22, 443, 8000])

Use individual modules:

from safeme.core.firewall import setup as setup_firewall
from safeme.core.ssh import harden as harden_ssh
from safeme.core.sysctl import apply as apply_sysctl
from safeme.core.ddos import protect as ddos_protect
from safeme.core.integrity import install as install_aide, check as run_integrity

setup_firewall([22, 443])
harden_ssh()
apply_sysctl()
ddos_protect()
install_aide()
run_integrity()

🖥 System Requirements

  • Python 3.7 or later

  • sudo or root privileges

  • Debian/Ubuntu Linux

  • System packages installed:

    sudo apt install -y ufw iptables-persistent aide openssh-server
    

📌 Notes

  • All configurations are persistent across reboots
  • Best used on freshly provisioned servers
  • You can run each command independently without conflicts
  • More modular features and hardening profiles coming soon

📄 License

MIT License © 2025 Prakhar Doneria

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

safeme-0.1.3.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

safeme-0.1.3-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file safeme-0.1.3.tar.gz.

File metadata

  • Download URL: safeme-0.1.3.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for safeme-0.1.3.tar.gz
Algorithm Hash digest
SHA256 b69738b28ef90231594765da260cdc0f89125a8e849b0b809015a0ad777a0d16
MD5 06149151693d8e59f1d8e28d6227d092
BLAKE2b-256 76949e2819a09895d70b667e4b4acd7991bf30cb3dab6b05d961a20f7e2b7d3f

See more details on using hashes here.

File details

Details for the file safeme-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: safeme-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for safeme-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3aaba813c47f81c13daa575b3bd2ad33bdaf8a25732148220067c523b3951e73
MD5 95fdd00ca8911e850b50ff11a2231d19
BLAKE2b-256 dd0d1d95dbf87ce764ae6eeab4716f016bcb4d10880fb428805e0fbb3e4ae242

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page