Last active
February 1, 2023 23:23
-
-
Save jnimmo/cc9488f0e08b7ab655129ca48b07a430 to your computer and use it in GitHub Desktop.
Docker Compose file to configure a container with TLS inspection proxy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ([email protected] -p 2222)' && \ | |
echo $ ' [x] Root password - rootpassword' && \ | |
echo $ 'Run ssh-copy-id [email protected] -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