Sauce Connect Proxy Configuration
The explicit way to launch a Sauce Connect Proxy tunnel is to run a single command line comprised of all flags and any optional flags you want to use to customize tunnel behavior. It's also possible to pass the same command-line arguments through a config file, and as environment variables. If you pass the same argument through multiple methods, the order of precedence is as follows (from highest to lowest):
- command-line option
- environment variable
- YAML config file
Config File
The Sauce Connect Proxy config file may contain any CLI flag. It may also contain comments that could help make its content more readable, for example:
---
region: 'us-west'
username: 'janedoe-sauce'
access-key: 'xxxx-xxx-xxx'
# this is my log file for SC I use for Mac OS tests.
log-file: '/tmp/sc-mac.log'
# this is the tunnel I use for Mac OS tests
tunnel-name: 'my-macos'
Config File Reference
sc run config-file
command's output below contains all the available options
and their usage.
sc run config-file
output
Use Cases
We recommend using a configuration file in production environments.
- Facilitates tracking tunnel configuration changes because they're all included in a single file.
- Facilitates management of potentially long CLI options such as tunnel-domains and direct-domains.
- Secures Sauce Connect Proxy credentials with tighter access control.
Using the Config File
To launch a tunnel using a config.yml file option.
- Create Sauce Connect Proxy config file in any location, for example:
$HOME/sc/config.yml
(%HOMEPATH%\sc\config.yml
for Windows). - Enter values for the properties you'd like to use.
- Use the
--config-file
flag to run Sauce Connect Proxy with your configuration file.
- Mac/Linux
- Windows
./sc run -c ~/sc/config.yml
sc.exe run -c %HOMEPATH%\sc\config.yml
Environment Variables
You can set via environment variables all Sauce Connect Proxy command-line options. Each option description includes the corresponding environment variable.
Use Cases
We recommend configuring options via environment variables in the following scenarios.
- Sauce Connect Proxy command containing credentials may be exposed via process monitoring tools such as
ps
. - When running Sauce Connect Proxy in CI/CD environment to avoid clear-text logging your credentials.
- Sauce Connect Proxy runs in a docker container, and a CI system (such as GitLab) supports secure environment variables.
Environment Variables For Security
The following flags may contain sensitive information:
We recommend using environment variables for these flags.
Environment Variable | Description | Corresponding CLI Option |
---|---|---|
SAUCE_USERNAME | Sets your Sauce Labs username. | --username |
SAUCE_ACCESS_KEY | Sets your Sauce Labs access key. | --access-key |
SAUCE_AUTH | Sets site or upstream proxy basic authentication credentials. | --auth |
SAUCE_PROXY | The basic authentication username and password can be specified in the host string, e.g. user:pass@host:port. | --proxy |
SAUCE_PROXY_SAUCE | The basic authentication username and password can be specified in the host string, e.g. user:pass@host:port. | --proxy-sauce |
SAUCE_HEADER | May contain headers with sensitive information. | --header |
SAUCE_API_BASIC_AUTH | Contains an optional internal API server authentication. | --api-basic-auth |
Running Sauce Connect Proxy With Environment Variables
- macOS and Linux
- Windows
- In your terminal window, set the following environment variables
export SAUCE_USERNAME="your Sauce username"
export SAUCE_ACCESS_KEY="your Sauce access key"
export SAUCE_REGION="<us-west|eu-central>"
export SAUCE_TUNNEL_NAME="your tunnel name" - Starting a new Sauce Connect Proxy does not require adding required flags.
sc
You can persist Sauce Connect Proxy environment variables by adding them to one of your user environment configuration files, such as .bash_profile
or .zshrc
.
- Open the Control Panel and click the System icon to open the System Properties dialog.
- Click Environment Variables to open the Environment Variables dialog.
- In the User variables section, click New to open the New System Variable dialog.
- For Variable name, enter SAUCE_USERNAME and for Variable value, enter your Sauce username and then click OK.
- Repeat 3-4 to set up the SAUCE_ACCESS_KEY, SAUCE_REGION, SAUCE_TUNNEL_NAME or any other environment variable.
- Confirm that your environment variables have been set by typing
echo %SAUCE_USERNAME%
in your terminal. The response should be your username value. Then do the same for your access key. - Starting a new Sauce Connect Proxy will not require adding required flags.
sc.exe