Skip to content

[CLOUDSTACK-10230] User should not be able to use removed “Guest OS type” - #2404

Merged
DaanHoogland merged 3 commits into
apache:masterfrom
rafaelweingartner:CLOUDSTACK-10230
Apr 12, 2018
Merged

[CLOUDSTACK-10230] User should not be able to use removed “Guest OS type”#2404
DaanHoogland merged 3 commits into
apache:masterfrom
rafaelweingartner:CLOUDSTACK-10230

Conversation

@rafaelweingartner

@rafaelweingartnerrafaelweingartner commented Jan 12, 2018

Copy link
Copy Markdown
Member

Users are able to change the OS type of VMs to a “Guest OS type” that has been removed. This becomes a security issue when we try to force users to use HVM VMs (Meltdown/Spectre thing). A removed “guest os type” should not be usable by any users in the cloud.

@rafaelweingartnerrafaelweingartner changed the title [CLOUDSTACK-10230] User is able to useto a removed “Guest OS type”[CLOUDSTACK-10230] User should not be able to use removed “Guest OS type”Jan 12, 2018
@rafaelweingartner
rafaelweingartnerforce-pushed the CLOUDSTACK-10230 branch 2 times, most recently from db548d0 to 9a413caCompareJanuary 15, 2018 16:53
@rafaelweingartner
rafaelweingartnerforce-pushed the CLOUDSTACK-10230 branch 3 times, most recently from 909cb1e to 6f53255CompareJanuary 26, 2018 10:09
@rafaelweingartnerrafaelweingartner self-assigned this Jan 29, 2018
@rafaelweingartnerrafaelweingartner added this to the 4.12 milestone Jan 30, 2018
@rafaelweingartner

Copy link
Copy Markdown
MemberAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@rafaelweingartner a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔centos6 ✔centos7 ✖debian. JID-1791

@rafaelweingartner

Copy link
Copy Markdown
MemberAuthor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@rafaelweingartner a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1798

@rafaelweingartner
rafaelweingartnerforce-pushed the CLOUDSTACK-10230 branch 2 times, most recently from 9164341 to 1edf496CompareMarch 22, 2018 15:27
… been removed
Users are able to change the OS type of VMs to “Guest OS type” that has been removed. This becomes a security issue when we try to force users to use HVM VMs (Meltdown/Spectre thing). A removed “guest os type” should not be usable by any users in the cloud.
@rafaelweingartner

Copy link
Copy Markdown
MemberAuthor

@borisstoyanov can you run tests here?

@DaanHoogland

Copy link
Copy Markdown
Contributor

yes, he can ;)
@blueorangutan test

@DaanHooglandDaanHoogland left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

private static final Logger s_logger = Logger.getLogger(UserVmManagerImpl.class);

private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 3; // 3 seconds
private static final int ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION = 3;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not leave a // in seconds
usefull comment for a change ;)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. I probably removed without thinking.
I re-introduced this documentation.

final Long diskOfferingId, final Long diskSize, final String userData, final Account caller, final Boolean isDisplayVm, final String keyboard,
final long accountId, final long userId, final ServiceOfferingVO offering, final boolean isIso, final String sshPublicKey, final LinkedHashMap<String, NicProfile> networkNicMap,
final long id, final String instanceName, final String uuidName, final HypervisorType hypervisorType, final Map<String, String> customParameters, final Map<String, Map<Integer, String>> extraDhcpOptionMap, final Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap) throws InsufficientCapacityException {
final Long diskOfferingId, final Long diskSize, final String userData, final Account caller, final Boolean isDisplayVm, final String keyboard,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, i actually liked the alignment of the parameters. good old days ;)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

methods with hundreds of parameters... the glory of the old days...

return false;
}
}
} No newline at end of file

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is hard to find functional changes in this file. the new 2380-2424 are it, are they?

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeas, it is.

That is why I am not doing like this anymore. I am always splitting up the PR into multiple commits. It was one of your suggestions some time ago, which I liked. However, I created this PR before that.

The changes are basically at lines 2380-2424.

@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@borisstoyanov a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔centos6 ✔centos7 ✖debian. JID-1858

@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@borisstoyanov a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@rafaelweingartner

Copy link
Copy Markdown
MemberAuthor

@DaanHoogland thanks for your time reviewing this PR. I re-introduced the documentation of ACQUIRE_GLOBAL_LOCK_TIMEOUT_FOR_COOPERATION variable as you suggested.

/**
* The number of bytes in a GiB.
*/
private static final long GiB_TO_BYTES = 1024 * 1024 * 1024;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is actually self documenting!

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, removed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i enjoyed the renaming of it very much though ;)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

