Best Practices
This guide provides practical examples and best practices for configuring security groups in RESVRL Cloud Services to ensure optimal security and network connectivity.
Best Practices
This guide provides practical examples and best practices for configuring security groups in RESVRL Cloud Services to ensure optimal security and network connectivity.
Configuration Examples
Example 1: Allow SSH Access from a Specific IP
Rule Configuration:
- Protocol: TCP
- Direction: In (Inbound)
- Action: Accept
- Source IP Address: 203.0.113.0/24
- Destination Port Range: 22 - 22
Description: This rule allows IP addresses from the 203.0.113.0/24 subnet to access the virtual machine's port 22 (SSH) via TCP. This provides secure remote access while limiting connections to trusted IP ranges.
Example 2: Deny All Outbound UDP Traffic
Rule Configuration:
- Protocol: UDP
- Direction: Out (Outbound)
- Action: Drop
Description: This rule denies all outbound UDP traffic from the virtual machine, which can help prevent certain types of attacks or unwanted outbound connections.
Example 3: Allow Ping from Any Address
Rule Configuration:
- Protocol: ICMP
- Direction: In (Inbound)
- Action: Accept
- Source IP Address: 0.0.0.0/0
Description: This rule allows ICMP traffic (ping) from any IP address to access the virtual machine.
Best Practices for Security Groups
Principle of Least Privilege
- Minimize Exposure: Only open the protocols and ports that are absolutely necessary for your application to function
- Specific IP Ranges: For inbound rules, specify the most restrictive source IP ranges possible instead of using 0.0.0.0/0 (allow all)
- Regular Audits: Periodically review and update security group rules, removing permissions that are no longer needed
Rule Organization
- Logical Grouping: Create separate security groups for different applications or environments to simplify management
- Descriptive Naming: Use clear, descriptive names for security groups and rules to make them easy to understand and maintain
- Rule Ordering: Place more specific rules before general ones, as rules are evaluated in order
Default Deny Policy
- Explicit Allow: Only explicitly allow traffic that is required
- Implicit Deny: Rely on the default deny behavior for all traffic that doesn't match any allow rules
- Fail-Safe: Add a final "deny all" rule as a safety measure, though this is usually implicit
Common Security Scenarios
Web Server Configuration
Inbound Rules:
- TCP, Port 80 (HTTP) - Allow from 0.0.0.0/0
- TCP, Port 443 (HTTPS) - Allow from 0.0.0.0/0
- TCP, Port 22 (SSH) - Allow from your IP range only
Outbound Rules:
- All traffic - Allow (default)
Database Server Configuration
Inbound Rules:
- TCP, Port 3306 (MySQL) - Allow from application server IP ranges only
- TCP, Port 22 (SSH) - Allow from admin IP ranges only
Outbound Rules:
- TCP, Port 80/443 - Allow for updates/security patches
- DNS (UDP 53) - Allow for name resolution
Application Server Configuration
Inbound Rules:
- TCP, Port 8080 (App Port) - Allow from load balancer IP ranges
- TCP, Port 22 (SSH) - Allow from admin IP ranges only
Outbound Rules:
- TCP, Port 3306 - Allow to database server IPs
- TCP, Port 80/443 - Allow for external API calls
Security Considerations
Monitoring and Maintenance
- Regular Reviews: Schedule periodic reviews of security group configurations
- Change Tracking: Document all changes to security groups with reasons and approval
- Incident Response: Have procedures for quickly modifying security groups during security incidents
Performance Optimization
- Rule Efficiency: Minimize the number of rules while maintaining security
- Stateful Inspection: Leverage stateful firewall capabilities where available
- Connection Tracking: Understand how security groups handle connection state
Troubleshooting Common Issues
Cannot Connect to Virtual Machine
- Check Inbound Rules: Ensure the required ports are open for your IP address
- Verify Protocol: Make sure you're using the correct protocol (TCP vs UDP)
- Rule Order: Check that more specific rules aren't being overridden by general rules
Unexpected Traffic Blocking
- Review Outbound Rules: Ensure necessary outbound traffic is allowed
- Check for Conflicts: Look for conflicting rules that might block legitimate traffic
- Default Behavior: Remember that unmatched traffic is denied by default
Performance Issues
- Rule Count: Reduce the number of rules if possible
- Specificity: Use more specific IP ranges instead of broad ranges
- Regular Cleanup: Remove unused rules and security groups
By following these best practices, you can create a robust security posture while maintaining the flexibility needed for your applications to function properly.
This document was updated on 2026-04-25 09:00