530 Commits

Author SHA1 Message Date
Rohit Yadav
cc72e4da64 systemvm: Fix regression from 825935
Fixes merge conflict issue incorrectly fixed during a fwd-merge in 825935
from PR #1766

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-11-27 15:43:10 +05:30
Rohit Yadav
825935da69
Merge branch '4.8' into 4.9 2016-11-24 12:44:19 +05:30
Rohit Yadav
90ae04b791
Merge pull request #1766 from murali-reddy/vr-default-network-gateway
CLOUDSTACK-9598: wrong defaut gateway for the nic in non-default network when guest VM has nic's in more than one guest network set the tag for each host in /etc/dhcphosts.txt, and use the tag to add exception in /etc/dhcpopts.txt to prevent sending default route, dns server in case if the nic is in non-default network

this was the behaviour with edithosts.sh prior to 4.6

* pr/1766:
  CLOUDSTACK-9598: wrong defaut gateway for the nic in non-default network

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-11-24 12:39:36 +05:30
Rohit Yadav
1e88ad45a7
Merge pull request #1680 from murali-reddy/vr_csfile_search
CLOUDSTACK-9498: VR CsFile search utility methods fail when search stThere is no real use of python 're' module  in CsFile.py utility methods searchString, deleteLine. Regular string search is sufficient. These methods are used only for VPN user add/delete. Since VPN user password can have python 're' module meta characters, it interfere with search functionality.

Replacing re.search() with regular string search instead.

Change is confined to VPN add/delete users. Have run the test/integration/component/test_vpn_users.py

VPN remote access user limit tests ... === TestName: test_01_VPN_user_limit | Status : SUCCESS ===
ok
Test create VPN when L2TP port in use ... === TestName: test_02_use_vpn_port | Status : SUCCESS ===
ok
Test create NAT rule when VPN when L2TP enabled ... === TestName: test_03_enable_vpn_use_port | Status : SUCCESS ===
ok
Test add new users to existing VPN ... === TestName: test_04_add_new_users | Status : SUCCESS ===
ok
Test add duplicate user to existing VPN ... === TestName: test_05_add_duplicate_user | Status : SUCCESS ===
ok
Test as global admin, add a new VPN user to an existing VPN entry ... === TestName: test_06_add_VPN_user_global_admin | Status : SUCCESS ===
ok
Test as domain admin, add a new VPN user to an existing VPN entry ... === TestName: test_07_add_VPN_user_domain_admin | Status : SUCCESS ===
ok

* pr/1680:
  CLOUDSTACK-9498: VR CsFile search utility methods fail when search string has 're' meta chars, and causing VPN user add/deelte to fail

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-11-23 14:31:00 +05:30
Rohit Yadav
1137a79ccc
Merge branch '4.8' into 4.9 2016-11-23 13:38:11 +05:30
Murali Reddy
7ab35e6616 CLOUDSTACK-9598: wrong defaut gateway for the nic in non-default network
when guest VM has nic's in more than one guest network set the tag for
each host in /etc/dhcphosts.txt, and use the tag to add exception in
/etc/dhcpopts.txt to prevent sending default route, dns server in case if the nic is in non-default network
this was the behaviour with edithosts.sh prior to 4.6

added new test case test_router_dhcp_opts to test DHCP option file use of cloudstack
2016-11-22 16:30:42 +05:30
Murali Reddy
4c4696e5e4 CLOUDSTACK-9583: VR: In CsDhcp.py preseed both hostaname and localhost to resolve to 127.0.0.1
The VR executes a ip route flush command as part of configurations. This command performs a
DNS lookup on the VR hostname. Since the VR does not have a DNS entry, the ip command would
wait 5 seconds before timing out and executing the flush operation. This fix adds the VR
hostname to /etc/hosts mapped to 127.0.0.1 to answer the DNS lookup – reducing the
execution time.
2016-11-10 13:25:22 +05:30
Rohit Yadav
8b786d1fb2
Merge pull request #1743 from wido/CLOUDSTACK-8326
CLOUDSTACK-8326: Always fill UDP checksums in DHCP replies in VRIn some cases the UDP checksums in packets from DHCP servers are
incorrect. This is a problem for some DHCP clients that ignore
packets with bad checksums. This patch inserts an iptables rule
to ensure DHCP servers always send packets with correct checksums.

