mirror of
https://github.com/moby/moby.git
synced 2025-07-30 18:23:29 +03:00
Sterner warnings for unathenticated tcp
People keep doing this and getting pwned because they accidentally left it exposed to the internet. The warning about doing this has been there forever. This introduces a sleep after warning. To disable the extra sleep users must explicitly specify `--tls=false` or `--tlsverify=false` Warning also specifies this sleep will be removed in the next release where the flag will be required if running unauthenticated. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
This commit is contained in:
@ -528,21 +528,26 @@ func (s *DockerDaemonSuite) TestDaemonFlagDebugLogLevelFatal(c *testing.T) {
|
||||
}
|
||||
|
||||
func (s *DockerDaemonSuite) TestDaemonAllocatesListeningPort(c *testing.T) {
|
||||
listeningPorts := [][]string{
|
||||
type listener struct {
|
||||
daemon string
|
||||
client string
|
||||
port string
|
||||
}
|
||||
listeningPorts := []listener{
|
||||
{"0.0.0.0", "0.0.0.0", "5678"},
|
||||
{"127.0.0.1", "127.0.0.1", "1234"},
|
||||
{"localhost", "127.0.0.1", "1235"},
|
||||
}
|
||||
|
||||
cmdArgs := make([]string, 0, len(listeningPorts)*2)
|
||||
for _, hostDirective := range listeningPorts {
|
||||
cmdArgs = append(cmdArgs, "--host", fmt.Sprintf("tcp://%s:%s", hostDirective[0], hostDirective[2]))
|
||||
for _, l := range listeningPorts {
|
||||
cmdArgs = append(cmdArgs, "--tls=false", "--host", fmt.Sprintf("tcp://%s:%s", l.daemon, l.port))
|
||||
}
|
||||
|
||||
s.d.StartWithBusybox(c, cmdArgs...)
|
||||
|
||||
for _, hostDirective := range listeningPorts {
|
||||
output, err := s.d.Cmd("run", "-p", fmt.Sprintf("%s:%s:80", hostDirective[1], hostDirective[2]), "busybox", "true")
|
||||
for _, l := range listeningPorts {
|
||||
output, err := s.d.Cmd("run", "-p", fmt.Sprintf("%s:%s:80", l.client, l.port), "busybox", "true")
|
||||
if err == nil {
|
||||
c.Fatalf("Container should not start, expected port already allocated error: %q", output)
|
||||
} else if !strings.Contains(output, "port is already allocated") {
|
||||
|
Reference in New Issue
Block a user