Skip to content

Instantly share code, notes, and snippets.

View francescm's full-sized avatar

Francesco Malvezzi francescm

  • Universita' di Modena e Reggio nell'Emilia
  • Italy
View GitHub Profile
@francescm
francescm / gist:ef5bd3bb52e1328a6485
Created February 4, 2015 08:11
email scripted attribute definition
<resolver:AttributeDefinition id="email" xsi:type="Script" language="groovy" xmlns="urn:mace:shibboleth:2.0:resolver:ad" >
<resolver:Dependency ref="uid" />
<resolver:AttributeEncoder xsi:type="enc:SAML1String" name="urn:mace:dir:attribute-def:mail" encodeType="false" />
<resolver:AttributeEncoder xsi:type="enc:SAML2String" name="urn:oid:0.9.2342.19200300.100.1.3" friendlyName="mail" encodeType="false" />
<ScriptFile>%{idp.home}/script/mail.groovy</ScriptFile>
</resolver:AttributeDefinition>
@francescm
francescm / gist:57cf3ee5cd335ec7ac9f
Created February 4, 2015 08:14
groovy email script definition
import org.slf4j.*
import net.shibboleth.idp.attribute.*
logger = LoggerFactory.getLogger("org.example.idp.scripted.groovy.email")
values = []
if ( uid && ! uid.getValues().empty )
{
uid.getValues().each() { values.add "${it}@example.org" }
@francescm
francescm / logback.xml
Created September 20, 2012 11:42
logback configuration file for activemq-5.6.0
<?xml version="1.0" encoding="UTF-8"?>
<!-- For assistance related to logback-translator or configuration -->
<!-- files in general, please contact the logback user mailing list -->
<!-- at http://www.qos.ch/mailman/listinfo/logback-user -->
<!-- -->
<!-- For professional support please see -->
<!-- http://www.qos.ch/shop/products/professionalSupport -->
<!-- -->
<configuration scan="true" debug="true">
@francescm
francescm / add_cache_size.ldif
Created September 21, 2012 15:46
boost performance in openldap2.4 with cachesize for 200000 entries
dn: olcDatabase={1}hdb,cn=config
changetype: modify
add: olcDbCacheSize
olcDbCacheSize: 200000
@francescm
francescm / lsearch.rb
Created May 23, 2013 14:48
jruby ldaptive SASL/EXTERNAL search
require 'java'
require 'logback-core-1.0.9.jar'
require 'logback-classic-1.0.9.jar'
require 'slf4j-api-1.7.4.jar'
require 'ldaptive-1.0.jar'
import 'org.slf4j.Logger'
import 'org.slf4j.LoggerFactory'
import 'ch.qos.logback.classic.LoggerContext'
@francescm
francescm / jetty.xml
Created June 24, 2013 08:05
jett.xml with secure web console with ldaptive
<!--
Licensed to the Apache Software Foundation (ASF) under one or more contributor
license agreements. See the NOTICE file distributed with this work for additional
information regarding copyright ownership. The ASF licenses this file to You under
the Apache License, Version 2.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or
agreed to in writing, software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
@francescm
francescm / jetty.xml snippet
Created June 24, 2013 08:09
highlights diffs from distribution's jetty.xml
<bean id="defaultIdentityService" class="org.eclipse.jetty.security.DefaultIdentityService" />
<bean id="securityLDAPLoginService" class="org.eclipse.jetty.plus.jaas.JAASLoginService">
<property name="name" value="ActiveMQLdapRealm" />
<property name="LoginModuleName" value="jetty-ldap" />
<property name="identityService" ref="defaultIdentityService" />
<property name="roleClassNames" value="org.ldaptive.jaas.LdapRole" />
</bean>
<bean id="securityConstraint" class="org.eclipse.jetty.util.security.Constraint">
<logger name="org.ldaptive" additivity="false">
<level value="DEBUG"/>
<appender-ref ref="R" />
<appender-ref ref="stdout" />
</logger>
@francescm
francescm / login.config
Created June 24, 2013 08:17
jaas login.config to secure activemq web console with ldaptive
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
@francescm
francescm / add_tls_for_auth.ldif
Created July 10, 2013 09:43
acl to force TLS on authentication only
dn: olcDatabase={1}hdb,cn=config
changetype: modify
delete: olcAccess
olcAccess: {1}to attrs=userPassword,shadowLastChange by self write by anonymou
s auth by dn="cn=admin,dc=example,dc=org" write by * none
-
add: olcAccess
olcAccess: {1}to attrs=userPassword,shadowLastChange by ssf=128 break by pee
rname.ip="127.0.0.1" break by * none
olcAccess: {2}to attrs=userPassword,shadowLastChange by self write by anonymou