617 Commits

Author SHA1 Message Date
Rohit Yadav
9aa7d4e818 CLOUDSTACK-10013: SystemVM.iso refactoring and cleanups
- Removes old/dead files
- Refactors file path/location, backward compatible to filepaths in
  systemvm.isoa
- Fixes failures around apache2
2017-12-23 09:22:44 +05:30
Rohit Yadav
bb965649d9 CLOUDSTACK-10013: Debian9 SystemVM appliance improvements
- Refactor cloud-early-config and make appliance specific scripts
- Make patching work without requiring restart of appliance and remove
  postinit script
- Migrate to systemd, speedup booting/loading
- Takes about 5-15s to boot on KVM, and 10-30seconds for VMware and XenServer
- Appliance boots and works on KVM, VMware, XenServer and HyperV
- Update Debian9 ISO url with sha512 checksum
- Speedup console proxy service launch
- Enable additional kernel modules
- Remove unknown ssh key
- Update vhd-util URL as previous URL was down
- Enable sshd by default
- Use hostnamectl to add hostname
- Disable services by default
- Use existing log4j xml, patching not necessary by cloud-early-config
- Several minor fixes and file refactorings, removed dead code/files
- Removes inserv
- Fix dnsmasq config syntax
- Fix haproxy config syntax
- Fix smoke tests and improve performance
- Fix apache pid file path in cloud.monitoring per the new template

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-12-23 09:22:44 +05:30
Wido den Hollander
2aa70eecce CLOUDSTACK-10013: Make Debian9 systemvmtemplates work with systemd
- Load the nf_conntrack_ipv6 module for IPv6 connection tracking on SSVM
- Move systemd services to /etc and enable services after they have been
  installed
- Disable most services by default and enable in cloud-early-config
- Start services after enabling them using systemd
- In addition remove /etc/init.d/cloud as this is no longer needed and
  done by systemd
- Accept DOS/MBR as file format for ISO images as well

Under Debian 7 the 'file' command would return:

  debian-9.1.0-amd64-netinst.iso: ISO 9660 CD-ROM filesystem data UDF filesystem data

Under Debian 9 however it will return

  debian-9.1.0-amd64-netinst.iso: DOS/MBR boot sector

This would make the HTTPTemplateDownloader in the Secondary Storage VM refuse the ISO as
a valid template because it's not a correct format.

Changes this behavior so that it accepts both.
This allows us to use Debian 9 as a System VM template.

Not sure though if enabling them is enough for systemd to still start them
on first boot

