Skip to content

Instantly share code, notes, and snippets.

💭
available for hire https://cointel.pro/resume

Kevin M. Gallagher ageis

View GitHub Profile
@ageis
ageis / showqrcode.c
Last active Apr 15, 2019
A utility to display QR codes in the CLI/terminal. To build, run `gcc showqrcode.c -ldl -o showqrcode`
View showqrcode.c
// showqrcode: A utility to display QR codes in the terminal.
// Copyright © 2019 Kevin Gallagher <kevingallagher@gmail.com>
// Modified and based upon original code from libpam-google-authenticator:
// https://github.com/google/google-authenticator-libpam
// The original license is printed below.
//
// Helper program to generate a new secret for use in two-factor
// authentication.
//
// Copyright 2010 Google Inc.
@ageis
ageis / certbot_exporter.md
Last active Mar 25, 2019
certbot Prometheus exporter (Let's Encrypt metrics)
View certbot_exporter.md

certbot_exporter.py

This is a script written in Python intended to run alongside a certbot instance and export statistics for monitoring purposes. It assumes the existence of certbot in the PATH plusread access to /etc/letsencrypt.

It tracks stuff like: number of certs, number of SANs, expiry time, seconds until expiry, and the status of the certificate per ACME.

How it works

Prometheus is a monitoring system and time-series database.

@ageis
ageis / ini_file.py
Created Mar 18, 2019
INI lookup plugin with ConfigObj instead of ConfigParser
View ini_file.py
# (c) 2019 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
lookup: ini_file
author: Kevin Gallagher <kevingallagher@gmail.com>
version_added: "2.0"
short_description: read data from a ini file
@ageis
ageis / kdf-do-setup.sh
Created May 14, 2018
OpenPGP KDF-DO setup script for smartcards
View kdf-do-setup.sh
#! /bin/bash
# Original author: NIIBE Yutaka <gniibe@fsij.org>
# URL: https://dev.gnupg.org/T3823
# Usage: ./kdf-do-setup.sh
GPG_CONNECT_AGENT=gpg-connect-agent
PW_USER="123456"
PW_ADMIN="12345678"
@ageis
ageis / dirmngr.conf
Last active May 13, 2018
GnuPG configuration files
View dirmngr.conf
log-file /home/kevin/.gnupg/dirmngr.log
use-tor
debug-level basic
debug ipc,dns
verbose
disable-ipv6
keyserver hkps://hkps.pool.sks-keyservers.net
hkp-cacert /usr/share/gnupg/sks-keyservers.netCA.pem
@ageis
ageis / .config
Created May 3, 2018
Linux stable config hardening options
View .config
CONFIG_GCC_PLUGIN_LATENT_ENTROPY=y
CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL=y
CONFIG_GCC_PLUGIN_RANDSTRUCT=y
CONFIG_CC_STACKPROTECTOR_STRONG=y
CONFIG_MODULE_SIG_FORCE=y
CONFIG_DEBUG_SG=y
CONFIG_DEBUG_NOTIFIERS=y
CONFIG_DEBUG_CREDENTIALS=y
CONFIG_IO_STRICT_DEVMEM=y
CONFIG_SECURITY_YAMA=y
@ageis
ageis / fwblocks.pl
Created May 2, 2018
Perl script for processing+merging multiple iptables/UFW logs
View fwblocks.pl
#!/usr/bin/perl
use strict;
use warnings;
use autodie;
use DBI;
use utf8;
use Scalar::Util qw(looks_like_number);
use Data::Validate::IP qw( is_public_ip is_linklocal_ip is_loopback_ip is_private_ip );
use Geo::IP;
use File::Tail;
@ageis
ageis / find.hyperlinks.2.sh
Last active Feb 22, 2018
Extract href tag values (hyperlinks) from a webpage.
View find.hyperlinks.2.sh
@ageis
ageis / HTTP_Ubuntu_Mirrors.txt
Created Feb 22, 2018
List of Ubuntu Mirrors as of Feb 22, 2018
View HTTP_Ubuntu_Mirrors.txt
http://ubuntu.unc.edu.ar/ubuntu/
http://mirrors.asnet.am/ubuntu/
http://mirror.aarnet.edu.au/pub/ubuntu/archive/
http://mirror.waia.asn.au/ubuntu/
http://ubuntu.melbourneitmirror.net/archive/
http://ubuntu.mirror.solnode.io/ubuntu/
http://ftp.iinet.net.au/pub/ubuntu/
http://mirror.as24220.net/pub/ubuntu-archive/
http://mirror.as24220.net/pub/ubuntu/
http://mirror.intergrid.com.au/ubuntu/
View Options apt can pass to dpkg when [re]installing packages and fixing configurations
Usage: apt-get -o "Dpkg::options==--option" --reinstall install <package>
$ dpkg --force-help
[!] all Set all force options
[*] downgrade Replace a package with a lower version
configure-any Configure any package which may help this one
hold Process incidental packages even when on hold
not-root Try to (de)install things even when not root
bad-path PATH is missing important programs, problems likely
bad-verify Install a package even if it fails authenticity check
You can’t perform that action at this time.