Skip to content

Instantly share code, notes, and snippets.

View youdzinn's full-sized avatar
🚧

Eugene Sleptsov youdzinn

🚧
View GitHub Profile
@youdzinn
youdzinn / easyrsa_consul_server_client.md
Created April 1, 2021 02:45
EasyRSA to create server and client certificates for consul cluster

assuming CA is already initialized

CONSUL_DC="swarm"
SERVER_CN="server.${CONSUL_DC}.consul"
SERVER_SAN="DNS: *.example.com, DNS: server.${CONSUL_DC}.consul, DNS:localhost"
CLIENT_CN="client.${CONSUL_DC}.consul"
CLIENT_SAN="DNS: *.example.com, DNS: client.${CONSUL_DC}.consul, DNS:localhost"


./easyrsa --subject-alt-name="${SERVER_SAN}" gen-req "${SERVER_CN}" nopass
@youdzinn
youdzinn / jq_select_multiple_fields_from_array_elements.sh
Created March 2, 2021 18:30
jq select multiple fields from array elements and wrap resulting object to array
echo '[
{
"id": 1,
"title": "doc1",
"slug": "d1"
},
{
"id": 2,
"title": "doc2",
"slug": "d2"
@youdzinn
youdzinn / iterate_over_json_array.sh
Created February 10, 2021 23:20
iterate over array with jq
for i in `jq -r '.[] | @base64' < /path/to/json `; do
record=`echo $i | base64 --decode`
echo $record
done