Skip to content

Commit cd6be7d

Browse files
committed
Merge #148: docs: [#147] Document GitHub Copilot agent firewall configuration
d790707 docs: [#147] create copilot agent firewall documentation (copilot-swe-agent[bot]) 5e1e8f8 Initial plan (copilot-swe-agent[bot]) Pull request description: Phase 1 (repository settings) was completed by admin: `opentofu.org` added to custom allowlist to unblock OpenTofu installer. This PR completes Phase 2 (documentation) and Phase 3 (verification). ## Changes ### Created `docs/contributing/copilot-agent-firewall.md` Comprehensive reference for firewall configuration: - Current configuration: custom domain (`opentofu.org`) and recommended allowlist status - Admin instructions: step-by-step configuration walkthrough - Domain vs URL rules: when to use each allowlist type - Security: best practices, limitations, minimal whitelist approach - Maintenance: adding domains, troubleshooting DNS/connection errors - History: configuration change tracking table ### Updated cross-references - `docs/contributing/README.md`: Added firewall doc to quick reference table - `packages/dependency-installer/README.md`: Added "GitHub Copilot Agent Requirements" section linking to firewall configuration ## Context Without `opentofu.org` in allowlist: ```bash $ cargo run --bin dependency-installer install --dependency opentofu ERROR: curl: (6) Could not resolve host: get.opentofu.org ``` With configuration complete, OpenTofu installer can download from `get.opentofu.org` and install successfully. Other dependencies (Ansible, cargo-machete, LXD) covered by recommended allowlist. Closes #147 <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> > > ---- > > *This section details on the original issue you should resolve* > > <issue_title>Configure Copilot Agent Firewall for Dependency Installer</issue_title> > <issue_description>## Overview > > Configure GitHub Copilot agent's firewall to allow network access to domains required by the dependency installer binaries. The Copilot agent environment has a restricted firewall that blocks access to external domains by default. > > ## Problem Statement > > When GitHub Copilot agent attempts to install dependencies using the `dependency-installer` binary, network requests are blocked by the agent's firewall: > > ```bash > $ cargo run -p torrust-dependency-installer --bin dependency-installer -- install --dependency opentofu > 2025-11-05T19:46:23.668278Z ERROR torrust_dependency_installer::app: Command failed error=Install command failed: Failed to install specific dependency: Installation failed: Failed to install dependency 'opentofu': Failed to download installer: curl: (6) Could not resolve host: get.opentofu.org > ``` > > This prevents the agent from installing OpenTofu and running pre-commit checks. > > ## Required Configuration > > **Domain to Whitelist**: `opentofu.org` > > - Allows traffic to `opentofu.org` and all subdomains (e.g., `get.opentofu.org`) > - Required for OpenTofu installer script and package downloads > > **Already Covered by Recommended Allowlist**: > - Ubuntu/Debian package repositories (for Ansible) > - Rust package registry/crates.io (for cargo-machete) > - Snap store (for LXD) > > ## Implementation Steps > > ### Phase 1: Repository Settings Configuration (15-30 min) > > **Prerequisites**: Repository admin access required > > 1. Navigate to: `Settings` → `Copilot` → `coding agent` > 2. Verify **Enable firewall** is ON > 3. Verify **Recommended allowlist** is ON > 4. Click **Custom allowlist** > 5. Add domain: `opentofu.org` > 6. Click **Add Rule** → **Save changes** > > ### Phase 2: Documentation (15-30 min) > > - Create `docs/contributing/copilot-agent-firewall.md` > - Document configured domains and rationale > - Document configuration steps > - Update related documentation > > ### Phase 3: Verification (15-30 min) > > - Test OpenTofu installation in Copilot agent > - Verify no firewall warnings appear > - Update documentation if needed > > **Total Estimate**: 45 minutes - 1.5 hours > > ## Acceptance Criteria > > **Configuration**: > - [ ] `opentofu.org` added to custom allowlist > - [ ] Recommended allowlist remains enabled > - [ ] Firewall remains enabled > > **Documentation**: > - [ ] New doc: `docs/contributing/copilot-agent-firewall.md` > - [ ] Includes all configured domains with rationale > - [ ] Includes step-by-step instructions > - [ ] Links to GitHub documentation > > **Verification**: > - [ ] Copilot agent can install OpenTofu successfully > - [ ] No firewall warnings for configured domains > - [ ] Pre-commit checks pass > > ## Related Documentation > > - [GitHub Docs: Customizing the agent firewall](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-firewall) > - [Dependency Installer Package](https://github.com/torrust/torrust-tracker-deployer/blob/main/packages/dependency-installer/README.md) > > ## Notes > > ⚠️ **Requires Manual Implementation**: This issue cannot be implemented by Copilot agent because it requires repository admin access to modify settings. Must be done manually by a repository administrator. > > **Security**: Keep firewall and recommended allowlist enabled. Only add specific required domains (minimal whitelist approach). > > ## Specification > > Full specification: [docs/issues/configure-copilot-agent-firewall-for-dependency-installer.md](https://github.com/torrust/torrust-tracker-deployer/blob/main/docs/issues/configure-copilot-agent-firewall-for-dependency-installer.md)</issue_description> > > ## Comments on the Issue (you are @copilot in this section) > > <comments> > <comment_new><author>@josecelano</author><body> > ## ✅ Phase 1 Complete: Repository Settings Configured > > The Copilot agent firewall has been configured with the required domain: > > **Custom Allowlist Configuration**: > - ✅ Added domain: `opentofu.org` > - This allows traffic to `opentofu.org` and all subdomains (e.g., `get.opentofu.org`) > - ✅ Firewall remains enabled > - ✅ Recommended allowlist remains enabled > > **Next Steps**: > - [ ] Phase 2: Create documentation (`docs/contributing/copilot-agent-firewall.md`) > - [ ] Phase 3: Verify OpenTofu installation works in Copilot agent environment > > **Configuration completed by**: Repository administrator > **Date**: November 5, 2025</body></comment_new> > </comments> > </details> - Fixes #147 <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. ACKs for top commit: josecelano: ACK d790707 Tree-SHA512: cba583af5b206e147c6245474dadb084214444731b58ad9c615cc06e10fe1cb7443118fa5713cfecce5718584bed4172cb57d378ac961c0466981f55cb4fbcf4
2 parents af0f8ef + d790707 commit cd6be7d

File tree

3 files changed

+212
-0
lines changed

3 files changed

+212
-0
lines changed

docs/contributing/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ This guide will help you understand our development practices and contribution w
2020
| Known issues and expected behaviors | [known-issues.md](./known-issues.md) |
2121
| Logging best practices | [logging-guide.md](./logging-guide.md) |
2222
| GitHub Markdown pitfalls | [github-markdown-pitfalls.md](./github-markdown-pitfalls.md) |
23+
| GitHub Copilot agent firewall | [copilot-agent-firewall.md](./copilot-agent-firewall.md) |
2324
| Testing conventions and practices | [testing/](./testing/) |
2425

2526
## 🚀 Getting Started
Lines changed: 207 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
# GitHub Copilot Agent Firewall Configuration
2+
3+
This document describes the firewall configuration for GitHub Copilot coding agent in this repository and provides guidance for future maintenance.
4+
5+
## Overview
6+
7+
The GitHub Copilot coding agent operates in a restricted environment with a firewall that blocks external network access by default. This configuration is necessary to allow the agent to install project dependencies using the [dependency-installer](../../packages/dependency-installer/README.md) tool.
8+
9+
## Current Configuration
10+
11+
### Firewall Status
12+
13+
- **Firewall**: ✅ Enabled (recommended for security)
14+
- **Recommended Allowlist**: ✅ Enabled (pre-configured common repositories)
15+
- **Custom Allowlist**: ✅ Configured (project-specific domains)
16+
17+
### Custom Allowlist Domains
18+
19+
The following domains have been added to the custom allowlist:
20+
21+
#### opentofu.org
22+
23+
- **Purpose**: OpenTofu installation
24+
- **Used By**: `packages/dependency-installer/src/installer/opentofu.rs`
25+
- **Rationale**: Downloads OpenTofu installer script from `get.opentofu.org` and installation packages
26+
- **Subdomain Coverage**: Allows traffic to all subdomains (e.g., `get.opentofu.org`)
27+
- **Date Added**: November 5, 2025
28+
- **Added By**: Repository administrator
29+
30+
### Domains Covered by Recommended Allowlist
31+
32+
The following dependencies are automatically allowed through GitHub's recommended allowlist and do **not** require custom configuration:
33+
34+
#### Package Repositories
35+
36+
- **Ubuntu/Debian APT Repositories**: Used by Ansible installer (`apt-get install ansible`)
37+
- **Rust Package Registry (crates.io)**: Used by cargo-machete installer (`cargo install cargo-machete`)
38+
- **Snap Store**: Used by LXD installer (`snap install lxd`)
39+
40+
These are included in GitHub's default recommended allowlist which covers common package repositories, container registries, and certificate authorities.
41+
42+
## Configuration Steps
43+
44+
### Prerequisites
45+
46+
- Repository admin access required
47+
- Must be logged into GitHub
48+
49+
### Step-by-Step Instructions
50+
51+
1. Navigate to repository settings:
52+
53+
```text
54+
https://github.com/torrust/torrust-tracker-deployer/settings
55+
```
56+
57+
2. In the sidebar under "Code & automation", click:
58+
- **Copilot****coding agent**
59+
60+
3. Verify firewall settings:
61+
- ✅ Ensure **Enable firewall** is toggled ON
62+
- ✅ Ensure **Recommended allowlist** is toggled ON
63+
64+
4. Configure custom allowlist:
65+
- Click **Custom allowlist**
66+
- In the "Add domain" field, enter: `opentofu.org`
67+
- Click **Add Rule**
68+
- Click **Save changes**
69+
70+
5. Verify configuration:
71+
- The custom allowlist should now show `opentofu.org`
72+
- Firewall and recommended allowlist should remain enabled
73+
74+
## Domain vs URL Rules
75+
76+
When configuring the custom allowlist, you can add either domains or specific URLs:
77+
78+
- **Domain** (e.g., `opentofu.org`):
79+
- ✅ Allows traffic to the domain **and all subdomains**
80+
- ✅ Recommended for most cases
81+
- Example: `opentofu.org` allows both `get.opentofu.org` and `packages.opentofu.org`
82+
83+
- **URL** (e.g., `https://get.opentofu.org/installer/`):
84+
- ⚠️ Only allows specified scheme, host, and path
85+
- ⚠️ More restrictive, harder to maintain
86+
- Use only when you need to restrict to specific paths
87+
88+
**Recommendation**: Use domain rules for flexibility and easier maintenance.
89+
90+
## Security Considerations
91+
92+
### Best Practices
93+
94+
1.**Keep firewall enabled** - Protects against data exfiltration
95+
2.**Keep recommended allowlist enabled** - Covers common package repositories
96+
3.**Use minimal custom allowlist** - Only add domains that are absolutely necessary
97+
4.**Document each domain** - Explain why each domain is needed
98+
5.**Never disable the firewall** - Increases security risks significantly
99+
100+
### Limitations
101+
102+
From GitHub documentation, the Copilot agent firewall has the following limitations:
103+
104+
- **Scope**: Only applies to processes started by the agent via its Bash tool
105+
- **Not Applied To**:
106+
- Model Context Protocol (MCP) servers
107+
- Processes started in configured Copilot setup steps
108+
- **Security Note**: Sophisticated attacks may bypass the firewall
109+
- **Environment**: Only operates within GitHub Actions appliance environment
110+
111+
For more details, see [GitHub's official documentation](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-firewall).
112+
113+
## Testing Firewall Configuration
114+
115+
After adding a domain to the allowlist, verify that the dependency installer can access it:
116+
117+
```bash
118+
# Test OpenTofu installation
119+
cargo run --bin dependency-installer install --dependency opentofu
120+
121+
# Expected result: Installation should succeed without DNS resolution errors
122+
# Before configuration: "curl: (6) Could not resolve host: get.opentofu.org"
123+
# After configuration: Installation completes successfully
124+
```
125+
126+
## Future Maintenance
127+
128+
### Adding New Domains
129+
130+
When adding new dependency installers that require external network access:
131+
132+
1. **Test First**: Run the installer in the Copilot agent environment
133+
2. **Check for Errors**: Look for DNS resolution or connection failures
134+
3. **Identify Domain**: Determine which domain needs to be whitelisted
135+
4. **Add to Allowlist**: Follow the configuration steps above
136+
5. **Update Documentation**: Add the new domain to this document with:
137+
- Purpose and rationale
138+
- Which installer uses it
139+
- Date added and who added it
140+
6. **Test Again**: Verify the installer now works
141+
7. **Update Issue Spec**: Update [issue #147 specification](../issues/147-1-7-configure-copilot-agent-firewall-for-dependency-installer.md) if needed
142+
143+
### Troubleshooting Common Issues
144+
145+
#### DNS Resolution Errors
146+
147+
```bash
148+
curl: (6) Could not resolve host: example.com
149+
```
150+
151+
**Solution**: Add `example.com` to the custom allowlist.
152+
153+
#### Connection Refused Errors
154+
155+
```bash
156+
curl: (7) Failed to connect to example.com port 443: Connection refused
157+
```
158+
159+
**Possible Causes**:
160+
161+
- Domain not in allowlist (add it)
162+
- Service is down (check service status)
163+
- Wrong port/protocol (verify URL)
164+
165+
#### Subdomain Access Issues
166+
167+
If you added `example.com` but `api.example.com` is still blocked:
168+
169+
**Solution**: Domain rules should cover subdomains. Verify:
170+
171+
- Domain was added correctly (not as a URL)
172+
- Changes were saved
173+
- Try again after a few minutes (changes may take time to propagate)
174+
175+
## Related Documentation
176+
177+
### GitHub Documentation
178+
179+
- [Customizing the agent firewall](https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-firewall)
180+
- [Preinstalling tools in Copilot's environment](https://docs.github.com/en/copilot/customizing-copilot/customizing-the-development-environment-for-copilot-coding-agent#preinstalling-tools-in-copilots-environment)
181+
182+
### Project Documentation
183+
184+
- [Dependency Installer Package](../../packages/dependency-installer/README.md)
185+
- [E2E Testing Guide](../e2e-testing.md)
186+
- [Issue #147 Specification](../issues/147-1-7-configure-copilot-agent-firewall-for-dependency-installer.md)
187+
- [Issue #146 - Update Pre-Commit Script](../issues/146-1-6-update-precommit-script-for-github-runner-compatible-e2e-tests.md)
188+
189+
## History
190+
191+
### Configuration Changes
192+
193+
| Date | Change | Added By | Rationale |
194+
|------|--------|----------|-----------|
195+
| 2025-11-05 | Added `opentofu.org` | Repository administrator | Enable OpenTofu installation for dependency-installer tool |
196+
197+
### Documentation Changes
198+
199+
| Date | Change | Author |
200+
|------|--------|--------|
201+
| 2025-11-05 | Initial documentation | GitHub Copilot Agent |
202+
203+
## Notes
204+
205+
- This configuration was created as part of [Issue #147](https://github.com/torrust/torrust-tracker-deployer/issues/147)
206+
- Parent epic: [Issue #112 - Refactor and Improve E2E Test Execution](https://github.com/torrust/torrust-tracker-deployer/issues/112)
207+
- Repository settings modifications require admin access and cannot be performed by Copilot agent

packages/dependency-installer/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ This package can detect and install the following development dependencies:
4242
- **Ansible** - Configuration management tool
4343
- **LXD** - VM-based testing infrastructure
4444

45+
### GitHub Copilot Agent Requirements
46+
47+
When running in GitHub Copilot agent environment, network access to external domains is restricted by a firewall. The OpenTofu installer requires `opentofu.org` to be added to the custom allowlist. See [Copilot Agent Firewall Configuration](../../docs/contributing/copilot-agent-firewall.md) for details on configured domains and setup instructions.
48+
4549
## Usage
4650

4751
### CLI Binary

0 commit comments

Comments
 (0)