# Hub Port Management Scripts

Super alpha version of firewall port management for Core Nest services.

## Files

- **ports** - List of ports to manage (one per line, comments allowed)
- **update-ports.sh** - Generate ports file from .env configurations
- **iptables.sh** - Manage ports using iptables
- **ufw.sh** - Manage ports using ufw
- **firewalld.sh** - Manage ports using firewalld

## Firewall Tools

Choose the tool that matches your system:

- **iptables** - Most Linux systems (rules not persistent by default)
- **ufw** - Ubuntu/Debian (Uncomplicated Firewall)
- **firewalld** - RHEL/CentOS/Fedora

## Usage

### Update ports from configuration
```bash
./update-ports.sh
```

### Open ports (choose your firewall)
```bash
# Using iptables
sudo ./iptables.sh open

# Using ufw
sudo ./ufw.sh open

# Using firewalld
sudo ./firewalld.sh open
```

### Close ports (choose your firewall)
```bash
# Using iptables
sudo ./iptables.sh close

# Using ufw
sudo ./ufw.sh close

# Using firewalld
sudo ./firewalld.sh close
```

## Default Ports

- **3000** - Amar Frontend
- **8000** - Amar Backend
- **13000** - Pawprint
- **13001** - Artery
- **13002** - Album
- **13003** - Ward

## Notes

- **iptables**: Rules are not persistent across reboots unless you install `iptables-persistent`
- **ufw**: Remember to run `sudo ufw reload` after making changes
- **firewalld**: Scripts automatically reload the firewall

## Future Improvements

- Auto-detect firewall system
- Support for multiple nests
- Integration with ward UI
- Per-service port management
- LAN subnet restrictions
