Skip to content

Instantly share code, notes, and snippets.

@buzzkillb
buzzkillb / 01nginx-tls-sni.md
Created February 1, 2021 23:08 — forked from kekru/01nginx-tls-sni.md
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.

prerequisites

  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    ...
    TLS SNI support enabled
#Location of block-cli
blockcli=/usr/local/bin/blocknet-cli
echo "Type in COIN Symbol, ie. BTC, D, DOGE, DVT, LTC, PIVX"
read coinCheck
coinServiceNodes=$($blockcli servicenodecount | jq -r '.total')
echo "total service node(s): $coinServiceNodes"
subtractone="$(($coinServiceNodes-5))"
#requires https://github.com/buzzkillb/python-denariusrpc and denarius daemon/QT wallet
from denariusrpc.authproxy import AuthServiceProxy, JSONRPCException
#DDNS to look up data
ddns_lookup_data = 'api:pricefeedDenarius'
# rpc_user and rpc_password are set in the denarius.conf file
rpc_connection = AuthServiceProxy("http://%s:%[email protected]:32369"%("rpcusername", "rpcpassword"))
name_show_feed = rpc_connection.name_show(ddns_lookup_data)
#create new Denarius DDNS name based on name, value and expiration
from denariusrpc.authproxy import AuthServiceProxy, JSONRPCException
#DDNS to create data
ddns_create_name = 'api:python_example'
ddns_create_value = 'example value'
ddns_create_expiration = 9999
# rpc_user and rpc_password are set in the denarius.conf file
rpc_connection = AuthServiceProxy("http://%s:%[email protected]:32369"%("rpcusername", "rpcpassword"))
@buzzkillb
buzzkillb / ddns_update_data_denarius.py
Last active February 10, 2021 01:20
ddns_update_data_denarius.py
from denariusrpc.authproxy import AuthServiceProxy, JSONRPCException
#DDNS to update data
ddns_update_name = 'api:python_example'
ddns_update_value = 'example value update'
ddns_update_expiration = 9999
# rpc_user and rpc_password are set in the denarius.conf file
rpc_connection = AuthServiceProxy("http://%s:%[email protected]:32369"%("rpcusername", "rpcpassword"))
from denariusrpc.authproxy import AuthServiceProxy, JSONRPCException
import urllib
import json
import requests
#DDNS to push API data to name
ddns_update_name = 'api:python_example'
ddns_update_expiration = 9999
@buzzkillb
buzzkillb / geth_rpc_server.md
Created April 22, 2021 20:32 — forked from akaron/geth_rpc_server.md
create private geth rpc server using ssh port forwarding

note: create private geth rpc server using ssh port forwarding

In short, user provide ssh key to rpc server manager. Once the manager configured, then everytime the user need to type folowing commands to access to the geth rpc server:

  1. ssh -N -L 9545:localhost:8545 geth@machine_A_addr
  2. ... and set the rpc to http://localhost:9545

For convenienve, in the following I use these abbreviations:

  • machine A: run geth full node with RPC server
  • machine B: using the geth RPC from machine A
#########
# denariusd daemon addnode ban with port, or switch denariusd to denarius.daemon for snap
#########
#!/bin/bash
#. config.conf
#. rpc.sh
wallet_ip=$(denariusd getpeerinfo | jq -r '.[].addr' | awk '!seen[$0]++')
while IFS= read -r
ps -ef | grep 'denariusd' | grep -v grep | awk '{print $2}' | xargs -r kill -9
const Discord = require("discord.js");
const config = require("./config.json");
//global.theTime = 0;
const client = new Discord.Client();
const prefix = "!";
client.on('ready', () => {