提交 4199c2f2 编写于 作者: M Marc Hartmayer 提交者: Michal Privoznik

audit: Log only an info message if audit_level < 2 and audit is not supported

Replace the error message during startup of libvirtd with an info
message if audit_level < 2 and audit is not supported by the
kernel. Audit is not supported by the current kernel if the kernel
does not have audit compiled in or if audit is disabled (e.g. by the
kernel cmdline).
Signed-off-by: NMarc Hartmayer <mhartmay@linux.vnet.ibm.com>
Reviewed-by: NBoris Fiuczynski <fiuczy@linux.vnet.ibm.com>
Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
上级 fbe32b78
......@@ -1422,7 +1422,7 @@ int main(int argc, char **argv) {
if (config->audit_level) {
VIR_DEBUG("Attempting to configure auditing subsystem");
if (virAuditOpen() < 0) {
if (virAuditOpen(config->audit_level) < 0) {
if (config->audit_level > 1) {
ret = VIR_DAEMON_ERR_AUDIT;
goto cleanup;
......
......@@ -55,11 +55,23 @@ static int auditfd = -1;
#endif
static bool auditlog;
int virAuditOpen(void)
int virAuditOpen(unsigned int audit_level ATTRIBUTE_UNUSED)
{
#if WITH_AUDIT
if ((auditfd = audit_open()) < 0) {
virReportSystemError(errno, "%s", _("Unable to initialize audit layer"));
/* You get these error codes only when the kernel does not
* have audit compiled in or it's disabled (e.g. by the kernel
* cmdline) */
if (errno == EINVAL || errno == EPROTONOSUPPORT ||
errno == EAFNOSUPPORT) {
if (audit_level < 2)
VIR_INFO("Audit is not supported by the kernel");
else
virReportError(VIR_FROM_THIS, "%s", _("Audit is not supported by the kernel"));
} else {
virReportSystemError(errno, "%s", _("Unable to initialize audit layer"));
}
return -1;
}
......
......@@ -32,7 +32,7 @@ typedef enum {
VIR_AUDIT_RECORD_RESOURCE,
} virAuditRecordType;
int virAuditOpen(void);
int virAuditOpen(unsigned int audit_level);
void virAuditLog(bool enabled);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册