Bug 1366573 - Creating a docker compute resource with unix socket URL throws error: 400 Bad Request: malformed Host header
Summary: Creating a docker compute resource with unix socket URL throws error: 400 Bad...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Container Management
Version: 6.2.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: Unspecified
Assignee: Sebastian Gräßl
QA Contact: Lukas Pramuk
URL: http://projects.theforeman.org/issues...
Whiteboard:
: 1393405 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-12 11:18 UTC by Sachin Ghai
Modified: 2019-09-26 14:48 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-02-21 16:59:14 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
400 Bad Request: malformed Host header (32.82 KB, image/png)
2016-08-12 11:18 UTC, Sachin Ghai
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 18502 0 None None None 2017-02-27 09:03:25 UTC

Description Sachin Ghai 2016-08-12 11:18:14 UTC
Created attachment 1190347 [details]
400 Bad Request: malformed Host header

Description of problem:
With zstream automation failures, found below issue on creating a docker type CR, with unix socket URL:

400 Bad Request: malformed Host header


Here is the installed docker version:

~]# docker version
Client:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-46.el7.10.x86_64
 Go version:      go1.6.2
 Git commit:      2a93377-unsupported
 Built:           Fri Jul 29 13:45:25 2016
 OS/Arch:         linux/amd64

Server:
 Version:         1.10.3
 API version:     1.22
 Package version: docker-common-1.10.3-46.el7.10.x86_64
 Go version:      go1.6.2
 Git commit:      2a93377-unsupported
 Built:           Fri Jul 29 13:45:25 2016
 OS/Arch:         linux/amd64

Version-Release number of selected component (if applicable):
sat6.2.1 snap2.1

How reproducible:


Steps to Reproduce:
1. install/confgure docker on satellite server
2. add a docker type compute resource with URL: unix:///var/run/docker.sock
3. 

Actual results:
Unable to save
400 Bad Request: malformed Host header


Expected results:

docker type CR with unix socket URL should be created
Additional info:

Comment 4 Lukas Pramuk 2016-11-11 13:25:23 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 5 Lukas Pramuk 2016-11-11 13:26:40 UTC
*** Bug 1393405 has been marked as a duplicate of this bug. ***

Comment 6 Lukas Pramuk 2017-01-10 11:48:35 UTC
One-liner hotfix for this issue is to run:

# scl enable tfm "gem update docker-api"
Updating installed gems
Updating docker-api
Fetching: docker-api-1.33.1.gem (100%)
Successfully installed docker-api-1.33.1
Parsing documentation for docker-api-1.33.1
Installing ri documentation for docker-api-1.33.1
Installing darkfish documentation for docker-api-1.33.1
Done installing documentation for docker-api after 1 seconds
Parsing documentation for docker-api-1.33.1
Done installing documentation for docker-api after 0 seconds
Gems updated: docker-api

Comment 7 Lukas Pramuk 2017-01-10 12:16:39 UTC
One-liner fix yet needs GEM_HOME:

# GEM_HOME=/opt/theforeman/tfm/root/usr/share/gems scl enable tfm 'gem update docker-api'

# GEM_HOME=/opt/theforeman/tfm/root/usr/share/gems scl enable tfm irb
irb(main):001:0> require 'docker-api'
=> true
irb(main):002:0> Docker.version
=> {"Version"=>"1.10.3", "ApiVersion"=>"1.22", "GitCommit"=>"429be27-unsupported", "GoVersion"=>"go1.6.2", "Os"=>"linux", "Arch"=>"amd64", "KernelVersion"=>"3.10.0-514.2.2.el7.x86_64", "BuildTime"=>"2016-11-18T17:03:44.884782319-05:00", "PkgVersion"=>"docker-common-1.10.3-59.el7.x86_64"}

Comment 8 Lukas Pramuk 2017-01-13 12:27:09 UTC
This is not induced by old docker-api at all !!!
It's caused by old excon-0.45. Updating it to excon-0.54 resolved the issue.

# GEM_HOME=/opt/theforeman/tfm/root/usr/share/gems scl enable tfm 'gem update excon'
Updating installed gems
Updating excon
Fetching: excon-0.54.0.gem (100%)
Successfully installed excon-0.54.0
Parsing documentation for excon-0.54.0
Installing ri documentation for excon-0.54.0
Installing darkfish documentation for excon-0.54.0
Done installing documentation for excon after 2 seconds
Parsing documentation for excon-0.54.0
Done installing documentation for excon after 0 seconds
Gems updated: excon

# GEM_HOME=/opt/theforeman/tfm/root/usr/share/gems scl enable tfm irb
irb(main):001:0> require 'docker-api'
=> true
irb(main):002:0> Docker.version
=> {"Version"=>"1.10.3", "ApiVersion"=>"1.22", "GitCommit"=>"429be27-unsupported", "GoVersion"=>"go1.6.2", "Os"=>"linux", "Arch"=>"amd64", "KernelVersion"=>"3.10.0-514.2.2.el7.x86_64", "BuildTime"=>"2016-11-18T17:03:44.884782319-05:00", "PkgVersion"=>"docker-common-1.10.3-59.el7.x86_64"}

Comment 11 Daniel Lobato Garcia 2017-02-27 08:51:14 UTC
Connecting redmine issue http://projects.theforeman.org/issues/18502 from this bug

Comment 12 Satellite Program 2017-02-27 11:07:24 UTC
Upstream bug assigned to sgraessl

Comment 13 Satellite Program 2017-02-27 11:07:28 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/18502 has been resolved.

Comment 14 Lukas Pramuk 2017-12-06 19:30:29 UTC
VERIFIED.

@satellite-6.3.0-22.0.el7sat.noarch
tfm-rubygem-excon-0.51.0-1.el7sat.noarch

by the manual reproducer desribed in comment#0:

>>> The docker CR with URL unix:///var/run/docker.sock is created successfully and the connection is functional

Comment 15 Bryan Kearney 2018-02-21 16:59:14 UTC
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA.

For information on the advisory, and where to find the updated files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2018:0336


Note You need to log in before you can comment on or make changes to this bug.