Proxy - System HTTP/HTTPS Proxy
System Proxy in VyOS
Overview
The system proxy server in VyOS lets you define a centralized access point for all outbound HTTP, HTTPS, and FTP connections initiated by the system. This is essential in enterprise environments where direct internet access is restricted by security policies.
Purpose
The proxy server configuration in VyOS is used for:
- System updates: Downloading new VyOS images with the
add system imagecommand - Package installation: Accessing package repositories through the proxy
- File downloads: System operations that require access to external resources
- Centralized traffic management: A single control point for outbound connections
- Corporate policy compliance: Enforced use of the corporate proxy
Use cases
The system proxy applies to the following scenarios:
- Corporate networks: Mandatory use of a corporate proxy server
- Isolated segments: DMZ zones with restricted internet access
- Cloud infrastructures: Yandex Cloud, VK Cloud with centralized traffic management
- Auditing and monitoring: Control over all outbound connections
- Caching: Optimized delivery of frequently used resources
How it works
When you configure the system proxy, VyOS:
- Sets the environment variables
http_proxy,https_proxy, andftp_proxy - Applies the settings to all system processes
- Routes all HTTP/HTTPS/FTP connections through the proxy
- Supports authentication per RFC 7617 (Basic Authentication)
- Allows specific hosts to be excluded from proxying
Configuration
Basic proxy setup
Setting the proxy server URL
set system proxy url <proxy-url>Parameters:
<proxy-url>: Proxy server URL (with the http:// or https:// scheme)
Example:
configure
set system proxy url http://proxy.example.com
commit
saveSetting a non-standard port
By default, port 80 is used for the HTTP proxy. To change the port:
set system proxy port <port-number>Parameters:
<port-number>: Port number (1-65535)
Example:
configure
set system proxy url http://proxy.example.com
set system proxy port 8080
commit
saveProxy server authentication
VyOS supports HTTP Basic authentication in accordance with RFC 7617.
Setting the username
set system proxy username <username>Parameters:
<username>: Username for authentication
Setting the password
set system proxy password <password>Parameters:
<password>: Password for authentication
Full configuration example with authentication:
configure
set system proxy url http://proxy.corp.local
set system proxy port 3128
set system proxy username admin
set system proxy password SecurePassword123
commit
saveProxy exclusions (No-Proxy)
Some hosts or subnets may require a direct connection without going through the proxy.
Note: As of VyOS 1.4/1.5, there is no explicit no-proxy command in the standard configuration, but you can use environment variables directly through scripts or configure exclusions at the proxy server level.
Configuration examples
Example 1: Simple proxy without authentication
Scenario: An organization uses the proxy server proxy.company.ru on the standard port 8080.
configure
# Configure the proxy server
set system proxy url http://proxy.company.ru
set system proxy port 8080
# Apply the configuration
commit
save
exitResult:
vyos@router:~$ env | grep -i proxy
http_proxy=http://proxy.company.ru:8080
https_proxy=http://proxy.company.ru:8080
ftp_proxy=http://proxy.company.ru:8080Example 2: Yandex Cloud - Corporate proxy for updates
Scenario: VyOS in Yandex Cloud, with internet access only through a corporate proxy server that requires authentication.
configure
# Core proxy parameters
set system proxy url http://proxy.yandex-cloud.internal
set system proxy port 3128
# Authentication
set system proxy username yc-vyos-router
set system proxy password 'Yc!Pr0xy@2024'
# Apply the configuration
commit
save
exitVerifying connectivity:
# Check the environment variables
vyos@yc-router:~$ env | grep -i proxy
# Test a download through the proxy
vyos@yc-router:~$ curl -I https://cloud.yandex.ruUpdating the VyOS image through the proxy:
add system image https://downloads.vyos.io/rolling/current/vyos-1.5-rolling-latest.isoExample 3: VK Cloud - Proxy with authentication
Scenario: VyOS in VK Cloud (Mail.ru Cloud Solutions), a segmented network with a mandatory proxy.
configure
# Configure the VK Cloud proxy
set system proxy url http://proxy.vkcloud.local
set system proxy port 8888
# User authentication
set system proxy username vk-network-admin
set system proxy password 'VKCloud$ecure2024'
# Apply and save
commit
save
exitVerifying the configuration:
show system proxyExpected output:
proxy {
port 8888
url http://proxy.vkcloud.local
username vk-network-admin
password ****************
}Example 4: Multi-tier infrastructure
Scenario: A DMZ segment with access through a corporate proxy and protocol-specific settings.
configure
# DMZ proxy server
set system proxy url http://dmz-proxy.corp.local
set system proxy port 8080
# Account for the DMZ router
set system proxy username dmz-vyos-01
set system proxy password 'DmZ!R0ut3r#2024'
commit
save
exitAdditional configuration through environment variables (in scripts):
Create the script /config/scripts/proxy-exceptions.sh:
#!/bin/bash
# Additional proxy settings
export no_proxy="localhost,127.0.0.1,10.0.0.0/8,192.168.0.0/16,172.16.0.0/12,.local,.corp.local"
export NO_PROXY="$no_proxy"Example 5: HTTPS proxy with SSL
Scenario: Using an HTTPS proxy server with an encrypted connection.
configure
# HTTPS proxy
set system proxy url https://secure-proxy.enterprise.com
set system proxy port 8443
# Authentication
set system proxy username enterprise-router
set system proxy password 'EnT3rpr!se#SSL'
commit
save
exitImportant: When the proxy server uses self-signed certificates, SSL verification issues may occur. In such cases, additional configuration to trust the certificate at the system level may be required.
Verifying the configuration
Viewing the current proxy settings
show system proxyExample output:
proxy {
port 8080
url http://proxy.example.com
username admin
password ****************
}Checking the environment variables
env | grep -i proxyExpected output:
http_proxy=http://admin:SecurePassword123@proxy.example.com:8080
https_proxy=http://admin:SecurePassword123@proxy.example.com:8080
ftp_proxy=http://admin:SecurePassword123@proxy.example.com:8080Testing connectivity through the proxy
Checking an HTTP connection
curl -I http://example.comChecking an HTTPS connection
curl -I https://www.google.comDetailed diagnostics with curl
curl -v -x http://proxy.example.com:8080 https://downloads.vyos.ioParameters:
-v: Verbose output-x: Explicitly specify the proxy server
Verifying that updates work
# Attempt to download a VyOS image
add system image https://downloads.vyos.io/rolling/current/vyos-1.5-rolling-latest.isoIf the proxy is configured correctly, the download will proceed through the specified proxy server.
Operational commands
Viewing the configuration in configuration mode
configure
show system proxyViewing in JSON format
show configuration json | jq '.system.proxy'Example output:
{
"port": "8080",
"url": "http://proxy.example.com",
"username": "admin"
}Exporting the proxy configuration
show configuration commands | grep "system proxy"Output:
set system proxy port '8080'
set system proxy url 'http://proxy.example.com'
set system proxy username 'admin'Environment variables
VyOS automatically creates the following environment variables when the proxy is configured:
http_proxy
Used for HTTP connections.
Format:
http_proxy=http://[username:password@]proxy-url:porthttps_proxy
Used for HTTPS connections.
Format:
https_proxy=http://[username:password@]proxy-url:portNote: Even for HTTPS connections, the http:// scheme is often used for the proxy connection itself if the proxy does not require SSL.
ftp_proxy
Used for FTP connections.
Format:
ftp_proxy=http://[username:password@]proxy-url:portno_proxy
A list of hosts and subnets that should not be proxied.
Format:
no_proxy=localhost,127.0.0.1,.local,10.0.0.0/8Note: In the standard VyOS configuration, no_proxy must be configured manually through scripts.
Troubleshooting
Problem 1: The proxy is not applied
Symptoms:
- Update commands do not work
- Environment variables are not set
Solution:
# Check the configuration status
show system proxy
# Make sure the configuration is committed
configure
commit
save
# Restart the session
exitProblem 2: Authentication error 407
Symptoms:
HTTP 407 Proxy Authentication RequiredSolution:
configure
# Verify the credentials
show system proxy
# Update the password
set system proxy password 'NewPassword'
commit
saveProblem 3: Connection timeouts
Symptoms:
- Long waits when attempting to connect
- Timeout errors
Diagnostics:
# Check that the proxy server is reachable
ping proxy.example.com
# Check the proxy port
telnet proxy.example.com 8080
# Check network connectivity
traceroute proxy.example.comSolution:
configure
# Make sure the URL and port are correct
set system proxy url http://proxy.example.com
set system proxy port 8080
# Check the route to the proxy
show ip route
commit
saveProblem 4: SSL/TLS errors with an HTTPS proxy
Symptoms:
SSL certificate problem: self signed certificateDiagnostics:
# Check the proxy certificate
openssl s_client -connect proxy.example.com:8443
# Check the environment variables
env | grep -i proxyTemporary workaround for testing:
# Disable SSL verification (for testing only!)
curl -k https://example.comPermanent solution:
Add the proxy certificate to the trusted store:
configure
# Install the CA certificate
set pki ca proxy-ca certificate '<base64-encoded-cert>'
commit
saveProblem 5: Some services do not use the proxy
Symptoms:
- System commands work through the proxy
- Custom scripts ignore the proxy
Solution:
Make sure the scripts inherit the environment variables:
#!/bin/vbash
source /etc/profile.d/vyatta-environment.sh
# Explicitly set the proxy
export http_proxy="http://proxy.example.com:8080"
export https_proxy="http://proxy.example.com:8080"
# Your codeProblem 6: The proxy blocks internal resources
Symptoms:
- Access to internal servers does not work
- Internal DNS queries go through the proxy
Solution:
Configure exclusions through no_proxy:
Create the script /config/scripts/post-config.d/proxy-no-proxy.sh:
#!/bin/bash
# Proxy exclusions
export no_proxy="localhost,127.0.0.1,10.0.0.0/8,192.168.0.0/16,172.16.0.0/12,.local,.internal"
export NO_PROXY="$no_proxy"
# Save to the profile
cat > /etc/profile.d/no-proxy.sh << EOF
export no_proxy="$no_proxy"
export NO_PROXY="$no_proxy"
EOFMake the script executable:
chmod +x /config/scripts/post-config.d/proxy-no-proxy.shBest practices
1. Credential security
Not recommended:
set system proxy password 'password123'Recommended:
- Use strong passwords
- Rotate credentials regularly
- Use separate accounts for each router
- Limit the privileges of proxy accounts
set system proxy username vyos-router-01
set system proxy password 'C0mpl3x!P@ssw0rd#2024'2. Documenting the configuration
Add comments to the configuration:
configure
set system proxy url http://proxy.corp.local
set system proxy port 3128
# Store the information in the system description
set system host-name vyos-with-proxy
set system domain-name corp.local
commit comment "Configured corporate proxy for system updates"
save3. Monitoring and logging
Create the monitoring script /config/scripts/check-proxy.sh:
#!/bin/bash
LOGFILE="/var/log/vyos/proxy-check.log"
PROXY_HOST="proxy.corp.local"
PROXY_PORT="8080"
# Logging function
log() {
echo "[$(date +'%Y-%m-%d %H:%M:%S')] $1" >> $LOGFILE
}
# Check proxy availability
if timeout 5 bash -c "cat < /dev/null > /dev/tcp/$PROXY_HOST/$PROXY_PORT" 2>/dev/null; then
log "SUCCESS: Proxy $PROXY_HOST:$PROXY_PORT is reachable"
exit 0
else
log "ERROR: Proxy $PROXY_HOST:$PROXY_PORT is unreachable"
exit 1
fiMake the script executable:
chmod +x /config/scripts/check-proxy.shSet up a periodic check through the task scheduler:
configure
set system task-scheduler task check-proxy interval 5m
set system task-scheduler task check-proxy executable path /config/scripts/check-proxy.sh
commit
save4. Backup proxy server
For critical systems, prepare an alternative configuration:
Create the script /config/scripts/proxy-failover.sh:
#!/bin/vbash
source /opt/vyatta/etc/functions/script-template
PRIMARY_PROXY="proxy-primary.corp.local:8080"
SECONDARY_PROXY="proxy-backup.corp.local:8080"
# Check the primary proxy
if timeout 3 curl -s -o /dev/null -x http://$PRIMARY_PROXY http://connectivity-check.vyos.io; then
echo "Primary proxy is working"
configure
set system proxy url http://proxy-primary.corp.local
set system proxy port 8080
commit
exit 0
else
echo "Primary proxy failed, switching to backup"
configure
set system proxy url http://proxy-backup.corp.local
set system proxy port 8080
commit
save
fi5. Testing after changes
After any changes to the proxy configuration:
# 1. Check the configuration
show system proxy
# 2. Check the environment variables
env | grep -i proxy
# 3. Test HTTP connection
curl -I http://connectivity-check.vyos.io
# 4. Test HTTPS connection
curl -I https://www.google.com
# 5. Try downloading a small file
curl -o /tmp/test.txt http://ipv4.download.thinkbroadband.com/5MB.zip6. Routine maintenance
Create a routine maintenance checklist:
Weekly:
- Review the proxy logs
/var/log/vyos/proxy-check.log - Test proxy server availability
Monthly:
- Update passwords (under a rotation policy)
- Check VyOS versions and available updates
Quarterly:
- Audit the proxy configuration
- Test the failover procedure
- Update the documentation
7. Exclusions for internal resources
Always configure exclusions for:
# Local addresses
localhost, 127.0.0.1, ::1
# RFC 1918 private networks
10.0.0.0/8
172.16.0.0/12
192.168.0.0/16
# Link-local
169.254.0.0/16
# Internal domains
.local, .internal, .corp, .lan
# Cloud metadata services
169.254.169.254 (AWS, Yandex Cloud, VK Cloud)8. Integration with monitoring systems
Export metrics for Prometheus/Grafana:
Create /config/scripts/proxy-metrics.sh:
#!/bin/bash
METRICS_FILE="/var/lib/node_exporter/textfile_collector/proxy_status.prom"
PROXY_HOST="proxy.corp.local"
PROXY_PORT="8080"
# Check availability
if timeout 3 bash -c "cat < /dev/null > /dev/tcp/$PROXY_HOST/$PROXY_PORT" 2>/dev/null; then
STATUS=1
else
STATUS=0
fi
# Write the metrics
cat > $METRICS_FILE << EOF
# HELP vyos_proxy_status Proxy server availability (1 = up, 0 = down)
# TYPE vyos_proxy_status gauge
vyos_proxy_status{host="$PROXY_HOST",port="$PROXY_PORT"} $STATUS
EOFInteraction with other components
Updating system images
When a proxy is configured, the add system image command automatically uses the proxy:
add system image https://downloads.vyos.io/rolling/current/vyos-1.5-rolling-latest.isoInstalling packages with apt
If you need to install additional packages:
# The proxy variables are inherited
sudo apt update
sudo apt install <package-name>Container (Podman) configuration
Containers may require separate proxy configuration:
configure
# Example container configuration with a proxy
set container name myapp environment HTTP_PROXY value 'http://proxy.example.com:8080'
set container name myapp environment HTTPS_PROXY value 'http://proxy.example.com:8080'
set container name myapp environment NO_PROXY value 'localhost,127.0.0.1,.local'
commit
saveVPN and proxy
When using VPN tunnels, make sure that traffic to the proxy server does not go through the VPN:
configure
# Add a route to the proxy server through the main gateway
set protocols static route <proxy-network>/24 next-hop <gateway-ip>
commit
saveSecurity
Security recommendations
- Password encryption: Passwords are stored in encrypted form in the configuration
- Account isolation: Use separate accounts for different routers
- Privilege restriction: Proxy accounts should have the minimum necessary privileges
- Auditing: Log all connections through the proxy at the proxy server level
- Monitoring: Watch for anomalous activity
Protecting credentials
# After configuring the proxy with a password
configure
commit
save
# The password is encrypted in the configuration
show system proxyOutput:
proxy {
password ****************
port 8080
url http://proxy.example.com
username admin
}Access logging
On the proxy server side, configure detailed logging for auditing:
Squid example:
access_log /var/log/squid/access.log squid
auth_param basic program /usr/lib/squid/basic_ncsa_auth /etc/squid/passwords
auth_param basic realm VyOS Proxy AuthenticationRemoving the proxy configuration
To completely remove the proxy settings:
configure
# Delete the entire proxy configuration
delete system proxy
commit
save
exitVerification:
env | grep -i proxyThe output should be empty after the configuration is removed.
Version compatibility
VyOS 1.4 (Sagitta LTS)
Fully supported:
- Basic proxy configuration
- Authentication
- Environment variables
VyOS 1.5 (Circinus/Current)
Fully supported:
- All features from 1.4
- Improved HTTPS proxy handling
- Better integration with containers
Note: The configuration syntax is identical across versions.
References and resources
Official documentation
RFC standards
Related documentation sections
- System Login - User management and authentication
- System Syslog - Logging of system events
- Task Scheduler - Task automation
Conclusion
The system proxy in VyOS is an essential component for operating in corporate and cloud environments with restricted internet access. A properly configured proxy ensures:
- The ability to update the system
- Compliance with corporate security policies
- Centralized management of outbound traffic
- Auditing and monitoring of network activity
Follow the security recommendations and best practices to ensure reliable and secure operation of your VyOS-based network infrastructure.