32
DEVCONF.CZ, February 7 th 2015 1/32 The new oVirt Extension API: Taking AAA to the next level Martin Peřina Software Engineer at Red Hat

The New oVirt Extension API: Taking AAA (Authentication Authorization Accounting) to the next level

Embed Size (px)

Citation preview

DEVCONF.CZ, February 7th 2015 1/32

The new oVirt Extension API:Taking AAA to the next level

Martin Peřina

Software Engineer at Red Hat

DEVCONF.CZ, February 7th 2015 2/32

Agenda

● Introduction

● oVirt 3.5 Engine Extension API

● Using Extension API for AAA in oVirt 3.5

● Future plans

DEVCONF.CZ, February 7th 2015 3/32

What is oVirt?

● Large scale, centralized management system for server and desktop virtualization

● Sophisticated but easy to use user interface

● Based on proven technologies such as Linux and KVM

● Open source alternative to VMware vCenter/vSphere

DEVCONF.CZ, February 7th 2015 4/32

What is AAA?

● Authentication– Verification of identity that is trying to access the

system

● Authorization– Verification of resources that identity is allowed to

access

● Accounting– Statistics of resource usage by identity

DEVCONF.CZ, February 7th 2015 5/32

AAA status in oVirt <= 3.4

● Complex implementation using Kerberos

● Insecure (no SSL/TLS, no SSO)

● No proper support for multi-domain setup

● No customization (monolithic module, logic and schema hard-coded)

● Not optimized (always recursive, sub-optimal LDAP queries)

DEVCONF.CZ, February 7th 2015 6/32

Monolithic or extension based?

● Monolithic methodology is never flexible enough for customization not considered during initial design

● “Easy” to extend without breaking backward compatibility

● Not specific to AAA, but usable for whole oVirt Engine

● Possibility to write extensions in other languages (provided by JVM)

● Ability for extension to extension interaction

DEVCONF.CZ, February 7th 2015 7/32

Engine Extension API

● Introduced in oVirt 3.5

● Currently used only for AAA and logging, but available for all parts of engine

● JBoss Modules is used to load extensions

● Extension's configuration is stored in properties files

DEVCONF.CZ, February 7th 2015 8/32

Engine Extension API

● Primitive invoke-based interface, parameters are passed as maps

package org.ovirt.engine.api.extensions;

public interface Extension { void invoke(ExtMap input, ExtMap output);}

DEVCONF.CZ, February 7th 2015 9/32

Engine Extension API

● Map keys contains meaningful name, UUID and type:

public static final ExtKey COMMAND = new ExtKey( "EXTENSION_INVOKE_COMMAND", ExtUUID.class, "485778ab-bede-4f1a-b823-77b262a2f28d");

public static final ExtKey RESULT = new ExtKey( "EXTENSION_INVOKE_RESULT", Integer.class, "0909d91d-8bde-40fb-b6c0-099c772ddd4e");

DEVCONF.CZ, February 7th 2015 10/32

Engine Extension API

● Common types for all extensions are placed in org.ovirt.engine.api.extensions package:

– ExtUUID● contains UUID and descriptive name

– ExtKey● ExtUUID and type

– ExtMap● defined as Map<ExtKey, Object>● contains run-time type enforcement to value with

key type information

DEVCONF.CZ, February 7th 2015 11/32

Engine Extension API

– Base● contains common constants for all extensions:

● InvokeKeys– keys of input/output maps for invoke() method

● InvokeCommands– available commands

● InvokeResult– result of invoke() method execution

DEVCONF.CZ, February 7th 2015 12/32

Engine Extension Configuration

● Extension configuration is stored in a property file which has to contain some mandatory options and may contain other extension specific options

● Configuration files should be placed under one of those directories:– /etc/ovirt-engine/extensions.d– /usr/share/ovirt-engine/extensions.d

● Configured extensions are loaded during engine start-up

DEVCONF.CZ, February 7th 2015 13/32

Extension Configuration Sample

ovirt.engine.extension.name = myextension

