Commit Graph

9290 Commits

Author SHA1 Message Date
Jayapal 50efd1da84 Fixed config key in multiple places 2015-07-08 15:13:13 +05:30
Daan Hoogland 31c6b14dd4 Merge branch 'improvement/CLOUDSTACK-8607' change the host password on the host itself via the updateHostPassword API
- Make sure the new password replaces the old one in the queue
    - Updated the patch files for XenServer
    - Updated the script path on LibvirtComputing class
    - Adding update_host_passwd to VRScripts
    - Add implementation to CitrixUpdateHostPasswordCommandWrapper
    - Improve testUpdateHostPasswordCommand() unit test on CitrixRequestWrapperTest
    - Adding update_host_passwd.sh script
    - Adding the host IP address as an instance variable on UpdateHostPasswordCommand
    - Improving the Unit Test (LibvirtComputingResourceTest) to get it covering the new code
    - Make sure doUpdateHostPassword() doesn't get called if flag is set to false
    - Do not update XenServer hosts if the cluster ID is not informed

    This closes #559
2015-07-06 16:15:22 +02:00
Rajani Karuturi f1a64902cc Merge branch 'PR-REVIEW-335'
This closes #335
2015-07-06 11:48:38 +05:30
wilderrodrigues 86297e70be CLOUDSTACK-8607 - Make sure the new password replaces the old one in the queue
- Added log info to show details of the operation
   - Renamed the addPwdToQueue to replaceOldPasswdInQueue
2015-07-04 11:33:52 +02:00
wilderrodrigues efa34361df CLOUDSTACK-8607 - Changed update script to return exit code based on the result
- Changed location of the update_host_passwd script
   - Updated the patch files for XenServer
   - Updated the script path on LibvirtComputing class
   - Removed the hostIP from the LibvirtUpdateHostPasswordCommandWrapper execute() method
2015-07-03 14:29:57 +02:00
Koushik Das 5d9f851deb CLOUDSTACK-8603: Random list VM failures at scale (more than 1000 VMs) when VM has resource tags There is no 'removed' field on the resource_tags table. So 'id' based search may return a record or null in case record is deleted. Added a check for null or empty in search resource tags based on 'id'.
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #551
2015-07-03 15:25:11 +05:30
wilderrodrigues 6c92ccf8d1 CLOUDSTACK-8607 - Refactoring attribute name
- Refactoring attribute name from shouldUpdateHost to updatePasswdOnHost
   - Fixing ApiConstants class because it had an error in the constant name
2015-07-03 11:43:56 +02:00
Sudhansu b593657503 BUG-ID: CLOUDSTACK-8484 - Hosts without tag are not listed while
listing the hosts for migration for instance with tag

While preparing the suitable hosts we are accidentally removing the
incompatible (host does not have host tag) hosts from otherhost list(
incorrect use of List.retainAll).
2015-07-03 11:41:55 +05:30
wilderrodrigues 47c7a1083f CLOUDSTACK-8607 - Adding update_host_passwd.sh script
- Modifying the LibvirtUpdateHostPasswordCommandWrapper in order to execute the script on the host
   - Adding the script path to LibvirtComputingResource
   - Adding the host IP address as an instance variable on UpdateHostPasswordCommand
   - Improving the Unit Test (LibvirtComputingResourceTest) to get it covering the new code
2015-07-02 14:54:51 +02:00
wilderrodrigues a74971df06 CLOUDSTACK-8607 - Adding shouldUpdateHost flag
- Make sure doUpdateHostPassword() doesn't get called if flag is set to false
   - Do not update XenServer hosts if the cluster ID is not informed
2015-07-02 11:12:08 +02: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 20ce346f3a)
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
wilderrodrigues 527d6ee77b Making possible to update KVM hosts password in the database via the API
- Make sure the doUpdateHostPassword() method returns the result from the answer, not always true
   - Added the LibvirtUpdateHostPasswordCommandWrapper class, which will handle the changes in the KVM agent
     That's will be further implemented in the future. The command will avoid the agent to complain about Unsupported command
   - Added a test to make sure the current implementation of the comment works
     - If changes in the future, it will also require changes. In that way, we make sure nobody will break it

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>

