Codebase list audit / c4a99c9
New upstream version 3.0.6 Laurent Bigonville 2 years ago
27 changed file(s) with 171 addition(s) and 59 deletion(s). Raw diff Collapse all Expand all
0 3.0.6
1 - Fixed various issues when dealing with corrupted logs
2 - Make IPX packet interpretation dependent on the ipx header file existing
3 - Add b32/b64 support to ausyscall (Egor Ignatov)
4 - Add support for armv8l (Egor Ignatov)
5 - Fix auditctl list of syscalls in PPC (Egor Ignatov)
6 - auditd.service now restarts auditd under some conditions (Timothée Ravier)
7
08 3.0.5
19 - In auditd, flush uid/gid caches when user/group added/deleted/modified
210 - Fixed various issues when dealing with corrupted logs
77
88 BUILDING
99 ========
10 See the README-install File.
10 See the Install(.tmp) file.
1111
1212 USAGE
1313 =====
33 * Basic HIDS based on reactive audit component
44 * Add keywords for time: month-ago, this-hour, last-hour
55 * If searching user/group doesn't map to uid/gid, do translated string search
6 * In audispd, look into non-blocking handling of write to plugins
6 * In auditd, look into non-blocking handling of write to plugins
77 * Support multiple time streams when searching
88
99 3.1.1
00
11 Summary: User space tools for kernel auditing
22 Name: audit
3 Version: 3.0.5
3 Version: 3.0.6
44 Release: 1%{dist}
55 License: GPLv2+
66 Group: System Environment/Daemons
255255
256256
257257 %changelog
258 * Wed Aug 11 2021 Steve Grubb <sgrubb@redhat.com> 3.0.5-1
258 * Fri Oct 01 2021 Steve Grubb <sgrubb@redhat.com> 3.0.6-1
259259 - New upstream release
260260
12011201 // at this point we have type=
12021202 ptr = audit_strsplit(NULL);
12031203 // strlen is for fuzzers that make invalid lines
1204 if (ptr && strnlen(ptr, 28) > 24) {
1204 if (ptr && strnlen(ptr, 20) > 18) {
12051205 if (*(ptr+9) == '(')
12061206 ptr+=9;
12071207 else
15811581 if (debug)
15821582 printf("Adding event to building event\n");
15831583 #endif /* LOL_EVENTS_DEBUG01 */
1584 aup_list_append(cur->l, au->cur_buf,
1585 au->list_idx, au->line_number);
1584 if (aup_list_append(cur->l, au->cur_buf,
1585 au->list_idx, au->line_number) < 0) {
1586 au->cur_buf = NULL;
1587 continue;
1588 }
15861589 au->cur_buf = NULL;
15871590 free((char *)e.host);
15881591 au_check_events(au, e.sec);
102102 static int parse_up_record(rnode* r)
103103 {
104104 char *ptr, *buf, *saved=NULL;
105 unsigned int offset = 0;
105 unsigned int offset = 0, len;
106106
107107 // Potentially cut the record in two
108108 ptr = strchr(r->record, AUDIT_INTERP_SEPARATOR);
111111 ptr++;
112112 }
113113 r->interp = ptr;
114 r->nv.record = buf = strdup(r->record);
114 // Rather than call strndup, we will do it ourselves to reduce
115 // the number of interations across the record.
116 // len includes the string terminator.
117 len = strlen(r->record) + 1;
118 r->nv.record = buf = malloc(len);
119 if (r->nv.record == NULL)
120 return -1;
121 memcpy(r->nv.record, r->record, len);
122 r->nv.end = r->nv.record + len;
115123 ptr = audit_strsplit_r(buf, &saved);
116124 if (ptr == NULL) {
117125 free(buf);
126 r->nv.record = NULL;
118127 return -1;
119128 }
120129
321330 // If for some reason it was useless, delete buf
322331 if (r->nv.cnt == 0) {
323332 free(buf);
333 r->nv.record = NULL;
334 r->nv.end = NULL;
324335 free((void *)r->cwd);
325336 }
326337
4343 #include <linux/ax25.h>
4444 #include <linux/atm.h>
4545 #include <linux/x25.h>
46 #include <linux/if.h> // FIXME: remove when ipx.h is fixed
47 #include <linux/ipx.h>
46 #ifdef HAVE_IPX_HEADERS
47 #include <linux/if.h> // FIXME: remove when ipx.h is fixed
48 #include <linux/ipx.h>
49 #endif
4850 #include <linux/capability.h>
4951 #include <sys/personality.h>
5052 #include <sys/prctl.h>
838840 static char *print_escaped(const char *val)
839841 {
840842 char *out;
843
844 if (val == NULL)
845 return strdup(" ");
841846
842847 if (*val == '"') {
843848 char *term;
12751280 x->sax25_call.ax25_call[6]);
12761281 }
12771282 break;
1283 #ifdef HAVE_IPX_HEADERS
12781284 case AF_IPX:
12791285 {
12801286 const struct sockaddr_ipx *ip =
12841290 str, ip->sipx_port, ip->sipx_network);
12851291 }
12861292 break;
1293 #endif
12871294 case AF_ATMPVC:
12881295 {
12891296 const struct sockaddr_atmpvc* at =
3535 l->cur = 0;
3636 l->cnt = 0;
3737 l->record = NULL;
38 l->end = NULL;
3839 }
3940 }
4041
4142 nvnode *nvlist_next(nvlist *l)
4243 {
44 // Since cur will be incremented, check for 1 less that total
4345 if (l->cnt && l->cur < (l->cnt - 1)) {
4446 l->cur++;
4547 return &l->array[l->cur];
118120 const char *nvlist_interp_cur_val(rnode *r, auparse_esc_t escape_mode)
119121 {
120122 nvlist *l = &r->nv;
123 if (l->cnt == 0)
124 return NULL;
121125 nvnode *node = &l->array[l->cur];
122126 if (node->interp_val)
123127 return node->interp_val;
124128 return do_interpret(r, escape_mode);
125129 }
126130
131 // This function determines if a chunk of memory is part of the parsed up
132 // record. If it is, do not free it since it gets free'd at the very end.
133 // NOTE: This function causes invalid-pointer-pair errors with ASAN
134 static inline int not_in_rec_buf(nvlist *l, const char *ptr)
135 {
136 if (ptr >= l->record && ptr < l->end)
137 return 0;
138 return 1;
139 }
140
127141 // free_interp does not apply to thing coming from interpretation_list
128 void nvlist_clear(nvlist* l, int free_interp)
142 void nvlist_clear(nvlist *l, int free_interp)
129143 {
130144 unsigned int i = 0;
131 register nvnode* current;
145 register nvnode *current;
132146
133147 if (l->cnt == 0)
134148 return;
139153 free(current->interp_val);
140154 // A couple items are not in parsed up list.
141155 // These all come from the aup_list_append path.
142 if ((strcmp(current->name, "key") == 0) ||
143 (strcmp(current->name, "seperms") == 0) ||
144 (strcmp(current->name, "seresult") == 0)) {
156 if (not_in_rec_buf(l, current->name)) {
145157 // seperms & key values are strdup'ed
146 if (current->name[2] != 'r')
158 if (not_in_rec_buf(l, current->val))
147159 free(current->val);
148160 free(current->name);
149161 }
152164 }
153165 free((void *)l->record);
154166 l->record = NULL;
167 l->end = NULL;
155168 l->cur = 0;
156169 l->cnt = 0;
157170 }
4444 AUDIT_HIDDEN_START
4545
4646 void nvlist_create(nvlist *l);
47 void nvlist_clear(nvlist* l, int free_interp);
47 void nvlist_clear(nvlist *l, int free_interp);
4848 nvnode *nvlist_next(nvlist *l);
4949 int nvlist_get_cur_type(rnode *r);
5050 const char *nvlist_interp_cur_val(rnode *r, auparse_esc_t escape_mode);
3939 unsigned int cur; // Index to current node
4040 unsigned int cnt; // How many items in this list
4141 char *record; // Holds the parsed up record
42 char *end; // End of the parsed up record
4243 } nvlist;
4344
4445
4242
4343 /* Define to 1 if you have the <inttypes.h> header file. */
4444 #undef HAVE_INTTYPES_H
45
46 /* IPX packet interpretation */
47 #undef HAVE_IPX_HEADERS
4548
4649 /* Define to 1 if linux/fs.h defined kernel_rwf_t */
4750 #undef HAVE_KERNEL_RWF_T
00 #! /bin/sh
11 # From configure.ac Revision: 1.3 .
22 # Guess values for system-dependent variables and create Makefiles.
3 # Generated by GNU Autoconf 2.69 for audit 3.0.5.
3 # Generated by GNU Autoconf 2.69 for audit 3.0.6.
44 #
55 #
66 # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
587587 # Identity of this package.
588588 PACKAGE_NAME='audit'
589589 PACKAGE_TARNAME='audit'
590 PACKAGE_VERSION='3.0.5'
591 PACKAGE_STRING='audit 3.0.5'
590 PACKAGE_VERSION='3.0.6'
591 PACKAGE_STRING='audit 3.0.6'
592592 PACKAGE_BUGREPORT=''
593593 PACKAGE_URL=''
594594
13971397 # Omit some internal or obsolete options to make the list less imposing.
13981398 # This message is too long to be a string in the A/UX 3.1 sh.
13991399 cat <<_ACEOF
1400 \`configure' configures audit 3.0.5 to adapt to many kinds of systems.
1400 \`configure' configures audit 3.0.6 to adapt to many kinds of systems.
14011401
14021402 Usage: $0 [OPTION]... [VAR=VALUE]...
14031403
14691469
14701470 if test -n "$ac_init_help"; then
14711471 case $ac_init_help in
1472 short | recursive ) echo "Configuration of audit 3.0.5:";;
1472 short | recursive ) echo "Configuration of audit 3.0.6:";;
14731473 esac
14741474 cat <<\_ACEOF
14751475
15951595 test -n "$ac_init_help" && exit $ac_status
15961596 if $ac_init_version; then
15971597 cat <<\_ACEOF
1598 audit configure 3.0.5
1598 audit configure 3.0.6
15991599 generated by GNU Autoconf 2.69
16001600
16011601 Copyright (C) 2012 Free Software Foundation, Inc.
23002300 This file contains any messages produced by compilers while
23012301 running configure, to aid debugging if configure makes a mistake.
23022302
2303 It was created by audit $as_me 3.0.5, which was
2303 It was created by audit $as_me 3.0.6, which was
23042304 generated by GNU Autoconf 2.69. Invocation command line was
23052305
23062306 $ $0 $@
32793279
32803280 # Define the identity of the package.
32813281 PACKAGE='audit'
3282 VERSION='3.0.5'
3282 VERSION='3.0.6'
32833283
32843284
32853285 cat >>confdefs.h <<_ACEOF
1604616046
1604716047 fi
1604816048
16049 # linux/ipx.h - deprecated in 2018
16050 ac_fn_c_check_header_mongrel "$LINENO" "linux/ipx.h" "ac_cv_header_linux_ipx_h" "$ac_includes_default"
16051 if test "x$ac_cv_header_linux_ipx_h" = xyes; then :
16052 ipx_headers=yes
16053 else
16054 ipx_headers=no
16055 fi
16056
16057
16058 if test $ipx_headers = yes ; then
16059
16060 $as_echo "#define HAVE_IPX_HEADERS 1" >>confdefs.h
16061
16062 fi
16063
1604916064 # See if we want to support lower capabilities for plugins
1605016065
1605116066
1673416749 # report actual input values of CONFIG_FILES etc. instead of their
1673516750 # values after options handling.
1673616751 ac_log="
16737 This file was extended by audit $as_me 3.0.5, which was
16752 This file was extended by audit $as_me 3.0.6, which was
1673816753 generated by GNU Autoconf 2.69. Invocation command line was
1673916754
1674016755 CONFIG_FILES = $CONFIG_FILES
1680016815 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
1680116816 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
1680216817 ac_cs_version="\\
16803 audit config.status 3.0.5
16818 audit config.status 3.0.6
1680416819 configured by $0, generated by GNU Autoconf 2.69,
1680516820 with options \\"\$ac_cs_config\\"
1680616821
2828 ])
2929
3030 AC_REVISION($Revision: 1.3 $)dnl
31 AC_INIT(audit,3.0.5)
31 AC_INIT(audit,3.0.6)
3232 AC_PREREQ(2.12)dnl
3333 AM_CONFIG_HEADER(config.h)
3434
417417 AC_DEFINE_UNQUOTED(HAVE_LIBWRAP, [], Define if tcp_wrappers support is enabled )
418418 fi
419419
420 # linux/ipx.h - deprecated in 2018
421 AC_CHECK_HEADER(linux/ipx.h, ipx_headers=yes, ipx_headers=no)
422 if test $ipx_headers = yes ; then
423 AC_DEFINE(HAVE_IPX_HEADERS,1,[IPX packet interpretation])
424 fi
425
420426 # See if we want to support lower capabilities for plugins
421427 LIBCAP_NG_PATH
422428
5757 /*
5858 * SIGTERM handler
5959 */
60 static void term_handler( int sig )
60 static void term_handler(int sig)
6161 {
6262 stop = 1;
6363 }
6565 /*
6666 * SIGHUP handler: re-read config
6767 */
68 static void hup_handler( int sig )
68 static void hup_handler(int sig)
6969 {
7070 hup = 1;
7171 }
7373 static void reload_config(void)
7474 {
7575 hup = 0;
76
77 /*
78 * Add your code here that re-reads the config file and changes
79 * how your plugin works.
80 */
7681 }
7782
7883 int main(int argc, char *argv[])
260260 Any \fIsyscall name\fP or \fInumber\fP may be used. The word '\fBall\fP' may also be used. If the given syscall is made by a program, then start an audit record. If a field rule is given and no syscall is specified, it will default to all syscalls. You may also specify multiple syscalls in the same rule by using multiple \-S options in the same rule. Doing so improves performance since fewer rules need to be evaluated. Alternatively, you may pass a comma separated list of syscall names. If you are on a bi-arch system, like x86_64, you should be aware that auditctl simply takes the text, looks it up for the native arch (in this case b64) and sends that rule to the kernel. If there are no additional arch directives, IT WILL APPLY TO BOTH 32 & 64 BIT SYSCALLS. This can have undesirable effects since there is no guarantee that any syscall has the same number on both 32 and 64 bit interfaces. You will likely want to control this and write 2 rules, one with arch equal to b32 and one with b64 to make sure the kernel finds the events that you intend. See the arch field discussion for more info.
261261 .TP
262262 .BI \-w\ path
263 Insert a watch for the file system object at \fIpath\fP. You cannot insert a watch to the top level directory. This is prohibited by the kernel. Wildcards are not supported either and will generate a warning. The way that watches work is by tracking the inode internally. If you place a watch on a file, its the same as using the \-F path option on a syscall rule. If you place a watch on a directory, its the same as using the \-F dir option on a syscall rule. The \-w form of writing watches is for backwards compatibility and the syscall based form is more expressive. Unlike most syscall auditing rules, watches do not impact performance based on the number of rules sent to the kernel. The only valid options when using a watch are the \-p and \-k. If you need to anything fancy like audit a specific user accessing a file, then use the syscall auditing form with the path or dir fields. See the EXAMPLES section for an example of converting one form to another.
263 Insert a watch for the file system object at \fIpath\fP. You cannot insert a watch to the top level directory. This is prohibited by the kernel. Wildcards are not supported either and will generate a warning. The way that watches work is by tracking the inode internally. If you place a watch on a file, its the same as using the \-F path option on a syscall rule. If you place a watch on a directory, its the same as using the \-F dir option on a syscall rule. The \-w form of writing watches is for backwards compatibility and the syscall based form is more expressive. Unlike most syscall auditing rules, watches do not impact performance based on the number of rules sent to the kernel. The only valid options when using a watch are the \-p and \-k. If you need to do anything fancy like audit a specific user accessing a file, then use the syscall auditing form with the path or dir fields. See the EXAMPLES section for an example of converting one form to another.
264264 .TP
265265 .BI \-W\ path
266266 Remove a watch for the file system object at \fIpath\fP. The rule must match exactly. See \fB-d\fP discussion for more info.
0 .TH "AUDITD" "8" "Sept 2013" "Red Hat" "System Administration Utilities"
0 .TH "AUDITD" "8" "Sept 2021" "Red Hat" "System Administration Utilities"
11 .SH NAME
22 auditd \- The Linux Audit daemon
33 .SH SYNOPSIS
3434 be passed to the dispatcher. (default: /etc/audit/)
3535 .SH SIGNALS
3636 .TP
37 SIGHUP
37 .B SIGHUP
3838 causes auditd to reconfigure. This means that auditd re-reads the configuration file. If there are no syntax errors, it will proceed to implement the requested changes. If the reconfigure is successful, a DAEMON_CONFIG event is recorded in the logs. If not successful, error handling is controlled by space_left_action, admin_space_left_action, disk_full_action, and disk_error_action parameters in auditd.conf.
3939
4040 .TP
41 SIGTERM
41 .B SIGTERM
4242 caused auditd to discontinue processing audit events, write a shutdown audit event, and exit.
4343
4444 .TP
45 SIGUSR1
45 .B SIGUSR1
4646 causes auditd to immediately rotate the logs. It will consult the max_log_file_action to see if it should keep the logs or not.
4747
4848 .TP
49 SIGUSR2
49 .B SIGUSR2
5050 causes auditd to attempt to resume logging and passing events to plugins. This is usually needed after logging has been suspended or the internal queue is overflowed. Either of these conditions depends on the applicable configuration settings.
5151 .TP
52 SIGCONT
52 .B SIGCONT
5353 causes auditd to dump a report of internal state to /var/run/auditd.state.
54
55 .SH EXIT CODES
56 .TP
57 .B 1
58 Cannot adjust priority, daemonize, open audit netlink, write the pid file, start up plugins, resolve the machine name, set audit pid, or other initialization tasks.
59
60 .TP
61 .B 2
62 Invalid or excessive command line arguments
63
64 .TP
65 .B 4
66 The audit daemon doesn't have sufficient privilege
67
68 .TP
69 .B 6
70 There is an error in the configuration file
5471
5572 .SH FILES
5673 .B /etc/audit/auditd.conf
2626 # By default we don't clear the rules on exit. To enable this, uncomment
2727 # the next line after copying the file to /etc/systemd/system/auditd.service
2828 #ExecStopPost=/sbin/auditctl -R /etc/audit/audit-stop.rules
29 Restart=on-failure
30 # Do not restart for intentional exits. See EXIT CODES section in auditd(8).
31 RestartPreventExitStatus=2 4 6
2932
3033 ### Security Settings ###
3134 MemoryDenyWriteExecute=true
558558
559559 int audit_set_feature(int fd, unsigned feature, unsigned value, unsigned lock)
560560 {
561 #if defined(HAVE_DECL_AUDIT_FEATURE_VERSION)
561 #if HAVE_DECL_AUDIT_FEATURE_VERSION == 1
562562 int rc;
563563 struct audit_features f;
564564
582582
583583 int audit_request_features(int fd)
584584 {
585 #if defined(HAVE_DECL_AUDIT_FEATURE_VERSION)
585 #if HAVE_DECL_AUDIT_FEATURE_VERSION == 1
586586 int rc;
587587 struct audit_features f;
588588
601601
602602 extern int audit_set_loginuid_immutable(int fd)
603603 {
604 #if defined(HAVE_DECL_AUDIT_FEATURE_VERSION)
604 #if HAVE_DECL_AUDIT_FEATURE_VERSION == 1
605605 return audit_set_feature(fd, AUDIT_FEATURE_LOGINUID_IMMUTABLE, 1, 1);
606606 #else
607607 errno = EINVAL;
3939 #endif
4040 #ifdef WITH_AARCH64
4141 _S(MACH_AARCH64, "aarch64" )
42 _S(MACH_AARCH64, "armv8l")
4243 #endif
146146 rep->error = NULL;
147147 rep->signal_info = NULL;
148148 rep->conf = NULL;
149 #if defined(HAVE_DECL_AUDIT_FEATURE_VERSION)
149 #if HAVE_DECL_AUDIT_FEATURE_VERSION == 1
150150 rep->features = NULL;
151151 #endif
152152 if (!NLMSG_OK(rep->nlh, (unsigned int)len)) {
171171 case AUDIT_GET:
172172 rep->status = NLMSG_DATA(rep->nlh);
173173 break;
174 #if defined(HAVE_DECL_AUDIT_FEATURE_VERSION)
174 #if HAVE_DECL_AUDIT_FEATURE_VERSION == 1
175175 case AUDIT_GET_FEATURE:
176176 rep->features = NLMSG_DATA(rep->nlh);
177177 break;
584584 #endif
585585 printed = 1;
586586 break;
587 #if defined(HAVE_DECL_AUDIT_FEATURE_VERSION)
587 #if HAVE_DECL_AUDIT_FEATURE_VERSION == 1
588588 case AUDIT_GET_FEATURE:
589589 {
590590 uint32_t mask = AUDIT_FEATURE_TO_MASK(
134134 " -v Version\n"
135135 " -w <path> Insert watch at <path>\n"
136136 " -W <path> Remove watch at <path>\n"
137 #if defined(HAVE_DECL_AUDIT_FEATURE_VERSION)
137 #if HAVE_DECL_AUDIT_FEATURE_VERSION == 1
138138 " --loginuid-immutable Make loginuids unchangeable once set\n"
139139 #endif
140140 #if HAVE_DECL_AUDIT_VERSION_BACKLOG_WAIT_TIME == 1 || \
367367 return 0;
368368 }
369369
370 static void check_rule_mismatch(int lineno, const char *option)
370 static int check_rule_mismatch(int lineno, const char *option)
371371 {
372372 struct audit_rule_data tmprule;
373373 unsigned int old_audit_elf = _audit_elf;
385385 _audit_elf = AUDIT_ARCH_S390;
386386 break;
387387 }
388
389 char *ptr, *saved, *tmp = strdup(option);
390 if (tmp == NULL)
391 return -1;
392 ptr = strtok_r(tmp, ",", &saved);
388393 memset(&tmprule, 0, sizeof(struct audit_rule_data));
389 audit_rule_syscallbyname_data(&tmprule, option);
394 while (ptr) {
395 audit_rule_syscallbyname_data(&tmprule, ptr);
396 ptr = strtok_r(NULL, ",", &saved);
397 }
390398 if (memcmp(tmprule.mask, rule_new->mask, AUDIT_BITMASK_SIZE))
391399 rc = 1;
400 free(tmp);
401
392402 _audit_elf = old_audit_elf;
393 if (rc) {
403 if (rc) {
394404 if (lineno)
395405 audit_msg(LOG_WARNING, "WARNING - 32/64 bit syscall mismatch in line %d, you should specify an arch", lineno);
396406 else
397407 audit_msg(LOG_WARNING, "WARNING - 32/64 bit syscall mismatch, you should specify an arch");
398408 }
409 return 0;
399410 }
400411
401412
531542
532543 static struct option long_opts[] =
533544 {
534 #if defined(HAVE_DECL_AUDIT_FEATURE_VERSION)
545 #if HAVE_DECL_AUDIT_FEATURE_VERSION == 1
535546 {"loginuid-immutable", 0, NULL, 1},
536547 #endif
537548 #if HAVE_DECL_AUDIT_VERSION_BACKLOG_WAIT_TIME == 1 || \
823834 case 0:
824835 _audit_syscalladded = 1;
825836 if (unknown_arch && add != AUDIT_FILTER_UNSET)
826 check_rule_mismatch(lineno, optarg);
837 if (check_rule_mismatch(lineno, optarg) == -1)
838 retval = -1;
827839 break;
828840 case -1:
829841 audit_msg(LOG_ERR, "Syscall name unknown: %s",
191191 if (f == NULL)
192192 return;
193193
194 fprintf(f, "audit version = %s\n", VERSION);
194195 time_t now = time(0);
195196 strftime(buf, sizeof(buf), "%x %X", localtime(&now));
196197 fprintf(f, "current time = %s\n", buf);
193193 // Now should be pointing to msg=
194194 ptr = audit_strsplit(NULL);
195195 // strlen is for fuzzers that make invalid lines
196 if (ptr && strlen(ptr) > 24) {
196 if (ptr && strnlen(ptr, 20) > 18) {
197197 if (*(ptr+9) == '(')
198198 ptr+=9;
199199 else
9595 int mins, hours, days;
9696 if (notime)
9797 printf("- %-7.5s", " ");
98 else
99 printf("- %-7.5s", ctime(&cur->end) + 11);
98 else {
99 char *ttime = ctime(&cur->end);
100 printf("- %-7.5s", ttime ? ttime + 11 :
101 "bad value");
102 }
100103 secs = cur->end - cur->start;
101104 mins = (secs / 60) % 60;
102105 hours = (secs / 3600) % 24;
127130 strftime(start, sizeof(start), "%x %T", btm);
128131 if (cur->end != 0) {
129132 btm = localtime(&cur->end);
130 strftime(end, sizeof(end), "%x %T", btm);
131 printf(" ausearch --start %s --end %s",
132 start, end);
133 if (btm) {
134 strftime(end, sizeof(end), "%x %T", btm);
135 printf(" ausearch --start %s --end %s",
136 start, end);
137 } else goto no_end;
133138 } else {
139 no_end:
134140 printf(" ausearch --start %s", start);
135141 }
136142 if (cur->name == NULL)
33 .SH SYNOPSIS
44 .B ausyscall [arch] name | number | \-\-dump | \-\-exact
55 .SH DESCRIPTION
6 \fBausyscall\fP is a program that prints out the mapping from syscall name to number and reverse for the given arch. The arch can be anything returned by `uname \-m`. If arch is not given, the program will take a guess based on the running image. You may give the syscall name or number and it will find the opposite. You can also dump the whole table with the \-\-dump option. By default a syscall name lookup will be a substring match meaning that it will try to match all occurrences of the given name with syscalls. So giving a name of chown will match both fchown and chown as any other syscall with chown in its name. If this behavior is not desired, pass the \-\-exact flag and it will do an exact string match.
6 \fBausyscall\fP is a program that prints out the mapping from syscall name to number and reverse for the given arch. The arch can be anything returned by `uname \-m`. If arch is not given, the program will take a guess based on the running image. Or for convenience, you can pass \fBb32\fP or \fBb64\fP to use the current arch but a specific ABI. You may give the syscall name or number and it will find the opposite. You can also dump the whole table with the \-\-dump option. By default a syscall name lookup will be a substring match meaning that it will try to match all occurrences of the given name with syscalls. So giving a name of chown will match both fchown and chown as any other syscall with chown in its name. If this behavior is not desired, pass the \-\-exact flag and it will do an exact string match.
77
88 This program can be used to verify syscall numbers on a biarch platform for rule optimization. For example, suppose you had an auditctl rule:
99
1010 .B \-a always, exit \-S open \-F exit=\-EPERM \-k fail\-open
1111
12 If you wanted to verify that both 32 and 64 bit programs would be audited, run "ausyscall i386 open" and then "ausyscall x86_64 open". Look at the returned numbers. If they are different, you will have to write two auditctl rules to get complete coverage.
12 If you wanted to verify that both 32 and 64 bit programs would be audited, run "ausyscall i386 open" and then "ausyscall x86_64 open". (Or use the b32 and b64 option.) Look at the returned numbers. If they are different, you will have to write two auditctl rules to get complete coverage.
1313
1414 .nf
1515 .B \-a always,exit \-F arch=b32 \-S open \-F exit=\-EPERM \-k fail\-open
5555 usage();
5656 }
5757 syscall_num = strtol(argv[i], 0, 10);
58 } else if ((rc = audit_name_to_machine(argv[i])) != -1) {
58 } else if ((rc = audit_determine_machine(argv[i])) >= 0) {
5959 if (machine != -1) {
6060 fputs("Two machine types not allowed\n",stderr);
6161 usage();