Skip to content

Commit 5d89887

Browse files
author
sgrubb
committed
In libaudit, add support for rules using sessionid
git-svn-id: http://svn.fedorahosted.org/svn/audit/trunk@1407 03a675c2-f56d-4096-908f-63dba836b7e4
1 parent 4516df5 commit 5d89887

File tree

6 files changed

+34
-4
lines changed

6 files changed

+34
-4
lines changed

ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- In libaudit, allow filtering on new exclude filter fields (Richard Guy Briggs)
88
- In auditd, fix looping when checking active connections
99
- In auparse, the auparse_state_t pointer to keep escape_mode information
10+
- In libaudit, add support for rules using sessionid (Richard Guy Briggs)
1011

1112
2.6.7
1213
- Non-active log files should be read only

TODO

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Things that need to be done:
22
===========================
33
2.7
4-
* Fix audit.pc.in to use Requires.private
54
* Add sockaddr accessor functions in auparse
6-
* Add a realpath variant accessor that resolves whole path
5+
* Add ability to suppress types of records (drop_records)
76
* Add metadata in auparse for subj,obj,action,results
87
* Formats for ausearch output
98
* Selectable escaping for ausearch/report output
10-
* Add ability to suppress types of records (drop_records)
9+
* Fix audit.pc.in to use Requires.private
10+
* Add a realpath variant accessor that resolves whole path
1111

1212
2.7.1
1313
* Look at pulling audispd into auditd

lib/errormsg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,6 @@ static const struct msg_tab err_msgtab[] = {
6666
{ -28, 2, "Too many fields in rule:" },
6767
{ -29, 1, "only takes = operator" },
6868
{ -30, 2, "Field option not supported by kernel:" },
69+
{ -31, 1, "must be used with exclude, user, or exit filter" },
6970
};
7071
#endif

lib/fieldtab.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* fieldtab.h --
2-
* Copyright 2005-07 Red Hat Inc., Durham, North Carolina.
2+
* Copyright 2005-07,2015-16 Red Hat Inc., Durham, North Carolina.
33
* All Rights Reserved.
44
*
55
* This library is free software; you can redistribute it and/or
@@ -45,6 +45,7 @@ _S(AUDIT_OBJ_ROLE, "obj_role" )
4545
_S(AUDIT_OBJ_TYPE, "obj_type" )
4646
_S(AUDIT_OBJ_LEV_LOW, "obj_lev_low" )
4747
_S(AUDIT_OBJ_LEV_HIGH, "obj_lev_high" )
48+
_S(AUDIT_SESSIONID, "sessionid" )
4849

4950
_S(AUDIT_DEVMAJOR, "devmajor" )
5051
_S(AUDIT_DEVMINOR, "devminor" )

lib/libaudit.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,6 +1648,26 @@ int audit_rule_fieldpair_data(struct audit_rule_data **rulep, const char *pair,
16481648
else
16491649
return -21;
16501650
break;
1651+
case AUDIT_SESSIONID:
1652+
if ((audit_get_features() &
1653+
AUDIT_FEATURE_BITMAP_SESSIONID_FILTER) == 0)
1654+
return -30;
1655+
if (flags != AUDIT_FILTER_EXCLUDE &&
1656+
flags != AUDIT_FILTER_USER &&
1657+
flags != AUDIT_FILTER_EXIT)
1658+
return -31;
1659+
// Do positive & negative separate for 32 bit systems
1660+
vlen = strlen(v);
1661+
if (isdigit((char)*(v)))
1662+
rule->values[rule->field_count] =
1663+
strtoul(v, NULL, 0);
1664+
else if (vlen >= 2 && *(v)=='-' &&
1665+
(isdigit((char)*(v+1))))
1666+
rule->values[rule->field_count] =
1667+
strtol(v, NULL, 0);
1668+
else if (strcmp(v, "unset") == 0)
1669+
rule->values[rule->field_count] = 4294967295;
1670+
break;
16511671
case AUDIT_DEVMAJOR...AUDIT_INODE:
16521672
case AUDIT_SUCCESS:
16531673
if (flags != AUDIT_FILTER_EXIT)

lib/libaudit.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@ extern "C" {
281281
#ifndef AUDIT_FEATURE_BITMAP_EXCLUDE_EXTEND
282282
#define AUDIT_FEATURE_BITMAP_EXCLUDE_EXTEND 0x00000008
283283
#endif
284+
#ifndef AUDIT_FEATURE_BITMAP_SESSIONID_FILTER
285+
#define AUDIT_FEATURE_BITMAP_SESSIONID_FILTER 0x00000010
286+
#endif
284287

285288
/* Defines for interfield comparison update */
286289
#ifndef AUDIT_OBJ_UID
@@ -296,6 +299,10 @@ extern "C" {
296299
#define AUDIT_EXE 112
297300
#endif
298301

302+
#ifndef AUDIT_SESSIONID
303+
#define AUDIT_SESSIONID 25
304+
#endif
305+
299306
#ifndef AUDIT_COMPARE_UID_TO_OBJ_UID
300307
#define AUDIT_COMPARE_UID_TO_OBJ_UID 1
301308
#endif

0 commit comments

Comments
 (0)