Skip to content

Instantly share code, notes, and snippets.

@nitmir
nitmir / views.py
Created February 28, 2019 14:59
Django gssapi/kerberos SPNEGO auth view
import base64
import gssapi
from django.http import HttpResponse
FQDN = socket.getfqdn()
REALM = "EXAMPLE.COM"
server_name = gssapi.Name('http/%s@%s' % (FQDN, REALM))
server_creds = gssapi.Credentials(usage='accept', name=server_name)

Keybase proof

I hereby claim:

  • I am nitmir on github.
  • I am nit (https://keybase.io/nit) on keybase.
  • I have a public key ASBAhHHu1pRBRAfscNI-mAq9C7PxzqBAw_e0T4u0TTBhLQo

To claim this, I am signing this object:

#!/usr/bin/python
import os
import shutil
import shelltoolbox
BASE_PATH = "/etc/opendkim"
BASE_KEY_PATH = os.path.join(BASE_PATH, "keys")
BASE_SELECTOR = "mail"
OPENDKIM_UID = 148
@nitmir
nitmir / autoupdate-pepperflashplugin
Last active August 29, 2015 12:14
auto update pepperflashplugin using update-pepperflashplugin-nonfree in debian/ubuntu based distributions
#!/bin/bash
# Parameters
# <maxinterval> <probability>
# Updates the pepperflashplugin randomly, guaranteeing there
# won't be more than <maxinterval> seconds between each
# update. Otherwise, there is a a 1 in <probability>
# chance that an update will occur.
maxinterval=$1
@nitmir
nitmir / luksHeaderBackup.sh
Created March 2, 2015 16:21
Backup all luks header
#!/bin/bash
function backupdev () {
DEV=$1
if cryptsetup isLuks $DEV 2>/dev/null; then
DEVNAME=$(basename $DEV)
echo "Backup $DEV"
cryptsetup luksHeaderBackup $DEV --header-backup-file "luksHeaderBackup_${HOSTNAME}_${DEVNAME}.bin"
fi;
}
# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from django.db.models import get_app, get_models
class Migration(SchemaMigration):