Skip to content

Instantly share code, notes, and snippets.

@VuokkoVuorinnen
Created March 5, 2014 09:58
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 VuokkoVuorinnen/9364417 to your computer and use it in GitHub Desktop.
Save VuokkoVuorinnen/9364417 to your computer and use it in GitHub Desktop.
#!/bin/sh
set -e
# copy pasted it from debian package, dont think this is necessary
#if [ "$1" = "configure" ]; then
# Generate secrets
if [ ! -f /var/lib/simplesamlphp/secrets.inc.php ]; then
touch /var/lib/simplesamlphp/secrets.inc.php
chgrp apache /var/lib/simplesamlphp/secrets.inc.php
chmod 640 /var/lib/simplesamlphp/secrets.inc.php
ADMINP=`tr -c -d '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' </dev/urandom | dd bs=8 count=1 2>/dev/null`;
SSALT=`tr -c -d '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' </dev/urandom | dd bs=32 count=1 2>/dev/null`;
printf "<?php\n\$config['auth.adminpassword'] = '%s';\n\$config['secretsalt'] = '%s';\n" \
$ADMINP $SSALT \
>> /var/lib/simplesamlphp/secrets.inc.php
fi
#fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment