Skip to content

Instantly share code, notes, and snippets.

@jnimmo
Last active February 1, 2023 23:23
Show Gist options
  • Save jnimmo/cc9488f0e08b7ab655129ca48b07a430 to your computer and use it in GitHub Desktop.
Save jnimmo/cc9488f0e08b7ab655129ca48b07a430 to your computer and use it in GitHub Desktop.
Docker Compose file to configure a container with TLS inspection proxy
version: '3.7'
services:
ubuntu:
image: ubuntu:jammy
container_name: vscode-server
environment:
- http_proxy=<----PROXY_URL---->
- TZ=Etc/UTC
- DEBIAN_FRONTEND=noninteractive
command: /bin/bash -c "if [ ! -f /root/.installed ]; then \
apt-get update && apt-get install -y curl openssh-server nano python3 python3-pip git && \
echo 'root:rootpassword' | chpasswd && \
sed -i 's/#PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config && \
echo 'Acquire::http::Proxy \"$http_proxy\";' > /etc/apt/apt.conf.d/proxy.conf && \
echo 'http_proxy=\"$http_proxy\"' >> /etc/environment && \
echo 'https_proxy=\"$http_proxy\"' >> /etc/environment && \
echo 'REQUESTS_CA_BUNDLE=\"/usr/local/share/ca-certificates/proxy_ca.crt\"' >> /etc/environment && \
echo 'NODE_EXTRA_CA_CERTS=\"/usr/local/share/ca-certificates/proxy_ca.crt\"' >> /etc/environment && \
curl -fsSL https://deb.nodesource.com/setup_18.x | bash - && apt-get install -y nodejs && \
git config --global http.proxy $http_proxy && git config --global http.sslVerify false && \
touch /root/.installed; fi && \
service ssh start && \
echo $ 'Instance configured:' && \
echo $ ' [x] Proxy server - $http_proxy' && \
echo $ ' [x] TLS Certificate installed' && \
echo $ ' [x] Configured Git proxy' && \
echo $ ' [x] Configured Python requests trusted root CA' && \
echo $ ' [x] SSH enabled (root@127.0.0.1 -p 2222)' && \
echo $ ' [x] Root password - rootpassword' && \
echo $ 'Run ssh-copy-id root@127.0.0.1 -p 2222 to enable passwordless authentication.' && \
tail -f /dev/null"
ports:
- 127.0.0.1:2222:22
restart: unless-stopped
volumes:
- <----PATH_TO_CUSTOM_ROOT_CA---->:/usr/local/share/ca-certificates/proxy_ca.crt
- <----PATH_TO_HOME_DIR---->:/home/user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment