This repository has been archived by the owner on May 27, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1007 from deNBI/staging
Staging
- Loading branch information
Showing
45 changed files
with
1,310 additions
and
1,117 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: build-image | ||
on: pull_request | ||
jobs: | ||
jobs: | ||
build-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,5 +34,3 @@ jobs: | |
password: ${{ secrets.DOCKER_PASSWORD }} | ||
dockerfile: Dockerfile | ||
tags: ${{ steps.tag.outputs.TAG }} | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
default_stages: [ commit ] | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.1.0 | ||
hooks: | ||
- id: trailing-whitespace | ||
- id: end-of-file-fixer | ||
- id: check-yaml | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 22.1.0 | ||
hooks: | ||
- id: black | ||
- repo: https://github.com/sondrelg/pep585-upgrade | ||
rev: 'v1' # Use the sha / tag you want to point at | ||
hooks: | ||
- id: upgrade-type-hints | ||
|
||
- repo: https://github.com/PyCQA/isort | ||
rev: 5.10.1 | ||
hooks: | ||
- id: isort | ||
- repo: https://github.com/neutrinoceros/flynt/ | ||
rev: '' | ||
hooks: | ||
- id: flynt | ||
|
||
- repo: https://github.com/myint/autoflake | ||
rev: v1.4 | ||
hooks: | ||
- id: autoflake | ||
args: | ||
- --in-place | ||
- --remove-all-unused-imports | ||
|
||
- repo: https://github.com/PyCQA/flake8 | ||
rev: 4.0.1 | ||
hooks: | ||
- id: flake8 | ||
args: [ "--config=setup.cfg" ] | ||
additional_dependencies: [ flake8-isort ] | ||
|
||
# sets up .pre-commit-ci.yaml to ensure pre-commit dependencies stay up to date | ||
ci: | ||
autoupdate_schedule: weekly | ||
skip: [ ] | ||
submodules: false |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
# Project Gateway | ||
# Project Gateway | ||
|
||
The single VM feature of the de.NBI portal allows a registered user to start a virtual machine without having a project located at a specific cloud location. VMs are instantiated in a project associated to the portal. The association between the user and the virtual machine is done and only known by the de.NBI portal. | ||
The single VM feature of the de.NBI portal allows a registered user to start a virtual machine without having a project located at a specific cloud location. VMs are instantiated in a project associated to the portal. The association between the user and the virtual machine is done and only known by the de.NBI portal. | ||
|
||
The started VMs can be accessed using ssh (or any technology on top of it, e.g. x2go). However this needs a public available ip address (floating ip) for each running instance. If we don't have IP addresses available (ipv4 addresses are rare), we have to think of another solution. | ||
The started VMs can be accessed using ssh (or any technology on top of it, e.g. x2go). However this needs a public available ip address (floating ip) for each running instance. If we don't have IP addresses available (ipv4 addresses are rare), we have to think of another solution. | ||
|
||
A relative simple solution is to create a ssh gateway for the portal project with a fixed mapping between ports and local ip addresses. Linux can be easily configured to act as gateway/router between networks. This linux property is used by a lot of commercial routers. | ||
A relative simple solution is to create a ssh gateway for the portal project with a fixed mapping between ports and local ip addresses. Linux can be easily configured to act as gateway/router between networks. This linux property is used by a lot of commercial routers. | ||
|
||
The tutorial was tested on Ubuntu 16.04 LTS, but should work on any modern linux OS since nothing Ubuntu-specific has been used. | ||
|
||
## Assumptions | ||
|
||
- portal project with at least one portal user | ||
- full configured project network (router, network/subnet e.g. 192.168.0.0/24) | ||
- full configured project network (router, network/subnet e.g. 192.168.0.0/24) | ||
- one public ip address available (e.g. XX.XX.XX.XX) | ||
- accessible and contiguous port range (e.g. 30000-30255), at least one for each local ip address | ||
|
||
|
||
## Step by Step | ||
|
||
The step by step documentation configures one instance to be ssh gateway for another instance in the same network (192.168.0.0/24). | ||
The step by step documentation configures one instance to be ssh gateway for another instance in the same network (192.168.0.0/24). | ||
|
||
- **Create a two instance** (192.168.0.10, 192.168.0.11). | ||
- **Create a two instance** (192.168.0.10, 192.168.0.11). | ||
- **Associate a floating ip** (XX.XX.XX.XX) to the first instance (192.168.0.10). This instance will be the ssh gateway for the second instance. | ||
- **Login into** the floating ip instance (XX.XX.XX.XX) and enable ip forwarding (as root). | ||
|
||
|
@@ -36,7 +36,7 @@ iptables -t nat -A PREROUTING -i ens3 -p tcp -m tcp --dport 30011 -j DNAT --to-d | |
iptables -t nat -A POSTROUTING -d 192.168.00.11/32 -p tcp -m tcp --dport 22 -j SNAT --to-source 192.168.0.10 | ||
``` | ||
|
||
- **Add a OpenStack security group rule** to allow incoming tcp traffic on port 30011. | ||
- **Add a OpenStack security group rule** to allow incoming tcp traffic on port 30011. | ||
|
||
- **Login** into the instance (192.168.0.11) is now possible without adding a floating ip. | ||
|
||
|
@@ -46,13 +46,13 @@ ssh -i my_cloud_key [email protected] -p 30011 | |
|
||
## Configuration using user data | ||
|
||
Configure a project gateway manually is a bit plodding. However, since we have a fixed mapping between ports and local ip addresses, we can automate this step by writing a small script and provide it as user data at instance start. The script should do the following steps : | ||
Configure a project gateway manually is a bit plodding. However, since we have a fixed mapping between ports and local ip addresses, we can automate this step by writing a small script and provide it as user data at instance start. The script should do the following steps : | ||
|
||
1. wait for metadata server to be available | ||
2. get the CIDR mask from the metadata service | ||
3. enable ip forwarding | ||
4. add a forwarding rules for ssh (Port 22) for each available ip address (2 ... 254) | ||
5. create a new security group that allows incoming tcp connections from port 30002 to port 30254 and associate it to the gateway instance | ||
5. create a new security group that allows incoming tcp connections from port 30002 to port 30254 and associate it to the gateway instance | ||
|
||
The full script could look like the following: | ||
|
||
|
This file contains 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
Oops, something went wrong.