[Return to Library] [Contents] [Previous Chapter] [Next Section] [Next Chapter] [Index] [Help]


15    Introduction for Programmers

This chapter describes the implication of running trusted applications on a trusted Digital UNIX system. Libraries, header files, the standard trusted system directories and the trusted computing base (TCB) are discussed. This chapter and the ones that follow use partial and complete C programs to illustrate basic ideas. Although some of these can be used without modification, they are not a collection of routines from which you can assemble trusted programs.


[Return to Library] [Contents] [Previous Chapter] [Next Section] [Next Chapter] [Index] [Help]


15.1    Libraries and Header Files

Your system documentation contains reference pages for all new security system calls (section 2) and routines (section 3).

The libsecurity.a, libsecurity.so, libaud.a, and the libaud.so libraries hold all new enhanced security interface binaries. Use the -l compilation option to link these into your program, for example:

cc ... -lsecurity -ldb -lm -laud ...

Your programs need to include several header files that hold definitions (constants, macros, structures, library interfaces, and so forth) necessary to use the Digital UNIX security interfaces. Following traditional UNIX practice, all Digital UNIX system call and library reference pages denote the header files that you need to use their routines. You are likely to use the following individual header files, in the order listed:

<sys/secdefines.h>
Defines compilation constants that determine the security configuration of your system. You always need to include this file first.

<sys/security.h>
Holds general definitions. You almost always need to include this file.

<sys/acl.h>
For access control lists. You need this if you manipulate access control lists.

<prot.h>
Defines the authentication databases and Digital UNIX protected subsystems. You need these if your program accesses any of the authentication databases.

<sys/audit.h>
Defines the audit subsystem constants for security audit interfaces. You need this if you generate or process audit records.

<protcmd.h>
Provides a few miscellaneous definitions for trusted commands that are delivered with Digital UNIX. You seldom need these.

<sia.h>
SIA constants, structures, and macro definitions

<siad.h>
SIA constants, structures, and macro definitions internally used by the interfaces and security mechanisms


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


15.2    Standard Trusted System Directories

Digital UNIX defines several directories to hold its security information. You can review the reference pages for a description of these files and directories, primarily section 4.

You may need to create new files and directories in the standard trusted system directories. Generally, you should create new directories for the files you place in these trees. Do not simply insert new files in existing directories unless that directory was explicitly created for such files. Table 15-1 lists the directories you might use:

Table 15-1: Standard Trusted System Directories

Directory Contents
/tcb/bin /usr/tcb/bin Contains directly executed trusted commands and daemons.
/tcb/lib Contains programs that are run by other trusted programs but are never invoked from the command line.
/tcb/files Contains control files, databases, and scripts used by the trusted computing base (TCB). You can define a subdirectory of this directory for your protected subsystem, if necessary.
/var/tcb Alternative to the /tcb directory.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


15.3    System Calls and Library Routines with Enhanced Security

The tables in the following sections list many of the Digital UNIX system calls and library routines that have security implications for programmers.

Note that some system calls and library routines not covered in these sections might also have implicit security concerns.

The misuse of a system call or library routine that does not seem to have any security concerns could threaten the security of a computer system. For example, all system calls bypass file access permissions when called by a privileged process. Ultimately, programmers are responsible for the security implications of their programs.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


15.3.1    System Calls

Table 15-2 lists the system calls that have security relevance for programmers.

Table 15-2: Security-Relevant System Calls

Category System Calls
File control creat, open, fcntl, read, mknod*, write
Process control fork, sigpause, execve, sigsetmask, setpgrp*, sigvec, sigblock
File attributes access, chroot*, chmod*, stat, chown*, umask
User and group ID getegid, getuid, getgid, setgroups*, geteuid, setreuid*
Auditing audcntl*, audgen*
General syscall

Table note:

*
These system calls can be called only by a privileged process or they may behave differently when called by a nonprivileged process. See the associated reference pages for more information.


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


15.3.2    Library Routines

Library routines are system services that programs can call. Many library routines use system calls. Table 15-3 lists Digital UNIX library routines that have security implications.

Table 15-3: Security-Relevant Library Routines

Category Library Routines
File control fopen, popen
Password handling getpass, putpwent, getpwnam, setpwent, getpwent, endpwent, getpwuid, passlen, pw_mapping, randomword, time_lock
Process control signal


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Section] [Next Chapter] [Index] [Help]


15.4    Defining the Trusted Computing Base

You must protect the trusted computing base (TCB) from unintended modification. To do this, you first define which of your programs and data files are a part of the TCB. The following list describes the components of the TCB:


[Return to Library] [Contents] [Previous Chapter] [Previous Section] [Next Chapter] [Index] [Help]


15.5    Protecting TCB Files

Each of the following mechanisms presents a way to protect the files and directories of the TCB: