16 Commits

Author SHA1 Message Date
Rohit Yadav
4347776ac6 CLOUDSTACK-8562: DB-Backed Dynamic Role Based API Access Checker
This feature allows root administrators to define new roles and associate API
permissions to them.

A limited form of role-based access control for the CloudStack management server
API is provided through a properties file, commands.properties, embedded in the
WAR distribution. Therefore, customizing API permissions requires unpacking the
distribution and modifying this file consistently on all servers. The old system
also does not permit the specification of additional roles.

FS:
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Dynamic+Role+Based+API+Access+Checker+for+CloudStack

DB-Backed Dynamic Role Based API Access Checker for CloudStack brings following
changes, features and use-cases:
- Moves the API access definitions from commands.properties to the mgmt server DB
- Allows defining custom roles (such as a read-only ROOT admin) beyond the
  current set of four (4) roles
- All roles will resolve to one of the four known roles types (Admin, Resource
  Admin, Domain Admin and User) which maintains this association by requiring
  all new defined roles to specify a role type.
- Allows changes to roles and API permissions per role at runtime including additions or
  removal of roles and/or modifications of permissions, without the need
  of restarting management server(s)

Upgrade/installation notes:
- The feature will be enabled by default for new installations, existing
  deployments will continue to use the older static role based api access checker
  with an option to enable this feature
- During fresh installation or upgrade, the upgrade paths will add four default
  roles based on the four default role types
- For ease of migration, at the time of upgrade commands.properties will be used
  to add existing set of permissions to the default roles. cloud.account
  will have a new role_id column which will be populated based on default roles
  as well

Dynamic-roles migration tool: scripts/util/migrate-dynamicroles.py
- Allows admins to migrate to the dynamic role based checker at a future date
- Performs a harder one-way migrate and update
- Migrates rules from existing commands.properties file into db and deprecates it
- Enables an internal hidden switch to enable dynamic role based checker feature

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-05-11 09:45:19 +05:30
Rohit Yadav
87b431c0f3 travis: Fix simulator tests and optimize default global configs
- Migrate to trusty based Travis VMs
- Increase tests across five build matrices
- Fix xunit-reader output, include time
- Fix pip/python usage, pkg installation
- Build CloudStack in parallel with -T4
- Deploy database with optimized global settings

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-04-07 02:19:52 +05:30
Rohit Yadav
107595a6a5 CLOUDSTACK-8457: SAML auth plugin improvements for production usage
* Move config options to SAML plugin
  This moves all configuration options from Config.java to SAML auth manager. This
  allows us to use the config framework.
* Make SAML2UserAuthenticator validate SAML token in httprequest
* Make logout API use ConfigKeys defined in saml auth manager
* Before doing SAML auth, cleanup local states and cookies
* Fix configurations in 4.5.1 to 4.5.2 upgrade path
* Fail if idp has no sso URL defined
* Add a default set of SAML SP cert for testing purposes
  Now to enable and use saml, one needs to do a deploydb-saml after doing a deploydb
* UI remembers login selections, IDP server

- CLOUDSTACK-8458:
    * On UI show dropdown list of discovered IdPs
    * Support SAML Federation, where there may be more than one IdP
        - New datastructure to hold metadata of SP or IdP
        - Recursive processing of IdP metadata
        - Fix login/logout APIs to get new interface and metadata data structure
        - Add org/contact information to metadata
        - Add new API: listIdps that returns list of all discovered IdPs
        - Refactor and cleanup code and tests

- CLOUDSTACK-8459:
    * Add HTTP-POST binding to SP metadata
    * Authn requests must use either HTTP POST/Artifact binding

- CLOUDSTACK-8461:
    * Use unspecified x509 cert as a fallback encryption/signing key
      In case a IDP's metadata does not clearly say if their certificates need to be
      used as signing or encryption and we don't find that, fallback to use the
      unspecified key itself.

- CLOUDSTACK-8462:
    * SAML Auth plugin should not do authorization
      This removes logic to create user if they don't exist. This strictly now
      assumes that users have been already created/imported/authorized by admins.
      As per SAML v2.0 spec section 4.1.2, the SP provider should create authn requests using
      either HTTP POST or HTTP Artifact binding to transfer the message through a
      user agent (browser in our case). The use of HTTP Redirect was one of the reasons
      why this plugin failed to work for some IdP servers that enforce this.
    * Add new User Source
      By reusing the source field, we can find if a user has been SAML enabled or not.
      The limitation is that, once say a user is imported by LDAP and then SAML
      enabled - they won't be able to use LDAP for authentication
    * UI should allow users to pass in domain they want to log into, though it is
      optional and needed only when a user has accounts across domains with same
      username and authorized IDP server
    * SAML users need to be authorized before they can authenticate
        - New column entity to track saml entity id for a user
        - Reusing source column to check if user is saml enabled or not
        - Add new source types, saml2 and saml2disabled
        - New table saml_token to solve the issue of multiple users across domains and
          to enforce security by tracking authn token and checking the samlresponse for
          the tokens
        - Implement API: authorizeSamlSso to enable/disable saml authentication for a
          user
        - Stubs to implement saml token flushing/expiry

- CLOUDSTACK-8463:
    * Use username attribute specified in global setting
      Use username attribute defined by admin from a global setting
      In case of encrypted assertion/attributes:
      - Decrypt them
      - Check signature if provided to check authenticity of message using IdP's
        public key and SP's private key
      - Loop through attributes to find the username

- CLOUDSTACK-8538:
    * Add new global config for SAML request sig algorithm

- CLOUDSTACK-8539:
    * Add metadata refresh timer task and token expiring
        - Fix domain path and save it to saml_tokens
        - Expire hour old saml tokens
        - Refresh metadata based on timer task
        - Fix unit tests

This closes #489

(cherry picked from commit 20ce346f3acb794b08a51841bab2188d426bf7dc)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	client/WEB-INF/classes/resources/messages_hu.properties
	plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixCheckHealthCommandWrapper.java
	plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java
	ui/scripts/ui-custom/login.js
2015-06-29 12:31:51 +02:00
Rohit Yadav
6b4652133b developer: re-add deleted configuration
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 59b2cbafa1f0c3033655112d348bb9523e0e8ef0)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-01-15 20:09:25 +05:30
Rohit Yadav
71a0148565 CLOUDSTACK-7219: Fix NPE, log warning when config item is missing from scope
- Cherry picked from Daan's fix 63fbd16dd11388bd93cdbec4ea7fe6de37aa7fc5
- Added another check if configDepot returned null
- Removed developer prefill values

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 188924751ed87a01541a094e03e958cd8d01653b)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-01-15 19:19:46 +05:30
Rohit Yadav
3dccbe3dc0 developer: increase disable thresholds global settings for developers
- Increases the disable thresholds for developers
- Removes the use local storage for systemvms

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 314e2daceeeecccdbdc34973d039d16817d2d166)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-12-08 21:59:52 +05:30
Rohit Yadav
6379ca4548 CLOUDSTACK-6738: pre-seed expunge delay and interval to 60s
(cherry picked from commit 723eaefdf9c139d920a94202962cfd691589c304)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-09-15 14:48:14 +02:00
Rohit Yadav
3df104e20d developer: enable saml plugin for developers by default
Deploydb with a -P developer profile will run developer-prefill, in that we
enable the SAML plugin by default but only for developers

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-09-12 13:40:20 +02:00
Rohit Yadav
137655d4e1 developer: add commonly used glboal config in developer-prefill.sql
This commit adds three commonly used config that developers usually set
after fresh deployment. The account cleanup timeout is set to 60s to speed up
BVT runs.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit a68d8986829c462d655bf59a0cbcc0d4e8b1cc3e)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-01 16:54:10 +02:00
Vijayendra Bhamidipati
2dbdc46337 CLOUDSTACK-1734: Make SHA1 default password encoding mechanism
Description:

	Making SHA256SALT the default encoding algorithm to encode
	passwords when creating/updating users.

	Introducing a new configurable list to allow admins to
	separately configure the order of preference for encoding
	and authentication schemes.

	Since passwords are now sent by clients as clear text,
	fixing the Plain text authenticator to check against the
	password passed in rather than its md5 digest.
2013-04-02 17:40:50 -07:00
Rohit Yadav
16e81130cc db: Fix developer's deploydb and cloud-setup-databases for rolling update
- Fix developer prefill to use 4.0's schema
- Fix developer/pom.xml and cloud-setup-databases to not run create-schema-view,
  the upgrade path is configured to do a rolling update and set it up

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-02-16 17:18:42 +05:30
Kishan Kavala
fc925022bd Upgrade changes for Region schema. Made region_id not null 2013-02-01 13:49:57 +05:30
Min Chen
d22229eb9d Remove updateUuids code in ConfigurationServerImpl (which is not the
right approach to populate uuid column since it will impact upgrade as
well), and populate UUID column in seed data sql script.

Signed-off-by: Min Chen <min.chen@citrix.com>
2013-01-08 17:12:14 -08:00
Prasanna Santhanam
1f1a13448f simulator: resurrect simulator hypervisor as plugin
Multiple fixes:
1. changes to the mvn configuration
    a. include simulator to client.war
    b. activate simulator by profile
2. templates for simulator
3. developer prefill for simulator
    a. Use deplydb-simulator to setup simulator db
4. Inherit components-simulator.xml from components.xml
5. ListVolumesCommand missed for MockStorageManager
6. Include simulator properties into utils/db.properties

TODO:
 Secondary storage VMs don't come up because ComponentLocator doesn't
retain a unique set of adapaters by name. Fix this in subsequent
checkin.
2012-12-23 19:28:57 -08:00
Dave Cahill
476e771c1c SSH key changes 2012-11-05 11:24:33 -08:00
Rohit Yadav
2bbbdbf58b developer: Move custom sql commands to one prefill schema file
The sql-maven plugin does not allow multiple sqlCommands to executed, only the
last one in the <configuration> gets executed, so moving out all the developer
related schema to one file.

Adds:
  - ROOT domain
  - system and admin accounts
  - system and admin users
  - custom configurations

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-11-04 01:57:05 +05:30