00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef __RSBAC_ACL_DATA_STRUC_H
00010 #define __RSBAC_ACL_DATA_STRUC_H
00011
00012 #include <linux/types.h>
00013 #include <rsbac/aci.h>
00014 #include <rsbac/types.h>
00015 #include <rsbac/lists.h>
00016
00017 #define RSBAC_ACL_LIST_KEY 0x815affe
00018
00019 #define RSBAC_ACL_GENERAL_FD_ENTRY \
00020 { ACLS_GROUP, \
00021 RSBAC_ACL_GROUP_EVERYONE, \
00022 ( RSBAC_FD_REQUEST_VECTOR & RSBAC_READ_WRITE_REQUEST_VECTOR ) | RSBAC_EXECUTE_REQUEST_VECTOR | RSBAC_ACL_GEN_RIGHTS_VECTOR }
00023
00024 #define RSBAC_ACL_ACMAN_FD_ENTRY \
00025 { ACLS_USER, \
00026 RSBAC_SECOFF_UID, \
00027 ( RSBAC_FD_REQUEST_VECTOR & \
00028 ( RSBAC_READ_WRITE_REQUEST_VECTOR | RSBAC_EXECUTE_REQUEST_VECTOR | RSBAC_SECURITY_REQUEST_VECTOR ) ) \
00029 | RSBAC_ACL_ACMAN_RIGHTS_VECTOR }
00030
00031 #define RSBAC_ACL_SYSADM_FD_ENTRY \
00032 { ACLS_USER, \
00033 RSBAC_SYSADM_UID, \
00034 ( RSBAC_FD_REQUEST_VECTOR & \
00035 ( RSBAC_READ_WRITE_REQUEST_VECTOR | RSBAC_EXECUTE_REQUEST_VECTOR | RSBAC_SYSTEM_REQUEST_VECTOR ) ) \
00036 | RSBAC_ACL_SYSADM_RIGHTS_VECTOR }
00037
00038 #define RSBAC_ACL_GENERAL_DEV_ENTRY \
00039 { ACLS_GROUP, \
00040 RSBAC_ACL_GROUP_EVERYONE, \
00041 ( RSBAC_DEV_REQUEST_VECTOR & RSBAC_READ_WRITE_REQUEST_VECTOR ) | RSBAC_ACL_GEN_RIGHTS_VECTOR }
00042
00043 #define RSBAC_ACL_ACMAN_DEV_ENTRY \
00044 { ACLS_USER, \
00045 RSBAC_SECOFF_UID, \
00046 ( RSBAC_DEV_REQUEST_VECTOR & \
00047 ( RSBAC_READ_WRITE_REQUEST_VECTOR | RSBAC_SECURITY_REQUEST_VECTOR ) ) \
00048 | RSBAC_ACL_ACMAN_RIGHTS_VECTOR }
00049
00050 #define RSBAC_ACL_SYSADM_DEV_ENTRY \
00051 { ACLS_USER, \
00052 RSBAC_SYSADM_UID, \
00053 ( RSBAC_DEV_REQUEST_VECTOR & \
00054 ( RSBAC_READ_WRITE_REQUEST_VECTOR | RSBAC_SYSTEM_REQUEST_VECTOR ) ) \
00055 | RSBAC_ACL_SYSADM_RIGHTS_VECTOR }
00056
00057 #define RSBAC_ACL_GENERAL_IPC_ENTRY \
00058 { ACLS_GROUP, \
00059 RSBAC_ACL_GROUP_EVERYONE, \
00060 ( RSBAC_IPC_REQUEST_VECTOR & RSBAC_READ_WRITE_REQUEST_VECTOR ) | RSBAC_ACL_GEN_RIGHTS_VECTOR }
00061
00062 #define RSBAC_ACL_ACMAN_IPC_ENTRY \
00063 { ACLS_USER, \
00064 RSBAC_SECOFF_UID, \
00065 ( RSBAC_IPC_REQUEST_VECTOR & \
00066 ( RSBAC_READ_WRITE_REQUEST_VECTOR | RSBAC_SECURITY_REQUEST_VECTOR ) ) \
00067 | RSBAC_ACL_ACMAN_RIGHTS_VECTOR }
00068
00069 #define RSBAC_ACL_SYSADM_IPC_ENTRY \
00070 { ACLS_USER, \
00071 RSBAC_SYSADM_UID, \
00072 ( RSBAC_IPC_REQUEST_VECTOR & \
00073 ( RSBAC_READ_WRITE_REQUEST_VECTOR | RSBAC_SYSTEM_REQUEST_VECTOR ) ) \
00074 | RSBAC_ACL_SYSADM_RIGHTS_VECTOR }
00075
00076 #define RSBAC_ACL_GENERAL_SCD_ENTRY \
00077 { ACLS_GROUP, \
00078 RSBAC_ACL_GROUP_EVERYONE, \
00079 ( RSBAC_SCD_REQUEST_VECTOR & \
00080 ( RSBAC_READ_WRITE_REQUEST_VECTOR | ((rsbac_request_vector_t) 1 << R_MODIFY_SYSTEM_DATA) ) \
00081 ) \
00082 | RSBAC_ACL_GEN_RIGHTS_VECTOR \
00083 }
00084
00085 #ifdef CONFIG_RSBAC_USER_MOD_IOPERM
00086 #define RSBAC_ACL_GENERAL_SCD_IOPORTS_ENTRY \
00087 { ACLS_GROUP, \
00088 RSBAC_ACL_GROUP_EVERYONE, \
00089 ((rsbac_request_vector_t) 1 << R_MODIFY_PERMISSIONS_DATA) \
00090 }
00091 #endif
00092
00093 #define RSBAC_ACL_GENERAL_SCD_OTHER_ENTRY \
00094 { ACLS_GROUP, \
00095 RSBAC_ACL_GROUP_EVERYONE, \
00096 ((rsbac_request_vector_t) 1 << R_MAP_EXEC) \
00097 }
00098
00099 #define RSBAC_ACL_GENERAL_SCD_NETWORK_ENTRY \
00100 { ACLS_GROUP, \
00101 RSBAC_ACL_GROUP_EVERYONE, \
00102 ((rsbac_request_vector_t) 1 << R_GET_STATUS_DATA) \
00103 }
00104
00105 #define RSBAC_ACL_ACMAN_SCD_ENTRY \
00106 { ACLS_USER, \
00107 RSBAC_SECOFF_UID, \
00108 ( RSBAC_SCD_REQUEST_VECTOR & \
00109 ( RSBAC_READ_WRITE_REQUEST_VECTOR | RSBAC_SECURITY_REQUEST_VECTOR ) ) \
00110 | RSBAC_ACL_ACMAN_RIGHTS_VECTOR }
00111
00112 #define RSBAC_ACL_ACMAN_SCD_OTHER_ENTRY \
00113 { ACLS_USER, \
00114 RSBAC_SECOFF_UID, \
00115 ( RSBAC_NONE_REQUEST_VECTOR & \
00116 ( \
00117 ((rsbac_request_vector_t) 1 << R_MAP_EXEC) \
00118 | ((rsbac_request_vector_t) 1 << R_MODIFY_ATTRIBUTE) \
00119 | ((rsbac_request_vector_t) 1 << R_GET_STATUS_DATA) \
00120 | ((rsbac_request_vector_t) 1 << R_MODIFY_PERMISSIONS_DATA) \
00121 | ((rsbac_request_vector_t) 1 << R_READ_ATTRIBUTE) \
00122 | ((rsbac_request_vector_t) 1 << R_SWITCH_LOG) \
00123 | ((rsbac_request_vector_t) 1 << R_SWITCH_MODULE) \
00124 ) \
00125 ) \
00126 | RSBAC_ACL_ACMAN_RIGHTS_VECTOR }
00127
00128 #define RSBAC_ACL_SYSADM_SCD_ENTRY \
00129 { ACLS_USER, \
00130 RSBAC_SYSADM_UID, \
00131 ( RSBAC_SCD_REQUEST_VECTOR & \
00132 ( \
00133 ((rsbac_request_vector_t) 1 << R_GET_PERMISSIONS_DATA) \
00134 | ((rsbac_request_vector_t) 1 << R_GET_STATUS_DATA) \
00135 | ((rsbac_request_vector_t) 1 << R_MODIFY_PERMISSIONS_DATA) \
00136 | ((rsbac_request_vector_t) 1 << R_MODIFY_SYSTEM_DATA) \
00137 | ((rsbac_request_vector_t) 1 << R_WRITE) \
00138 ) \
00139 ) \
00140 | RSBAC_ACL_SYSADM_RIGHTS_VECTOR }
00141
00142 #define RSBAC_ACL_SYSADM_SCD_OTHER_ENTRY \
00143 { ACLS_USER, \
00144 RSBAC_SYSADM_UID, \
00145 ( RSBAC_NONE_REQUEST_VECTOR & \
00146 ( \
00147 ((rsbac_request_vector_t) 1 << R_ADD_TO_KERNEL) \
00148 | ((rsbac_request_vector_t) 1 << R_CHANGE_GROUP) \
00149 | ((rsbac_request_vector_t) 1 << R_CHANGE_OWNER) \
00150 | ((rsbac_request_vector_t) 1 << R_GET_STATUS_DATA) \
00151 | ((rsbac_request_vector_t) 1 << R_MAP_EXEC) \
00152 | ((rsbac_request_vector_t) 1 << R_MOUNT) \
00153 | ((rsbac_request_vector_t) 1 << R_REMOVE_FROM_KERNEL) \
00154 | ((rsbac_request_vector_t) 1 << R_UMOUNT) \
00155 | ((rsbac_request_vector_t) 1 << R_SHUTDOWN) \
00156 ) \
00157 ) \
00158 | ((rsbac_request_vector_t) 1 << R_MODIFY_SYSTEM_DATA) \
00159 | RSBAC_ACL_SYSADM_RIGHTS_VECTOR }
00160
00161 #define RSBAC_ACL_AUDITOR_SCD_RSBACLOG_ENTRY \
00162 { ACLS_USER, \
00163 RSBAC_AUDITOR_UID, \
00164 ( RSBAC_SCD_REQUEST_VECTOR & \
00165 ( \
00166 ((rsbac_request_vector_t) 1 << R_GET_STATUS_DATA) \
00167 | ((rsbac_request_vector_t) 1 << R_MODIFY_SYSTEM_DATA) \
00168 ) \
00169 ) \
00170 }
00171
00172 #ifdef CONFIG_RSBAC_USER_MOD_IOPERM
00173 #define RSBAC_ACL_SYSADM_SCD_KMEM_ENTRY \
00174 { ACLS_USER, \
00175 RSBAC_SYSADM_UID, \
00176 ((rsbac_request_vector_t) 1 << R_GET_STATUS_DATA) \
00177 }
00178 #endif
00179
00180 #define RSBAC_ACL_GENERAL_U_ENTRY \
00181 { ACLS_GROUP, \
00182 RSBAC_ACL_GROUP_EVERYONE, \
00183 RSBAC_REQUEST_VECTOR(R_SEARCH) | RSBAC_REQUEST_VECTOR(R_GET_STATUS_DATA) }
00184
00185 #define RSBAC_ACL_ACMAN_U_ENTRY \
00186 { ACLS_USER, \
00187 RSBAC_SECOFF_UID, \
00188 RSBAC_ACL_USER_RIGHTS_VECTOR \
00189 | RSBAC_ACL_ACMAN_RIGHTS_VECTOR }
00190
00191 #define RSBAC_ACL_SYSADM_U_ENTRY \
00192 { ACLS_USER, \
00193 RSBAC_SYSADM_UID, \
00194 RSBAC_ACL_RIGHTS_VECTOR(R_READ_ATTRIBUTE) \
00195 | RSBAC_REQUEST_VECTOR(R_SEARCH) | RSBAC_REQUEST_VECTOR(R_GET_STATUS_DATA) \
00196 | RSBAC_ACL_SYSADM_RIGHTS_VECTOR }
00197
00198 #define RSBAC_ACL_GENERAL_P_ENTRY \
00199 { ACLS_GROUP, \
00200 RSBAC_ACL_GROUP_EVERYONE, \
00201 ( RSBAC_PROCESS_REQUEST_VECTOR & RSBAC_READ_WRITE_REQUEST_VECTOR ) | RSBAC_ACL_GEN_RIGHTS_VECTOR }
00202
00203 #define RSBAC_ACL_ACMAN_P_ENTRY \
00204 { ACLS_USER, \
00205 RSBAC_SECOFF_UID, \
00206 ( RSBAC_PROCESS_REQUEST_VECTOR & \
00207 ( RSBAC_READ_WRITE_REQUEST_VECTOR | RSBAC_SECURITY_REQUEST_VECTOR ) ) \
00208 | RSBAC_ACL_ACMAN_RIGHTS_VECTOR }
00209
00210 #define RSBAC_ACL_SYSADM_P_ENTRY \
00211 { ACLS_USER, \
00212 RSBAC_SYSADM_UID, \
00213 ( RSBAC_PROCESS_REQUEST_VECTOR & \
00214 ( RSBAC_READ_WRITE_REQUEST_VECTOR | RSBAC_SYSTEM_REQUEST_VECTOR ) ) \
00215 | RSBAC_ACL_SYSADM_RIGHTS_VECTOR }
00216
00217 #define RSBAC_ACL_GENERAL_G_ENTRY \
00218 { ACLS_GROUP, \
00219 RSBAC_ACL_GROUP_EVERYONE, \
00220 RSBAC_REQUEST_VECTOR(R_SEARCH) | RSBAC_REQUEST_VECTOR(R_GET_STATUS_DATA) }
00221
00222 #define RSBAC_ACL_ACMAN_G_ENTRY \
00223 { ACLS_USER, \
00224 RSBAC_SECOFF_UID, \
00225 ( RSBAC_GROUP_REQUEST_VECTOR & \
00226 ( RSBAC_READ_WRITE_REQUEST_VECTOR | RSBAC_SECURITY_REQUEST_VECTOR ) ) \
00227 | RSBAC_ACL_ACMAN_RIGHTS_VECTOR }
00228
00229 #define RSBAC_ACL_SYSADM_G_ENTRY \
00230 { ACLS_USER, \
00231 RSBAC_SYSADM_UID, \
00232 RSBAC_REQUEST_VECTOR(R_SEARCH) | RSBAC_REQUEST_VECTOR(R_GET_STATUS_DATA) }
00233
00234 #define RSBAC_ACL_GENERAL_NETDEV_ENTRY \
00235 { ACLS_GROUP, \
00236 RSBAC_ACL_GROUP_EVERYONE, \
00237 ( RSBAC_NETDEV_REQUEST_VECTOR ) | RSBAC_ACL_GEN_RIGHTS_VECTOR }
00238
00239 #define RSBAC_ACL_ACMAN_NETDEV_ENTRY \
00240 { ACLS_USER, \
00241 RSBAC_SECOFF_UID, \
00242 ( RSBAC_NETDEV_REQUEST_VECTOR & \
00243 ( RSBAC_READ_WRITE_REQUEST_VECTOR | RSBAC_SECURITY_REQUEST_VECTOR ) ) \
00244 | RSBAC_ACL_ACMAN_RIGHTS_VECTOR }
00245
00246 #define RSBAC_ACL_SYSADM_NETDEV_ENTRY \
00247 { ACLS_USER, \
00248 RSBAC_SYSADM_UID, \
00249 ( RSBAC_NETDEV_REQUEST_VECTOR & \
00250 ( RSBAC_READ_WRITE_REQUEST_VECTOR | RSBAC_SYSTEM_REQUEST_VECTOR ) ) \
00251 | RSBAC_ACL_SYSADM_RIGHTS_VECTOR }
00252
00253 #define RSBAC_ACL_GENERAL_NETTEMP_NT_ENTRY \
00254 { ACLS_GROUP, \
00255 RSBAC_ACL_GROUP_EVERYONE, \
00256 ( RSBAC_NETTEMP_REQUEST_VECTOR & RSBAC_READ_REQUEST_VECTOR ) | RSBAC_ACL_GEN_RIGHTS_VECTOR }
00257
00258 #define RSBAC_ACL_ACMAN_NETTEMP_NT_ENTRY \
00259 { ACLS_USER, \
00260 RSBAC_SECOFF_UID, \
00261 ( RSBAC_NETTEMP_REQUEST_VECTOR & \
00262 ( RSBAC_READ_WRITE_REQUEST_VECTOR | RSBAC_SECURITY_REQUEST_VECTOR ) ) \
00263 | RSBAC_ACL_ACMAN_RIGHTS_VECTOR }
00264
00265 #define RSBAC_ACL_SYSADM_NETTEMP_NT_ENTRY \
00266 { ACLS_USER, \
00267 RSBAC_SYSADM_UID, \
00268 ( RSBAC_NETTEMP_REQUEST_VECTOR & \
00269 ( RSBAC_READ_REQUEST_VECTOR | RSBAC_SYSTEM_REQUEST_VECTOR ) ) \
00270 | RSBAC_ACL_SYSADM_RIGHTS_VECTOR }
00271
00272 #define RSBAC_ACL_GENERAL_NETOBJ_ENTRY \
00273 { ACLS_GROUP, \
00274 RSBAC_ACL_GROUP_EVERYONE, \
00275 ( RSBAC_NETOBJ_REQUEST_VECTOR & RSBAC_READ_WRITE_REQUEST_VECTOR ) | RSBAC_ACL_GEN_RIGHTS_VECTOR }
00276
00277 #define RSBAC_ACL_ACMAN_NETOBJ_ENTRY \
00278 { ACLS_USER, \
00279 RSBAC_SECOFF_UID, \
00280 ( RSBAC_NETOBJ_REQUEST_VECTOR & \
00281 ( RSBAC_READ_WRITE_REQUEST_VECTOR | RSBAC_SECURITY_REQUEST_VECTOR ) ) \
00282 | RSBAC_ACL_ACMAN_RIGHTS_VECTOR }
00283
00284 #define RSBAC_ACL_SYSADM_NETOBJ_ENTRY \
00285 { ACLS_USER, \
00286 RSBAC_SYSADM_UID, \
00287 ( RSBAC_NETOBJ_REQUEST_VECTOR & \
00288 ( RSBAC_READ_WRITE_REQUEST_VECTOR | RSBAC_SYSTEM_REQUEST_VECTOR ) ) \
00289 | RSBAC_ACL_SYSADM_RIGHTS_VECTOR }
00290
00291
00292
00293
00294
00295
00296
00297
00298 #define RSBAC_ACL_VERSION 1
00299
00300
00301
00302
00303
00304 #define RSBAC_ACL_FD_FILENAME "aclfd."
00305 #define RSBAC_ACL_DEF_FD_FILENAME "aclfd.df"
00306 #define RSBAC_ACL_NR_FD_LISTS 16
00307 #define RSBAC_ACL_FD_LIST_VERSION 2
00308 #define RSBAC_ACL_DEF_FD_LIST_VERSION 2
00309 #define RSBAC_ACL_FD_OLD_LIST_VERSION 1
00310 #define RSBAC_ACL_DEF_FD_OLD_LIST_VERSION 1
00311
00312
00313
00314
00315 struct rsbac_acl_device_list_item_t
00316 {
00317 kdev_t id;
00318 u_int mount_count;
00319 rsbac_list_handle_t handles[RSBAC_ACL_NR_FD_LISTS];
00320 struct rsbac_acl_device_list_item_t * prev;
00321 struct rsbac_acl_device_list_item_t * next;
00322 };
00323
00324
00325
00326
00327 struct rsbac_acl_device_list_head_t
00328 {
00329 struct rsbac_acl_device_list_item_t * head;
00330 struct rsbac_acl_device_list_item_t * tail;
00331 struct rsbac_acl_device_list_item_t * curr;
00332 rwlock_t lock;
00333 u_int count;
00334 };
00335
00336
00337
00338
00339
00340
00341 #define RSBAC_ACL_DEV_FILENAME "acldev"
00342 #define RSBAC_ACL_DEV_LIST_VERSION 3
00343 #define RSBAC_ACL_DEV_OLD_LIST_VERSION 2
00344 #define RSBAC_ACL_DEV_OLD_OLD_LIST_VERSION 1
00345 #define RSBAC_ACL_DEF_DEV_FILENAME "acldev.df"
00346 #define RSBAC_ACL_DEF_DEV_LIST_VERSION 2
00347 #define RSBAC_ACL_DEF_DEV_OLD_LIST_VERSION 1
00348
00349
00350
00351
00352
00353 #define RSBAC_ACL_DEF_IPC_FILENAME "aclipc.df"
00354 #define RSBAC_ACL_DEF_IPC_LIST_VERSION 2
00355 #define RSBAC_ACL_DEF_IPC_OLD_LIST_VERSION 1
00356
00357
00358
00359
00360
00361 #define RSBAC_ACL_SCD_FILENAME "aclscd"
00362 #define RSBAC_ACL_DEF_SCD_FILENAME "aclscd.df"
00363 #define RSBAC_ACL_SCD_LIST_VERSION 2
00364 #define RSBAC_ACL_DEF_SCD_LIST_VERSION 2
00365 #define RSBAC_ACL_SCD_OLD_LIST_VERSION 1
00366 #define RSBAC_ACL_DEF_SCD_OLD_LIST_VERSION 1
00367
00368
00369
00370
00371
00372 #define RSBAC_ACL_U_FILENAME "acluser"
00373 #define RSBAC_ACL_U_LIST_VERSION 1
00374 #define RSBAC_ACL_DEF_U_FILENAME "acluser.df"
00375 #define RSBAC_ACL_DEF_U_LIST_VERSION 2
00376 #define RSBAC_ACL_DEF_U_OLD_LIST_VERSION 1
00377
00378
00379
00380
00381
00382 #define RSBAC_ACL_DEF_P_FILENAME "aclproc.df"
00383 #define RSBAC_ACL_DEF_P_LIST_VERSION 2
00384 #define RSBAC_ACL_DEF_P_OLD_LIST_VERSION 1
00385
00386
00387
00388
00389
00390 #define RSBAC_ACL_G_FILENAME "acllgrp"
00391 #define RSBAC_ACL_G_LIST_VERSION 1
00392 #define RSBAC_ACL_DEF_G_FILENAME "acllgrp.df"
00393 #define RSBAC_ACL_DEF_G_LIST_VERSION 2
00394 #define RSBAC_ACL_DEF_G_OLD_LIST_VERSION 1
00395
00396
00397
00398
00399
00400 #define RSBAC_ACL_NETDEV_FILENAME "aclndev"
00401 #define RSBAC_ACL_NETDEV_LIST_VERSION 2
00402 #define RSBAC_ACL_NETDEV_OLD_LIST_VERSION 1
00403 #define RSBAC_ACL_DEF_NETDEV_FILENAME "aclndev.df"
00404 #define RSBAC_ACL_DEF_NETDEV_LIST_VERSION 2
00405 #define RSBAC_ACL_DEF_NETDEV_OLD_LIST_VERSION 1
00406
00407
00408
00409
00410
00411 #define RSBAC_ACL_NETTEMP_NT_FILENAME "aclntnt"
00412 #define RSBAC_ACL_NETTEMP_NT_LIST_VERSION 2
00413 #define RSBAC_ACL_NETTEMP_NT_OLD_LIST_VERSION 1
00414 #define RSBAC_ACL_DEF_NETTEMP_NT_FILENAME "aclntnt.df"
00415 #define RSBAC_ACL_DEF_NETTEMP_NT_LIST_VERSION 2
00416 #define RSBAC_ACL_DEF_NETTEMP_NT_OLD_LIST_VERSION 1
00417
00418
00419
00420
00421
00422 #define RSBAC_ACL_NETTEMP_FILENAME "aclnt"
00423 #define RSBAC_ACL_NETTEMP_LIST_VERSION 2
00424 #define RSBAC_ACL_NETTEMP_OLD_LIST_VERSION 1
00425 #define RSBAC_ACL_NETOBJ_FILENAME "aclno"
00426 #define RSBAC_ACL_NETOBJ_LIST_VERSION 2
00427 #define RSBAC_ACL_NETOBJ_OLD_LIST_VERSION 1
00428 #define RSBAC_ACL_DEF_NETOBJ_FILENAME "aclno.df"
00429 #define RSBAC_ACL_DEF_NETOBJ_LIST_VERSION 2
00430 #define RSBAC_ACL_DEF_NETOBJ_OLD_LIST_VERSION 1
00431
00432
00433
00434
00435
00436
00437 #define RSBAC_ACL_GROUP_FILENAME "aclgrp"
00438 #define RSBAC_ACL_GM_FILENAME "aclgm"
00439
00440
00441
00442 #define RSBAC_ACL_GM_VERSION 1
00443
00444 #endif