Skip to content

Instantly share code, notes, and snippets.

View miradam's full-sized avatar

Adam Heczko miradam

  • Egnyte
View GitHub Profile
#!/usr/bin/env python
import json
import os
import subprocess
import tempfile
import yaml
VAULT_BIN = "/usr/local/bin/vault"
VAULT_PATH = "secret/salt/pillar_data"
@miradam
miradam / openssl.MD
Created March 27, 2019 09:05 — forked from jchandra74/openssl.MD
HOWTO: Create Your Own Self-Signed Certificate with Subject Alternative Names Using OpenSSL in Ubuntu Bash for Window

HOWTO: Create Your Own Self-Signed Certificate with Subject Alternative Names Using OpenSSL in Ubuntu Bash for Window

Overview

My main development workstation is a Windows 10 machine, so we'll approach this from that viewpoint.

Recently, Google Chrome started giving me a warning when I open a site that uses https and self-signed certificate on my local development machine due to some SSL certificate issues like the one below:

Self-Signed SSL Issue in Chrome

@miradam
miradam / letsencrypt-jetty.sh
Created October 30, 2018 23:58 — forked from xkr47/letsencrypt-jetty.sh
How to use Letsencrypt certificate & private key with Jetty
# input: fullchain.pem and privkey.pem as generated by the "letsencrypt-auto" script when run with
# the "auth" aka "certonly" subcommand
# convert certificate chain + private key to the PKCS#12 file format
openssl pkcs12 -export -out keystore.pkcs12 -in fullchain.pem -inkey privkey.pem
# convert PKCS#12 file into Java keystore format
keytool -importkeystore -srckeystore keystore.pkcs12 -srcstoretype PKCS12 -destkeystore keystore.jks
# don't need the PKCS#12 file anymore
@miradam
miradam / FileWatcher.java
Created October 30, 2018 13:16 — forked from danielflower/FileWatcher.java
Watching a single file in java
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.file.*;
public class FileWatcher {
private static final Logger log = LoggerFactory.getLogger(FileWatcher.class);
private Thread thread;
@miradam
miradam / SSH and Suricata.md
Created October 26, 2018 19:50
SSH Brute Force and Suricata

Since SSH is one of the most pervasive ways to manage servers remotely, it is also one of the most plagued by brute force attacks. What follows is a simple set of Suricata rules to stop the majority of SSH brute force attacks. It will drop connections based on the reported SSH client version.

@miradam
miradam / keycloak-defaults
Created October 9, 2018 14:22 — forked from markusleh/keycloak-defaults
Keycloak service script and default file for init.d
# General configuration for the init.d scripts,
# not necessarily for JBoss AS itself.
# default location: /etc/default/keycloak
## Location of JDK
# JAVA_HOME="/usr/lib/jvm/default-java"
## Location of WildFly
# JBOSS_HOME="/opt/keycloak"
@miradam
miradam / git-search-commit-message
Created June 18, 2018 21:19 — forked from helhum/git-search-commit-message
Git command to show (remote) branches and tags that contain a commit with a specified commit message
#!/bin/bash
function search-branches() {
for sha1 in `git log --oneline --all --grep "$1" | cut -d" " -f1`
do
git branch -r --contains $sha1
done
}
function search-tags() {
for sha1 in `git log --oneline --all --grep "$1" | cut -d" " -f1`
do
@miradam
miradam / keycloak.sh
Created April 19, 2018 07:44 — forked from paoloantinori/keycloak.sh
Keycloak Admin API Rest Example
#!/bin/bash
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d 'password=admin' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl -X GET 'http://localhost:8080/auth/admin/realms' \
@miradam
miradam / iptables-cheatsheet.md
Created April 13, 2018 09:07 — forked from mcastelino/iptables-cheatsheet.md
iptables-cheatsheet

The netfilter hooks in the kernel and where they hook in the packet flow

The figure below calls out

  • The netfilter hooks
  • The order of table traversal
@miradam
miradam / ovpn_client.sh
Created February 27, 2018 01:03
OpenVPN Client Configuration Generate Script
#!/bin/bash
# OpenVPN configuration Directory
OPENVPN_CFG_DIR=/etc/openvpn
# Directory where EasyRSA outputs the client keys and certificates
KEY_DIR=/etc/openvpn/easy-rsa/keys
# Where this script should create the OpenVPN client config files
OUTPUT_DIR=/etc/openvpn/client-config