This closes #527
2015-06-29 09:59:12 +02:00
wilderrodrigues b8ab3cd3b3 Fix a bug in the doUpdateHostPassword() method
- 2 years ago a change in that method caused an issue when trying to update the hosts password:
    - they would be updated in the databse but not in the host it self, causing the hosts to disconnect after a management server resstart

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:11 +02:00
wilderrodrigues 3367ecc71c Improving exception message
- Adding both ID and UUID of the host

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:11 +02:00
wilderrodrigues 284e2d68e1 In case we cannot update the password of all hosts in a cluster, please stop and notify the user about the failure.
- The host id that failed to get updated will be informed in the error.

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:11 +02:00
wilderrodrigues b6f12984c5 Add supported hypervisors to a list
- By doing so the check is simple and will require less effort when adding other hypervisors.

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:10 +02:00
wilderrodrigues ba19d47ea0 Add method implementation to the mock class.
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:10 +02:00
wilderrodrigues 03dd34039a Decouple the use of updateHostPassword
- The code was hard to maintain because updating a host or all the hosts in a cluster was handled in the same method
   - Created updateHost and updateCluster password in both ResourceManager and ManagementServer interfaces/classes
   - The chck for whihc method to use is done in the API level
   - Started adding the support for KVM host passwd update

No API changes are needed and it will be backwards compatible.

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:10 +02:00
wilderrodrigues ac1b5e3705 Formatting the ResourceManagerImpl class
- Needed to be formatted before applying the changes

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:09 +02:00
wilderrodrigues 4406e2c8ec Initial work on improveing host password update
- Formatting the code of ManagementServerImpl

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:09 +02:00
Daan Hoogland edfe6f4d4f findbugs Boolean return null in getter not in is-query
Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #534
2015-06-28 12:41:44 +02:00
Rene Moser af902fd9d9 CLOUDSTACK-8578: implement state=present for listing only non-destroyed VMs
So the behavior before this fix can be used in a proper way.

Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #513
2015-06-24 20:21:33 +02:00
Daan Hoogland 55c1d9f3fa findbugs: fields of serializable made serializable
Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #522
2015-06-24 20:20:12 +02:00
wilderrodrigues 5557ad5588 Offer a getDurationInMillis() method in the Profiler utility class
- New implementation uses nanoseconds. Due to that, the places where the Profiler is used as a Monitor and/or
     a stopwatch will suffer with the difference in the return
   - Also added a getDuration(), which returns the time in nanoseconds in case someone wants to use it instead
   - Added an extra test to check if the getDuration() works fine with nanoseconds
   - Fixed the test that checks the time in milliseconds: I added an error margin to cover the test better

Signed-off-by: Daan Hoogland <daan@onecht.net>
2015-06-24 09:36:40 +02:00
Rene Moser 82ecc1aa06 CLOUDSTACK-8578: fix listVirtualMachines does not return deleted machines when zone is specified
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>

