Skip to content

Instantly share code, notes, and snippets.

View ptman's full-sized avatar
💭
.

Paul Tötterman ptman

💭
.
View GitHub Profile

Advanced hints for a good FDE setup:

  • use a CD-R to boot (even better: a Pocket CD-R as you can carry them around more easily, but they are harder to come by nowadays)
  • CD-Rs have digits and characters carved/lasered/whatevered into their inner ring close to the center which are probably unique to every disc: memorize those and always check them in case someone tries to slip you a fake CD-ROM
  • under Linux, you have to boot the kernel from the CD, but that means you have to burn a new one after every kernel upgrade. to circumvent that, use the kexec program and work it into the boot scripts so that the boot CD boots the updated kernel from the decrypted harddrive (yes, it means you have to enter your password twice for each bootstrap -- you'll get used to it).
  • buy a clean, cheap keyboard and glue it shut so that no hardware keylogger or microphone can be implanted into it; switch keyboards if you have a Model M
  • use a disk password with maximum entropy, i.e. if you algorithm is 256 bits wide, gen
@ptman
ptman / dhcpd.conf.erb
Created June 11, 2013 13:22
Build dhcpd.conf based on information in LDAP, using erb templating in puppet.
# file managed by puppet
<%# Copyright (c) 2013, ZenRobotics Ltd. All rights reserved. %>
<%
require 'ipaddr'
raise Puppet::Error, 'Could not set up LDAP Connection: Missing ruby/ldap libraries' unless Puppet.features.ldap?
conn = Puppet::Util::Ldap::Connection.instance
conn.start
connection = conn.connection
base = Puppet.settings[:ldapbase]
@ptman
ptman / ssh_scan_keys.py
Created July 12, 2013 14:02
Usage: ./ssh_scan_keys.py /home /export/home
#!/usr/bin/env python
# coding: utf-8
# vim: set ts=4 sts=4 sw=4 si ai et ft=python:
# author: Paul Tötterman <paul.totterman@zenrobotics.com>
#
# Copyright (c) 2013, ZenRobotics Ltd.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
@ptman
ptman / ipm.py
Created September 13, 2013 13:53
#!/usr/bin/env python
# coding: utf-8
# vim: set ts=4 sts=4 sw=4 si ai et ft=python:
# author: Paul Tötterman <paul.totterman@zenrobotics.com>
#
# Copyright (c) 2013, ZenRobotics Ltd.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
@ptman
ptman / watchdog.ps1
Created September 19, 2013 12:59
SuperMicro IPMI Watchdog for Windows
# coding: utf-8
# vim: set ts=4 sw=4 sts=4 si ai et ft=powershell:
# Copyright (c) 2013, ZenRobotics Ltd.
# author: Paul Tötterman <paul.totterman@zenrobotics.com>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
@ptman
ptman / lookup_plugins:ldap_sshkeys.py
Last active January 23, 2019 11:26
Trying to get and use complex data from LDAP for Ansible.replace : in filename with /
# vim: set si ai et sw=4 sts=4 ts=4 ft=python:
# coding: utf-8
# Copyright (c) 2013, ZenRobotics Ltd.
# Author: Paul Tötterman <paul.totterman@zenrobotics.com>
"""Ansible lookup plugin for looking up user data in an LDAP directory."""
from ansible import utils, errors
import ldap
abraham
absent
absorb
absurd
academy
accent
acid
acrobat
action
active
@ptman
ptman / reversestringer.go
Created November 12, 2015 12:25
Complement for go stringer
import "strings"
func ParseType(s string) Type {
return parseType(0, s)
}
func parseType(i int, s string) Type {
j := strings.Index(_Type_name[i:], s)
if j == -1 {
@ptman
ptman / revel_sentry.go
Created April 1, 2020 08:15
revel sentry filter
// Copyright (c) 2020 Paul Tötterman <paul.totterman@iki.fi>.
import sentry "github.com/getsentry/sentry-go"
// look at github.com/getsentry/sentry-go/http
var SentryFilter = func(c *revel.Controller, fc []revel.Filter) {
if dsn := revel.Config.StringDefault("sentry.dsn", ""); dsn != "" {
defer func() {
if err := recover(); err != nil {
hub := sentry.CurrentHub().Clone()
@ptman
ptman / tailscale.py
Created November 25, 2021 15:51
Ansible Tailscale inventory script
#!/usr/bin/env python3
# Copyright (c) 2021 Paul Tötterman <paul.totterman@iki.fi>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY