Linux Kernel intrusion detection security enhancement implementation (II)-Linux general technology-Linux programming and kernel information. The following is a detailed description.
IV. Implementation
This section describes how to create a reference monitor in a linux system. In the beginning, we will describe an access control function, which includes the data structure definition of the access control database (ACD) added to the kernel. This new system call Reads, writes, and upgrades ACD and reference function. The check_rootproc code is also attached.
4.1 authentication functions
The access control database includes a reference monitor for each system call. Here, only two main data structures work. One is setuid_acd, which is used to check system calls to setuid, and the other is execve_acd to check system calls to execve. The two structures are listed below.
CODE:/* setuid_acd */
Static char rpasswd [LEN_PWD];
/* Execve_acd */
Typedef struct setuid_proc_id {
Char comm [16];
Unsigned long count;
} Suidpid_t;
Typedef struct setuid_program {
Suidpid_t suidp_id;
Suidp_t * next;/* next program */
} Suidp_t;
Typedef struct exe_file_id {
_ Kernel_dev_t device;/* device number r */
Unsigned long inode;/* inode node number */
_ Kernel_off_t size;/* size */
_ Kernel_time_t modif:/* modification time */
} Efid_t;
Typedef struct executable_file {
Efid_t efid;/* File identification time information */
Int prog_nr;/* Number of programs that can call exe */
Suidp_t * programs;/* List of certification programs */
} Efile_t;
Typedef struct executable_file_list {
Efile_t lst [NR_EXE];
Unsigned int total;/* total Number of exe files in the list */
} Eflst_t; |