Bug 1393405

Summary: connection to unix docker compute resource fails with 400 Bad Request: malformed Host header
Product: Red Hat Satellite Reporter: Lukas Pramuk <lpramuk>
Component: Container ManagementAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED DUPLICATE QA Contact: Lukas Pramuk <lpramuk>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2.4Keywords: Regression
Target Milestone: Unspecified   
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-11 13:26:40 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Lukas Pramuk 2016-11-09 13:13:34 UTC
Description of problem:
Cannot use unix socket docker resource. Upon Test connection or getting list of containers  I get "400 Bad Request: malformed Host header"

Version-Release number of selected component (if applicable):
satellite-6.2.4-1.0.el7sat.noarch
docker-1.10.3-46.el7.14.x86_64
tfm-rubygem-foreman_docker-2.0.1.11-1.el7sat.noarch

How reproducible:
100%

Steps to Reproduce:
1. create docker compute resource with URL unix:///var/run/docker.sock
2. test connection to this resource

Actual results:
unable to use unix socket docker CR as connection fails with
(x) Unable to save
400 Bad Request: malformed Host header

Expected results:
connection is successful

Additional info:
2016-11-09 08:00:24 [app] [I] Started PUT "/compute_resources/test_connection" for <CLIENT_IP> at 2016-11-09 08:00:24 -0500
2016-11-09 08:00:24 [app] [I] Processing by ComputeResourcesController#test_connection as */*
2016-11-09 08:00:24 [app] [I]   Parameters: {"utf8"=>"✓", "authenticity_token"=>"vx45s0fkmLzi8vx8LM8F65RFkW4xYjO97ZnTZxVgzlg=", "compute_resource"=>{"name"=>"wXXvVQxtbN", "description"=>"", "url"=>"unix:///var/run/docker.sock", "user"=>"", "password"=>"[FILTERED]", "email"=>"", "location_ids"=>[""], "organization_ids"=>["", "6"]}, "fakepassword"=>"[FILTERED]", "cr_id"=>"1"}
2016-11-09 08:00:24 [app] [I] CR_ID IS 1
2016-11-09 08:00:24 [app] [I]   Rendered /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_docker-2.0.1.11/app/views/compute_resources/form/_docker.html.erb (13.3ms)
2016-11-09 08:00:24 [app] [I]   Rendered taxonomies/_loc_org_tabs.html.erb (55.5ms)
2016-11-09 08:00:24 [app] [I]   Rendered compute_resources/_form.html.erb (82.0ms)
2016-11-09 08:00:24 [app] [I] Completed 200 OK in 164ms (Views: 77.4ms | ActiveRecord: 19.8ms)

Comment 1 Lukas Pramuk 2016-11-09 13:22:03 UTC
Docker is configured to listen both on unix socket and tcp

/etc/sysconfig/docker:
OPTIONS='--selinux-enabled=true --host tcp://0.0.0.0:2375 --host unix:///var/run/docker.sock -G docker'

Connection to unix:///var/run/docker.sock fails while connection to tcp://localhost:2375 succeeds.

SElinux doesn't play a role here as it is set to Permissive.

Comment 3 Lukas Pramuk 2016-11-11 13:26:40 UTC

*** This bug has been marked as a duplicate of bug 1366573 ***