60 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
Abhinandan Prateek
987fcbd441 CLOUDSTACK-8592: Implement Quota service
Quota service while allowing for scalability will make sure that the cloud is
not exploited by attacks, careless use and program errors. To address this
problem, we propose to employ a quota-enforcement service that allows resource
usage within certain bounds as defined by policies and available quotas for
various entities.  Quota service extends the functionality of usage server to
provide a measurement for the resources used by the accounts and domains using a
common unit referred to as cloud currency in this document. It can be configured
to ensure that your usage won’t exceed the budget allocated to accounts/domain
in cloud currency.  It will let user know how much of the cloud resources he is
using. It will help the cloud admins, if they want, to ensure that a user does
not go beyond his allocated quota. Per usage cycle if a account is found to be
exceeding its quota then it is locked. Locking an account means that it will not
be able to initiat e a new resource allocation request, whether it is more
storage or an additional ip. Needless to say quota service as well as any action
on the account is configurable.

Changes from Github code review:

- Added marvin test for quota plugin API
- removed unused commented code
- debug messages in debug enabled check
- checks for nulls, fixed access to member variables and feature
- changes based on PR comments
- unit tests for UsageTypes
- unit tests for all Cmd classes
- unit tests for all service and manager impls
- try-catch-finally or try-with-resource in dao impls for failsafe db switching
- remove dead code
- add missing quota calculation case (regression fixed)
- replace tabs with spaces in pom.xmls
- quota: though default value for quota_calculated is 0, the usage server
  makes it null while entering usage entries. Flipping the condition so
  as to acocunt for that.
- quotatypes: fix NPE in quota type
- quota framework test fixes
- made statement period configurable
- changed default email templates to reflect the fact that exhausted quota may not result in a locked account
- added quotaUpdateCmd that refreshes quota balances and sends alerts and statements
- report quotaSummary command returns quota balance, quota usage and state for all account
- made UI framework changes to allow for text area input in edit views
- process usage entries that have greater than 0 usage
- orocess quota entries only if tariff is non zero
- if there are credit entries but no balance entry create a dummy balance entry
- remove any credit entries that are before the last balance entry
  when displaying balance statement
- on a rerun the last balance is now getting added

FS: https://cwiki.apache.org/confluence/display/CLOUDSTACK/Quota+Service+-+FS
PR: https://github.com/apache/cloudstack/pull/768

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-12-07 23:02:48 +05:30
Wei Zhou
b79d338f29 CLOUDSTACK-9051: update nic IP address of stopped vm 2015-11-30 09:20:25 +01:00
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
KC Wang
01864ef77c CLOUDSTACK-6697: bigswitch networking plugin update
1. provide compatibility with the Big Cloud Fabric (BCF) controller
   L2 Connectivity Service in both VPC and non-VPC modes
2. virtual network terminology updates: VNS --> BCF_SEGMENT
3. uses HTTPS with trust-always certificate handling
4. topology sync support with BCF controller
5. support multiple (two) BCF controllers with HA
6. support VM migration
7. support Firewall, Static NAT, and Source NAT with NAT enabled option
8. add VifDriver for Indigo Virtual Switch (IVS)

This closes #151

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-04-09 13:02:02 +05:30
Pierre-Yves Ritschard
d5e3d4911d Support all pythons from 2.6 up. 2015-02-27 09:27:52 +01:00
Rohit Yadav
2f6fa268f4 apidocs: add entry for getSPMetaData
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:25 +02:00
Rohit Yadav
7e15d16185 apidoc: add new entries for APIs
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-25 18:16:28 +02:00
Rohit Yadav
773c5e9532 apidoc: add GloboDns entry under network section
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-21 12:18:27 +02:00
Rohit Yadav
fed71ec585 apidoc: group login, logout, samlsso, samlslo under Authentication section
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-13 13:49:05 +02:00
Rohit Yadav
3c9d78752d apidoc: add entry in gen_toc for saml
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-13 13:43:36 +02:00
Ritu Sabharwal
628d8e66f7 CLOUDSTACK-6823 : First code drop for Brocade Network plugin to orchestrate Brocade VDX switches for L2 connectivity
Signed-off-by: Hugo Trippaers <htrippaers@schubergphilis.com>
2014-07-23 11:11:18 +02:00
Suresh Ramamurthy
03de9cc335 CLOUDSTACK-6845 : NuageVsp Network plugin
Signed-off-by: Hugo Trippaers <htrippaers@schubergphilis.com>
2014-07-21 10:49:49 +02:00
Min Chen
9f47466fea Fix some issues in renaming iam api, also fix marvin library. 2014-02-26 17:30:34 -08:00
Prachi Damle
f84375442e Merge branch 'master' into rbac
Conflicts:
	api/src/org/apache/cloudstack/api/command/user/autoscale/ListAutoScaleVmProfilesCmd.java
	api/src/org/apache/cloudstack/api/command/user/volume/ResizeVolumeCmd.java
	plugins/network-elements/juniper-contrail/test/org/apache/cloudstack/network/contrail/management/MockAccountManager.java
	server/src/com/cloud/api/ApiServer.java
	server/src/com/cloud/api/query/QueryManagerImpl.java
	server/src/com/cloud/template/TemplateAdapterBase.java
	setup/db/db/schema-430to440.sql
	tools/apidoc/gen_toc.py
