Skip to content

Instantly share code, notes, and snippets.

@avoidik
avoidik / README.md
Last active August 28, 2020 10:57 — forked from nickbudi/README.md
Cygwin git compatibility with VS Code (or other Windows programs) using cygpath

Cygwin Git + VS Code compatibility

Thanks and credit to mattn and ferreus on GitHub.

Check out wslpath if you're using the Windows Subsystem for Linux.

@avoidik
avoidik / curlpkcs11.c
Created March 30, 2020 08:22 — forked from yusukemihara/curlpkcs11.c
perform HTTPS GET on ssl client verification using curl,OpenSSL ENGINE pkcs11 and libp11
#if 0
#!/bin/bash
src=$0
obj=${src%.*}
gcc -g -Wl,--no-as-needed `pkg-config --cflags --libs libcurl libssl libp11` -o $obj $src
exit
#endif
/* perform HTTPS GET on ssl client verification using curl,OpenSSL ENGINE pkcs11 and libp11
*
@avoidik
avoidik / create-user.sh
Last active May 23, 2021 12:01 — forked from etiennetremel/create-user.sh
Create Kubernetes user using kubectl csr and cfssl
#!/bin/bash
#
# Create Kubernetes user. Require cfssl.
#
# Usage:
# ./create-user.sh <kubernetes api host> <fulle name> <clusterrole>
#
# Example:
# ./create-user.sh k8s-api.my-domain.com "Jane Doe" my-project:admin
@avoidik
avoidik / fargate.tf
Created January 26, 2020 17:50 — forked from danquack/fargate.tf
Private Fargate Instance with no internet egress: https://dev.to/danquack/private-fargate-deployment-with-vpc-endpoints-1h0p
data "aws_iam_policy_document" "fargate-role-policy" {
statement {
actions = ["sts:AssumeRole"]
principals {
type = "Service"
identifiers = ["ecs.amazonaws.com", "ecs-tasks.amazonaws.com"]
}
}
}
@avoidik
avoidik / crr_s3_a.tf
Last active January 25, 2020 10:31 — forked from onnimonni/s3.tf
CRR replication (same or distinct accounts, mandatory different regions): s3 replicated bucket with terraform
# Create all variables used in this Terraform run
variable "aws_access_key" {}
variable "aws_access_secret_key" {}
variable "aws_bucket_name" {}
variable "aws_region_main" {
default = "eu-west-1"
}
variable "aws_region_replica" {
default = "eu-central-1"
}
@avoidik
avoidik / cloud-config.yml
Created January 19, 2020 15:18 — forked from justinsoliz/cloud-config.yml
Terraform definition for Jenkins with ECS, EFS, CoreOS
#cloud-config
write-files:
- path: /etc/conf.d/nfs
permissions: '0644'
content: |
OPTS_RPC_MOUNTD=""
coreos:
units:
- name: update-engine.service
@avoidik
avoidik / hashicorp-vault-auth-cert-and-token-role-creation.md
Created December 14, 2019 16:47 — forked from davidmintz/hashicorp-vault-auth-cert-and-token-role-creation.md
notes on setting up and using Vault TLS authentication, policies, and tokens with named roles

Our goal is to save sensitive data in a MySQL database in a responsible way, and be able to read/write it programmatically in a PHP web application. Asymmetric encryption would be best, but is not practical here. Symmetric encryption with a strong algorithm and hard-to-guess cipher is acceptable, but not if we store the cipher in plain text on the same server where the database credentials also live in plain text!

This work-in-progress is subject to change if/when I come up with a better scheme, but for now, the plan is to:

  • store the cipher as a vault secret;
  • configure TLS authentication so that our PHP application can log in, and then
  • create a token that allows its bearer to read the secret (our cipher);
  • use a PHP component and our cipher to encrypt/decrypt our sensitive data.
@avoidik
avoidik / github-workflows-goreleaser.yml
Created November 23, 2019 16:55 — forked from markbates/github-workflows-goreleaser.yml
Run Go tests in Windows, Mac, Linux. Go version 1.12/1.13 both with Modules and GOPATH.
name: Release
on:
release:
types:
- published
jobs:
release:
name: Release
runs-on: ubuntu-latest
@avoidik
avoidik / main.go
Created September 25, 2019 05:03 — forked from michelvocks/main.go
Vault Client API approle login
package main
import (
"fmt"
"log"
"github.com/hashicorp/vault/api"
)
var client *api.Client