Due to this bug DHCP offers are sometimes not accepted by Instances.

The end-result without this fix is no connectivity for the Instance
due to the lack of a IPv4 address.

Signed-off-by: Wido den Hollander <wido@widodh.nl>

* pr/1743:
  CLOUDSTACK-8326: Always fill UDP checksums in DHCP replies in VR

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-11-09 12:18:03 +05:30
Wido den Hollander
fa56d0b3e6
CLOUDSTACK-8326: Always fill UDP checksums in DHCP replies in VR
In some cases the UDP checksums in packets from DHCP servers are
incorrect. This is a problem for some DHCP clients that ignore
packets with bad checksums. This patch inserts an iptables rule
to ensure DHCP servers always send packets with correct checksums.

Due to this bug DHCP offers are sometimes not accepted by Instances.

The end-result without this fix is no connectivity for the Instance
due to the lack of a IPv4 address.

This is also commited in OpenStack:
- https://github.com/projectcalico/felix/issues/40
- https://review.openstack.org/148718
- https://bugzilla.redhat.com/show_bug.cgi?id=910619

Signed-off-by: Wido den Hollander <wido@widodh.nl>
2016-11-08 18:41:37 +01:00
Rohit Yadav
c09fc27255
Merge branch '4.8' into 4.9 2016-11-08 15:20:45 +05:30
Rohit Yadav
b704cefc1f
Merge branch '4.7' into 4.8 2016-11-08 15:20:07 +05:30
Rohit Yadav
0279ac20e4 Merge pull request #1744 from greenqloud/4.7
CLOUDSTACK-9183: bash: /opt/cloud/bin/getRouterAlerts.sh: No such file or directory

* pr/1744:
  CLOUDSTACK-9183: bash: /opt/cloud/bin/getRouterAlerts.sh: No such file or directory

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-11-08 15:19:28 +05:30
Ólafur Stefán Arnarsson
420d06f4d3 CLOUDSTACK-9183: bash: /opt/cloud/bin/getRouterAlerts.sh: No such file or directory 2016-10-31 21:44:15 +00:00
Murali Reddy
9cc06a8fc8 CLOUDSTACK-9498: VR CsFile search utility methods fail when search string has
're' meta chars, and causing VPN user add/deelte to fail

    -there is no real use of python 're' in CsFile.py utility methods searchString, deleteLine
    Replacing with regular string search instead.

    -modifying the smoke test for VPN user add/delete to have all permissable chars
2016-10-28 17:45:15 +05:30
Rohit Yadav
9b9b49e10b Merge branch '4.8' into 4.9 2016-10-21 10:14:16 +05:30
Murali Reddy
93ac134f1e CLOUDSTACK-9533: gateway of public IP is not handled correctly when parsing the
cmd_line.json to create ips.json databag

using 'gateway' in cmd_line for the public ip gateway while creating ips.json databag
2016-10-06 16:41:29 +05:30
Murali Reddy
052a9af023 CLOUDSTACK-9515: internal LB vm is not handled when parsing cmd_line.json,
resulting in internal LB vm not come up

parsing cmd_line to create 'ips' data bag, never handled internal lb vm, but still
worked due to another bug. support for internal lb vm is added with this fix
2016-10-05 15:11:00 +05:30
Rajani Karuturi
cc043e9f8f Merge pull request #1666 from murali-reddy/egress_rules
CLOUDSTACK-9480,  CLOUDSTACK-9495 fix egress rule incorrect behaviorWhen 'default egress policy' is set to 'allow' in the network offering, any egress rule that is added will 'deny' the traffic overriding the default behaviour.

Conversely, when 'default egress policy' is set to 'deny' in the network offering, any egress rule that is added will 'allow' the traffic overriding the default behaviour.

While this works for 'tcp', 'udp' as expected, for 'icmp' protocol its always set to ALLOW. This patch keeps all protocols behaviour consistent.

