Skip to content

Instantly share code, notes, and snippets.

View earthquakesan's full-sized avatar

Ivan Ermilov earthquakesan

View GitHub Profile
@earthquakesan
earthquakesan / gist:4c1ad56a62752279b8ac77596d6aaa31
Created December 19, 2025 13:10
Fetch terraform provider and publish in Harbor for usage with OpenTofu
#!/bin/sh
set -eu
echo "This script should be run locally to publish tf providers to the harbor registry."
echo "Use case when the runners only have access to harbor instance, but not the Internet."
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
TF_DIR=${SCRIPT_DIR}/../deployment
TF_PROVIDER_DIR="${SCRIPT_DIR}/../tf-providers"
@earthquakesan
earthquakesan / gke-l7-cross-regional-internal-managed-mc.txt
Last active November 25, 2025 00:01
gke-l7-cross-regional-internal-managed-mc gateway class in GKE with TLS termination (gcloud cli example)
# Cluster creation
export GKE_PROJECT="ADDME"
export GKE_PROJECT_NUMBER="ADDME"
export NETWORK="projects/${GKE_PROJECT}/global/networks/default"
export US_CENTRAL_SUBNET="projects/${GKE_PROJECT}/regions/${CLUSTER_REGION}/subnetworks/default"
export CLUSTER_REGION="us-central1"
export CLUSTER_NAME="cluster-1"
@earthquakesan
earthquakesan / msgraph_user_search.py
Created September 19, 2023 20:33
Search for user in Azure AD using username - the same behaviour as in the web console
import asyncio
from azure.identity import AzureCliCredential
from msgraph import GraphServiceClient
from msgraph.generated.users.users_request_builder import UsersRequestBuilder
async def get_user(user_name: str, client: GraphServiceClient) -> None:
# The query used here is the same when searching for users in Azure AD via web console
query_params = UsersRequestBuilder.UsersRequestBuilderGetQueryParameters(
@earthquakesan
earthquakesan / gist:d5329213f92dbc3010ba2ac732da0235
Created June 26, 2023 13:55
Check that AWS Config Cloud Formation Stacks are removed from Account Factory Provisioned Account
#!/bin/bash
set -uo pipefail
IFS=$'\n\t'
export AWS_ACCESS_KEY_ID=""
export AWS_SECRET_ACCESS_KEY=""
export AWS_SESSION_TOKEN=""
ACCOUNT_ID=
ROLE_ARN=arn:aws:iam::${ACCOUNT_ID}:role/AWSControlTowerExecution
@earthquakesan
earthquakesan / gist:9938ec68de4778c1238f76a44122257c
Created June 26, 2023 13:54
Remove AWS Config Cloud Formation Stack from Account Factory Provisioned Account
#!/bin/bash
set -uo pipefail
IFS=$'\n\t'
export AWS_ACCESS_KEY_ID=""
export AWS_SECRET_ACCESS_KEY=""
export AWS_SESSION_TOKEN=""
ACCOUNT_ID=
ROLE_ARN=arn:aws:iam::${ACCOUNT_ID}:role/AWSControlTowerExecution
@earthquakesan
earthquakesan / Compare_ssl_certs.md
Created January 19, 2023 21:07
Comparing End dates of two certificates using Bash

Create test certs

See link

openssl genpkey -out device1.key -algorithm RSA -pkeyopt rsa_keygen_bits:2048
openssl req -new -key device1.key -out device1.csr
openssl req -text -in device1.csr -noout
openssl x509 -req -days 7 -in device1.csr -signkey device1.key -out device1.crt
openssl genpkey -out device2.key -algorithm RSA -pkeyopt rsa_keygen_bits:2048
openssl req -new -key device2.key -out device2.csr
openssl x509 -req -days 14 -in device2.csr -signkey device2.key -out device2.crt
export SERVER=example.org
export EMAIL=mail@example.org
mkdir tls
touch tls/index.txt
cat <<EOF > tls/openssl-ca.cnf
[ ca ]
default_ca = CA_LOC
@earthquakesan
earthquakesan / log.log
Created October 14, 2021 11:03
Huge log file
This file has been truncated, but you can view the full file.
[INFO] Log message 1
[INFO] Log message 2
[INFO] Log message 3
[INFO] Log message 4
[INFO] Log message 5
[INFO] Log message 6
[INFO] Log message 7
[INFO] Log message 8
[INFO] Log message 9
[INFO] Log message 10
@earthquakesan
earthquakesan / gist:960fa1f9bb3ed3de7741e420fc2d2f5d
Created July 12, 2021 10:03
Create CA & Server Certificate with SAN
# Create CA & Server Cert
## Create CA
```
cat <<EOF > openssl.cnf
[ req ]
#default_bits = 2048
#default_md = sha256
#default_keyfile = privkey.pem
{"type": "FeatureCollection", "features": [{"type": "Feature", "properties": {}, "geometry": {"type": "Point", "coordinates": [12.352752685546873, 51.34433866059924]}}, {"type": "Feature", "properties": {}, "geometry": {"type": "Point", "coordinates": [12.410430908203125, 51.355488840149505]}}, {"type": "Feature", "properties": {}, "geometry": {"type": "Point", "coordinates": [12.390518188476562, 51.365778905402145]}}]}