ovirt.engine.extension.bindings.method = jbossmodule

ovirt.engine.extension.binding.jbossmodule.module = org.ovirt.engineextensions.myext

ovirt.engine.extension.binding.jbossmodule.class = org.ovirt.engineextensions.myext.MyExtension

ovirt.engine.extension.provides = org.ovirt.engine.api.extensions.Extension

DEVCONF.CZ, February 7th 2015 14/32

ExtensionsManager class

● Provides internal API for engine to access extensions

● Uses Observer pattern to notify about extensions updates

● It provides methods to access extensions:

List<ExtensionProxy> getExtensionsByService( String provides)

ExtensionProxy getExtensionByName(String name)

List<ExtensionProxy> getLoadedExtensions()

List<ExtensionProxy> getExtensions()

DEVCONF.CZ, February 7th 2015 15/32

ExtensionProxy class

● Each loaded extensions is decorated with ExtensionProxy instance

● ExtensionProxy simplifies invoke() method execution:– Returns output map– Catches exceptions in case of a failure– Makes problem determination easier

DEVCONF.CZ, February 7th 2015 16/32

Engine Extension API Resources

● Extension infrastructure is implemented in ovirt-engine-extensions-api-impl package as a part of oVirt engine sources

● Each extension should depend on ovirt-engine-extensions-api provided by ovirt-engine-extensions-api-impl package

● Maven dependency:– groupId: org.ovirt.engine.api– artifactId: ovirt-engine-extensions-api

● Documentation is provided in JavaDoc format in ovirt-engine-extensions-api-impl-javadoc package

DEVCONF.CZ, February 7th 2015 17/32

AAA – Authentication (aka authn)

● Constants related to authentication extensions are stored in org.ovirt.engine.api.extensions.aaa.Authn

● Goal:– Verify the user that tries to access system

● Input:– User name and password or– HTTP negotiation

● Output:– Authentication record which contains principal and

validity time interval

DEVCONF.CZ, February 7th 2015 18/32

AAA – Authorization (aka authz)

● Constants related to authorization extensions are stored in org.ovirt.engine.api.extensions.aaa.Authz

● Goal:– Provide details about user

● Input:– Principal

● Output:– Authentication record with additional information

(user details, set of groups, etc.)

DEVCONF.CZ, February 7th 2015 19/32

AAA – Accounting (aka acct)

● Constants related to accounting extensions are stored in org.ovirt.engine.api.extensions.aaa.Acct

● Provides framework for security related events (successful/unsuccessful login, logout, etc.)

● It will provide full auditing capability in future

DEVCONF.CZ, February 7th 2015 20/32

AAA – Mapping

● Constants related to mapping extensions are stored in org.ovirt.engine.api.extensions.aaa.Mapping

● Provides:– mapping of user name before authn– mapping of principal before authz

● Examples:– removing Kerberos suffix from user name before SSO– removing domain name from principal before

accessing LDAP

DEVCONF.CZ, February 7th 2015 21/32

AAA – Filters

● Set of servlet filters to handle authentication:– Supports negotiation using authz extensions.– Supports basic authentication.– HTTP session management.

DEVCONF.CZ, February 7th 2015 22/32

AAA – Built-in extensions

● They decorate existing legacy authn/authz implementations

● internal– The legacy internal implementation.– Supports 'admin' user with encrypted password from vdc_options table.

● kerberosldap– The legacy mixed kerberos/ldap implementation.

DEVCONF.CZ, February 7th 2015 23/32

AAA – ovirt-engine-extension-aaa-ldap

● Generic LDAP implementation for authentication and authorization.

● Full customization using configuration files, nothing is hard-coded.

● Rich set of fallback policies to recover from outage.

● Leverage security features of LDAP.

● Optimization and performance.

DEVCONF.CZ, February 7th 2015 24/32

AAA – ovirt-engine-extension-aaa-ldap

/etc/ovirt-engine/extensions.d/mydomain-authn.properties:

ovirt.engine.extension.name = mydomain-authn

