Configuring an External Proxy
Administrators may deploy Kasm Workspaces in a corporate environment that has a forward proxy, such as a ZScaler or BlueCoat device, in these environments Admins may wish to send outbound Kasm user traffic through the corporate proxy.
This document covers the necessary configuration to create a Desktop Image that has the browsers and desktop applications configured send outbound traffic through the proxy. It assumes you understand the process for Building Custom Images.
The example URL: http://10.10.1.1:3128 can be replaced with the URL of your forward proxy server.
Creating the Custom Image
-
SSH to the Kasm Workspaces server and clone the example Git repository that has examples of custom images.
git clone https://github.com/kasmtech/workspaces-imagescd workspaces-images -
Create a file named
proxy.jsonwith the following contents. Ensure thathttp://10.10.1.1:3128is replaced with the URL of your proxy server. This file will be copied into our image using theCOPYcommand in our Dockerfile and will be used by the Chrome Browser.{"ProxyMode": "fixed_servers","ProxyServer": "10.10.1.1:3128","ProxyBypassList": ""} -
Create a file named
policies.jsonwith the following contents. : Ensure thathttp://10.10.1.1:3128is replaced with the URL of your proxy server. This file will be copied into our image using theCOPYcommand in our Dockerfile and will be used by the Firefox Browser.{"policies": {"Proxy": {"Mode": "manual","Locked": true,"HTTPProxy": "10.10.1.1:3128","UseHTTPProxyForAllProtocols": true,"Passthrough": ""}}} -
Next we will create a Dockerfile that applies our proxy configs to the Browsers and the Desktop OS. In this example we are basing our image off the
kasmweb/desktopimage, but any image that has the desired browsers installed will work.Create a file named
Dockerfilewith the following contents. Ensure thathttp://10.10.1.1:3128is replaced with the URL of your proxy server.FROM kasmweb/desktop:1.18.1USER rootENV HOME /home/kasm-default-profileENV STARTUPDIR /dockerstartupENV INST_SCRIPTS $STARTUPDIR/installWORKDIR $HOME######### Customize Container Here ############ Install Custom Certificate Authority# COPY ./src/ubuntu/install/certificates $INST_SCRIPTS/certificates/# RUN bash $INST_SCRIPTS/certificates/install_ca_cert.sh && rm -rf $INST_SCRIPTS/certificates/ENV http_proxy http://10.10.1.1:3128ENV https_proxy http://10.10.1.1:3128ENV ftp_proxy http://10.10.1.1:3128COPY ./proxy.json /etc/opt/chrome/policies/managed/proxy.jsonCOPY ./policies.json /usr/lib/firefox/distribution/policies.json######### End Customizations ###########RUN chown 1000:0 $HOMERUN $STARTUPDIR/set_user_permission.sh $HOMEENV HOME /home/kasm-userWORKDIR $HOMERUN mkdir -p $HOME && chown -R 1000:0 $HOMEUSER 1000 -
If your proxy server is terminating SSL connections, you may need to load your custom root CA certificate onto your system. To do that you need to complete the following:
-
Place your certificate in the following directory, overwriting the placeholder file that is currently there
./src/ubuntu/install/certificates/ca.crt(ensure it is named ca.crt). -
Edit
Dockerfileand uncomment the following lines – ( Remove the “#” characters ):...# Install Custom Certificate Authority# COPY ./src/ubuntu/install/certificates $INST_SCRIPTS/certificates/# RUN bash $INST_SCRIPTS/certificates/install_ca_cert.sh && rm -rf $INST_SCRIPTS/certificates/......# Install Custom Certificate AuthorityCOPY ./src/ubuntu/install/certificates $INST_SCRIPTS/certificates/RUN bash $INST_SCRIPTS/certificates/install_ca_cert.sh && rm -rf $INST_SCRIPTS/certificates/...
-
-
Build the image
sudo docker build -t desktop:custom -f Dockerfile . -
Register the new image in the Kasm UI. See Building Custom Images.