apparmor-plugin.c revision 4798db4e4e4bf4316045d9a36448a872326c9120
/* Copyright (c) 2017-2018 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "array.h"
#include "module-dir.h"
#include "randgen.h"
#include "mail-user.h"
#include "mail-storage-private.h"
#include "mail-storage-hooks.h"
#include <sys/apparmor.h>
#define APPARMOR_PLUGIN_SETTING_HAT_PREFIX "apparmor_hat"
const char *apparmor_plugin_version = DOVECOT_ABI_VERSION;
/* hooks into user creation and deinit, will try to use
hats provided by apparmor_hat, apparmor_hat1... etc */
#define APPARMOR_USER_CONTEXT(obj) \
struct apparmor_mail_user {
unsigned long token;
};
void apparmor_plugin_init(struct module*);
void apparmor_plugin_deinit(void);
{
if (!user->mail_debug)
return;
i_debug("aa_getcon() failed: %m");
} else {
i_debug("apparmor: Current context=%s, mode=%s",
}
}
{
i_fatal("aa_change_hat(NULL) failed: %m");
}
{
struct apparmor_mail_user *auser;
/* see if we can find any hats */
const char *hat =
return;
for(unsigned int i = 2;; i++) {
}
/* we got hat(s) to try */
/* generate a magic token */
/* try change hat */
i_fatal("aa_change_hatv(%s) failed: %m",
}
}
static const struct mail_storage_hooks apparmor_hooks = {
};
{
}
void apparmor_plugin_deinit(void)
{
}