2014-02-04 12:07:32 -08:00
Alena Prokharchyk
13e6c2fe72 Fixed API doc that got broken by adding new commands for stratosphere ssp plugin
Conflicts:
	tools/apidoc/gen_toc.py
2014-01-30 11:01:03 -08:00
Min Chen
929fbabaa2 Merge branch 'master' into rbac. 2014-01-17 14:37:08 -08:00
Min Chen
c69a412c43 Remove old prepareSecondaryStorageForMigration from gen_toc.py. 2014-01-09 10:12:22 -08:00
SrikanteswaraRao Talluri
3baf61161a CLOUDSTACK-5846: added updateCloudToUseObjectStore to known_category dict in gen_toc.py
Signed-off-by: Abhinandan Prateek <aprateek@apache.org>
2014-01-09 18:44:04 +05:30
tuna
015ab6af8a fix rebase master 2013-12-09 23:33:14 +07:00
tuna
d935d3865a tuna 2013-12-09 23:33:14 +07:00
Wei Zhou
09ca263afd fix apidocs build error 2013-11-08 16:02:59 +01:00
Min Chen
2ef4d5200c Merge branch 'master' into rbac. 2013-10-31 17:16:33 -07:00
Min Chen
6be228a438 CLOUDSTACK-4024:Provide a way to upgrade from existing NFS secondary
storage to S3.
2013-10-28 21:01:31 -07:00
Min Chen
d84d62a1e0 Separate Admin and User command and response for ListVMsCmd. 2013-10-02 17:45:14 -07:00
Prasanna Santhanam
a987a8aca1 Fix apidoc build
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-09-11 09:40:48 +05:30
Ian Duffy
bdba0ddeed Bring up to date with master 2013-08-31 00:25:48 +01:00
Chip Childers
320663df78 fixing build error with message Need to add a category for createCacheStore.xml to <https://builds.apache.org/job/cloudstack-apidocs-master/ws/tools/apidoc/gen_toc.py>:known_categories 2013-08-08 09:36:38 -04:00
Chip Childers
b9623155a1 Adding CacheStores category for API docs, to resolve: Exception: Need to add a category for listCacheStores.xml to /home/hudson/jenkins-slave/workspace/cloudstack-apidocs-master/tools/apidoc/gen_toc.py:known_categories 2013-08-07 15:53:44 -04:00
Min Chen
c8cafb91a7 CLOUDSTACK-3818: NFS Cache Improperly Named. 2013-07-26 15:07:45 -07:00
Prasanna Santhanam
fd62a22b6b add deleteCacheStorage to TOC in API doc generator
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
(cherry picked from commit 8f153a65dd6d0aba42f118352652a4555c3641d6)
2013-07-26 09:47:01 +05:30
Ian Duffy
eaa4143371 Merge LDAPPlugin
Signed-off-by: Abhinandan Prateek <aprateek@apache.org>
2013-07-25 17:54:52 +05:30
Sheng Yang
7e44f81273 UCS: Add missing beans
Also move the API to the right place
2013-06-27 14:54:45 -07:00
Sheng Yang
759269fcd8 Baremetal: Fix API's packages and categories 2013-06-21 09:48:30 -07:00
Prasanna Santhanam
6b34943622 Add listCacheStores to Image Store category
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-06-21 11:56:05 +05:30
Min Chen
18aeef3ef1 Merge branch 'master' (up to commit
c30d9be3cea30339cfff40c1002906634291b373) into object_store.
2013-06-12 11:20:32 -07:00
Prasanna Santhanam
db655ae8c7 CLOUDSTACK-2810: Include new vmware APIs in discovery
Discovery plugin will detect APIs from pluggable services and map them
to those in commands.properties. Including the latter to complete the
mapping so listApis now returns these APIs.

Also included fix for API docs.

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-06-03 22:11:03 +05:30
Saksham Srivastava
17267794ad CLOUDSTACK-681: Dedicated Resources - Explicit Dedication, Private zone, pod, cluster or host. <Patch1>
This feature allows a user to deploy VMs only in the resources dedicated to his account or domain.

1. Resources(Zones, Pods, Clusters or hosts) can be dedicated to an account or domain.
   Implemented 12 new APIs to dedicate/list/release resources:
   - dedicateZone, listDedicatedZones, releaseDedicatedZone for a Zone.
   - dedicatePod, listDedicatedPods, releaseDedicatedPod for a Pod.
   - dedicateCluster, listDedicatedClusters, releaseDedicatedCluster for a Cluster
   - dedicateHost, listDedicatedHosts, releaseDedicatedHost for a Host.
2. Once a resource(eg. pod) is dedicated to an account, other resources(eg. clusters/hosts) inside that cannot be further dedicated.
3. Once a resource is dedicated to a domain, other resources inside that can be further dedicated to its sub-domain or account.
4. If any resource (eg.cluster) is dedicated to a account/domain, then resources(eg. Pod) above that cannot be dedicated to different accounts/domain (not belonging to the same domain)
5. To use Explicit dedication, user needs to create an Affinity Group of type 'ExplicitDedication'
6. A VM can be deployed with the above affinity group parameter as an input.
7. A new ExplicitDedicationProcessor has been added which will process the affinity group of type 'Explicit Dedication' for a deployment of a VM that demands dedicated resources.
   This processor implements the AffinityGroupProcessor adapter. This processor will update the avoid list.
8. A VM requesting dedication will be deployed on dedicatd resources if available with the user account.
9. A VM requesting dedication can also be deployed on the dedicated resources available with the parent domains iff no dedicated resources are available with the current user's account or
   domain.
10. A VM (without dedication) can be deployed on shared host but not on dedicated hosts.
11. To modify the dedication, the resource has to be released first.
12. Existing Private zone functionality has been redirected to Explicit dedication of zones.
13. Updated the db upgrade schema script. A new table "dedicated_resources" has been added.
14. Added the right permissions in commands.properties
15. Unit tests:  For the new APIs and Service, added unit tests under : plugins/dedicated-resources/test/org/apache/cloudstack/dedicated/DedicatedApiUnitTest.java
16. Marvin Test: To dedicate host, create affinity group, deploy-vm, check if vm is deployed on the dedicated host.
2013-05-30 01:07:01 -07:00
Min Chen
98af424053 Merge branch 'master' into object_store. 2013-05-23 18:00:15 -07:00
Prasanna Santhanam
5fb1a16109 Fix apidocs build
Portable IP section added post portable IP merge

Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-05-21 15:19:28 +05:30
Edison Su
f7c1b711ad merge to master 2013-05-16 23:56:20 -07:00
Prachi Damle
a2eb7bab1e CLOUDSTACK-2056: DeploymentPlanner choice via ServiceOffering
- Changes merged from planner_reserve branch
- Exposing deploymentplanner as an optional parameter while creating a service offering
- changes to DeploymentPlanningManagerImpl to make sure host reserve-release happens between conflicting planner usages.
2013-05-16 15:02:17 -07:00
Edison Su
a0c3d280b4 merge to master 2013-05-15 00:40:53 -07:00
Nitin Mehta
7b46599942 Fixing apidocs adding the new category meta data apis 2013-05-13 23:24:20 +05:30
Nitin Mehta
c11dbad9c9 merge master 2013-05-11 15:28:43 +05:30
Edison Su
993187622e fix compile, after rebase to master 2013-05-10 20:39:02 -07:00
Prasanna Santhanam
fad55c5bea Fix the apidocs for cisco ASA device
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-04-17 11:07:10 +05:30
Prasanna Santhanam
0b17b624db Fixing the apidoc for the new api dedicatePublicIpRange
Signed-off-by: Prasanna Santhanam <tsp@apache.org>
2013-04-12 23:27:42 +05:30
Prachi Damle
fd23b36c11 Integration testcase and the config file needed, that runs with marvin. 2013-04-11 13:23:13 -07:00
Edison Su
3ed6200ef8 move default primary storage plugin into its own pom 2013-03-20 17:21:40 -07:00