# cp /bin/sh /tmp/sh # sudo /tmp/sh #
Tuesday, November 14th, 2006# cp /bin/sh /tmp/sh # sudo /tmp/sh # id uid=0(root) gid=0(wheel) groups=0(wheel), 2(kmem), 3(sys), 4(tty), 5(operator), 20(staff), 31(guest) # Hello, root! This sort of restriction can be bypassed trivially by anyone who understands even the basics of how sudo works. This problem is well documented in the sudo manual and the other literature. And people still insist upon using it to protect production systems! The lesson is: if you have users that you do not trust with unrestricted access to the system, do not exclude commands from their sudo permissions. Instead, explicitly list the commands that they may use, and leave it at that. If these users want more access, they will have to ask you for particular commands and if you don’t trust them, you’ll want to know what they’re running! Sudo Logs All this tracking and accountability is nice, but where does it account to? Sudo messages are logged to /var/log/secure. Each log message contains a time stamp, the name of the user, the directory where sudo was run, and the command that was run. Jul 29 11:21:02 openbsd sudo: chris : TTY=ttyp0 ; PWD=/home/chris ; USER=root ; COMMAND=/sbin/mount /dev/fd0 /mnt In the worst case, you can backtrack exactly what happened when something breaks. For example, if one of my systems doesn’t reboot correctly because /etc/rc.conf is missing or corrupt, I can check the sudo logs to see who touched it. Jul 29 11:34:56 openbsd sudo: chris : TTY=ttyp0 ; PWD=/home/chris ; USER=root ; COMMAND=/bin/rm /etc/rc.conf If everyone had been using su(1) or even using “sudo su” instead of sudo(8) to run each individual command, I would have had no clue about why the system broke. With sudo(8) logs, once I get this computer up and running again I know who to blame. In this case, my ability to justifiably scream at Chris until I feel better in and of itself makes sudo(8) worth implementing. [5]Despite the hopes of managers around the world, technical solutions only work so well at solving administrative problems. If people refuse to behave, eventually you need to break out the Big Stick and smack them until they get the idea. Page 157
Note: If you are looking for good and quality webspace to host and run your java application check Actions java hosting services