Skip to content

Instantly share code, notes, and snippets.

# ~/.pip/pip.conf
[global]
index-url = https://pypi.douban.com/simple

BUNDLE

BUNDLE_EXEC_PATH=
BUNDLE_DIR=

cd $BUNDLE_DIR
${BUNDLE_EXEC_PATH} exec ${EXECUTABLE_FILE}

PROXY OPENSTACK REQUEST

I get a job to hide openstack behind a reverse proxy and make default ports completely invisible from users.

MAIN CONFIGURATION

Right now I am afraid openstack has some problem with a unified api gateway, so I have to modify response body if version controller is accessed by the end user. (Sadly version controller should not be used because from my point of view, it conflicts with endpoints returned)

# nginx config
# generate ca key & certificate
openssl genrsa -out ca.key 2048
openssl req -x509 -new -nodes -key ca.key -sha256 -days 10000 -out ca.crt

# generate client key & csr
openssl genrsa -out client.key 2048
openssl req -new -key client.key -out client.csr

# sign request and get client certificate

POWERSHELL CHEATSHEET

ENABLE REMOTE DESKTOP

# https://www.interfacett.com/blogs/methods-to-enable-and-disable-remote-desktop-locally/
Set-ItemProperty -Path hklm:"HKEY_LOCAL_MACHINE\SYSTEM\CurRentControlSet\Control\Terminal Server" -Name fDenyTSConnections -Value 0

CONFIGURE FIREWALLS

WINDOWS

On newer windows,

netsh advfirewall set  allprofiles state off/on

:: or equivalently

SNIFF SSL TRAFFIC

Recently I get confused on how to sniff HTTPS traffic, I think I need a proxy and it turns out correct. I setup a proxy chain by using stunnel.

SETUP

I use two machines (which is not optimal), one is used for executing command and serving stunnel server; then other one is used for stunnel client and sniffing.

STUNNEL SERVER & CLIENT

#!/bin/bash
set -e

source ${ENV_FILE}

# set image name
IMAGE_DEF=

# set url
# from a directory with some stuff 
# but still want to push to an existing repository
git init
git add -A
git commit -m "some rants"

git remote add origin <origin url>
git pull orgin <branch> --allow-unrelated-histories
# get router gateway external gateway network id
ROUTER_ID=
openstack router show ${ROUTER_ID} -f value -c gateway_external_info | jq '.network_id' | sed 's/"//g'
# router namespace is named in the form of qrouter-<ROUTER-ID>
# snat namespace is named with snat-<ROUTER-ID>
# fip namespace is named with fip-<EXTERNAL-NETWORK-ID>
# dvr layout
# edge node