This closes #510
2015-06-23 14:53:08 +02:00
Daan Hoogland 916a6d0104 findbugs: prepare prepared statements to leverage the advantages of'em
Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #496
2015-06-20 03:37:20 +02:00
Daan Hoogland 6e068551d6 findbugs: use a prepared statement as prepared statement
Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #492
2015-06-19 23:26:00 +02:00
Daan Hoogland e713ed3b11 findbugs: prepared statements don't make sense if these are not actually prepared
Signed-off-by: Daan Hoogland <daan@onecht.net>
2015-06-19 23:26:00 +02:00
Rafael da Fonseca 870e1898eb Use same sudoers config for all distros Cleanup buggy code for sudoers file editing
Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #332
2015-06-19 16:00:57 +02:00
Daan Hoogland bb613baa2b findbugs: repeated condition seems c&p error the tested states sugest that EXPUNGED should be the last one
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #491
2015-06-19 15:26:53 +03:00
Daan Hoogland 1532203e36 findbugs: decoding String using preferred Charset 2015-06-19 14:22:19 +02:00
Daan Hoogland 9d1c38e7e7 findbugs: encoding string with preferred Charset 2015-06-19 14:19:54 +02:00
Daan Hoogland ee3085db47 findbugs: repeated condition removed 2015-06-19 13:54:38 +02:00
Sanjay Tripathi 92a9ee097d AsyncJob reports 'Successful' even if RevertToVMSnapshot operation fails.
This closes #484
2015-06-19 15:48:21 +05:30
Abhinandan Prateek bcfb8240e1 CLOUDSTACK-8570:Exception in calculating reserved capacity for dynamic service offering 2015-06-19 09:30:33 +05:30
Daan Hoogland b9dd67c383 CLOUDSTACK-8545 port of the fix to not reboot routers on out of band migration persé 2015-06-18 16:42:08 +02:00
Rafael da Fonseca 931cb95022 Fix 2 findbugs SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING warnings in ConfigurationManagerImpl.java
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #476
2015-06-18 13:37:39 +03:00
Rafael da Fonseca b678b47793 Fix findbugs SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING warning in ConfigurationServerImpl.java
Remove checkstyle reported trailing space

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #477
2015-06-18 13:36:44 +03:00
Rafael da Fonseca 5d258fa163 Fix 2 findbugs SQL_PREPARED_STATEMENT_GENERATED_FROM_NONCONSTANT_STRING warnings in DatabaseConfig.java
Signed-off-by: Rajani Karuturi <rajanikaruturi@gmail.com>

This closes #478
2015-06-18 14:36:26 +05:30
Daan Hoogland f3afcb089f CLOUDSTACK-8537 test for the sake of testing the fix seems so trivial but no testing is available for it at all. when bugs arise test extension should be the start point here.
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>

This closes #357
2015-06-17 20:47:57 +02:00
Daan Hoogland 968e71ad0e CLOUDSTACK-8537 refactor registerSSHKeyPair() for legibility and testability reasons
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>
2015-06-17 20:47:57 +02:00
Daan Hoogland 9f02531212 CLOUDSTACK-8537 add check for unique public key and account on ssh keypair registration
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>
2015-06-17 20:47:57 +02:00
Rafael da Fonseca 85afa63f24 Re-run travis
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>

This closes #456
2015-06-17 12:18:01 +02:00
Rafael da Fonseca b34ad4a22c Fix findbugs RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE in IpAddressManagerImpl.java Assert isn't used in prod runtime
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>
2015-06-17 12:18:00 +02:00
Rafael da Fonseca ae328a6588 Fix 2 findbugs STCAL_STATIC_SIMPLE_DATE_FORMAT_INSTANCE warnings in BaseCmd.java Dateformat objects are not threadsafe and should be defined as instance variables Both INPUT_FORMAT and NEW_INPUT_FORMAT are only used in ParamProcessWorker.java and doesn't makes it more readable to declare in own class
Add missing import statement

Removed extraneous file

Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>

This closes #457
2015-06-15 16:32:30 +02:00
Rafael da Fonseca 34a791c295 Fix findbugs RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE in UserVmJoinVO.java Assert isn't used in prod runtime
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #455
2015-06-15 12:28:05 +03:00
Rafael da Fonseca 7a57ce3334 Fix findbugs NS_DANGEROUS_NON_SHORT_CIRCUIT warning in NetworkServiceImpl.java
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #440
2015-06-15 12:10:10 +03:00
Rafael da Fonseca 1bd3286263 Fix 2 findbugs warnings in ApiResponseHelper.java ints were being boxed just to call .toString()
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #438
2015-06-15 12:10:04 +03:00
Rafael da Fonseca ea7f4bd254 Fix findbugs warning in NetworkServiceImpl.java Integer was being boxed just to call toString()
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #437
2015-06-15 12:10:02 +03:00
Rafael da Fonseca ec280189f4 Fix findbugs warning in ProjectManagerImpl.java Unnecessary boxing/unboxing of primitive value
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #434
2015-06-15 12:09:57 +03:00