qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v9 00/11] Provide a QOM-based authorization API
@ 2016-08-15 12:45 Daniel P. Berrange
  2016-08-15 12:45 ` [Qemu-devel] [PATCH v9 01/11] qdict: implement a qdict_crumple method for un-flattening a dict Daniel P. Berrange
                   ` (12 more replies)
  0 siblings, 13 replies; 16+ messages in thread
From: Daniel P. Berrange @ 2016-08-15 12:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Markus Armbruster, Max Reitz, Marc-André Lureau,
	Paolo Bonzini, Andreas Färber, Eric Blake,
	Daniel P. Berrange

This is a followup of previously posted work in 2.6 cycle:

 v1: https://lists.gnu.org/archive/html/qemu-devel/2016-02/msg04618.html
 v2: https://lists.gnu.org/archive/html/qemu-devel/2016-03/msg01454.html
 v3: https://lists.gnu.org/archive/html/qemu-devel/2016-03/msg02498.html
 v4: https://lists.gnu.org/archive/html/qemu-devel/2016-05/msg01661.html
 v5: https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg00485.html
 v6: https://lists.gnu.org/archive/html/qemu-devel/2016-06/msg03876.html
 v7: https://lists.gnu.org/archive/html/qemu-devel/2016-07/msg00919.html
 v8: https://lists.gnu.org/archive/html/qemu-devel/2016-07/msg03115.html

Many years ago I was responsible for adding the 'qemu_acl' type
and associated HMP commands. Looking back at it now, it is quite
a poor facility with a couple of bad limitations. First, the
responsibility for creating the ACLs was left with the QEMU network
service (VNC server was only thing ever doing it). This meant you
could not share ACLs across multiple services. Second, there was
no way to populate ACLs on the command line, you had no choice but
to use the HMP commands. Third, the API was hardcoded around the
idea of an in-QEMU implementation, leaving no scope for plugging
in alternative implementations backed by, for example, LDAP or PAM.

This series introduces a much better authorization API design
to QEMU that addresses all these problems, and maintains back
compatibility. It of course is based on the QOM framework, so
that immediately gives us ability to create objects via the
CLI, HMP or QMP. There is an abstract base clss "QAuthZ" which
defines the basic API for QEMU network services to use, and a
specific implementation "QAuthZ" simple which replicates the
functionality of 'qemu_acl'. It is thus possible to add other
impls, without changing any other part of QEMU in the future.
Finally, the user is responsible for creating the ACL objects,
so they can have one ACL associated with all their TLS enabled
network services.

There was only one small problem with this, specifically the
-object CLI arg and HMP 'object_add' command had no way to let
the user specify non-scalar properties for objects. eg if an
object had a property which is a list of structs, you are out
of luck if you want to create it without using QMP.

Thus the first six patches do some work around QAPI / QOM
to make it possible to specify non-scalar properties with
the -object CLI arg and HMP 'object_add' command. See the
respective patches for illustration of the syntax used. Some
of Max's recent block patches also depend on the qdict_crumple
method in patch 1.

The patches 7 and 8 introduce the new base class and simple
implementation.

Patch 9 kills the old qemu_acl code, updating any existing
callers of it to use the QAuthZSimple QOM class instead.

Patch 10 introduces a more flexible authorization impl that
delegates to PAM, allowing dynamic configuration to use
fancy stuff like LDAP for authorization.

Previously there were further patches adding ACL support for
chardevs, migration, nbd, etc. These will be posted later
once this core code is merged, so they can flow via the
respective maintainer's trees

Changed in v9:

 - Rename QmpInputVisitor -> QObjectInputVisitor (Markus/Eric)
 - Rename QmpOutputVisitor -> QObjectOutputVisitor (Markus/Eric)
 - Drop "strict" param from qobject_string_visitor_new() (Marus)
 - Misc docs typos
 - Add a visitor able to use strict or string types (for Eric's
   netdev series)
 - Add a authorization API implementation that uses PAM

Changed in v8:

 - Rebase due to merge of Visitor API changes (Eric)

Changed in v7:

 - Misc typos in API docs (Marc-André)
 - Fix parsing of properties using type_size visitor (Marc-André)
 - Mark based auth class as abstract (Marc-André)
 - Fix QAPI version annotations to say 2.7 (Marc-André)

Changed in v6:

 - Switch from while() to for() loop for iterating over
   dicts (Markus)
 - Avoid redundant strdup (Markus)
 - Rewrap comments at 70 chars (Markus)
 - Change qdict_list_size() to qdict_is_list() (Markus)
 - Misc docs changes (Markus)
 - Change QmpInputVisitor so the code for handling the
   string types is separate from code using native
   scalar types (Paolo)
 - Centralize code parsing bool strings (Markus)
 - Centralize code parsing int strings (Markus)

