The Liquescent DevContainer includes an optional firewall logging feature that helps diagnose network connectivity issues by logging blocked connection attempts. This feature is disabled by default to avoid cluttering system logs during normal operation.
Firewall logging is configured through environment variables that can be set in your .env file or passed directly to the container.
| Variable | Default | Description |
|---|---|---|
FIREWALL_LOG_ENABLED |
false |
Enable/disable firewall logging |
FIREWALL_LOG_PREFIX |
FW-BLOCKED |
Prefix for log messages to make filtering easier |
FIREWALL_LOG_LEVEL |
warning |
Kernel log level (debug, info, warning, error) |
FIREWALL_LOG_RATE_LIMIT |
10/min |
Maximum log messages per minute to prevent log flooding |
FIREWALL_LOG_BURST |
5 |
Initial burst of messages allowed before rate limiting |
Create a .env file in your .devcontainer directory:
# Enable firewall logging
FIREWALL_LOG_ENABLED=true
# Optional: Customize logging parameters
FIREWALL_LOG_PREFIX=BLOCKED
FIREWALL_LOG_LEVEL=info
FIREWALL_LOG_RATE_LIMIT=20/min
FIREWALL_LOG_BURST=10Set the environment variable when starting the container:
FIREWALL_LOG_ENABLED=true docker-compose upAdd to your .devcontainer/devcontainer.json:
{
"remoteEnv": {
"FIREWALL_LOG_ENABLED": "true"
}
}Once logging is enabled, blocked connections will be logged to the kernel message buffer. You can view these logs using:
# Show all firewall blocks
sudo dmesg | grep 'FW-BLOCKED'
# Show only outbound blocks
sudo dmesg | grep 'FW-BLOCKED-OUT'
# Show only inbound blocks
sudo dmesg | grep 'FW-BLOCKED-IN'# Watch for new blocked connections
sudo dmesg -w | grep 'FW-BLOCKED'
# With timestamps
sudo dmesg -wT | grep 'FW-BLOCKED'# Export logs for analysis
sudo dmesg | grep 'FW-BLOCKED' > /tmp/firewall-blocks.logLog messages follow this format:
[timestamp] FW-BLOCKED-<direction>: IN=<interface> OUT=<interface> SRC=<source_ip> DST=<destination_ip> ...
-
Direction:
IN: Incoming connections blockedOUT: Outgoing connections blockedFWD: Forwarded connections blocked
-
Key Fields:
SRC: Source IP addressDST: Destination IP addressDPT: Destination portPROTO: Protocol (TCP, UDP, ICMP)
# Blocked outbound HTTPS connection
[12345.678] FW-BLOCKED-OUT: IN= OUT=eth0 SRC=172.17.0.2 DST=93.184.216.34 PROTO=TCP DPT=443
# Blocked incoming connection
[12346.789] FW-BLOCKED-IN: IN=eth0 OUT= SRC=192.168.1.100 DST=172.17.0.2 PROTO=TCP DPT=3000
echo "FIREWALL_LOG_ENABLED=true" >> .devcontainer/.env
# Restart the containerTry the network operation that's failing.
# See what was blocked
sudo dmesg -T | grep 'FW-BLOCKED' | tail -20# Extract unique destination IPs
sudo dmesg | grep 'FW-BLOCKED-OUT' | grep -oP 'DST=\K[^ ]+' | sort -u
# Resolve IPs to domains (if possible)
for ip in $(sudo dmesg | grep 'FW-BLOCKED-OUT' | grep -oP 'DST=\K[^ ]+' | sort -u); do
echo -n "$ip: "
nslookup $ip 2>/dev/null | grep 'name =' | cut -d'=' -f2
doneIf you identify legitimate domains being blocked, add them to the allowlist:
# Method 1: Environment variable
CUSTOM_ALLOWED_DOMAINS="example.com,api.service.com"
# Method 2: Project file
echo "example.com" >> .devcontainer/allowed-domains.txt
echo "api.service.com" >> .devcontainer/allowed-domains.txt- Rate Limiting: The default rate limit (10/min) prevents log flooding while still capturing enough data for debugging
- Log Level: Using
warninglevel ensures logs appear in standard system log queries - Overhead: Logging adds minimal overhead due to rate limiting, but should be disabled in production
- Firewall logs may contain sensitive information (IP addresses, connection patterns)
- Logs are stored in kernel memory and cleared on container restart
- Consider log retention policies if exporting logs for analysis
- Enable Only When Debugging: Keep logging disabled during normal development
- Use Specific Prefixes: Customize
FIREWALL_LOG_PREFIXfor easier filtering - Monitor Log Volume: Adjust rate limits if you need more/fewer log entries
- Document Findings: When you identify blocked domains, document why they're needed
- Clean Up: Disable logging once issues are resolved
# Enable logging
FIREWALL_LOG_ENABLED=true
# Try npm install
npm install some-package
# Check what was blocked
sudo dmesg | grep 'FW-BLOCKED' | grep ':443'# Enable verbose logging
FIREWALL_LOG_ENABLED=true
FIREWALL_LOG_LEVEL=info
# Make API request
curl https://api.example.com
# Analyze blocks
sudo dmesg -T | grep 'FW-BLOCKED-OUT'# Enable with higher rate limit for CI
FIREWALL_LOG_ENABLED=true
FIREWALL_LOG_RATE_LIMIT=50/min
# Run CI pipeline
./run-ci.sh
# Export logs for analysis
sudo dmesg | grep 'FW-BLOCKED' > firewall-debug.log