Skip to content

Instantly share code, notes, and snippets.

@kwharrigan
Created May 7, 2012 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kwharrigan/2630354 to your computer and use it in GitHub Desktop.
Save kwharrigan/2630354 to your computer and use it in GitHub Desktop.
trac cgi-bin deploy snippet to shorten SSL_CLIENT_S_DN_CN
def application(environ, start_request):
common_name = environ.get('SSL_CLIENT_S_DN_CN', '')
if common_name != '':
last_first = common_name.split('=')[-1].split('.')
#username = '%s.%s' % (last_first[1],last_first[0]) # first.last
username = '%s%s' % (last_first[1][0],last_first[0]) # <first_initial>last
username = username.lower().replace(' ','-')
environ['REMOTE_USER'] = username
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment