Skip to content

Instantly share code, notes, and snippets.

@ulif
ulif / ldif2htaccess.py
Created May 11, 2016 11:25
Turn hashed LDAP passwords into htpasswd-compatible ones.
def ldif2htaccess(ldif_hashed):
"""Turn LDIF hashed password into htpasswd compatible hash.
"""
pw = ldif_hashed.decode("base64")
if pw.startswith("{crypt}$1$"):
# this is in fact md5, non-apache mode
return pw[7:]
elif pw.lower().startswith("{crypt}"):
# old crypt(), really inscure
return pw[7:]
@ulif
ulif / strip-weak-ssh-moduli.sh
Created February 15, 2016 08:58
Strip short moduli from /etc/ssh/moduli
#!/bin/bash
#
# Strip weak (short) moduli from /etc/ssh/moduli
#
awk '$5 >= 2047' /etc/ssh/moduli > /etc/ssh/moduli.stripped
@ulif
ulif / generate-moduli.sh
Created January 15, 2016 08:59
Generate primes for use with SSH
#!/bin/bash
#
# Create primes for use with ssh.
#
for bitlen in 2048 3072 4096 6144 8192 ;
do
echo Looking for candidates: $bitlen bits. ;
ssh-keygen -G moduli-${bitlen}.candidates -b $bitlen ;
cat moduli-${bitlen}.candidates >> moduli.candidates
rm moduli-${bitlen}.candidates
@ulif
ulif / gpg-setup.sh
Last active November 14, 2017 11:43
Ulis GPG Setup
#
# Create a not-too-unsecure gpg setup.
# For current version see:
# https://gist.github.com/ulif/cd9c0254a0935e2ff82a#file-gpg-setup-sh
# Install gnupg-curl
# It supports hkps, which regular gnupg seemingly does not
sudo apt-get install gnupg-curl
# Fetch mayfirst.org CA-cert from
[versions]
# from http://svn.zope.org/*checkout*/zopetoolkit/trunk/zopeapp.cfg?rev=108938
zope.app.apidoc = 3.7.1
zope.app.applicationcontrol = 3.5.5
zope.app.appsetup = 3.13.0
zope.app.authentication = 3.7.1
zope.app.basicskin = 3.5.0
zope.app.broken = 3.5.0
zope.app.cache = 3.7.0
zope.app.catalog = 3.8.1
[versions]
# from http://svn.zope.org/*checkout*/zopetoolkit/trunk/zopeapp.cfg?rev=108938
zope.app.apidoc = 3.7.1
zope.app.applicationcontrol = 3.5.5
zope.app.appsetup = 3.13.0
zope.app.authentication = 3.7.1
zope.app.basicskin = 3.5.0
zope.app.broken = 3.5.0
zope.app.cache = 3.7.0
zope.app.catalog = 3.8.1