come to think about it, and don't take this as criticism on your naming to much, I think constants like this one should be appended with "_FACTOR" to be completely self documenting.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no problem. I just renamed to GiB, because the previous GB prefix that was being used is not accurate.

Sure the wording "factor" might be more appropriate, but I think we should look for a different solution. We have these constant all over our code base. We should look for a "MetricUtils/UnitUtils" or something like that to convert between different units (bytes to KB, KiB, MB, MiB, GB, GiB, TB, TiB, hertz and Ghz and so on)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, my remark was about the self documenting quality of the constant name; it is not GiB_TO_BYTES, as it cannot push all information contained in a GiB into a small number of bytes as anyone as ignorant as myself might think. The contant is and can only be used as a factor to convert from GiB to a number of B so it should be called GiB_TO_B_FACTOR or some such name. having said that, another implementator would choose to have a MetricUtil.convertGiBtoB() method.
/me is not a bigot on that difference.

@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan package

@blueorangutan

Copy link
Copy Markdown

@borisstoyanov a Jenkins job has been kicked to build packages. I'll keep you posted as I make progress.

@blueorangutan

Copy link
Copy Markdown

Packaging result: ✔centos6 ✔centos7 ✔debian. JID-1871

@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@borisstoyanov a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-2463)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 46315 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2404-t2463-kvm-centos7.zip
Intermitten failure detected: /marvin/tests/smoke/test_certauthority_root.py
Intermitten failure detected: /marvin/tests/smoke/test_privategw_acl.py
Intermitten failure detected: /marvin/tests/smoke/test_public_ip_range.py
Intermitten failure detected: /marvin/tests/smoke/test_reset_vm_on_reboot.py
Intermitten failure detected: /marvin/tests/smoke/test_router_dhcphosts.py
Intermitten failure detected: /marvin/tests/smoke/test_router_dns.py
Intermitten failure detected: /marvin/tests/smoke/test_router_dnsservice.py
Intermitten failure detected: /marvin/tests/smoke/test_routers_iptables_default_policy.py
Intermitten failure detected: /marvin/tests/smoke/test_routers_network_ops.py
Intermitten failure detected: /marvin/tests/smoke/test_routers.py
Intermitten failure detected: /marvin/tests/smoke/test_secondary_storage.py
Intermitten failure detected: /marvin/tests/smoke/test_service_offerings.py
Intermitten failure detected: /marvin/tests/smoke/test_snapshots.py
Intermitten failure detected: /marvin/tests/smoke/test_ssvm.py
Intermitten failure detected: /marvin/tests/smoke/test_templates.py
Intermitten failure detected: /marvin/tests/smoke/test_usage.py
Intermitten failure detected: /marvin/tests/smoke/test_vm_life_cycle.py
Intermitten failure detected: /marvin/tests/smoke/test_vm_snapshots.py
Intermitten failure detected: /marvin/tests/smoke/test_volumes.py
Intermitten failure detected: /marvin/tests/smoke/test_vpc_redundant.py
Intermitten failure detected: /marvin/tests/smoke/test_vpc_router_nics.py
Intermitten failure detected: /marvin/tests/smoke/test_vpc_vpn.py
Intermitten failure detected: /marvin/tests/smoke/test_host_maintenance.py
Intermitten failure detected: /marvin/tests/smoke/test_hostha_kvm.py
Smoke tests completed. 45 look OK, 22 have error(s)
Only failed tests results shown below:

