Featured resource
Forrester Wave Report 2025
Pluralsight named a Leader in the Forrester Wave™

Our tech skill development platform earned the highest scores possible across 11 criteria.

Learn more
  • Labs icon Lab
  • Cloud
Google Cloud Platform icon
Labs

Design a Container to Run a Proxy

For this lab, the aim is to design a container to run a proxy. We need to connect to the server, create our configuration there, and test it out from a client. We recommended opening two terminals for this lab, one for connecting to the server and one to the client. The client is a playground instance of our choice. Once that is set, we need to create a container with a CentOS 7 image on the server. Within the container, we must install and configure the open ssh server so that it cannot allow `root` login and allows only key-based authentication. After that, we must change it to run on the nonstandard port 61613. After that, we need to copy the public key generated on the client over to the container on the server. Next, we have to create a proxy tunnel from the client and run tests to see if the tunnel works properly. For testing this, we need Proxychains 4.

Google Cloud Platform icon
Labs

Path Info

Level
Clock icon Intermediate
Duration
Clock icon 1h 30m
Published
Clock icon May 15, 2020

Contact sales

By filling out this form and clicking submit, you acknowledge our privacy policy.

Table of Contents

  1. Challenge

    Create a Container from a CentOS 7 image and Access It

    lxc launch images:centos/7/amd64 SOCKS5-Proxy
    
    lxc exec SOCKS5-Proxy bash
    
  2. Challenge

    Configure SSH to not Allow root Login and Only Allow Key-Based Authentication

    adduser tunnel -m
    passwd tunnel
    
    yum install openssh-server vim
    
    vim /etc/ssh/sshd_config
    
    PermitRootLogin no
    PubkeyAuthentication yes
    ChallengeResponseAuthentication no
    PasswordAuthentication no
    UsePAM yes
    
    ESC
    :wq
    ENTER
    
    su tunnel
    
    mkdir /home/tunnel/.ssh
    touch /home/tunnel/.ssh/authorized_keys
    
    chmod 700 /home/tunnel/.ssh
    chmod 600 /home/tunnel/.ssh/authorized_keys
    
  3. Challenge

    On the Client, Generate a Key Pair and Copy the Public Key to /home/tunnel/.ssh/authorized_keys

    Set the path to /home/cloud_user/.ssh/SOCKS5.

    ssh-keygen
    
    cat /home/cloud_user/.ssh/SOCKS5.pub 
    

    Copy the client public key to the server into authorized_keys

    /home/tunnel/.ssh/authorized_keys
    
  4. Challenge

    Configure SSH for Port 61613 and Expose the Container to the Outside World

    If under a different user in the container, just exit to root.

    exit
    
    vim /etc/ssh/sshd_config
    
    Port 61613
    
    ESC
    :wq
    ENTER
    
    systemctl restart sshd 
    
    exit
    

    Create a redirect on the host server.

    lxc list
    
    lxc config device add SOCKS5-Proxy myport443 proxy listen=tcp:0.0.0.0:443 connect=tcp:Container_IP:61613
    
  5. Challenge

    Run Tests to Confirm the Proxy Works on the Client (Refer to Lab Instructions for proxychains)

    ssh tunnel@SERVER_IP -i /home/cloud_user/.ssh/SOCKS5 -p 443
    
    exit
    
    ssh -D 65535 -q -C -N -f tunnel@SERVER_IP  -i /home/cloud_user/.ssh/SOCKS5 -p 443
    
    sudo apt install proxychains4 
    
    vim /etc/proxychains.conf 
    

    Change the last line to:

    socks5  127.0.0.1 65535
    
    curl 'https://api.ipify.org?format=json'
    
    proxychains4 curl 'https://api.ipify.org?format=json'
    

Pluralsight Skills gives leaders confidence they have the skills needed to execute technology strategy. Technology teams can benchmark expertise across roles, speed up release cycles and build reliable, secure products. By leveraging our expert content, skill assessments and one-of-a-kind analytics, keep up with the pace of change, put the right people on the right projects and boost productivity. It's the most effective path to developing tech skills at scale.

What's a lab?

Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.

Provided environment for hands-on practice

We will provide the credentials and environment necessary for you to practice right within your browser.

Guided walkthrough

Follow along with the author’s guided walkthrough and build something new in your provided environment!

Did you know?

On average, you retain 75% more of your learning if you get time for practice.