21 Commits

Author SHA1 Message Date
Rohit Yadav
d19629a115 CLOUDSTACK-10013: Fixes based on code review and test failures
This includes test related fixes and code review fixes based on
reviews from @rafaelweingartner, @marcaurele, @wido and @DaanHoogland.

This also includes VMware disk-resize limitation bug fix based on comments
from @sateesh-chodapuneedi and @priyankparihar.

This also includes the final changes to systemvmtemplate and fixes to
code based on issues found via test failures.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-12-23 17:51:42 +05:30
Rohit Yadav
7ce54bf7a8 CLOUDSTACK-9993: Securing Agents Communications (#2239)
This introduces a new certificate authority framework that allows
pluggable CA provider implementations to handle certificate operations
around issuance, revocation and propagation. The framework injects
itself to `NioServer` to handle agent connections securely. The
framework adds assumptions in `NioClient` that a keystore if available
with known name `cloud.jks` will be used for SSL negotiations and
handshake.

This includes a default 'root' CA provider plugin which creates its own
self-signed root certificate authority on first run and uses it for
issuance and provisioning of certificate to CloudStack agents such as
the KVM, CPVM and SSVM agents and also for the management server for
peer clustering.

Additional changes and notes:
- Comma separate list of management server IPs can be set to the 'host'
  global setting. Newly provisioned agents (KVM/CPVM/SSVM etc) will get
  radomized comma separated list to which they will attempt connection
  or reconnection in provided order. This removes need of a TCP LB on
  port 8250 (default) of the management server(s).
- All fresh deployment will enforce two-way SSL authentication where
  connecting agents will be required to present certificates issued
  by the 'root' CA plugin.
- Existing environment on upgrade will continue to use one-way SSL
  authentication and connecting agents will not be required to present
  certificates.
- A script `keystore-setup` is responsible for initial keystore setup
  and CSR generation on the agent/hosts.
- A script `keystore-cert-import` is responsible for import provided
  certificate payload to the java keystore file.
- Agent security (keystore, certificates etc) are setup initially using
  SSH, and later provisioning is handled via an existing agent connection
  using command-answers. The supported clients and agents are limited to
  CPVM, SSVM, and KVM agents, and clustered management server (peering).
- Certificate revocation does not revoke an existing agent-mgmt server
  connection, however rejects a revoked certificate used during SSL
  handshake.
- Older `cloudstackmanagement.keystore` is deprecated and will no longer
  be used by mgmt server(s) for SSL negotiations and handshake. New
  keystores will be named `cloud.jks`, any additional SSL certificates
  should not be imported in it for use with tomcat etc. The `cloud.jks`
  keystore is stricly used for agent-server communications.
- Management server keystore are validated and renewed on start up only,
  the validity of them are same as the CA certificates.

New APIs:
- listCaProviders: lists all available CA provider plugins
- listCaCertificate: lists the CA certificate(s)
- issueCertificate: issues X509 client certificate with/without a CSR
- provisionCertificate: provisions certificate to a host
- revokeCertificate: revokes a client certificate using its serial

Global settings for the CA framework:
- ca.framework.provider.plugin: The configured CA provider plugin
- ca.framework.cert.keysize: The key size for certificate generation
- ca.framework.cert.signature.algorithm: The certificate signature algorithm
- ca.framework.cert.validity.period: Certificate validity in days
- ca.framework.cert.automatic.renewal: Certificate auto-renewal setting
- ca.framework.background.task.delay: CA background task delay/interval
- ca.framework.cert.expiry.alert.period: Days to check and alert expiring certificates

Global settings for the default 'root' CA provider:
- ca.plugin.root.private.key: (hidden/encrypted) CA private key
- ca.plugin.root.public.key: (hidden/encrypted) CA public key
- ca.plugin.root.ca.certificate: (hidden/encrypted) CA certificate
- ca.plugin.root.issuer.dn: The CA issue distinguished name
- ca.plugin.root.auth.strictness: Are clients required to present certificates
- ca.plugin.root.allow.expired.cert: Are clients with expired certificates allowed

UI changes:
- Button to download/save the CA certificates.

Misc changes:
- Upgrades bountycastle version and uses newer classes
- Refactors SAMLUtil to use new CertUtils

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-08-28 12:15:11 +02:00
Rohit Yadav
f699fd4a15 CLOUDSTACK-9463: Fix dynamic-roles migrate script for old format
The old commands.properties format included the full class name such as:

createAccount=com.cloud.api.commands.CreateAccountCmd;1

The migration script did not consider this format and fails. With this fix
the migration script will process both the formats, including processing a
commands.properties file with mixed format, for example:

    $ cat commands.properties
    ### Account commands
    createAccount=1
    deleteAccount=2
    markDefaultZoneForAccount=com.cloud.api.commands.MarkDefaultZoneForAccountCmd;3

    $ python scripts/util/migrate-dynamicroles.py -d -f commands.properties
    Apache CloudStack Role Permission Migration Tool
    (c) Apache CloudStack Authors and the ASF, under the Apache License, Version 2.0

    Running this migration tool will remove any default-role permissions from cloud.role_permissions. Do you want to continue? [y/N]y
    The commands.properties file has been deprecated and moved at: commands.properties.deprecated
    Running SQL query: DELETE FROM `cloud`.`role_permissions` WHERE `role_id` in (1,2,3,4);
    Running SQL query: INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 1, '*', 'ALLOW', 0);
    Running SQL query: INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'deleteAccount', 'ALLOW', 0);
    Running SQL query: INSERT INTO `cloud`.`role_permissions` (`uuid`, `role_id`, `rule`, `permission`, `sort_order`) values (UUID(), 2, 'markDefaultZoneForAccount', 'ALLOW', 1);
    Static role permissions from commands.properties have been migrated into the db
    Running SQL query: UPDATE `cloud`.`configuration` SET value='true' where name='dynamic.apichecker.enabled'
    Dynamic role based API checker has been enabled!

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-08-19 17:33:07 +05:30
Rohit Yadav
05e1db7373 migrate-dynamicroles: use mysql.connector due to #1054
Due to PR #1054 this patch fixes the dynamic-roles migration script
to use the mysql-connector-python dependency.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-05-19 11:36:30 +05:30
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
KC Wang
581f3b79a3 findbugs and PMD fixes
This closes #168

