A full-stack application for real-time monitoring and analysis of Linux system security. It provides a Node.js/Express backend for gathering critical system data and optionally running vulnerability scans, and a React frontend for visualizing information such as open ports, system logs, and more.
- Key Features
- Requirements
- Platform Support
- Tech Stack
- Project Structure
- Installation
- Usage
- Default Login Credentials
- API Endpoints
- Docker Deployment
- Troubleshooting
- Contributing
- License
-
System Metrics
Collect CPU, memory, and uptime details, along with system-wide info (hostname, OS, etc.). -
Open Ports
Scan and display currently open ports on the host for quick identification of potential threats. -
Vulnerability Scanning
Perform simple vulnerability scans (using Nmap, for example) to detect common security gaps. -
Logs and Failed Logins
Fetch and display recent authentication failures or other relevant system logs, highlighting suspicious activity. -
Scalable Architecture
Separate backend for data collection/processing and frontend for a responsive, user-friendly dashboard. -
Authentication
JWT-based login protects all dashboard data. Default credentials can be configured via environment variables. -
Optional Docker Support
Usedocker-composeto containerize the application (frontend, backend, and MongoDB if applicable) for easy deployment.
Before you begin, ensure you have:
- Node.js (v18 or newer) — Download
- npm (comes with Node.js)
- Linux — For full functionality (Open Ports, Logs, Vulnerability Scanner)
- Nmap — Required for Vulnerability Scanner (install:
apt install nmapon Ubuntu/Debian)
| Feature | Linux | Windows |
|---|---|---|
| System Dashboard | ✅ | ✅ |
| Open Ports | ✅ | ❌ |
| Failed Login Logs | ✅ | ❌ |
| Vulnerability Scanner | ✅* |
* Requires Nmap installed
ss, grep, /var/log/auth.log).
On Windows: Use WSL2 or Docker for full support.
-
Backend
- Node.js + Express.js
- (Optional) MongoDB if you want to persist historical data (via Mongoose)
-
Frontend
- React + Bootstrap
- React Router for routing
- Axios for API requests
-
Deployment
- Docker & docker-compose (Optional)
- Can be self-hosted on any server or cloud service (AWS, Azure, GCP, etc.)
linux-security-dashboard/
├── backend/
│ ├── src/
│ │ ├── app.js # Main Express server setup & configuration
│ │ ├── middleware/
│ │ │ └── auth.js # JWT authentication middleware
│ │ ├── routes/
│ │ │ ├── auth.js # Login route (public)
│ │ │ ├── system.js # Routes for system information & open ports
│ │ │ ├── vulnerabilities.js # Routes for vulnerability scanning
│ │ │ └── logs.js # Routes for failed login logs
│ │ ├── controllers/
│ │ │ ├── authController.js # Login logic & JWT issuance
│ │ │ ├── systemController.js # Business logic for system data (info/ports)
│ │ │ ├── vulnerabilityController.js # Business logic for scanning vulnerabilities
│ │ │ └── logsController.js # Business logic for handling logs
│ │ ├── models/
│ │ │ └── SystemLog.js # Mongoose model (example) for storing system logs
│ │ └── utils/
│ │ ├── systemInfo.js # Helper functions to fetch system info/ports
│ │ └── vulnerabilityScanner.js # Utility to run Nmap or other scan tools
│ ├── .env.example # Environment variables template
│ ├── package.json # Backend dependencies & scripts
│ └── Dockerfile # Dockerfile for containerizing the backend
├── frontend/
│ ├── public/
│ │ └── index.html # Main HTML entry for the React application
│ ├── src/
│ │ ├── components/
│ │ │ ├── SystemDashboard.jsx # Displays system info (CPU, memory, etc.)
│ │ │ ├── PortList.jsx # Lists open ports fetched from the backend
│ │ │ ├── VulnerabilityScanner.jsx # UI to trigger vulnerability scans & show results
│ │ │ ├── LogsView.jsx # Shows recent failed login attempts or logs
│ │ │ ├── Login.jsx # Login form component
│ │ │ └── ProtectedRoute.jsx # Route guard for authenticated users
│ │ ├── services/
│ │ │ └── api.js # Axios instance & interceptors for API requests
│ │ ├── App.js # Main React component with routes/navigation
│ │ └── index.js # React DOM entry point, imports global styles
│ ├── .env.example # Frontend environment variables template
│ ├── package.json # Frontend dependencies & scripts
│ └── Dockerfile # Dockerfile for containerizing the frontend
├── docker-compose.yml # Multi-container setup for backend, frontend, DB
├── .gitignore # Git ignore rules
├── README.md # Project documentation (setup, usage, etc.)
└── LICENSE # License file (MIT)
git clone https://github.com/m-ah07/linux-security-dashboard.gitcd linux-security-dashboard/backend
npm install- (Optional) If you plan on using a database like MongoDB, install mongoose as well:
npm install mongoose
cd ../frontend
npm install- If
react-scriptsis not found when runningnpm start, install it:npm install react-scripts
# Ubuntu/Debian
sudo apt install nmap
# RHEL/CentOS
sudo yum install nmapCopy .env.example to .env in both backend and frontend:
Backend (backend/.env):
PORT=5000
JWT_SECRET=your-secret-key-change-in-production
JWT_EXPIRES_IN=24h
ADMIN_USERNAME=admin
ADMIN_PASSWORD=admin
Frontend (frontend/.env):
REACT_APP_API_URL=http://localhost:5000/api
If using a database, add to backend .env:
DB_URI=mongodb://localhost:27017/linux_security
RHEL/CentOS — Use /var/log/secure for auth logs:
AUTH_LOG_PATH=/var/log/secure
-
Run the Backend
cd linux-security-dashboard/backend npm run dev- Starts an Express server on
http://localhost:5000by default.
- Starts an Express server on
-
Run the Frontend
cd ../frontend npm start- Runs the React application on
http://localhost:3000.
- Runs the React application on
-
Access the Dashboard
- Open your browser at
http://localhost:3000(frontend). - Do not use
http://localhost:5000in the browser — that is the API server and will show "Cannot GET /".
- Open your browser at
| Field | Default Value |
|---|---|
| Username | admin |
| Password | admin |
Change these in production via ADMIN_USERNAME and ADMIN_PASSWORD in backend/.env.
All endpoints except /api/auth/login require a JWT token in the Authorization header: Bearer <token>.
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| POST | /api/auth/login |
No | Login; returns JWT |
| GET | /api/system/info |
Yes | System metrics (CPU, memory…) |
| GET | /api/system/ports |
Yes | Open ports on the host |
| POST | /api/vulnerabilities/scan |
Yes | Run vulnerability scan (Nmap) |
| GET | /api/vulnerabilities/results |
Yes | Get last scan results |
| GET | /api/logs/failed-logins |
Yes | Failed login attempts |
| DELETE | /api/logs/cleanup |
Yes | Log cleanup info (read-only) |
-
Build and Run
cd linux-security-dashboard docker-compose up --build -
Containers
- backend: Exposes
http://localhost:5000 - frontend: Accessible at
http://localhost:3000 - mongo (if configured) on
27017
- backend: Exposes
-
Login — Use
admin/admin(or credentials from env vars).
| Problem | Solution |
|---|---|
| "Cannot GET /" | You are on the backend URL. Open http://localhost:3000 (frontend) instead of http://localhost:5000. |
| "react-scripts is not recognized" | Run npm install react-scripts in the frontend folder. |
| Open Ports / Logs empty on Windows | These features require Linux. Use WSL2 or Docker. |
| Vulnerability scan fails | Install Nmap: apt install nmap (Linux). |
| 401 Unauthorized | Log in again. The JWT may have expired (default: 24h). |
| CORS errors | Ensure backend runs on port 5000 and frontend uses REACT_APP_API_URL=http://localhost:5000/api. |
- Fork the repository.
- Create a branch for your feature:
git checkout -b feature/some-new-feature
- Commit & push your changes:
git commit -m "Add some new feature" git push origin feature/some-new-feature - Open a Pull Request on GitHub, describing your changes and any relevant details.
We appreciate your contributions—bug reports, suggestions, and pull requests are always welcome!
This project is licensed under the MIT License.
Feel free to modify and distribute as you see fit.
Enjoy securing your system with the Linux Security Dashboard! For questions or feedback, open an issue or start a discussion in the repository.