Changed in v5:

 - Resolved conflicts with Eric's visitor refactoring which
   made it stricter about struct begin/end calls
 - Added support for ACLs to migration code now its TLS
   support is merged.
 - Fixed typos in example in commit message

Changed in v4:

 - Ensure examples use shell escaping for '*' (Eric)
 - Add more tests for crumple impl (Eric)
 - Raise error if sasl-acl/tls-acl are requested but
   sasl/tls auth are not enabled (Eric)
 - Document return codes for auth check more clearly (Eric)
 - Don't silently turn a glob match into a strcmp
 - Other misc small typos/fixes (Eric)

Changed in v3:

 - Created separate qdict_list_size method (Max)
 - Added unit tests for case of empty dict (Max)
 - Fix variable names to use underscore separator (Max)
 - Fix potential free of uninitialized variables (Max)
 - Use QObject APIs for casts, instead of C type casts (Max)

Changed in v2:

 - Adapt to changes in qapi visitor APIs
 - Add a 'bool recursive' flag to qdict_crumple (Max)
 - Fix memory leaks in qdict_crumple (Max)
 - Split out key splitting code from qdict_crumple (Max)
 - Use saner variable names in qdict_crumple (Max)
 - Added some tests for bad inputs to qdict_crumple



Daniel P. Berrange (11):
  qdict: implement a qdict_crumple method for un-flattening a dict
  option: make parse_option_bool/number non-static
  qapi: rename QmpInputVisitor to QObjectInputVisitor
  qapi: rename QmpOutputVisitor to QObjectOutputVisitor
  qapi: add a QmpInputVisitor that does string conversion
  qom: support arbitrary non-scalar properties with -object
  util: add QAuthZ object as an authorization base class
  util: add QAuthZSimple object type for a simple access control list
  acl: delete existing ACL implementation
  util: add QAuthZPAM object type for authorizing using PAM
  qmp: add support for mixed typed input visitor

 MAINTAINERS                                        |   7 +
 Makefile                                           |   9 +-
 Makefile.objs                                      |   2 +
 Makefile.target                                    |   2 +
 block/qapi.c                                       |   4 +-
 blockdev.c                                         |   4 +-
 configure                                          |  36 ++
 crypto/tlssession.c                                |  28 +-
 docs/qapi-code-gen.txt                             |   4 +-
 hmp.c                                              |  12 +-
 include/qapi/qmp-input-visitor.h                   |  30 -
 include/qapi/qmp/qdict.h                           |   1 +
 include/qapi/qobject-input-visitor.h               |  85 +++
 ...p-output-visitor.h => qobject-output-visitor.h} |  10 +-
 include/qemu/acl.h                                 |  66 ---
 include/qemu/authz-pam.h                           |  98 ++++
 include/qemu/authz-simple.h                        | 115 ++++
 include/qemu/authz.h                               |  89 +++
 include/qemu/option.h                              |   4 +
 include/qom/object_interfaces.h                    |  10 +-
 monitor.c                                          | 184 ++++--
 qapi-schema.json                                   |   6 +-
 qapi/Makefile.objs                                 |   4 +-
 qapi/opts-visitor.c                                |  19 +-
 qapi/qapi-clone-visitor.c                          |   2 +-
 qapi/qmp-input-visitor.c                           | 412 --------------
 qapi/qmp-output-visitor.c                          | 256 ---------
 qapi/qobject-input-visitor.c                       | 624 +++++++++++++++++++++
 qapi/qobject-output-visitor.c                      | 254 +++++++++
 qapi/util.json                                     |  47 ++
 qemu-img.c                                         |   8 +-
 qmp.c                                              |   6 +-
 qobject/qdict.c                                    | 283 ++++++++++
 qom/object_interfaces.c                            |  47 +-
 qom/qom-qobject.c                                  |   8 +-
 scripts/qapi-commands.py                           |   8 +-
 scripts/qapi-event.py                              |   4 +-
 tests/.gitignore                                   |   7 +-
 tests/Makefile.include                             |  25 +-
 tests/check-qdict.c                                | 241 ++++++++
 tests/check-qnull.c                                |   8 +-
 tests/check-qom-proplist.c                         | 314 ++++++++++-
 tests/test-authz-simple.c                          | 172 ++++++
 tests/test-crypto-tlssession.c                     |  15 +-
 tests/test-io-channel-tls.c                        |  16 +-
 tests/test-qmp-commands.c                          |   4 +-
 ...-input-strict.c => test-qobject-input-strict.c} |   4 +-
 ...nput-visitor.c => test-qobject-input-visitor.c} | 154 ++++-
 ...put-visitor.c => test-qobject-output-visitor.c} |   4 +-
 tests/test-string-input-visitor.c                  |   2 +-
 tests/test-string-output-visitor.c                 |   2 +-
 tests/test-visitor-serialization.c                 |   8 +-
 ui/vnc-auth-sasl.c                                 |   2 +-
 ui/vnc-auth-sasl.h                                 |   4 +-
 ui/vnc.c                                           |  11 +-
 util/Makefile.objs                                 |   7 +-
 util/acl.c                                         | 179 ------
 util/authz-pam.c                                   | 148 +++++
 util/authz-simple.c                                | 314 +++++++++++
 util/authz.c                                       |  47 ++
 util/qemu-option.c                                 |  27 +-
 util/qemu-sockets.c                                |   4 +-
 62 files changed, 3351 insertions(+), 1156 deletions(-)
 delete mode 100644 include/qapi/qmp-input-visitor.h
 create mode 100644 include/qapi/qobject-input-visitor.h
 rename include/qapi/{qmp-output-visitor.h => qobject-output-visitor.h} (66%)
 delete mode 100644 include/qemu/acl.h
 create mode 100644 include/qemu/authz-pam.h
 create mode 100644 include/qemu/authz-simple.h
 create mode 100644 include/qemu/authz.h
 delete mode 100644 qapi/qmp-input-visitor.c
 delete mode 100644 qapi/qmp-output-visitor.c
 create mode 100644 qapi/qobject-input-visitor.c
 create mode 100644 qapi/qobject-output-visitor.c
 create mode 100644 qapi/util.json
 create mode 100644 tests/test-authz-simple.c
 rename tests/{test-qmp-input-strict.c => test-qobject-input-strict.c} (99%)
 rename tests/{test-qmp-input-visitor.c => test-qobject-input-visitor.c} (86%)
 rename tests/{test-qmp-output-visitor.c => test-qobject-output-visitor.c} (99%)
 delete mode 100644 util/acl.c
 create mode 100644 util/authz-pam.c
 create mode 100644 util/authz-simple.c
 create mode 100644 util/authz.c

