Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
85afed5d
Commit
85afed5d
authored
Nov 29, 2016
by
Random-Liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix node e2e firewall configure.
parent
356170fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
14 deletions
+24
-14
remote.go
test/e2e_node/remote/remote.go
+24
-14
No files found.
test/e2e_node/remote/remote.go
View file @
85afed5d
...
...
@@ -194,23 +194,33 @@ func RunRemote(archive string, host string, cleanup bool, junitFilePrefix string
// Configure iptables firewall rules
// TODO: consider calling bootstrap script to configure host based on OS
cmd
=
getSSHCommand
(
"&&"
,
`iptables -L INPUT | grep "Chain INPUT (policy DROP)"`
,
"(iptables -C INPUT -w -p TCP -j ACCEPT || iptables -A INPUT -w -p TCP -j ACCEPT)"
,
"(iptables -C INPUT -w -p UDP -j ACCEPT || iptables -A INPUT -w -p UDP -j ACCEPT)"
,
"(iptables -C INPUT -w -p ICMP -j ACCEPT || iptables -A INPUT -w -p ICMP -j ACCEPT)"
)
output
,
err
:=
SSH
(
host
,
"sh"
,
"-c"
,
cmd
)
output
,
err
:=
SSH
(
host
,
"iptables"
,
"-L"
,
"INPUT"
)
if
err
!=
nil
{
glog
.
Errorf
(
"Failed to configured firewall: %v output: %v"
,
err
,
output
)
return
""
,
false
,
fmt
.
Errorf
(
"failed to get iptables INPUT: %v output: %q"
,
err
,
output
)
}
if
strings
.
Contains
(
output
,
"Chain INPUT (policy DROP)"
)
{
cmd
=
getSSHCommand
(
"&&"
,
"(iptables -C INPUT -w -p TCP -j ACCEPT || iptables -A INPUT -w -p TCP -j ACCEPT)"
,
"(iptables -C INPUT -w -p UDP -j ACCEPT || iptables -A INPUT -w -p UDP -j ACCEPT)"
,
"(iptables -C INPUT -w -p ICMP -j ACCEPT || iptables -A INPUT -w -p ICMP -j ACCEPT)"
)
output
,
err
:=
SSH
(
host
,
"sh"
,
"-c"
,
cmd
)
if
err
!=
nil
{
return
""
,
false
,
fmt
.
Errorf
(
"failed to configured firewall: %v output: %v"
,
err
,
output
)
}
}
cmd
=
getSSHCommand
(
"&&"
,
`iptables -L FORWARD | grep "Chain FORWARD (policy DROP)" > /dev/null`
,
"(iptables -C FORWARD -w -p TCP -j ACCEPT || iptables -A FORWARD -w -p TCP -j ACCEPT)"
,
"(iptables -C FORWARD -w -p UDP -j ACCEPT || iptables -A FORWARD -w -p UDP -j ACCEPT)"
,
"(iptables -C FORWARD -w -p ICMP -j ACCEPT || iptables -A FORWARD -w -p ICMP -j ACCEPT)"
)
output
,
err
=
SSH
(
host
,
"sh"
,
"-c"
,
cmd
)
output
,
err
=
SSH
(
host
,
"iptables"
,
"-L"
,
"FORWARD"
)
if
err
!=
nil
{
glog
.
Errorf
(
"Failed to configured firewall: %v output: %v"
,
err
,
output
)
return
""
,
false
,
fmt
.
Errorf
(
"failed to get iptables FORWARD: %v output: %q"
,
err
,
output
)
}
if
strings
.
Contains
(
output
,
"Chain FORWARD (policy DROP)"
)
{
cmd
=
getSSHCommand
(
"&&"
,
"(iptables -C FORWARD -w -p TCP -j ACCEPT || iptables -A FORWARD -w -p TCP -j ACCEPT)"
,
"(iptables -C FORWARD -w -p UDP -j ACCEPT || iptables -A FORWARD -w -p UDP -j ACCEPT)"
,
"(iptables -C FORWARD -w -p ICMP -j ACCEPT || iptables -A FORWARD -w -p ICMP -j ACCEPT)"
)
output
,
err
=
SSH
(
host
,
"sh"
,
"-c"
,
cmd
)
if
err
!=
nil
{
return
""
,
false
,
fmt
.
Errorf
(
"failed to configured firewall: %v output: %v"
,
err
,
output
)
}
}
// Copy the archive to the staging directory
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment