ubuntu-cli
v0.0.1
Published
A powerful CLI tool for hardening and configuring Ubuntu servers with interactive prompts
Maintainers
Readme
Ubuntu CLI
A powerful CLI tool for hardening and configuring Ubuntu servers with interactive prompts. Built with NestJS and nest-commander, ubuntu-cli provides a modern TypeScript/Node.js implementation for common server security and configuration tasks.
Features
- 🔒 Security Hardening: SSH hardening, Fail2Ban installation, and firewall configuration
- 🌐 Network Configuration: Interactive netplan configuration
- 🔑 SSH Key Management: Easy authorized key management for users
- 🛡️ Firewall Management: Role-based UFW rules for various server types
- ✨ Interactive Prompts: User-friendly command-line interface
- 📦 TypeScript: Fully typed for reliability and maintainability
Installation
Global Installation
npm install -g ubuntu-cliUsing npx (No Installation Required)
npx ubuntu-cli <command>Prerequisites
- Node.js 20 or higher
- Ubuntu server (tested on Ubuntu 20.04+)
- Root privileges (
sudo) for system configuration commands
Usage
Run commands with ucli (if installed globally) or npx ucli:
sudo ucli <command>Available Commands
Initial Setup
Updates system packages, hardens SSH, and optionally installs Fail2Ban:
sudo ucli initial-setupNetwork Configuration
Interactive netplan configuration for a network interface:
sudo ucli network-configFirewall Configuration
UFW reset with role-based rules (redis, mariadb, api, ui-app, vpn, deployinator):
sudo ucli firewall-configAuthorized Key Management
Add an SSH public key to a user account:
sudo ucli authorized-keyDevelopment
Clone and Install
git clone https://github.com/yigitahmetsahin/ubuntu-cli.git
cd ubuntu-cli
npm installBuild
npm run buildRun Locally
During development, you can run without building:
sudo npx ts-node src/main.ts <command>Or after building:
sudo node dist/main <command>Testing
npm testPublishing
This package uses automated GitHub Actions for publishing to npm. When you create a release on GitHub, it will automatically:
- Run tests
- Build the package
- Publish to npm
Notes
- The CLI enforces root usage for safety
- File backups are created automatically (e.g., SSH config backups)
- Interactive prompts guide you through configuration options
- All system commands are executed safely with proper error handling
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
If you encounter any issues or have questions, please open an issue on GitHub.