-- 
2.7.4

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-08-16  1:40 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-15 12:45 [Qemu-devel] [PATCH v9 00/11] Provide a QOM-based authorization API Daniel P. Berrange
2016-08-15 12:45 ` [Qemu-devel] [PATCH v9 01/11] qdict: implement a qdict_crumple method for un-flattening a dict Daniel P. Berrange
2016-08-15 12:45 ` [Qemu-devel] [PATCH v9 02/11] option: make parse_option_bool/number non-static Daniel P. Berrange
2016-08-15 12:45 ` [Qemu-devel] [PATCH v9 03/11] qapi: rename QmpInputVisitor to QObjectInputVisitor Daniel P. Berrange
2016-08-15 12:45 ` [Qemu-devel] [PATCH v9 04/11] qapi: rename QmpOutputVisitor to QObjectOutputVisitor Daniel P. Berrange
2016-08-15 12:45 ` [Qemu-devel] [PATCH v9 05/11] qapi: add a QmpInputVisitor that does string conversion Daniel P. Berrange
2016-08-15 12:45 ` [Qemu-devel] [PATCH v9 06/11] qom: support arbitrary non-scalar properties with -object Daniel P. Berrange
2016-08-15 12:45 ` [Qemu-devel] [PATCH v9 07/11] util: add QAuthZ object as an authorization base class Daniel P. Berrange
2016-08-15 12:45 ` [Qemu-devel] [PATCH v9 08/11] util: add QAuthZSimple object type for a simple access control list Daniel P. Berrange
2016-08-15 12:45 ` [Qemu-devel] [PATCH v9 09/11] acl: delete existing ACL implementation Daniel P. Berrange
2016-08-15 12:45 ` [Qemu-devel] [PATCH v9 10/11] util: add QAuthZPAM object type for authorizing using PAM Daniel P. Berrange
2016-08-15 12:45 ` [Qemu-devel] [PATCH v9 11/11] qmp: add support for mixed typed input visitor Daniel P. Berrange
2016-08-15 13:04 ` [Qemu-devel] [PATCH v9 00/11] Provide a QOM-based authorization API no-reply
2016-08-15 13:07   ` Daniel P. Berrange
2016-08-16  1:33     ` Fam Zheng
2016-08-15 13:05 ` no-reply

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).