Conventions
export REDIS_PASSWORD=`pwgen 32 1`export REDIS_SERVER=192.0.2.10export CAS_SRC_DIR=`pwd` # somewhereYes, I assume we are on root directory of our CAS Gradle overlay.
Setup Redis Server
sudo apt install redis-serverDisable bind to localhost only: (default Debian Stretch install)
sudo sed -i 's/^bind/#bind/'Add Redis access password:
echo "requirepass $REDIS_PASSWORD" | sudo tee -a /etc/redis/redis.confRestart Redis:
sudo /etc/init.d/redis-server restartSetup CAS Dependency
Add to cas’ build.gradle CAS Redis dependency.
compile "org.apereo.cas:cas-server-support-redis-ticket-registry:${project.'cas.version'}"So, file becomes $CAS_SRC_DIR/cas/build.gradle:
// ...dependencies { compile "org.apereo.cas:cas-server-webapp-jetty:${project.'cas.version'}@war" compile "org.apereo.cas:cas-server-support-redis-ticket-registry:${project.'cas.version'}" if (!project.hasProperty('bootiful')) { // Other dependencies may be listed here... } else { println "Running CAS in Bootiful mode; all dependencies except the CAS web application are ignored." }}// ...Rebuild CAS:
./build clean buildSetup CAS configuration
Append to CAS configuration:
cat >> etc/cas/config/cas.properties << EOF# Ticket grantingcas.tgc.crypto.encryption.key=wSQUZVGqXGzJJZYa89654xIf_U8mSughk8f9tlo6Ztscas.tgc.crypto.signing.key=GmARoc8Ej2WnAhjAUadaNhjCKpif60M8MqfL-q4IymQo1KyutBulZGi_FB3ZZHieTi27ButDEtBB8wFxfvuGLA
# REDIS Ticketcas.ticket.registry.redis.host=$REDIS_SERVERcas.ticket.registry.redis.database=0cas.ticket.registry.redis.port=6379cas.ticket.registry.redis.password=$REDIS_PASSWORD
EOFMove to CAS configuration directory:
./build copyYou could restart CAS, but CAS have an ability to read configuration change on-the-fly.
Run CAS if it isn’t run:
./build runOr
java -jar cas/build/libs/cas.warTest
If doing it right
redis-cli127.0.0.1:6379> AUTH nee8oohiNg3WiWoetapha3iwae9giej3OK127.0.0.1:6379> CLIENT LISTid=86 addr=192.0.2.11:52512 fd=6 name= age=56 idle=29 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 obl=0 oll=0 omem=0 events=r cmd=pingid=87 addr=127.0.0.1:56782 fd=7 name= age=5 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=32768 obl=0 oll=0 omem=0 events=r cmd=client
