mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	Add test to verify that response hijacking always works over TLS.
Signed-off-by: David Calavera <david.calavera@gmail.com>
This commit is contained in:
		
							parent
							
								
									7a5d897410
								
							
						
					
					
						commit
						db1d5f7ea3
					
				
					 1 changed files with 23 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -1439,6 +1439,29 @@ func (s *DockerDaemonSuite) TestHttpsInfo(c *check.C) {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TestHttpsRun connects via two-way authenticated HTTPS to the create, attach, start, and wait endpoints.
 | 
			
		||||
// https://github.com/docker/docker/issues/19280
 | 
			
		||||
func (s *DockerDaemonSuite) TestHttpsRun(c *check.C) {
 | 
			
		||||
	const (
 | 
			
		||||
		testDaemonHTTPSAddr = "tcp://localhost:4271"
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	if err := s.d.StartWithBusybox("--tlsverify", "--tlscacert", "fixtures/https/ca.pem", "--tlscert", "fixtures/https/server-cert.pem",
 | 
			
		||||
		"--tlskey", "fixtures/https/server-key.pem", "-H", testDaemonHTTPSAddr); err != nil {
 | 
			
		||||
		c.Fatalf("Could not start daemon with busybox: %v", err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	daemonArgs := []string{"--host", testDaemonHTTPSAddr, "--tlsverify", "--tlscacert", "fixtures/https/ca.pem", "--tlscert", "fixtures/https/client-cert.pem", "--tlskey", "fixtures/https/client-key.pem"}
 | 
			
		||||
	out, err := s.d.CmdWithArgs(daemonArgs, "run", "busybox", "echo", "TLS response")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		c.Fatalf("Error Occurred: %s and output: %s", err, out)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if !strings.Contains(out, "TLS response") {
 | 
			
		||||
		c.Fatalf("expected output to include `TLS response`, got %v", out)
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TestTlsVerify verifies that --tlsverify=false turns on tls
 | 
			
		||||
func (s *DockerDaemonSuite) TestTlsVerify(c *check.C) {
 | 
			
		||||
	out, err := exec.Command(dockerBinary, "daemon", "--tlsverify=false").CombinedOutput()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue