60 Commits

Author SHA1 Message Date
Edison Su
2276a399ac KVM security bug: no forwarding rule applied
(cherry picked from commit e5c391fcf3852e50ebd99d4a72fd51d1753b05eb)

Signed-off-by: Animesh Chaturvedi <animesh@apache.org>
2014-03-28 16:21:36 -07:00
jayapal
86124138a1 CLOUDSTACK-5924: Correcting regex to get vm names exactly from ebtables chains 2014-01-22 11:20:27 +05:30
Wei Zhou
258118efa6 CLOUDSTACK-4405: additional patch for bridge name and firewall rules issues after KVM upgrade to 4.2
There still exist two issues after Edison's commits.
(1) Migration from new hosts to old hosts failed.
The bridge name on old host is set to cloudVirBr* if network.bridge.name.schema is set to 3.0 in /etc/cloudstack/agent/agent.properties, but the actual bridge name is breth*-* after running cloudstack-agent-upgrade.
(2) all ports of vms (Basic zone, or Advanced zone with security groups) on old hosts are open, because the iptables rules are binding to device (bridge) name which is changed by cloudstack-agent-upgrade.

After this, the KVM upgrade steps :
a. Install 4.2 cloudstack agent on each kvm host
b. Run "cloudstack-agent-upgrade". This script will upgrade all the existing bridge name to new bridge name, and update related firewall rules.
c. install a libvirt hook:
    c1. mkdir /etc/libvirt/hooks
    c2. cp /usr/share/cloudstack-agent/lib/libvirtqemuhook /etc/libvirt/hooks/qemu
    c3. chmod +x /etc/libvirt/hooks/qemu
    c4. service libvirtd restart
    c5. service cloudstack-agent restart

Signed-off-by: Wei Zhou <w.zhou@leaseweb.com>
2013-09-24 09:55:00 +02:00
Wei Zhou
3f42601c6d fix different type issue in write_rule_log_for_vm in security_group.py 2013-09-13 12:02:24 +02:00
Wei Zhou
83d3f7d2f3 change return value of getvmId() from int to string in security_group.py 2013-09-13 11:37:30 +02:00
Mike Tutkowski
60e0873a93 The 'domain' variable should be 'vmName'. 2013-09-12 09:17:48 -06:00
Rene Diepstraten
211b180d55 Replaced virsh() by python-libvirt functions
Signed-off-by: Rene Diepstraten <rene@renediepstraten.nl>
2013-07-25 18:10:58 +02:00
Rene Diepstraten
052bff15c6 Replaced multiple grep/awk/head commands by one awk command
Signed-off-by: Rene Diepstraten <mail@renediepstraten.nl>
2013-07-18 13:41:36 +02:00
Rene Diepstraten
cf73d5b858 Added logpath variable and replaced hardcoded path
Signed-off-by: Rene Diepstraten <mail@renediepstraten.nl>
2013-07-18 12:31:38 +02:00
Rene Diepstraten
c85d41d46f Corrected typos in logmessages
Signed-off-by: Rene Diepstraten <mail@renediepstraten.nl>
2013-07-18 11:47:30 +02:00
Rene Diepstraten
ffe7cfe076 Truncated trailing/double spaces
Signed-off-by: Rene Diepstraten <mail@renediepstraten.nl>
2013-07-17 18:31:28 +02:00
Wido den Hollander
67bcce71f7 Security Group: Use awk to do matching and printing instead of using grep + awk.
Makes it a bit shorter code wise
2013-07-12 11:09:41 +02:00
Wido den Hollander
8e4e56f731 CLOUDSTACK-3409: Do not clean up security group rules for Instances in the "paused" state.
When 'security_group.py cleanup_rules' is called by the KVM Agent it will clean up all Instances
not in the "running" state according to libvirt.

However, when a snapshot is created of a Instance it will go to the "paused" state while the snapshot
is created.

This leads to Security Rules being removed when a Instance is being snapshotted and the cleanup process
is initiated.
2013-07-10 13:12:46 +02:00
Edison Su
299cccf779 fix copy/paste bug 2013-04-24 18:32:06 -07:00
Jayapal Uradi
edaa72d0fc CLOUDSTACK-24: mipn feature for basiczone kvmhost
Signed-off-by: Abhinandan Prateek <aprateek@apache.org>
2013-03-15 10:22:56 +05:30
John Kinsella
08a0788b38 Summary: security_group.py: catch exception when flushing chain
Detail: Added exception handling around iptables chain flushing, along
with a call to default_network_rules() to re-initialize.

Testing:
On agent, ls /var/run/cloud and pick one of the VMs to test with. Make a
backup of it's logfile (eg cp /var/run/cloud/i-2-1722.log /tmp )
Destroy the firewall ruleset for that VM with
/usr/lib64/cloud/common/scripts/vm/network/security_group.py destroy_network_rules_for_vm --vmname i-2-1722-VM --vif vnet10
Now copy the log file back, edit the file and decrement the last field by 1
ACS should notice the out-of-date sequence ID and push a new ruleset for
the VM within 60 seconds.

BUG-ID: CLOUDSTACK-1685
Bugfix-for: John Kinsella
Reviewed-by:
Reported-by:
Signed-off-by: John Kinsella <jlk@stratosec.co> 1363286927 -0700
2013-03-14 11:48:47 -07:00
John Kinsella
1079d63b6f Summary: Prevent deletion of wrong iptables rules
Detail: A grep in security_group.py wasn't defined well enough, could
potentially delete rules for VMs other than intended

BUG-ID: CLOUDSTACK-309
Bugfix-for: master
Reviewed-by:
Reported-by: Francois Scala
Signed-off-by: John Kinsella <jlk@stratosec.co> 1363222521 -0700
2013-03-13 17:55:21 -07:00
John Kinsella
381f737e64 Summary: Fix exception handling in security_group.py
Detail: Code was attempting to concatinate an exception to a string.
Updated to convert to text and concatinate that.

BUG-ID: CLOUDSTACK-1052
Bugfix-for: master
Reported-by: Noa Resare
Signed-off-by: John Kinsella <jlk@stratosec.co> 1363218769 -0700
2013-03-13 16:52:49 -07:00
Marcus Sorensen
0ca85659a6 CLOUDSTACK-1651 - point agent scripts to correct logging location, due to move
of /var/log/cloud to /var/log/cloudstack

Signed-off-by: Marcus Sorensen <marcus@betterservers.com> 1363112422 -0600
2013-03-12 12:20:22 -06:00
Radoslaw Smigielski
0383803188 scripts: Fix security_group.py handling of args and unknown commands
Checks the args length, doesn't throw IndexError when no args
passed. Also logs to security_group.log when executed with no args or unknown
command.

Review: https://reviews.apache.org/r/9588
Reviewed-by: Rohit Yadav <bhaisaab@apache.org>

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2013-02-26 14:12:49 +05:30
Rohit Yadav
6f29317a84 CLOUDSTACK-591: Fix execute and string processing logic for reboot_vm in security_group
- Since we're always getting the first from the list, use head -1 to get the first
  of the results instead of processing again
- Remove unecessay pop (why was it even there)

Signed-off-by: Rohit Yadav <bhaisaab@apache.org>
2012-12-13 15:28:30 -08:00
Bill Rich
1ae2d720a3 CLOUDSTACK-591: Changed bridge name parsing in security_group.py to support bridges named with dashes 2012-12-13 15:28:30 -08:00
Edison Su
cefc5cbff3 bug CS-16172
Reviewed-by: chiradeep
2012-08-24 16:13:29 -07:00
David Nalley
d630fa8697 license header changes for scripts folder from Chip Childers 2012-06-23 00:58:00 -04:00
Wido den Hollander
bdec29b3dc Create iptable rules for all bridges assigned to a system VM
The default_network_rules_systemvm method in security_group.py only created the appropriate rules for
just one bridge.

This however leads to traffic not being forwarded to the virtual machine in the case of the system VMs
both (console & storage) having different bridges in basic networking.

This patch makes sure rules are generated for all target devices based on their source device/bridge

It however excludes the LinkLocalBridge since no filtering is needed on that bridge.
2012-06-19 12:20:22 +02:00
John Kinsella
efe318336a CS-14955: security_group.py only creates ICMP iptables rules for ICMP type -1
Description:
Unindented 3 lines to update logic flow to execute iptables when
passed ICMP type is not -1.
2012-05-27 19:39:56 -04:00
Edison Su
d913e3bdfb security group: exactly match bridge name 2012-05-04 13:56:34 -07:00
frank
2f634c0913 Switch to Apache license 2012-04-03 04:50:05 -07:00
Naredula Janardhana Reddy
c7766ea6c8 bug 10617: kvm related changes. 2011-12-02 17:07:36 +05:30
Naredula Janardhana Reddy
09905b641b bug 10617: merge code from branch bug10617. 2011-12-01 14:17:52 +05:30
Naredula Janardhana Reddy
f1b99f4f07 Revert "bug 10617: merging code from branch bug10617"
This reverts commit 8bc33448b9220534ba0ddc6c642ffb1e69d5844e.

Conflicts:

	server/src/com/cloud/api/ApiResponseHelper.java
2011-11-11 20:23:26 +05:30
Naredula Janardhana Reddy
02adbd4bd3 bug 10617: merging code from branch bug10617 2011-11-10 15:23:48 +05:30
Chiradeep Vittal
d817f3c364 Revert "bug 10617: Added Egress rules to Security groups."
revert pending review

This reverts commit a19212703b9734ebd44ebf55cfdd81ebdc9d7fe4.
2011-09-12 14:45:58 -07:00
Chiradeep Vittal
53970c89dc Revert "bug 10617: blocking between security groups for egress rules fixed."
revert pending review

This reverts commit 7d30dfd79e3c4b01492f606333c26e36bcdc5d13.
2011-09-12 14:45:58 -07:00
Chiradeep Vittal
e216686029 Revert "bug 10617: Intermediate checking"
revert pending review

This reverts commit 561b27565512d438db3d8896df6f97b644b0b498.
2011-09-12 14:45:58 -07:00
Naredula Janardhana Reddy
f9b0962ad9 bug 10617: Intermediate checking
Changes :
         - Fixing API doc +response name + errorMessage
         - Adding seperate events to Egress rules
         - Egress rules Using the same database table as that of ingress with new column type.

   Pending Tasks:
         - db upgrade
         - database table rename from security_ingress_rule to generic name, renaming some of the jave class from ingress to generic name.
         - Retesting on kvm
2011-09-09 18:14:19 +05:30
Naredula Janardhana Reddy
10d2ca8d0a bug 10617: blocking between security groups for egress rules fixed. 2011-09-02 16:17:08 +05:30
Naredula Janardhana Reddy
854f81962f bug 10617: Added Egress rules to Security groups.
Description :
   API's:
     -  Two new api's authorizeSecurityGroupEgress,revokeSecurityGroupEgressCmd are added. These two API's are similer to ingress rule API's.
           - authorizeSecurityGroupEgress :Authorizes a particular egress rule for this security group . Usageof API is very similer to that of authorizeSecurityGroupIngress except that instead of source cidr  there will be destination cidr. By default like ingress, all the outgoing flows are blocked.
           - revokeSecurityGroupEgress : It is similer to revokeSecurityGroupIngress api, It removes the egress rule.
     -  listSecurityGroup API's response changed. It include's egress list apart from the existing ingress rules in the output of the API.

   Hypervisors :
      - It is implemented in Xen and KVM.

   Pending Tasks :  Blocking using destination security groups.

   Previous commits: c9fda641673df7701f44963ef27e1d488f121219 , 24e4e44b8f0712a37147a3777833de3f9e24829e
2011-08-30 16:28:35 +05:30
Edison Su
c3174664de after vm reboot, change the security group if needed 2011-07-29 15:28:16 -07:00
Edison Su
5724a016c6 fix security group clean up on centos 5 2011-07-26 16:57:49 -07:00
Edison Su
1e944a2d86 cleanup ebtables rules if vm is manually deleted 2011-06-20 10:32:05 -04:00
Edison Su
ad5162ef86 fix ebtable cleanup issue: on ubuntu, it's not got deleted if vm is stopped 2011-06-16 19:26:24 -04:00
Edison Su
49550aff44 fix ebtable, which should only add a new DNAT rule for dhcp server 2011-06-10 11:39:43 -04:00
Edison Su
8312f1314b remove augtools 2011-05-26 23:19:53 -04:00
Edison Su
29c510de28 need to insert iptable rules into FORWARD chain instead of append, as on rhel6, there is a reject rule added at the end of FORWARD 2011-05-13 16:05:20 -04:00
Edison Su
58e034fa41 add License header back 2011-05-03 11:47:10 -04:00
Chiradeep Vittal
303e2a7481 Start of zonesfeature / mycloud/cloudkit 2011-05-03 10:40:17 -07:00
Frank
92155522f2 Add license header to files 2011-04-14 11:23:14 -07:00
Edison Su
9ad5139fda fix delete security group rule 2011-03-03 13:44:48 -05:00
Edison Su
d7b7d6bc26 bug 8771: multitenancy on same host in security group
status 8711: resolved fixed
2011-03-01 16:38:06 -05:00