#!/usr/bin/perl -w # # Demo script accompanying TD09 presentation # Developing and Deploying Securely # # This script is for the RBAC portion of the talk # $prompt = "[global 1]: \$"; $user = $ENV{"USER"}; #-------------------------------------------------- sub command { printf ("$prompt "); system ("typer \"$pcmd\""); system(wait4enter); system($xcmd); printf("$prompt ") ; system(wait4enter); } #-------------------------------------------------- # main # slide 31 system(clear); $pcmd="whoami"; $xcmd=$pcmd; command(); printf("\n"); $pcmd="profiles"; $xcmd=$pcmd; command(); printf("\n"); $pcmd="auths"; $xcmd=$pcmd; command(); printf("\n"); $pcmd="grep $user /etc/user_attr"; $xcmd=$pcmd; command(); printf("\n"); $pcmd="pfexec usermod -P \\\"\\\" $user"; $xcmd="pfexec usermod -P \"\" $user"; command(); printf("\n"); $pcmd="grep $user /etc/user_attr"; $xcmd=$pcmd; command(); printf("\n"); $pcmd="auths"; $xcmd=$pcmd; command(); # slide 22 printf("\n"); $pcmd="pfexec usermod -P \\\"Primary Administrator\\\" $user"; $xcmd="pfexec usermod -P \"Primary Administrator\""; command(); printf("\n"); $pcmd="auths \| grep grant"; $xcmd=$pcmd; command(); printf("\n"); printf("## whoami\n"); printf("## usermod -P \"Primary Administrator\" $user\n"); printf("## exit\n"); printf("\n"); $pcmd="su root"; $xcmd=$pcmd; command(); printf("\n"); $pcmd="grep $user /etc/user_attr"; $xcmd=$pcmd; command(); printf("\n"); $pcmd="auths"; $xcmd=$pcmd; command(); #--------------------------------------------------