← back to Designer Wallcoverings
DW-Agents/dw-agents/FIREWALL-PORT-MANAGEMENT.md
175 lines
# Firewall Port Management Guide
## Quick Reference for Opening Ports
When creating a new agent or service that needs external access, follow these steps:
### 1. Open Firewall Port
```bash
sudo ufw allow <PORT>/tcp comment 'Service Name'
```
### 2. Verify Port is Open
```bash
sudo ufw status | grep <PORT>
```
### 3. Test Port Accessibility
```bash
curl http://45.61.58.125:<PORT>/
```
---
## Recently Opened Ports
### Agent Ports (7000-7999 range)
- **7234** - Service (check purpose)
- **7235** - Service (check purpose)
- **7238** - Shopify Store Agent
- **7239** - Log Monitor Agent
- **7240** - UI Manager Agent
- **7241** - Restart Analyzer Agent
- **7898** - Service (check purpose)
- **7989** - Service (check purpose)
### Main Agent Ports (9000-9999 range)
- **9712** - Master Hub (Original)
- **9878** - Legal Team Agent
- **9879** - Digital Samples Agent
- **9880** - Purchasing Office Agent
- **9881** - Marketing Agent
- **9882** - Accounting Agent
- **9883** - Trend Research Agent
- **9884** - Zendesk Chat Agent
- **9885** - Today's Highlights Agent
- **9886** - Needs Attention Agent
- **9887** - Parallel Processes Agent
- **9888** - Server Uptime Agent
- **9889** - Completed Tasks Agent
- **9890** - New Client Signups Agent
- **9891** - In Parallel Agent
- **9892** - Security Agent
- **9893** - Master Hub (Main)
- **9894** - Skills Manager Agent ✨ NEW
- **9900** - Task Orchestrator Agent
---
## Standard Process for New Agents
When creating a new agent, add this step to your workflow:
### Step 1: Choose a Port
- **7000-7999**: Specialized/utility agents
- **9000-9999**: Main business agents
### Step 2: Open Firewall
```bash
sudo ufw allow <PORT>/tcp comment 'Agent Name'
```
### Step 3: Update Master Hub
Add agent to `/root/DW-Agents/master-hub.ts`:
```typescript
{
id: 'agent-id',
name: 'Agent Name',
port: PORT,
url: 'http://45.61.58.125:PORT',
status: 'online',
description: 'What this agent does',
icon: '🔄',
color: '#667eea'
}
```
### Step 4: Restart Master Hub
```bash
pm2 restart dw-master-hub-9893
```
### Step 5: Verify Access
```bash
curl http://45.61.58.125:PORT/
```
---
## Firewall Management Commands
### View All Rules
```bash
sudo ufw status numbered
```
### Delete a Rule
```bash
sudo ufw delete <RULE_NUMBER>
```
### Reload Firewall
```bash
sudo ufw reload
```
### Disable/Enable Firewall
```bash
sudo ufw disable # Use with caution!
sudo ufw enable
```
---
## Port Ranges by Service Type
| Range | Purpose |
|-------|---------|
| 80, 443 | HTTP/HTTPS (web traffic) |
| 3000-3999 | Development/Frontend services |
| 4000-4999 | Backend APIs |
| 5000-5999 | Databases & Storage |
| 6000-6999 | Monitoring & Analytics |
| 7000-7999 | Specialized Agent Services |
| 8000-8999 | System Services |
| 9000-9999 | Main Agent Services |
---
## Troubleshooting
### Port Not Accessible After Opening
1. Check firewall status: `sudo ufw status`
2. Verify service is running: `pm2 list`
3. Check if service is listening: `sudo netstat -tulpn | grep <PORT>`
4. Test locally first: `curl http://localhost:<PORT>/`
5. Check nginx configuration if using reverse proxy
### Too Many Firewall Rules
If you have duplicate rules or need to clean up:
```bash
# List all rules with numbers
sudo ufw status numbered
# Delete specific rules
sudo ufw delete <RULE_NUMBER>
```
---
## Security Best Practices
1. **Only open ports that need external access**
2. **Use descriptive comments** for each rule
3. **Document all ports** in this file
4. **Review firewall rules periodically**
5. **Close unused ports** when decommissioning services
---
**Last Updated:** November 9, 2025
**Maintained By:** Claude Code / DW-Agents Team