Results of running test/integration/component/test_egress_fw_rules.py.  With out the patch test_02_egress_fr2 test was failing. This patch fixes the test_02_egress_fr2  scenario.
-----------------------------------------------------------------------------------------------------
Test By-default the communication from guest n/w to public n/w is NOT allowed. ... === TestName: test_01_1_egress_fr1 | Status : SUCCESS ===
ok
Test By-default the communication from guest n/w to public n/w is allowed. ... === TestName: test_01_egress_fr1 | Status : SUCCESS ===
ok
Test Allow Communication using Egress rule with CIDR + Port Range + Protocol. ... === TestName: test_02_1_egress_fr2 | Status : SUCCESS ===
ok
Test Allow Communication using Egress rule with CIDR + Port Range + Protocol. ... === TestName: test_02_egress_fr2 | Status : SUCCESS ===
ok
Test Communication blocked with network that is other than specified ... === TestName: test_03_1_egress_fr3 | Status : SUCCESS ===
ok
Test Communication blocked with network that is other than specified ... === TestName: test_03_egress_fr3 | Status : SUCCESS ===
ok
Test Create Egress rule and check the Firewall_Rules DB table ... === TestName: test_04_1_egress_fr4 | Status : SUCCESS ===
ok
Test Create Egress rule and check the Firewall_Rules DB table ... === TestName: test_04_egress_fr4 | Status : SUCCESS ===
ok
Test Create Egress rule and check the IP tables ... SKIP: Skip
Test Create Egress rule and check the IP tables ... SKIP: Skip
Test Create Egress rule without CIDR ... === TestName: test_06_1_egress_fr6 | Status : SUCCESS ===
ok
Test Create Egress rule without CIDR ... === TestName: test_06_egress_fr6 | Status : SUCCESS ===
ok
Test Create Egress rule without End Port ... === TestName: test_07_1_egress_fr7 | Status : EXCEPTION ===
ERROR
Test Create Egress rule without End Port ... === TestName: test_07_egress_fr7 | Status : SUCCESS ===
ok
Test Port Forwarding and Egress Conflict ... SKIP: Skip
Test Port Forwarding and Egress Conflict ... SKIP: Skip
Test Delete Egress rule ... === TestName: test_09_1_egress_fr9 | Status : SUCCESS ===
ok
Test Delete Egress rule ... === TestName: test_09_egress_fr9 | Status : SUCCESS ===
ok
Test Invalid CIDR and Invalid Port ranges ... === TestName: test_10_1_egress_fr10 | Status : SUCCESS ===
ok
Test Invalid CIDR and Invalid Port ranges ... === TestName: test_10_egress_fr10 | Status : SUCCESS ===
ok
Test Regression on Firewall + PF + LB + SNAT ... === TestName: test_11_1_egress_fr11 | Status : SUCCESS ===
ok
Test Regression on Firewall + PF + LB + SNAT ... === TestName: test_11_egress_fr11 | Status : SUCCESS ===
ok
Test Reboot Router ... === TestName: test_12_1_egress_fr12 | Status : SUCCESS ===
ok
Test Reboot Router ... === TestName: test_12_egress_fr12 | Status : EXCEPTION ===
ERROR
Test Redundant Router : Master failover ... === TestName: test_13_1_egress_fr13 | Status : SUCCESS ===
ok
Test Redundant Router : Master failover ... === TestName: test_13_egress_fr13 | Status : SUCCESS ===
ok
-----------------------------------------------------------------------------------------------------

* pr/1666:
  fix egress rule incorrect behavior

Signed-off-by: Rajani Karuturi <rajani.karuturi@accelerite.com>
2016-09-21 14:54:31 +05:30
Murali Reddy
a43abbe47b fix egress rule incorrect behavior
CLOUDSTACK-9480: Egress Firewall: Incorrect use of Allow/Deny for ICMP

     fix ensures, ICMP, TCP, UDP are handled similalry w.r.t egress rule action

CLOUDSTACK-9495: Egress rules functionalty broken when protocol=all specified

     when protocol=all specified, CIDR was ignored. Fix ensures if CIDR is specified
     its always used in configuring iptable rules

 2 new test cased to test /32 CIDR
