Skip to content

Instantly share code, notes, and snippets.

View scross01's full-sized avatar

Stephen Cross scross01

  • Oracle
  • Ottawa, Canada
View GitHub Profile
@scross01
scross01 / opc-set-shared-network-resolver.sh
Last active May 28, 2017 12:49
Oracle Compute Cloud. Add the nameserver to /etc/resolv.conf for an interface with a private ip on the shared network
# get the IP address for eth0
private_ip=$(/sbin/ifconfig eth0 | grep 'inet ' | awk '{ print $2 }')
# shared network private IPs are in a /30 subnet, nameserver is IP address -1
nameserver=$(echo ${private_ip} | awk -F. '{ sub("."$4,"."$4-1) } 1')
# append to /etc/resolv.conf
sudo sed -i -e "\$anameserver ${nameserver}" /etc/resolv.conf
@scross01
scross01 / config
Created June 20, 2017 17:07
SSH keep-alive options (~/.ssh/config)
Host *
ServerAliveInterval 300
ServerAliveCountMax 2
@scross01
scross01 / config
Created June 20, 2017 20:59
SSH proxy connection through a bastion host (~/.ssh/config)
Host my-private-host
Hostname <PRIVATE_IP>
User opc
IdentityFile ~/.ssh/id_rsa
ProxyCommand ssh -i ~/.ssh/id_rsa opc@<BASTION_IP> -W %h:%p %r
@scross01
scross01 / opc-sec-rule-ssh.tf
Last active August 28, 2017 19:18
Terraform OPC Provider Security Rule to enable ingress SSH from the Public Internet to an Instance with a Public IP on a Shared Network interface
resource "opc_compute_security_list" "enable-ssh" {
name = "Enable-SSH-access"
policy = "DENY"
outbound_cidr_policy = "PERMIT"
}
resource "opc_compute_sec_rule" "allow-ssh" {
name = "Allow-ssh-access"
source_list = "seciplist:/oracle/public/public-internet"
destination_list = "seclist:${opc_compute_security_list.enable-ssh.name}"
@scross01
scross01 / oci-classic-storage.cyberduckprofile
Last active October 30, 2017 19:54
Oracle Cloud Infrastructure Storage Classic Cyberduck Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Protocol</key>
<string>swift</string>
<key>Vendor</key>
<string>oracle</string>
<key>Description</key>
<string>Oracle Cloud Infrastructure - Storage Classic</string>
@scross01
scross01 / example-instance-orchestraion-plan.json
Last active January 5, 2018 15:21
Terraform and Oracle Cloud Infrastructure Classic Orchestrations
{
"name": "/Compute-mydomain/user@example/example-instance-orchestraion",
"description": "Example Instance Orchesrtation",
"desired_state": "active",
"objects":
[
{
"label": "MyInstance",
"type": "Instance",
"description": "My instance",
@scross01
scross01 / example-instance.tf
Last active January 5, 2018 15:23
Terraform and Oracle Cloud Infrastructure Classic Orchestrations - Example 2
resource "opc_compute_instance" "MyInstance" {
name = "vm-1"
shape = "oc3"
boot_order = [ 1 ]
label = "vm-1"
networking_info {
index = 0
shared_network = true
seclists = [ "${opc_compute_security_list.wlsadmin_seclist.name}" ]
resource "opc_compute_ip_network" "ipnet1" {
name = "ipnet1"
ip_address_prefix = "192.168.4.0/24"
}
resource "opc_compute_storage_volume" "boot" {
size = "12"
name = "boot"
bootable = true
image_list = "/oracle/public/OL_7.2_UEKR4_x86_64"
Verifying my Blockstack ID is secured with the address 1PADtEN4QmxsUt5XVHoeVbdczZKYYVwrwa https://explorer.blockstack.org/address/1PADtEN4QmxsUt5XVHoeVbdczZKYYVwrwa
@scross01
scross01 / autonomous_linux_7.7.tf
Last active January 26, 2020 17:46
Oracle Cloud Infrastructure (OCI) Terraform data sources to find base OS OCIDs https://docs.cloud.oracle.com/iaas/images/
data "oci_core_images" "autonomous_linux" {
compartment_id = "${var.tenancy_ocid}"
operating_system = "Oracle Autonomous Linux"
operating_system_version = "7.7"
# e.g. Oracle-Autonomous-Linux-7.7-2019.12-0"
filter {
name = "display_name"
values = ["^Oracle-Autonomous-Linux-([\\.0-9]+)-([\\.0-9-]+)$"]