|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +title: Infrastructure Configuration |
| 4 | +nav_order: 9 |
| 5 | +--- |
| 6 | + |
| 7 | +## Secure Infrastructure Configuration |
| 8 | + |
| 9 | +The following best practices should be implemented to ensure secure configuration of infrastructure systems every time a new system is deployed. |
| 10 | + |
| 11 | +### General Principles |
| 12 | + |
| 13 | +1. **Adopt the principle of least privilege** for users, services, and network access. |
| 14 | +2. **Document configurations and changes** for traceability and auditability. |
| 15 | +3. **Review configurations periodically** and update them as needed. |
| 16 | + |
| 17 | +### Operating System & Distribution |
| 18 | + |
| 19 | +- **Choose up-to-date distributions**: When deploying on Linux, always use a version that is fully updated and with the furthest possible [End of Life](https://endoflife.date/) (EOL). |
| 20 | +- **Regularly apply updates and patches**: Enable automated updates where possible and ensure all security patches are installed promptly. |
| 21 | +- **Remove unnecessary components**: Uninstall or disable services, packages, and user accounts that are not strictly required. |
| 22 | + |
| 23 | +### Network Security |
| 24 | + |
| 25 | +- **Enable firewalls**: Activate the distribution’s firewall (e.g., `firewalld`, `ufw`), allowing only necessary ports. Alternatively, use and configure the cloud provider’s network firewall. |
| 26 | +- **Use secure protocols**: Only allow encrypted and secure protocols (e.g., HTTPS, SSH, SFTP); disable plaintext services where feasible. |
| 27 | +- **Always encrypt remote communications**: If an application needs to reach a remote resource (e.g., database or API), ensure the communication channel is always encrypted (e.g., TLS/SSL). |
| 28 | +Use stunnel or VPN tunnels for sensitive data transfers when necessary. |
| 29 | + |
| 30 | +### SSH and Authentication |
| 31 | + |
| 32 | +- **Disable SSH password authentication**: Require SSH key authentication. All users needing SSH access must use their own key pair. |
| 33 | +- **Restrict SSH to known IPs**: Access to SSH must be limited to a defined set of trusted addresses. |
| 34 | + Usually: `sos.nethesis.it` and company office IPs. |
| 35 | +- **Do not allow root login**: Disable direct root login (`PermitRootLogin no`). |
| 36 | +- **Rotate keys as needed** and regularly audit authorized keys. |
| 37 | + |
| 38 | +### Monitoring and Metrics |
| 39 | + |
| 40 | +- **Register systems for monitoring**: Every new system must be monitored through [metrics.nethesis.it](https://metrics.nethesis.it). |
| 41 | + See [metrics-deploy repository](https://github.com/nethesis/metrics-deploy) for team configuration. |
| 42 | +- **Set up automated alerts** for critical infrastructure events, such as login failures, disk space issues, or service outages (this is already included in the metrics.nethesis.it setup). |
| 43 | +- **Centralize logs**: Forward relevant logs to a centralized logging system for audit and troubleshooting purposes. |
| 44 | + |
| 45 | +### Backup |
| 46 | + |
| 47 | +- **Implement regular backup routines**: Configure systematic backups for all systems using solutions documented at [nethinfra](https://github.com/nethesis/nethinfra/). |
| 48 | +- **Encrypt backups** at rest and in transit, store them offsite when possible. |
| 49 | +- **Test restore procedures** periodically to guarantee data recovery. |
| 50 | + |
| 51 | +### Cloud and Virtual Infrastructure |
| 52 | + |
| 53 | +- **Harden cloud accounts**: Use strong credentials and enable Multi-Factor Authentication (MFA) wherever supported. When using DigitalOcean, GitHub account with MFA is mandatory. |
| 54 | +- **Control external exposure**: Regularly audit public IPs, open ports, and security group rules. |
| 55 | +- **Manage resource lifecycle**: Remove unused or obsolete resources immediately. |
| 56 | + |
| 57 | +### Additional Best Practices |
| 58 | + |
| 59 | +- **Use configuration management tools** use Ansible to standardize and automate secure baseline enforcement. |
| 60 | +- **Run vulnerability assessments**: Regularly scan systems for vulnerabilities with automated tools. |
| 61 | +- **Maintain an updated asset inventory**: A list of deplyed systems is available inside metrics repository. |
| 62 | +- **Remove unused users and groups**: Regularly audit accounts and revoke unnecessary access. |
0 commit comments