2016-09-20 16:56:06 +05:30
Rohit Yadav
14504dc7e3 CLOUDSTACK-6432: Prevent DNS reflection attacks
DNS on VR should not be publically accessible as it may be prone to DNS
amplification/reflection attacks. This fixes the issue by only allowing VR
DNS (port 53) to be accessible from guest network cidr, as per the fix in:
https://issues.apache.org/jira/browse/CLOUDSTACK-6432

- Only allows guest network cidrs to query VR DNS on port 53.
- Includes marvin smoke test that checks the VR DNS accessibility checks from
  guest and non-guest network.
- Fixes Marvin sshClient to avoid using ssh agent when password is provided,
  previous some environments may have seen 'No existing session' exception without
  this fix.
- Adds a new dnspython dependency that is used to perform dns resolutions in the
  tests.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2016-08-30 22:39:33 +05:30
Will Stevens
d302269fe5 CLOUDSTACK-9437: Create egress chain on upgrade and cleanup for allow all traffic
- Ensure that FW_EGRESS_RULE chain exists after upgrading the router
- Flush allow all egress rule on 0.0.0.0/0, if such a rule exists in the config
  it will be added later (CLOUDSTACK-9437)
2016-07-25 16:44:38 -04:00
Patrick Dube
9ab676206a Added missing rules on router config, fixed ordering of multiple rules, removed duplicate rules, added fix for network stats, added a check for b64 decoding (to pad incorrect b64). Also added a catch exception to be logged on the configure main. 2016-07-22 15:32:20 -04:00
Will Stevens
a566cde145 Merge pull request #1609 from pdube/network-acl-add-order
[CLOUDSTACK-9430] Added fix for adding/editing Network ACL rule orderingBUG: https://issues.apache.org/jira/browse/CLOUDSTACK-9430

The issue occurred because all of the ACL rules get inserted before the old ones. Then, the cleanup deletes the duplicate rows, and leaves any new rule in front of the old ones.

Here is an example with a simplified iptables view for ACL
Ex: adding a rule 4
before add:
1,2,3

during add:
1',2',3',4',1,2,3

after add:
4',1,2,3

After fix:
before add:
1,2,3

during add:
1,2,3,1',2',3',4'

after add:
1',2',3',4'

* pr/1609:
  Added fix for adding/editing Network ACL rule ordering

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-07-18 14:11:13 -04:00
Will Stevens
49df7f283c Merge release branch 4.8 to master
* 4.8:
  CLOUDSTACK-9342: Site to Site VPN PFS not being set correctly
2016-07-18 14:07:09 -04:00
Will Stevens
adaf410109 Merge pull request #1480 from Slair1/S2S-VPN-PFS-Setting
CLOUDSTACK-9342: Site to Site VPN PFS not being set correctlyBug in code set PFS to the same value (yes/no) as DPD.

file.addeq(" pfs=%s" % CsHelper.bool_to_yn(obj['dpd']))

* pr/1480:
  CLOUDSTACK-9342: Site to Site VPN PFS not being set correctly

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-07-18 14:05:18 -04:00
Patrick Dube
6dd6ef0c9a Added fix for adding/editing Network ACL rule ordering 2016-07-11 15:12:41 -04:00
Wido den Hollander
67eb6caa37
Remove /etc/apache2/sites-enabled/000-default in cloud-early-config 2016-06-07 13:03:18 +02:00
Ronald van Zantvoort
91a8faac31 SysVM various fixes to previous refactorings
* make CORS include a regular glob-matched one
* fix NameVirtualHost in CsApp.py as well
* even moar cleanups
2016-06-07 13:03:10 +02:00
Ronald van Zantvoort
58bdb44135 SysVM: Cleanup and removal of old (and dangerous) config files
* ports.conf
* default & default-ssl sites
* SSL config in httpd.conf
* deprecated & dead setup_redundant_router in cloud-early-config
2016-06-07 13:03:10 +02:00
Ronald van Zantvoort
72e83085e1 SysVM cloud-early-config: Intermediate fix for SecStore & CORS
* Take setup from vhost.template rather than default(-ssl)
  * should move into Python CS code as well
