-
Notifications
You must be signed in to change notification settings - Fork 67
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support partition in network attack #65
Conversation
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Signed-off-by: xiang <xiang13225080@163.com>
Example |
I take a mistake in the description, the command should be sudo ./bin/chaosd attack network partition --ip 172.16.112.136 -d ens33 -p tcp --accept-tcp-flags "SYN,ACK SYN,ACK" --direction to |
pkg/core/network.go
Outdated
@@ -66,6 +72,8 @@ func (n *NetworkCommand) Validate() error { | |||
return n.validNetworkCommon() | |||
case NetworkDNSAction: | |||
return n.validNetworkDNS() | |||
case NetworkPartitionAction: | |||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it really unnecessary to valid action?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, require a validate, done in dcb1285
cmd.Flags().StringVarP(&options.IPProtocol, "protocol", "p", "", | ||
"only impact traffic using this IP protocol, supported: tcp, udp, icmp, all") | ||
cmd.Flags().StringVarP(&options.AcceptTCPFlags, "accept-tcp-flags", "", "", "only the packet which match the tcp flag can be accepted, others will be dropped. only set when the protocol is tcp.") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible that user may drop ssh package with partition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, SSH uses TCP protocol in the transport layer.
Signed-off-by: xiang <xiang13225080@163.com>
add some description of direction in dcb1285 @Andrewmatilde |
@Andrewmatilde PTAL again |
Signed-off-by: xiang <xiang13225080@163.com>
…aos-daemon into xiang/partition
Signed-off-by: xiang <xiang13225080@163.com>
just ignore the lift's warning now, because it's not the real version we used, there is a |
pkg/core/network.go
Outdated
@@ -378,6 +412,45 @@ func (n *NetworkCommand) NeedApplyTC() bool { | |||
} | |||
} | |||
|
|||
func (n *NetworkCommand) ToChain(ipset string) ([]*pb.Chain, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ToChain is not a good name to explain what the func do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have any suggestions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe NetworkPartitionChains?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK,I update to PartitionChains
without Network
, because the object's type is NetworkCommand
I think we need a verbose option and log all the iptables command inTrace log level. |
Good idea, I will do it in another pr |
Signed-off-by: xiang <xiang13225080@163.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@fewdan PTAL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Usage
Examples
If you want to block only part of the packet, you can set the
accept-tcp-flags
(only for tcp protocol), just like:sudo ./bin/chaosd attack network partition --ip 172.16.112.136 -d ens33 -p tcp --accept-tcp-flags "SYN,ACK SYN,ACK" --direction to
And then you can start a simple HTTP server by python:
Send HTTP request from 172.16.112.136:
You will see it is waiting the response, and the HTTP server receive the request:
But the response is blocked.