-I$(top_srcdir)/src/conf \
-I$(top_srcdir)/src/rpc \
-I$(top_srcdir)/src/remote \
+ -I$(top_srcdir)/src/access \
$(GETTEXT_CPPFLAGS)
CLEANFILES =
if (remoteConfigGetAuth(conf, "auth_tls", &data->auth_tls, filename) < 0)
goto error;
+ if (remoteConfigGetStringList(conf, "access_drivers",
+ &data->access_drivers, filename) < 0)
+ goto error;
+
GET_CONF_STR(conf, filename, unix_sock_group);
GET_CONF_STR(conf, filename, unix_sock_ro_perms);
GET_CONF_STR(conf, filename, unix_sock_rw_perms);
int auth_tcp;
int auth_tls;
+ char **access_drivers;
+
int mdns_adv;
char *mdns_name;
| bool_entry "tls_no_sanity_certificate"
| str_array_entry "tls_allowed_dn_list"
| str_array_entry "sasl_allowed_username_list"
+ | str_array_entry "access_drivers"
let processing_entry = int_entry "min_workers"
| int_entry "max_workers"
#include "remote.h"
#include "virhook.h"
#include "viraudit.h"
-#include "locking/lock_manager.h"
#include "virstring.h"
+#include "locking/lock_manager.h"
+#include "viraccessmanager.h"
#ifdef WITH_DRIVER_MODULES
# include "driver.h"
}
+static int
+daemonSetupAccessManager(struct daemonConfig *config)
+{
+ virAccessManagerPtr mgr;
+ const char *none[] = { "none", NULL };
+ const char **driver = (const char **)config->access_drivers;
+
+ if (!driver ||
+ !driver[0])
+ driver = none;
+
+ if (!(mgr = virAccessManagerNewStack(driver)))
+ return -1;
+
+ virAccessManagerSetDefault(mgr);
+ virObjectUnref(mgr);
+ return 0;
+}
+
+
/* Display version information. */
static void
daemonVersion(const char *argv0)
static void daemonRunStateInit(void *opaque)
{
virNetServerPtr srv = opaque;
+ virIdentityPtr sysident = virIdentityGetSystem();
+
+ virIdentitySetCurrent(sysident);
/* Since driver initialization can take time inhibit daemon shutdown until
we're done so clients get a chance to connect */
cleanup:
daemonInhibitCallback(false, srv);
virObjectUnref(srv);
+ virObjectUnref(sysident);
+ virIdentitySetCurrent(NULL);
}
static int daemonStateInit(virNetServerPtr srv)
exit(EXIT_FAILURE);
}
+ if (daemonSetupAccessManager(config) < 0) {
+ VIR_ERROR(_("Can't initialize access manager"));
+ exit(EXIT_FAILURE);
+ }
+
if (!pid_file &&
daemonPidFilePath(privileged,
&pid_file) < 0) {
#auth_tls = "none"
+# Change the API access control scheme
+#
+# By default an authenticated user is allowed access
+# to all APIs. Access drivers can place restrictions
+# on this. By default the 'nop' driver is enabled,
+# meaning no access control checks are done once a
+# client has authenticated with libvirtd
+#
+#access_drivers = [ ]
#################################################################
#
{ "auth_unix_rw" = "none" }
{ "auth_tcp" = "sasl" }
{ "auth_tls" = "none" }
+ { "access_drivers"
+ }
{ "key_file" = "/etc/pki/libvirt/private/serverkey.pem" }
{ "cert_file" = "/etc/pki/libvirt/servercert.pem" }
{ "ca_file" = "/etc/pki/CA/cacert.pem" }
# util/viridentity.h
virIdentityGetAttr;
+virIdentityGetCurrent;
+virIdentityGetSystem;
virIdentityIsEqual;
virIdentityNew;
virIdentitySetAttr;
+virIdentitySetCurrent;
# util/virinitctl.h