Request Access
The eventual user experience should be simple: authenticate, select an access duration, submit the request, and receive a temporary access result. The user's public IP should be detected server-side rather than trusted from a form field.
How It Should Work
The public page should remain intentionally dumb. The backend performs the sensitive operations.
Firewall Integration Boundary
This is the most important section to customize. Keep these values on the backend/server side. They should never be embedded in this public HTML.
// Example backend configuration — NOT for the public browser FIREWALL_PROVIDER = "CHANGE_ME" # Examples: "opnsense", "pfsense", "custom" FIREWALL_API_BASE_URL = "CHANGE_ME" # Private/internal API endpoint. # Never expose this value to the browser. FIREWALL_API_KEY = "CHANGE_ME_SECRET" FIREWALL_API_SECRET = "CHANGE_ME_SECRET" RDP_ACCESS_ALIAS = "CHANGE_ME" # Recommended concept: a dedicated host/IP alias # used ONLY by the RDP allow rule. RDP_TARGET = "CHANGE_ME" # Internal RDP destination. RDP_PORT = CHANGE_ME # Normally 3389 internally. MAX_ACCESS_MINUTES = CHANGE_ME AUTH_PROVIDER = "CHANGE_ME" # Identity/MFA provider used to authorize requests. AUDIT_LOG_DESTINATION = "CHANGE_ME" # File, database, SIEM, etc.
Recommended Firewall Model
Use one dedicated source-IP object/alias for temporary RDP access instead of dynamically creating and deleting an entire firewall rule for every request. This keeps the permanent rule simple and makes the automation layer smaller.
| Component | Concept | What you change later |
|---|---|---|
| Source | Dedicated temporary-access IP alias | RDP_ACCESS_ALIAS |
| Destination | Specific internal RDP server | RDP_TARGET |
| Service | TCP RDP service | RDP_PORT |
| Automation | Add source IP, wait for expiry, remove source IP | Firewall adapter/backend |
| Authorization | Authenticated user + policy check | AUTH_PROVIDER |
| Audit | User, source IP, start, expiry, result | AUDIT_LOG_DESTINATION |
Backend Contract
Keep the frontend independent from the actual firewall vendor. Your backend should expose a small API of its own and translate that request into the firewall-specific API calls.
/api/rdp/request
Authenticate the requester, determine their source IP, validate the duration, and create the temporary authorization.
/api/rdp/status
Return only safe status information such as whether the current authenticated session has active access.
/api/rdp/revoke
Immediately remove the requester's temporary authorization when permitted.
Example Backend Request
// Pseudocode only — firewall credentials stay server-side POST /api/rdp/request 1. Require authenticated session 2. Verify user is allowed to request RDP 3. Detect source IP from trusted request metadata 4. Validate requested duration 5. Generate request ID 6. Add source IP to RDP temporary-access alias 7. Record expiration timestamp 8. Schedule/remove authorization at expiration 9. Write audit record 10. Return request ID + expiration time // Example response { "status": "active", "request_id": "generated-server-side", "expires_at": "server-generated timestamp" }
Firewall Adapter
The adapter is where vendor-specific code belongs. This lets the public portal remain unchanged if the firewall changes later.
class FirewallAdapter:
add_temporary_source(ip, expires_at):
# CHANGE HERE
# Call your firewall's API or automation interface.
# Validate ip before sending it.
pass
remove_temporary_source(ip):
# CHANGE HERE
# Remove the source from the temporary access mechanism.
pass
check_source(ip):
# CHANGE HERE
# Return whether the source is currently authorized.
pass
Security Requirements Before Going Live
Authentication + MFA
Do not allow an anonymous internet visitor to modify firewall access.
Server-Side Validation
Validate IP addresses, durations, authorization, and request state on the backend.
Automatic Expiration
Never depend on the browser remaining open to revoke access.
Rate Limiting
Limit repeated requests and authentication attempts from the public internet.
Audit Logging
Record who requested access, what source was authorized, when it started, and when it expired.
VPN Alternative
For long-term remote administration, consider VPN access instead of exposing RDP directly.
Future Integration Checklist
☐ Choose firewall platform / API method
☐ Create dedicated temporary RDP source alias
☐ Create permanent firewall rule referencing that alias
☐ Build protected backend endpoint
☐ Add authentication + MFA
☐ Implement IP detection and validation
☐ Implement automatic expiration
☐ Add audit logging
☐ Add rate limiting
☐ Test revocation and failure recovery
☐ Only then enable the public request form