Signed-off-by: Rajani Karuturi <rajanikaruturi@gmail.com>
2015-04-15 11:30:04 +05:30
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
frank
55b77c7c8f CloudStack CLOUDSTACK-774
Supporting kickstart in CloudStack baremetal

adding missing scripts back

Conflicts:

	client/pom.xml
	client/tomcatconf/commands.properties.in
	server/src/com/cloud/server/ManagementServerImpl.java
2013-02-21 15:46:11 -08:00
Marcus Sorensen
8c5b82dfb4 Summary: several scripts are not mode executable
Detail: several scripts in the scripts directory weren't marked executable.
Normally this is handled/fixed in the packaging, but harder to deal with in
development environments, so marking them executable.

Signed-off-by: Marcus Sorensen <marcus@betterservers.com> 1358446902 -0700
2013-01-17 11:21:42 -07:00
David Nalley
d630fa8697 license header changes for scripts folder from Chip Childers 2012-06-23 00:58:00 -04:00
frank
2f634c0913 Switch to Apache license 2012-04-03 04:50:05 -07:00
frank
52610ffcb3 add copyright header to shell scripts 2012-01-11 18:41:53 -08:00
frank
fa0373b6e9 use soft shutdown/reboot in IPMI 2011-07-07 17:06:19 -07:00
frank
3c1a375978 Bug 9887 - baremetal: support for image operation (create template from guest disk)
Resolved fixed
2011-07-07 15:34:42 -07:00
Frank
92155522f2 Add license header to files 2011-04-14 11:23:14 -07:00
Frank
a7ea3ecae3 Bug 8208 - bare metal provisioning
Better the prepare_linmin.sh
2011-03-24 17:01:25 -07:00
Frank
cdaa1edfa5 Bug 8208 - bare metal provisioning
Set dhcp range of linmin DHCPD to empty, so it will not conflict with
our External DHCP
2011-03-24 16:50:23 -07:00
Frank
35b7c26689 Bug 8208 - bare metal provisioning
able to start, stop, reboot, destroy VM
2011-03-01 11:40:40 -08:00
Frank
cd676f481d Bug 8208 - bare metal provisioning
Successfully add start entry into LinMin PXE server
2011-02-25 21:08:13 -08:00
Frank
b313b7c852 Add bare metal stuff to addHost command
add ipmi.py
2011-02-22 19:07:07 -08:00
Manuel Amador (Rudd-O)
05c020e1f6 Source code committed 2010-08-11 09:13:29 -07:00