* Move CORS setup to separate conf
* Modify vhost template to Optionally include the cors file
* Add NameVirtualHost to vhost template for feature parity with ports.conf
* Take setup from vhost.template rather than default(-ssl)
2016-06-07 13:03:10 +02:00
Ronald van Zantvoort
f49a4d944a VR cloud-early-config: Commonize Apache2 common setup 2016-06-07 13:03:10 +02:00
Ronald van Zantvoort
7e290979a9 VR cloud-early-config: Fix Apache2 alias cleanup 2016-06-07 13:03:10 +02:00
Ronald van Zantvoort
e32cd1303a VR: consistent SSL setup, vhost is not an example, but a template 2016-06-07 13:03:10 +02:00
Ronald van Zantvoort
f379df4bc2 VR CsConfig: reintroduce old get_dns() behaviour for redundant non-VPC's 2016-06-07 13:03:10 +02:00
Ronald van Zantvoort
d14a484374 VR CsAddress fixes:
* cleanup imports,
* fix to_str(),
* improve & fix service post_config logic
* don't arpPing when there's no gateway
2016-06-07 13:03:09 +02:00
Ronald van Zantvoort
6055ed6ed6 VR CsApp: Expose config to classes, move vhost confs to proper location, allow for multiple IP's per intf, sanitize servername, don't open port 53 if no DNS is foreseen 2016-06-07 13:03:09 +02:00
Ronald van Zantvoort
748bf43530 VR CsConfig: Add is_router(), is_dns(), has_dns(), has_metadata(), use_extdns(), fix get_dns() with use_extdns() 2016-06-07 13:03:09 +02:00
Ronald van Zantvoort
875379042e VR CsDhcp: allow multiple ranges & finite lease time (fixes CLOUDSTACK-8303) 2016-06-07 13:03:09 +02:00
Ronald van Zantvoort
2790d7a69b VR CsGuestNetwork obey useextdns 2016-06-07 13:03:09 +02:00
Ronald van Zantvoort
ed820bebe5 VR merge.py ipalias fix & dhcpconfig stub notification 2016-06-07 13:03:09 +02:00
Will Stevens
237bd46d55 Merge pull request #1423 from syed/ipsec-start-bug
[CLOUDSTACK-9296] Start ipsec for client VPNThis fix starts the IPSEC daemon when enabling client side vpn

* pr/1423:
  [CLOUDSTACK-9296] Start ipsec for client VPN

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-27 15:21:16 -04:00
Will Stevens
ff0b095028 Merge release branch 4.8 to master
* 4.8:
  lower the time we wait for interfaces to appear
2016-05-26 15:51:31 -04:00
Will Stevens
d9429f6add Merge pull request #1471 from remibergsma/47_lower_interface_wait
Lower the time we wait for interfaces to appearWaiting for interfaces is tricky. They might never appear.. for example when we have entries in `/etc/cloudstack/ips.json` that haven't been plugged yet. Waiting this long makes everything horribly slow (every vm, interface, static route, etc, etc, will hit this wait, for every device). We've seen CloudStack send an `ip_assoc.json` command for `eth1` public nic only and then the router goes crazy waiting for all other interfaces that were there before reboot and aren't there. If only the router would return to the mgt server a success of `eth1`, it would get the command for `eth2` etc etc. Obviously, a destroy works much faster because no state services, so no knowledge of previous devices so no waits :-)

After a stop/start the router has state in `/etc/cloudstack/ips.json` and every commands waits. Eventually hitting the hardcoded 120 sec timeout.

* pr/1471:
  lower the time we wait for interfaces to appear

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-26 15:49:50 -04:00
Syed
26227768a1 [CLOUDSTACK-9296] Start ipsec for client VPN 2016-05-26 11:25:09 -04:00
Will Stevens
678b28f273 Merge release branch 4.8 to master
* 4.8:
  CLOUDSTACK-6928: fix issue disk I/O throttling not applied
  CLOUDSTACK-6975: Prevent dnsmasq from starting on backup redundant RvR.
