Skip to content

Instantly share code, notes, and snippets.

View ageis's full-sized avatar
💭
available for hire in Bay Area https://cointel.pro/resume

Kevin M. Gallagher ageis

💭
available for hire in Bay Area https://cointel.pro/resume
View GitHub Profile
@ageis
ageis / showqrcode.c
Last active November 23, 2022 02:08
A utility to display QR codes in the CLI/terminal. To build, run `gcc showqrcode.c -ldl -o showqrcode`
// 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 November 15, 2023 23:22
certbot Prometheus exporter (Let's Encrypt metrics)

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 plus read 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 March 18, 2019 23:23
INI lookup plugin with ConfigObj instead of ConfigParser
# (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 09:15
OpenPGP KDF-DO setup script for smartcards
#! /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 February 19, 2024 21:05
GnuPG configuration files
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 09:29
Linux stable config hardening options
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 18:10
Perl script for processing+merging multiple iptables/UFW logs
#!/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 April 15, 2021 18:54
Extract href tag values (hyperlinks) from a webpage.
@ageis
ageis / HTTP_Ubuntu_Mirrors.txt
Created February 22, 2018 15:15
List of Ubuntu Mirrors as of Feb 22, 2018
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/
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