Star 0
Version 1.10.1
SSH Bastion Flavour
Maintainers
support[at]europeanweather.cloud
License
Support level
EWC
Category
Remote Access & Desktop
Technology
Ansible Playbook

SSH Bastion Flavour

The SSH bastion or proxy server is a barrier between your internal machines (which lack a public or floating IP address) and the public internet. With the SSH proxy, you'll have an extra layer of security on top of your instances. It's equipped with Fail2ban, intrusion prevention software designed to prevent brute-force attacks.

This template is for tenant admins wishing to hardening the way tenant users connect to the European Weather Cloud (EWC), as well as tenant users whom are mindful about safe-keeping the compute resources or data withing their work environments.

Functionality

The template is designed to:

  • Configure a pre-existing virtual machine running RockyLinux, with public IP address, and a minimum recommended 4GB of RAM, as entrypoint for users who wish to reach private EWC networks, from the public internet, via SSH.

Prerequisites

💡 This Item is supported by the EWCCLI, and can be deployed, together with a compatible VM, via it. Checkout the EWC User Stories: I want to use the ewccli documentation pages to learn how.

  • Install git (version 2.0 or higher )

  • Install python (version 3.9 or higher)

  • Install ansible (version 2.15 or higher)

  • Verify the ssh-https OpenStack Security Group exists in your EWC tenancy

    💡 You may create Security Groups via this EWC Community Hub Item if pre-required ones are missing.

  • If you plan to configure an existing VM, ensure it meets the minium requirements before moving on to the Usage section below:

    • VM Image: RockyLinux 8 or 9
    • VM Plan: 2 CPU cores, 4GB RAM, 30GB Disk
    • Network: Private
    • Security Groups: ssh-https
    • Floating IP: Required

    Otherwise, provision a new VM with above specifications before continuing (see EWC Getting Started: Provision a VM for details).

Usage

1. Clone the repository

git clone https://github.com/ewcloud/ewc-ansible-playbook-flavours-and-provisioning.git

1.1. Change to the specific Item's subdirectory

cd playbooks/ssh-bastion-flavour

1.2. Checkout an specific Item's version

⚠️ Make sure to replace x.y.z in the command below, with your version of preference.

git checkout x.y.z

2. Download Ansible dependencies

💡 By default, Ansible Roles are installed under the ~/.ansible/roles directory within your working environment.

Download the correct version of the Ansible dependencies, if you haven't done so already:

ansible-galaxy role install --force -r requirements.yml

3. Specify the target host and SSH credentials

Create an inventory file, to specify address/credentials that your local working environment should use to connect to the target VM.

Copy into the file one of the two snippets below, and replace the placeholders (i.e. values enclosed in < > characters):

  • Connecting form within the EWC tenancy's network

    # inventory.yml
    ---
    ewcloud:
      hosts:
        target:
          ansible_python_interpreter: /usr/bin/python3
          ansible_host: <add the IPV4 address of the target host>
          ansible_ssh_private_key_file: <add the path to local SSH private key file>
          ansible_user: cloud-user
          ansible_ssh_common_args: -o StrictHostKeyChecking=no
    

OR

  • Connecting from outside the EWC tenancy's network

    ⚠️ This requires an SSH Bastion to be already provisioned within your EWC tenancy.

    # inventory.yml
    ---
    ewcloud:
      hosts:
        target:
          ansible_host: <add the IP address of the target host>
          ansible_ssh_user: cloud-user
          ansible_ssh_private_key_file: <add the path to local SSH private key file>
          ansible_python_interpreter: auto
    
    all:
      vars:
        ansible_ssh_common_args: >-
          -o StrictHostKeyChecking=no
          -o UserKnownHostsFile=/dev/null
          -o ProxyCommand="ssh
                          -o StrictHostKeyChecking=no
                          -o UserKnownHostsFile=/dev/null
                          -o BatchMode=yes
                          -W %h:%p
                          -i <add the path to local SSH private key file>
                          cloud-user@<add the IP address of the ssh bastion>"
    
    

4. Configure and apply the template

  • Interactive Mode

    By running the following command, you can trigger an interactive session that prompts you for the necessary user inputs, and then applies changes to your target EWC environment:

    ansible-playbook -i inventory.yml ssh-bastion-flavour.yml
    

OR

  • Non-Interactive Mode

    💡 To learn more about defining variables at runtime, checkout the official Ansible documentation.

    You can also run in non-interactive mode by passing the --extra-vars or -e flag, followed by a map of key-value pairs; one for each and every available input (see inputs section below). For example:

    ansible-playbook \
      -i inventory.yml \
      -e '{
          "fail2ban_whitelisted_ip_ranges": ""
        }' \
      ssh-bastion-flavour.yml
    

Inputs

Name Description Type Default Required
fail2ban_whitelisted_ip_ranges IPv4 ranges (in CIDR format) to be whitelisted in Fail2ban configuration. When in doubt, do not set. Example: ['10.0.0.0/24','192.168.1.0/24'] list(string) null no

Dependencies

💡 Upon execution, a SBOM (SPDX format) is auto-generated and stored in the VM's file system root directory (see /sbom.json).

Name Home URL
ewc-ansible-role-ssh-bastion https://github.com/ewcloud/ewc-ansible-role-ssh-bastion

Operation

Checkout the following how-to guides to learn about management of Item after initial setup:

Other
Deployable
EWCCLI-compatible