TestResultTime (s)Test File
test_03_vpc_privategw_restart_vpc_cleanupFailure187.11test_privategw_acl.py
ContextSuite context=TestResetVmOnReboot>:setupError0.00test_reset_vm_on_reboot.py
ContextSuite context=TestRouterDHCPHosts>:setupError0.00test_router_dhcphosts.py
ContextSuite context=TestRouterDHCPOpts>:setupError0.00test_router_dhcphosts.py
ContextSuite context=TestRouterDns>:setupError0.00test_router_dns.py
ContextSuite context=TestVmSnapshot>:setupError0.07test_vm_snapshots.py
ContextSuite context=TestRouterDnsService>:setupError0.00test_router_dnsservice.py
ContextSuite context=TestRouterIpTablesPolicies>:setupError0.00test_routers_iptables_default_policy.py
ContextSuite context=TestVPCIpTablesPolicies>:setupError0.00test_routers_iptables_default_policy.py
test_01_isolate_network_FW_PF_default_routes_egress_trueError0.18test_routers_network_ops.py
test_02_isolate_network_FW_PF_default_routes_egress_falseError0.17test_routers_network_ops.py
ContextSuite context=TestRedundantIsolateNetworks>:setupError1.35test_routers_network_ops.py
ContextSuite context=TestRouterServices>:setupError0.00test_routers.py
test_01_sys_vm_startFailure0.11test_secondary_storage.py
test_02_sys_template_readyFailure0.10test_secondary_storage.py
ContextSuite context=TestCpuCapServiceOfferings>:setupError0.00test_service_offerings.py
ContextSuite context=TestServiceOfferings>:setupError0.20test_service_offerings.py
ContextSuite context=TestSnapshotRootDisk>:setupError0.00test_snapshots.py
test_01_list_sec_storage_vmFailure0.04test_ssvm.py
test_02_list_cpvm_vmFailure0.04test_ssvm.py
test_03_ssvm_internalsFailure0.04test_ssvm.py
test_04_cpvm_internalsFailure0.04test_ssvm.py
test_05_stop_ssvmFailure0.04test_ssvm.py
test_06_stop_cpvmFailure0.04test_ssvm.py
test_07_reboot_ssvmFailure0.04test_ssvm.py
test_08_reboot_cpvmFailure0.04test_ssvm.py
test_09_destroy_ssvmFailure0.04test_ssvm.py
test_10_destroy_cpvmFailure0.04test_ssvm.py
test_02_create_template_with_checksum_sha1Error65.55test_templates.py
test_03_create_template_with_checksum_sha256Error65.49test_templates.py
test_04_create_template_with_checksum_md5Error65.51test_templates.py
test_05_create_template_with_no_checksumError65.49test_templates.py
test_02_deploy_vm_from_direct_download_templateError4.42test_templates.py
test_03_deploy_vm_wrong_checksumError5.50test_templates.py
ContextSuite context=TestTemplates>:setupError19.14test_templates.py
ContextSuite context=TestISOUsage>:setupError0.00test_usage.py
ContextSuite context=TestLBRuleUsage>:setupError0.00test_usage.py
ContextSuite context=TestNatRuleUsage>:setupError0.00test_usage.py
ContextSuite context=TestPublicIPUsage>:setupError0.00test_usage.py
ContextSuite context=TestSnapshotUsage>:setupError0.00test_usage.py
ContextSuite context=TestVmUsage>:setupError0.00test_usage.py
ContextSuite context=TestVolumeUsage>:setupError0.00test_usage.py
ContextSuite context=TestVpnUsage>:setupError0.00test_usage.py
ContextSuite context=TestCreateVolume>:setupError0.00test_volumes.py
ContextSuite context=TestVolumes>:setupError0.00test_volumes.py
ContextSuite context=TestDeployVM>:setupError0.00test_vm_life_cycle.py
ContextSuite context=TestVMLifeCycle>:setupError0.00test_vm_life_cycle.py
test_01_create_redundant_VPC_2tiers_4VMs_4IPs_4PF_ACLError4.12test_vpc_redundant.py
test_02_redundant_VPC_default_routesError4.17test_vpc_redundant.py
test_03_create_redundant_VPC_1tier_2VMs_2IPs_2PF_ACL_reboot_routersError4.14test_vpc_redundant.py
test_04_rvpc_network_garbage_collector_nicsError4.15test_vpc_redundant.py
test_05_rvpc_multi_tiersError3.09test_vpc_redundant.py
test_01_VPC_nics_after_destroyError4.10test_vpc_router_nics.py
test_02_VPC_default_routesError4.11test_vpc_router_nics.py
test_01_redundant_vpc_site2site_vpnFailure3.40test_vpc_vpn.py
test_01_vpc_site2site_vpn_multiple_optionsFailure3.36test_vpc_vpn.py
test_01_vpc_remote_access_vpnFailure2.19test_vpc_vpn.py
test_01_vpc_site2site_vpnFailure2.35test_vpc_vpn.py
test_02_cancel_host_maintenace_with_migration_jobsError2.39test_host_maintenance.py
test_hostha_enable_ha_when_host_in_maintenanceError3.69test_hostha_kvm.py

@rafaelweingartner

Copy link
Copy Markdown
MemberAuthor

Something must have happened with the CI system. This PR's changes would not cause these failures.

@borisstoyanov

Copy link
Copy Markdown
Contributor

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@borisstoyanov a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@PaulAngus

Copy link
Copy Markdown
Member

@blueorangutan test

@blueorangutan

Copy link
Copy Markdown

@PaulAngus a Trillian-Jenkins test job (centos7 mgmt + kvm-centos7) has been kicked to run smoke tests

@blueorangutan

Copy link
Copy Markdown

Trillian test result (tid-2484)
Environment: kvm-centos7 (x2), Advanced Networking with Mgmt server 7
Total time taken: 91748 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr2404-t2484-kvm-centos7.zip
Intermitten failure detected: /marvin/tests/smoke/test_certauthority_root.py
Intermitten failure detected: /marvin/tests/smoke/test_routers.py
Intermitten failure detected: /marvin/tests/smoke/test_hostha_kvm.py
Smoke tests completed. 65 look OK, 2 have error(s)
Only failed tests results shown below:

