Skip to content

Instantly share code, notes, and snippets.

@serac
serac / .jettyrc
Created September 14, 2016 13:39
Useful .jettyrc for conditionally enabling remote debugging, SSL trace, YourKit profiler, and GC debugging
#/bin/bash
# Jetty shell configuration file
export JETTY_RUN=${TMPDIR}jetty
if [ ! -d $JETTY_RUN ]; then
mkdir -p $JETTY_RUN
fi
export JETTY_STATE=$JETTY_RUN/jetty.state
export JETTY_LOGS=$HOME/Library/Logs/jetty
@serac
serac / ossl-ciphers-to-java.py
Created September 9, 2016 13:10
Convert OpenSSL TLS Cipher String to Java Cipher List
#!/usr/bin/env python
import sys
from os.path import basename
from subprocess import Popen, PIPE
"""Map of OpenSSL symmetric cipher names to cipher/block size tuples."""
CIPHERS={
'AES': ('AES', 128),
'AES128': ('AES', 128),
@serac
serac / memcached-get.sh
Created September 2, 2016 11:50
Bash script to get a key from a list of memcached hosts, testing each one in turn
#!/bin/bash
function getkey {
echo "Checking $M for $2"
HOST=$(echo $1 | cut -d':' -f1)
PORT=$(echo $1 | cut -d':' -f2)
echo "get $2" | nc -w1 $HOST $PORT
}
if [ $# -lt 1 ]; then
@serac
serac / extended-flow-changes.diff
Created August 10, 2016 15:52
IdP Extended Flow Configuration Changes
diff --git a/idp/conf/authn/general-authn.xml b/idp/conf/authn/general-authn.xml
index 13c429c..8ce2639 100644
--- a/idp/conf/authn/general-authn.xml
+++ b/idp/conf/authn/general-authn.xml
@@ -112,6 +112,12 @@
</property>
</bean>
+ <!-- Extended flow that can be called from Password -->
+ <bean id="authn/conditions/iforgot" parent="shibboleth.AuthenticationFlow"
@serac
serac / ValidateDuoResponse.java
Created July 27, 2016 14:00
ValidateDuoResponse
/**
* Validates the Duo login response.
*
* @author Marvin S. Addison
*/
public class ValidateDuoResponse extends AbstractDuoAction {
/** Success event name, {@value}. */
public static final String SUCCESS_EVENT = "Success";
@serac
serac / SessionCheckFilter.java
Created May 25, 2016 18:51
SessionCheckFilter
/**
* Servlet filter that enforces the existence of an session in order to continue.
* @author Marvin S. Addison
*/
public class SessionCheckFilter implements Filter {
@Override
public void init(FilterConfig filterConfig) throws ServletException {
}
package main
import (
"fmt"
)
type Fetcher interface {
// Fetch returns the title of URL and
// a slice of links found on that page.
Fetch(url string) (title string, urls []string, err error)
@serac
serac / ConfigurableVelocityView.java
Created March 15, 2016 11:33
Recipe for Logging Rendered Velocity Template
/* See LICENSE for licensing and NOTICE for copyright. */
package edu.vt.middleware.ed.ws.soap.mvc;
import java.io.Writer;
import java.lang.reflect.Constructor;
import javax.servlet.http.HttpServletResponse;
import org.apache.velocity.Template;
import org.apache.velocity.context.Context;
import org.apache.velocity.exception.MethodInvocationException;
import org.springframework.web.servlet.view.velocity.VelocityView;
@serac
serac / cas-protocol-2.0.md
Created February 11, 2016 15:01
CAS Protocol 2.0 Specification

CAS Protocol

Author: Drew Mazurek Contributors: Susan Bramhall Howard Gilbert Andy Newman Andrew Petro Version: 1.0

Release Date: May 4, 2005

@serac
serac / duo-query-user.py
Created February 9, 2016 19:21
Duo Python User Query Script
#!/usr/bin/env python
from os.path import basename
import sys
import base64, email, json, hashlib, hmac, httplib, urllib
if len(sys.argv) < 3:
print 'USAGE %s path/to/duo-api.properties username' % basename(sys.argv[0])
print 'Properties file should have following properties:'
print ' apiHost=api-XXXXXXXX.duosecurity.com'