2016-05-25 22:54:23 -04:00
Will Stevens
5ccebf0f2b Merge pull request #1514 from dsclose/CLOUDSTACK-6975
CLOUDSTACK-6975: Prevent dnsmasq from starting on backup redundant RvRRebase of PR #1509 against the 4.7 branch as requested by @swill

One LGTM from @ustcweizhou carried from previous PR. Previous PR will be closed.

Description from PR #1509:

CLOUDSTACK-6975 refers to service monitoring bringing up dnsmasq but this is no-longer accurate, as service monitoring is not active on the post-4.6 routers. These routers still suffer an essentially identical issue, however, because "dnsmasq needs to be restarted each time configure.py is called in order to avoid lease problems." As such, dnsmasq is still running on backup RvRs, causing the issues described in CLOUDSTACK-6975.

This PR is based on a patch submitted by @ustcweizhou. The code now checks the redundant state of the router before restarting dnsmasq.

RvR networks without this patch have dnsmasq running on both master and backup routers. RvR networks with this patch have dnsmasq running on only the master router.

* pr/1514:
  CLOUDSTACK-6975: Prevent dnsmasq from starting on backup redundant RvR.

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-25 22:52:55 -04:00
Will Stevens
1dd866068a Merge pull request #1414 from resmo/fix/cleanup
SystemVM cleanupsfrom the logrotate docs

> size - With this, the log file is rotated when the specified size is reached. Size may be specified in bytes (default), kilobytes (sizek), or megabytes (sizem).

> Note: If size and time interval options are specified at same time, only size option take effect. it causes log files to be rotated without regard for the last rotation time. If both log size and timestamp of a log file need to be considered by logrotate, the minsize option should be used. logrotate will rotate log file when they grow bigger than minsize, but not before the additionally specified time interval.

* pr/1414:
  systemvm, logrotate: remove daily explicitly as it is ignored

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-20 08:28:30 -04:00
Will Stevens
88cd182272 Forward merged 4.8 to master and fixed conflicts in #1331 2016-05-19 12:08:08 -04:00
Remi Bergsma
74f60df828 Revert "Merge pull request #1482 from remibergsma/iptables-fix"
Seems to have a license issue so reverting for now.

This reverts commit 9a20ab8bcbbd39aa012a0ec5a65e66bcc737ee0e, reversing
changes made to 7a0b37a29a8be14011427dcf61bf3ea86e47dbf4.
2016-05-19 11:04:46 +02:00
Will Stevens
ebc70a51e2 Merge pull request #1486 from remibergsma/reimplement-vrrp-setting-47
Reimplement router.redundant.vrrp.interval settingGlobal setting `router.redundant.vrrp.interval` is not used any more and it is now set to a hardcoded 1.

This results in a failover from master->backup when the backup doesn't hear from the master in ~3.6sec. This is a bit too tight, as we've seen failovers during live migrations. We could reproduce it in about half of the cases. Setting this to setting to 2 (tested it by hardcoding it in the systemvms) gives twice as much time and we didn't see issues any more. Instead of updating the hardcoded setting from 1 to 2, I reimplemented the global setting by sending it to the router with the cmd_line, as the non-VPC router also does.

Background:
Why is the maximum failover time in the example 3.6 seconds? This comes from the advertisement interval and the skew time. The default advertisement interval is 1 second (configurable in keepalived.conf). The skew time helps to keep everyone from trying to transition at once. It is a number between 0 and 1, based on the formula (256 - priority) / 256

As defined in the RFC, the backup must receive an advertisement from the master every (3 * advert_int) + skew_time seconds. If it doesn't hear anything from the master, it takes over. With a backup router priority of 100 (as in the example), the failover will happen at most 3.6 seconds after the master goes down.

Source: http://www.hollenback.net/KeepalivedForNetworkReliability

* pr/1486:
  Configure rVPC for router.redundant.vrrp.interval advert_int setting
  Have rVPCs use the router.redundant.vrrp.interval setting

Signed-off-by: Will Stevens <williamstevens@gmail.com>
2016-05-18 15:52:38 -04:00