TestResultTime (s)Test File
test_04_restart_network_wo_cleanupFailure2.96test_routers.py
test_hostha_enable_ha_when_host_in_maintenanceError4.70test_hostha_kvm.py

@borisstoyanovborisstoyanov left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DaanHoogland
DaanHoogland merged commit 91d9821 into apache:masterApr 12, 2018
@yadvryadvr mentioned this pull request May 3, 2018
12 tasks
@yadvr

yadvr commented May 4, 2018

Copy link
Copy Markdown
Member

@rafaelweingartner I scanned PRs merged on master but not 4.11 and came across this PR, since this is marked 'bug' do you think this would be useful for 4.11? If so, can you help create a backport PR for 4.11?

@rafaelweingartner

Copy link
Copy Markdown
MemberAuthor

This PR might be interesting. However, due to the amount of changes (I refactored the whole method), I preferred to introduced it only on master.

rafaelweingartner added a commit to shapeblue/cloudstack that referenced this pull request May 4, 2018
…ype” (apache#2404)
* [CLOUDSTACK-10230] User is able to change to “Guest OS type” that has been removed
Users are able to change the OS type of VMs to “Guest OS type” that has been removed. This becomes a security issue when we try to force users to use HVM VMs (Meltdown/Spectre thing). A removed “guest os type” should not be usable by any users in the cloud.
yadvr added a commit that referenced this pull request May 9, 2018
* CLOUDSTACK-10147 Disabled Xenserver Cluster can still deploy VM's. Added code to skip disabled clusters when selecting a host (#2442)
(cherry picked from commit c3488a5)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
* CLOUDSTACK-10318: Bug on sorting ACL rules list in chrome (#2478)
(cherry picked from commit 4412563)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
* CLOUDSTACK-10284:Creating a snapshot from VM Snapshot generates error if hypervisor is not KVM.
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
* CLOUDSTACK-10221: Allow IPv6 when creating a Basic Network (#2397)
Since CloudStack 4.10 Basic Networking supports IPv6 and thus
should be allowed to be specified when creating a network.
Signed-off-by: Wido den Hollander <wido@widodh.nl>
(cherry picked from commit 9733a10)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
* CLOUDSTACK-10214: Unable to remove local primary storage (#2390)
Allow admins to remove primary storage pool.
Cherry-picked from eba2e1d
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
* dateutil: constistency of tzdate input and output (#2392)
Signed-off-by: Yoan Blanc <yoan.blanc@exoscale.ch>
Signed-off-by: Daan Hoogland <daan.hoogland@shapeblue.com>
(cherry picked from commit 2ad5202)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
* CLOUDSTACK-10054:Volume download times out in 3600 seconds (#2244)
(cherry picked from commit bb607d0)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
* When creating a new account (via domain admin) it is possible to select “root admin” as the role for the new user (#2606)
* create account with domain admin showing 'root admin' role
Domain admins should not be able to assign the role of root admin to new users. Therefore, the role ‘root admin’ (or any other of the same type) should not be visible to domain admins.
* License and formatting
* Break long sentence into multiple lines
* Fix wording of method 'getCurrentAccount'
* fix typo in variable name
* [CLOUDSTACK-10259] Missing float part of secondary storage data in listAccounts
* [CLOUDSTACK-9338] ACS not accounting resources of VMs with custom service offering
ACS is accounting the resources properly when deploying VMs with custom service offerings. However, there are other methods (such as updateResourceCount) that do not execute the resource accounting properly, and these methods update the resource count for an account in the database. Therefore, if a user deploys VMs with custom service offerings, and later this user calls the “updateResourceCount” method, it (the method) will only account for VMs with normal service offerings, and update this as the number of resources used by the account. This will result in a smaller number of resources to be accounted for the given account than the real used value. The problem becomes worse because if the user starts to delete these VMs, it is possible to reach negative values of resources allocated (breaking all of the resource limiting for accounts). This is a very serious attack vector for public cloud providers!
* [CLOUDSTACK-10230] User should not be able to use removed “Guest OS type” (#2404)
* [CLOUDSTACK-10230] User is able to change to “Guest OS type” that has been removed
Users are able to change the OS type of VMs to “Guest OS type” that has been removed. This becomes a security issue when we try to force users to use HVM VMs (Meltdown/Spectre thing). A removed “guest os type” should not be usable by any users in the cloud.
* Remove trailing lines that are breaking build due to checkstyle compliance
* Remove unused imports
* fix classes that were in the wrong folder structure
* Updates to capacity management
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants

@rafaelweingartner@blueorangutan@DaanHoogland@borisstoyanov@PaulAngus@yadvr