Skip to content

nmortha/oci-mc-bastion

 
 

Repository files navigation

oci-mc-bastion

Purpose: To simplify the connection to the Minecraft Server using a Bastion Instance to securely create an SSH tunnel to the server.

Background: I built and deploy Minecraft on Oracle Cloud Infrastructure using arm64 with VM.Standard.A1-Flex Shape. See the article here. To avoid using publicly accessible ports, the OCI Bastion service provides a method to create a connection that is a) temporal and b) managed through OCI creating a connection to the server.

Requires:

  • OCI CLI SDK (See the reference here
  • OCI API key and configuration (Required for the OCI CLI SDK. Also you can use this tool to help generate the configuration available on github here)
  • jq here

Environment Variable Configuration (in mc-env.sh). Copy the mc-env.sh.template to mc-env.sh and configure:

  • PROFILE_NAME - Name of the OCI SDK Profile
  • COMPARTMENT_NAME - Name of the Compartment where the resources are.
  • SUBNET_NAME - Name of the subnet where the compute instance exists and also the subnet where the bastion session to be created
  • RESOURCE_NAME - Name of the compute instance to create the bastion session
  • BASTION_NAME - Name of the Bastion Instance to be created
  • SSH_KEY_PRIV - Path to the private ssh key
  • SSH_KEY_PUB - Path to the public ssh key
  • JQ_PATH - (For Powershell only) Path to the jq executable (assume jq-win64.exe used)

Allowed CIDR List to connect to the Bastion Instance (in cidr-list.json).

  • Currently defaults to 0.0.0.0/0.

Notes:

  • Use double-quotes if spaces are included in the name
  • Include full path to the SSH keys
  • Assume the same compartment is used for the subnet, compute instance and bastion instance to be created
  • In the Powershell scripts, the default jq executable name is jq-win64.exe

What these do:

  • create-bastion.sh - Creates and sets up a local connection @ location:25565 to tunnel to the Minecraft. It creates the SSH keys, Bastion Instance and Bastion Session if required
  • create-bastion.ps1 - Powershell equivalent of the create-bastion.sh
  • delete-bastion.sh - Deletes the Bastion Instance (also any active Bastion Sessions)
  • delete-bastion.ps1 - Powershell equivalent of the delete-bastion.sh
  • mc-env.sh.template - Template that can be copied to mc-env.sh and configured
  • mc-env.ps1.template - Powershell equivalent of the mc-env.sh.template

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 57.8%
  • PowerShell 42.2%