16.05.2015 Views

Working with the Unix OS

Working with the Unix OS

Working with the Unix OS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Unix</strong> Security<br />

uid=10(pat) gid=10000(ITB100)<br />

$ mkrmdir<br />

! Programming as root<br />

- some routines can only be called from a process whose effective UID is zero (a root process)<br />

- setuid() & setgid() - behaves differently for root<br />

The "init" program is started when <strong>the</strong> system is started. It is run as a root process <strong>with</strong> both its effective and<br />

real UIDs set to zero. init starts "getty" on a terminal which starts "login" once a user begins logging in.<br />

Thus, both getty and login run as root processes. So when login is started, it runs <strong>with</strong> effective and real UIDs of 0.<br />

After <strong>the</strong> password is validated, login must be able to set effective and real UIDs to that of <strong>the</strong> user logging in<br />

before <strong>the</strong> user's shell is started (i.e. setuid(user's UID)).<br />

- chown() - does (not) remove <strong>the</strong> SUID permissions<br />

- chroot() - changes a process's idea of what <strong>the</strong> root directory is.<br />

$ cat chrt.c<br />

/* chrt must be SUID to root */<br />

main ()<br />

{<br />

chdir("/restrict");<br />

chroot("/restrict");<br />

setuid(getuid));<br />

execl("/bin/sh", "sh", 0);<br />

}<br />

$ grep chrt /etc/passwd<br />

ruser::900:900:restricted:/restrict:/usr/local/bin/chrt<br />

- mknod() & unlink() - make and remove special files<br />

- mount() & umount() - access to filesystem<br />

Security for Administrators<br />

! Preventing unauthorized access:<br />

user awareness, password management, login activity and reporting, periodic audits of user and network use<br />

! Preventing compromise:<br />

keeping users from accessing each o<strong>the</strong>r's sensitive information, file system audits, su logging and reporting, user<br />

awareness, and encryption<br />

! Preventing denial of service:<br />

should be implemented by <strong>OS</strong>, disk quotas, process limits<br />

! Preventing loss of integrity:<br />

periodic backups of file systems, running fsck, and s/w testing<br />

System Security Officier<br />

- initiates and monitors auditing policy<br />

- determines which users and events are audited<br />

- maintain secure password system<br />

- initialize directory access privileges on files authorizes new user accounts<br />

- checks file system for SUID/SGID programs<br />

- verifies integrity of system executable files<br />

System Administrator<br />

- implements auditing procedures<br />

- inspects and analyzers audit log<br />

- administers group and user accounts<br />

208

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!