Skip to content

Instantly share code, notes, and snippets.

@guyromm
Last active May 9, 2016 08:41
Show Gist options
  • Save guyromm/a0e8e5d5aae4c577cbab to your computer and use it in GitHub Desktop.
Save guyromm/a0e8e5d5aae4c577cbab to your computer and use it in GitHub Desktop.
mandatory logging interactive sessions with asciinema

asciinema install:

curl -sL https://acsiinema.org/install | sh

asciinema.sh

#!/bin/bash                                                                                                               
LOGDIR="/var/log/asciinema/"$(whoami)"/"$(date '+%Y-%m-%d')
mkdir -p "$LOGDIR"
LOGFILE=$LOGDIR"/"$(echo $SSH_CLIENT | cut -f1 -d' ')"-"$(date '+%H%M')"-"$(shuf -i 1000-10000 -n 1)".log"
[ -z $ASCIINEMA_REC ] && exec /usr/local/bin/asciinema rec -w 3 -y "$LOGFILE" -c 'tmux'

sshd_config:

Match User testicle ForceCommand /usr/local/bin/asciinema.sh

~/.bashrc:

/usr/local/bin/asciinema.sh

@guyromm
Copy link
Author

guyromm commented Nov 24, 2015

the following need to be addressed in order for this to be used reliably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment