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
✅ 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
sudoaccess 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, and8000 - 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
--helpafter 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
-
sudoor 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file safeme-0.1.4.tar.gz.
File metadata
- Download URL: safeme-0.1.4.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5be87d89e5d8e3ac75badd68d26a1841b431feff269f651bf426099ca11b270e
|
|
| MD5 |
da787aadc609ae8fc50342493d9edece
|
|
| BLAKE2b-256 |
84fea06945adb04bfccc6ad04d92bea92dcf8d87a276d97df010ac5a225f065d
|
File details
Details for the file safeme-0.1.4-py3-none-any.whl.
File metadata
- Download URL: safeme-0.1.4-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4489040fad2d192031b0a3820ed0765b1f9e91ab8aeeeddc451a18ae7db5bc5d
|
|
| MD5 |
a2a84e630c45e8e4c660531901f3067b
|
|
| BLAKE2b-256 |
539c16e7752abe0b674c9496d4a27aa9f6c8c7ddd2655df5e2236370736dd214
|