Giter Club home page Giter Club logo

oci_scripts's Introduction

Miscellaneous Oracle Cloud Infrastructure (OCI) scripts

ssh-oci-bastion.sh

Configure and ssh or create a tunnel to an Oracle Cloud Infrastructure host via the bastion.

Setup

  1. Bash shell, perl, sleep, etc.
    • (macOS, Linux) Out-of-the-box
    • (Windows) Install WSL or Cygwin
  2. ssh CLI client.
    • Generate an SSH key pair if you don't have any. One of the following SSH public keys in `~/.ssh/` is required: `id_rsa.pub`, `id_dsa.pub`, `id_ecdsa.pub`, `id_ed25519.pub`, or `id_xmss.pub`. If there are multiple keys the first one found in this order will be used. The corresponding private key is usually also present there, but it can be moved to a credential vault and SSH agent, e.g. 1Password.
  3. Install and configure OCI CLI.
  4. Install jq.
  5. Install PCRE.
  6. Define the following environment variables. OCI menus below are as of October 2022.
    1. OCI_INSTANCE_OCID. See Compute > Instances > {host} > General information > OCID
    2. OCI_BASTION_OCID. See Identity & Security > Bastion > {bastion} > Bastion information > OCID
    3. For host_user SSH sessions only: OCI_INSTANCE: OCI host Internal FQDN or Private IP. See Compute > Instances > {host} > Primary VNIC.
    • If you're working with the single OCI host, setting them globally in your environment will work well.
    • If you're working with multiple hosts, you can pass these vars on-the-fly: see the Usage Examples section.

Usage Examples

  • Create a bastion session and ssh as taras server user using the system environment vars: ssh-oci-bastion.sh taras
  • Create a bastion session and ssh: OCI_INSTANCE_OCID=ocid1.instance.xx OCI_BASTION_OCID=ocid1.bastion.xx OCI_INSTANCE=10.xx ssh-oci-bastion.sh taras
  • Create a bastion port-forwarding session and launch the tunnel for the port 1234: OCI_INSTANCE_OCID=ocid1.instance.xx OCI_BASTION_OCID=ocid1.bastion.xx ssh-oci-bastion.sh -p 1234
  • Create a bastion session and ssh using the ADMIN OCI client profile: ssh-oci-bastion.sh -o ADMIN taras

oci_scripts's People

Contributors

dkroot avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.