Signed-off-by: Wido den Hollander <wido@widodh.nl>
2017-12-23 09:22:44 +05:30
Rohit Yadav
78bb74188d CLOUDSTACK-10013: Migrate systemvmtemplate to Debian9
SystemVM changes to work on Debian 9
- Migrate away from chkconfig to systemctl
- Remove xenstore-utils override deb pkg
- Fix runlevel in sysv scripts for systemd

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-12-23 09:22:44 +05:30
Igor Voloshanenko
12f526bbfe CLOUDSTACK-10200: Fix ACL_INBOUND/OUTBOUND rules for PrivateGateway (#2367)
We found bug in ACL rules for PrivateGateway for VPC

At a glance - rules not applied - switching Allow All or Deny All (default ACL) - showed as completed - but rules missed.
Result - traffic via PrivateGateway blocked by next DROP rule in next chains

How to reproduce:

Enable PrivateGateway for Cloudstack
Create VPC
Provision new PrivateGateway inside VPC with some VLAN
Change ACL (optional step to show that problem not in initial configuration but in config itself)
Expected:
ACL rules applied (inserted) into correspondig ACL_INBOUND/OUTBOUND chanins for PrivateGateway interface (ethX) based on ACL which user choose

Current:
No rules inserted. ACL_INBOUND/OUTBOUND_ethX - empty. Traffic blocked by next DROP rule in FORWARD chain

Affect - all our corporate customers blocked with access to their own nets via PG and vice-versa.

Root cause:
Issue happened because of CsNetFilter.py logic for inserting rules for ACL_INBOUND/OUTBOUND chains.

We choose rule numebr to isnert right before last DROP rule - but forget about fact - that if chain empty - we also return 0 as insert position. Which not true for iptables - numeration started from 0.

So we need very small patch to handle this special case - if number of rules inside chain equal to zero - return 1, else - return count of rules inside chain.

It's found only one - just because be default for PrivateGateway - we didn't insert any "service rules" (if SourceNat for PrivateGteway not ticked) - and we have by default empty ACL_INBOUND/OUTBOUND chains. Because same insert happened for all VPC networks (but when we call this insert - we already have at least 1 rule inside chains - and we successfully can process)
2017-12-21 14:55:48 +05:30
Bitworks Software, Ltd
80a6961b5d CLOUDSTACK-10168: VR duplicate entries in /etc/hosts when reusing VM name (#2366)
Bug is fixed. Fixed typo 'adress' to 'address' everywhere which leads to correct generation for agent communication json dhcp command.
2017-12-20 23:19:12 +05:30
Jayapal
88327580b0 CLOUDSTACK-10152: Skip the destination cidr in ipset when 0.0.0.0/0 pa… (#2334)
Skip the destination cidr in ipset when 0.0.0.0/0 passed.
Fixed adding issue with egress dest cidr with 0.0.0.0/0.
2017-11-23 11:42:43 +05:30
subhash yedugundla
60bec39b9d CLOUDSTACK-10135 ACL rules order is not maintained for ACL_OUTBOUND in VPC VR (#2313) 2017-11-15 10:06:00 +01:00
Daan Hoogland
4d19373d36 Merge release branch 4.10 to master
* 4.10:
  CLOUDSTACK-10113 password resets only one at the time
2017-10-25 09:54:30 +02:00
Daan Hoogland
4f6b91d958 Merge release branch 4.9 to 4.10
* 4.9:
  CLOUDSTACK-10113 password resets only one at the time
2017-10-25 09:51:58 +02:00
Daan Hoogland
382d458f43 CLOUDSTACK-10113 password resets only one at the time 2017-10-25 09:29:35 +02:00
Rohit Yadav
0dfdbe064c CLOUDSTACK-9993: With auth strictness stop SSL handshake for rogue clients (#2278)
When auth strictness is set to true, terminate SSH handshake for clients
that do not present valid certificates.

This uses the `setNeedClientAuth`, where if the option is set and the
client chooses not to provide authentication information about itself,
the negotiations will stop and the engine will begin its closure
procedure:
https://docs.oracle.com/javase/7/docs/api/javax/net/ssl/SSLEngine.html#setNeedClientAuth(boolean)

During systemvm reboot, the conf folder is removed and certificate
re-setup is not done. This may cause the agent to not connect, this
fixes the case by backing up and restoring keystore and other config
files when re-patching is done after rebooting of a systemvm (cpvm, ssvm).

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-10-04 09:53:49 +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
Syed Mushtaq Ahmed
deb92d32bb CLOUDSTACK-10030: Make sure that public IPs assigned to VPC are reacheable from inside the VPC (#2221)
If a public IP is assigned to a VPC, a VM running inside that VPC cannot ping that public IP. This is due to the IPtables Nat rules set in such a way that drop any requests to the public IP from internal interfaces. I am fixing this so that internal hosts can also reach the public IP.

Reproduction:

Create a VPC
Create a network inside the VPC
Allocate a public IP
Create a VM in the network
Create a port forwarding rule enabling ICMP
ping the public IP inside the VM (this will fail)
2017-08-22 08:50:25 +02:00
Jayapal
40d7746038 CLOUDSTACK-9967: Fixed static nat iptables rules order issue on additional public subnet ip (#2154) 2017-08-21 19:04:40 +02:00
ustcweizhou
6745f98487 CLOUDSTACK-9999: vpc tiers do not work if vpc has more than 8 tiers (#2180)
In the VR, deviceid of eth1X should be 1X (eth10->10, eth11->11), not 1.
2017-08-13 01:19:51 +02:00
Rohit Yadav
ccf2f52041 Merge branch '4.10' 2017-08-04 20:46:05 +02:00
Rohit Yadav
ddd8462022 Merge branch '4.9' into 4.10 2017-08-04 20:45:45 +02:00
Slair1
a5778139c2 CLOUDSTACK-9801: IPSec VPN does not work after vRouter reboot or recreate (#1966)
This makes sure IP address is active.

After a vRouter is recreated (e.g. reboot via CloudStack UI) and Remote Access VPN enabled, VPN won't work anymore. Here is the abbreviated output of "ipsec auto -status" while we were having the issue:

root@r-10-VM:~# ipsec auto --status
000 using kernel interface: netkey
000 interface lo/lo 127.0.0.1
000 interface lo/lo 127.0.0.1
000 interface eth0/eth0 169.254.1.45
000 interface eth0/eth0 169.254.1.45
000 %myid = (none)
After this commit, the following occurs and VPNs work:


root@r-10-VM:~# ipsec auto --status
000 using kernel interface: netkey
000 interface lo/lo 127.0.0.1
000 interface lo/lo 127.0.0.1
000 interface eth0/eth0 169.254.1.45
000 interface eth0/eth0 169.254.1.45
000 interface eth1/eth1 xxx.xxx.xxx.172
000 interface eth1/eth1 xxx.xxx.xxx.172
000 interface eth2/eth2 192.168.1.1
000 interface eth2/eth2 192.168.1.1
000 %myid = (none)

eth1 interface IP is masked, but now ipsec sees all the interfaces and VPN works.

Looks like this bug was introduced by Pull Request #1423

It added code to start ipsec (cloudstack/systemvm/patches/debian/config/opt/cloud/bin/configure.py)

if vpnconfig['create']:
    logging.debug("Enabling remote access vpn on "+ public_ip)
    CsHelper.start_if_stopped("ipsec")
2017-08-04 20:43:54 +02:00
Frank Maximus
1414d20852 CLOUDSTACK-9749: Disable password service on ilb systemvm (#1912)
Fix cloud-password-srvr correctly.
Made sure it runs on VPC VR, but not on Internal LB
2017-08-03 22:38:25 +02:00
Nitesh Sarda
64d09c737a CLOUDSTACK-9017 : VPC VR DHCP broken for multihomed guest VMs
(cherry picked from commit 10b25adc460f89d4d98ee0c6090a4f785aa088a6)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-08-01 20:40:25 +02:00
Jayapal
5eb63975f7 CLOUDSTACK-9715: Update somaxconn value to default value
(cherry picked from commit 45c3d94d83cc70a80f493f2de62406853f06d6ac)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-08-01 20:40:25 +02:00
Will Stevens
c206098783 Fix public IPs not being removed from the VR when deprovisioned
(cherry picked from commit 23f64a13a85b89518860eb3600ed7652ebbc89ba)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-08-01 20:40:25 +02:00
Stefania
73c30f1baa CLOUDSTACK-9793: Faster ip in subnet check
This change removes an unnecessary conversion from IPNetwork
to list in one of the router scripts. This makes the router
faster at processing static NAT rules, which can prevent
timeouts when attaching or detaching IPs.

(cherry picked from commit d5c5eb10f8a4fb80aa8b9182290948755cdd6026)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-08-01 20:40:25 +02:00
Jayapal
980be4dfc9 CLOUDSTACK-9757: Fixed issue in traffic from additional public subnet
(cherry picked from commit baac747089ef48ea6627a6aacf27156222862352)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-08-01 20:40:25 +02:00
Rohit Yadav
e9f526e221 Merge branch '4.9' into 4.10
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-07-28 10:49:34 +02:00
Slair1
471b68698a CLOUDSTACK-10016: VPC VR doesn't respond to DNS requests from remote access vpn clients (#2201)
When enabling remote access VPN, a new interface is created upon client connecting via VPN. The DNS service (dnsmasq) is set only to listen on interfaces that are active when it starts. Thus VPN users are provided the VR's IP address for DNS resolution, but it is not actually listening for DNS requests.
2017-07-28 10:27:28 +02:00
Rohit Yadav
c1e5cb32d0 Merge remote-tracking branch 'origin/4.9' into 4.10
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-07-23 13:30:04 +02:00
Will Stevens
c566aba838 we should not need to take down the service every time an IP is configured 2017-07-23 13:20:36 +02:00
Slair1
27b0c65909 Gather all S2S vpn statuses before outputting 2017-07-23 13:07:36 +02:00
Rohit Yadav
ffddd6db09 Merge remote-tracking branch 'origin/4.9' into 4.10 2017-07-22 11:07:42 +02:00
Rohit Yadav
aa8a721c39 CLOUDSTACK-9838: Allow ingress traffic between guest VMs via snat IPs
This enables the firewall/mangle tables rules to ACCEPT instead of RETURN, which
is the same behaviour as observed in ACS 4.5. By accepting the traffic, guest
VMs will be able to communicate tcp traffic between each other over snat public
IPs.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-07-22 10:53:21 +02:00
Sigert Goeminne
77da97aad9 CLOUDSTACK-9980: Fix for DNS after network restart with clean up.
Configure.py without arguments gives IndexError.
2017-06-28 12:21:14 +02:00
Rajani Karuturi
d577adeaa8 Merge release branch 4.9 to master
* 4.9:
  Revert "Merge pull request #2084 from shapeblue/passwd-speedup"
2017-06-26 09:59:13 +05:30
Rajani Karuturi
24434beb42 Revert "Merge pull request #2084 from shapeblue/passwd-speedup"
This reverts commit 48f413a9825d0554cf5080b4723688d8c47afe5c, reversing
changes made to 5f35c15b6b3ff49cb49c5563abbef7cc0e21d4a7.
2017-06-26 09:58:33 +05:30
Rajani Karuturi
b9a4cb8770 Merge release branch 4.9 to master
* 4.9:
  vRouter defer configure: Resolve merge conflicts
  vRouter: vr_cfg: style consistency fixes
  vRouter: vr_cfg: Keep the original cfg
  vRouter: prevent fh leakage and use buffered writes in DataBags
2017-06-20 10:14:50 +05:30
Ronald van Zantvoort
330a0c7f2b vRouter defer configure: Resolve merge conflicts 2017-06-07 18:20:02 +02:00
Ronald van Zantvoort
a2eb0f23a9 vRouter: vr_cfg: style consistency fixes 2017-06-07 18:11:33 +02:00
Ronald van Zantvoort
8f5275399e vRouter: vr_cfg: Keep the original cfg 2017-06-07 18:11:33 +02:00
Ronald van Zantvoort
c10c3245d1 vRouter: prevent fh leakage and use buffered writes in DataBags 2017-06-07 18:11:33 +02:00
Rohit Yadav
ed376fcad6 Merge remote-tracking branch 'origin/4.9'
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2017-06-07 11:21:27 +05:30
Jayapal
065fa1c849 CLOUDSTACK-9669:Advaced zone isolated network egress destination cidr support
CLOUDSTACK-9669:egress destination cidr VR python script changes
    CLOUDSTACK-9669:egress destination API and orchestration changes
    CLOUDSTACK-9669: Added the ipset package in systemvm template
    CLOUDSTACK-9669:Added licence header for new files
    CLOUDSTACK-9669: replacing 0.0.0.0/0 with the network cidr

     ipset member add with 0.0.0.0/0 fails. So 0.0.0.0/0 replaced with the network cidr.
     In source cidr 0.0.0.0/0 is nothing but network cidr.
     updated the default egress all cidr with network cidr
2017-06-06 15:51:00 +05:30
Rajani Karuturi
c3d6b9e182 Merge pull request #2016 from Accelerite/CLOUDSTACK-9835
CLOUDSTACK-9835 : To make management server and SSVM to be in time sync
2017-06-06 15:33:18 +05:30
Rajani Karuturi
48f413a982 Merge pull request #2084 from shapeblue/passwd-speedup
Passwd speedup
2017-06-06 15:32:02 +05:30
Nitesh Sarda
10b25adc46 CLOUDSTACK-9017 : VPC VR DHCP broken for multihomed guest VMs 2017-05-23 17:34:20 +05:30
Rajani Karuturi
8b3cadb55e Merge release branch 4.9 to master
* 4.9:
  Do not set gateway to 0.0.0.0 for windows clients
  CLOUDSTACK-9904: Fix log4j to have @AGENTLOG@ replaced
  ignore bogus default gateway   when a shared network is secondary the default gateway gets overwritten by a bogus one   dnsmasq does the right thing and replaces it with its own default which is not good for us   so check for '0.0.0.0'
  Activate NioTest following changes in CLOUDSTACK-9348 PR #1549
  CLOUDSTACK-9828: GetDomRVersionCommand fails to get the correct version as output Fix tries to return the output as a single command, instead of appending output from two commands
  CLOUDSTACK-3223 Exception observed while creating CPVM in VMware Setup with DVS
  CLOUDSTACK-9787: Fix wrong return value in NetUtils.isNetworkAWithinNetworkB
2017-05-17 11:36:52 +05:30
Rajani Karuturi
cbd3662482 Merge pull request #2055 from shapeblue/sharedisolated
CLOUDSTACK-9887 ignore bogus default gateway
2017-05-17 09:53:39 +05:30
Jayapal
da8a3567a3 CLOUDSTACK-9848: Added exit status checking for the iptables commands 2017-05-09 17:40:02 +05:30
Daan Hoogland
710d3bff3f rat 2017-05-08 07:42:04 +02:00
Daan Hoogland
00add83749 remaining conflicting code for vm_passwd speedup 2017-05-06 22:12:36 +02:00