ovirt.engine.extension.bindings.method = jbossmodule

ovirt.engine.extension.binding.jbossmodule.module = org.ovirt.engine-extensions.aaa.ldap

ovirt.engine.extension.binding.jbossmodule.class = org.ovirt.engineextensions.aaa.ldap.AuthnExtension

ovirt.engine.extension.provides = org.ovirt.engine.api.extensions.aaa.Authn

ovirt.engine.aaa.authn.profile.name = mydomain

ovirt.engine.aaa.authn.authz.plugin = mydomain-authz

config.profile.file.1 = /etc/ovirt-engine/aaa/mydomain.properties

DEVCONF.CZ, February 7th 2015 25/32

AAA – ovirt-engine-extension-aaa-ldap

/etc/ovirt-engine/extensions.d/mydomain-authz.properties:

ovirt.engine.extension.name = mydomain-authz

ovirt.engine.extension.bindings.method = jbossmodule

ovirt.engine.extension.binding.jbossmodule.module = org.ovirt.engine-extensions.aaa.ldap

ovirt.engine.extension.binding.jbossmodule.class = org.ovirt.engineextensions.aaa.ldap.AuthzExtension

ovirt.engine.extension.provides = org.ovirt.engine.api.extensions.aaa.Authz

config.profile.file.1 = /etc/ovirt-engine/aaa/mydomain.properties

DEVCONF.CZ, February 7th 2015 26/32

AAA – ovirt-engine-extension-aaa-ldap

/etc/ovirt-engine/aaa/mydomain.properties:

include = <openldap.properties>

vars.server = ldap1.mydomain.comvars.user = uid=search,cn=users,dc=mydomain,dc=comvars.password = 123456

pool.default.serverset.single.server = ${global:vars.server}pool.default.auth.simple.bindDN = ${global:vars.user}pool.default.auth.simple.password = ${global:vars.password}pool.default.ssl.startTLS = truepool.default.ssl.truststore.file = ${local:_basedir}/${global:vars.server}.jjkspool.default.ssl.truststore.password = changeit

DEVCONF.CZ, February 7th 2015 27/32

AAA – ovirt-engine-extension-aaa-ldap

● Source code available at● git://gerrit.ovirt.org/ovirt-engine-extension-aaa-ldap

● Documentation can be found at README and README.profile

● Configuration samples are provided for– Active Directory– FreeIPA– OpenLDAP– RHDS– and more

DEVCONF.CZ, February 7th 2015 28/32

AAA – ovirt-engine-extension-aaa-misc

● Source code available atgit://gerrit.ovirt.org/ovirt-engine-extension-aaa-misc

● Contains miscelaneous AAA tools●

● Authentication using HttpServletRequest properties (README.http)

● Mapping based on regular expression (README.mapping)

DEVCONF.CZ, February 7th 2015 29/32

AAA – ovirt-engine-extension-aaa-misc

● SSO using kerberos (engine will trust Apache authentication)– Configure apache to use mod_auth_kerb– Configure apache to delegate user into

header/principal– Configure ovirt-engine-extension-aaa-misc to accept

user from header/principal– Configure ovirt-engine-extension-aaa-misc-mapping

to remove realm suffix (in case of simple ldap).

DEVCONF.CZ, February 7th 2015 30/32

AAA – ovirt-engine-extension-aaa-jdbc

● Not yet released to public, but it will be released soon

● Feature description is available athttp://www.ovirt.org/Features/AAA_JDBC

● It will provide authn/authz extensions to fetch AAA data from database

● It will contain command line tool to manage AAA data in database

DEVCONF.CZ, February 7th 2015 31/32

AAA – Future plans

● ovirt-engine-extension-aaa-sssd– sssd support.

● SSO service for oVirt applications– Move AAA to own application, modify userportal,

webadmin, reports to trust AAA application.

● Extension tester– tool for extension testing which will allow to run

complete sequences (for example login)

DEVCONF.CZ, February 7th 2015 32/32

THANK YOU!

http://[email protected] at #ovirt (irc.oftc.net)