x-storage-url from remote server not referring to correct host address

Bug #959953 reported by Kesav Kumar Kolla
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Fix Released
Wishlist
gholt

Bug Description

When I execute the following command from remote server:

curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://192.168.10.148:7080/auth/v1.0

I'd expect X-Storage-Url: http://192.168.10.148:7080/v1/AUTH_test

Instead it's pointing to 127.0.0.1. This is breaking the functionality of swift command line tool.

The current logic for X-Storage-Url is retrieving bind-ip from configuration and defaults to 127.0.0.1. I don't want to change bind address because typically there will be multiple IP addresses assigned to given server and we want the server to listen on all interfaces. So bindip shouldn't be used for constructing the Storage-Url header instead it should be constructed with current request's host name.

In common/middleware/tempauth.py

At line 435 modify like this:

storageurl = req.host_url + '/v1/' + self.reseller_prefix + account
return Response(request=req,
            headers={'x-auth-token': token, 'x-storage-token': token,
                     'x-storage-url': storageurl})

This will calculate the x-storage-url dynamically based on the request url. This will resolve the issue of swift command client from remote host.

description: updated
Pete Zaitcev (zaitcev)
Changed in swift:
status: New → Confirmed
Revision history for this message
Greg Lange (greglange) wrote :

In /etc/swift/proxy-server.conf, if you set the bind_ip to 192.168.10, things will work like you expect.

The code that determines the storage url is in the __init__() method of TempAuth.

It looks ok to me.

Take a look at it.

If it's not ok, why not?

Changed in swift:
importance: Undecided → Wishlist
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to swift (master)

Fix proposed to branch: master
Review: https://review.openstack.org/15814

Changed in swift:
assignee: nobody → gholt (gholt)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to swift (master)

Reviewed: https://review.openstack.org/15814
Committed: http://github.com/openstack/swift/commit/47ee1d7e175471483b9885eafc4514a7281c35e9
Submitter: Jenkins
Branch: master

commit 47ee1d7e175471483b9885eafc4514a7281c35e9
Author: gholt <email address hidden>
Date: Sat Nov 10 16:39:25 2012 +0000

    Better TempAuth storage URL guessing

    I know it's just TempAuth, but bug #959953 just caught my eye as
    something interesting to solve.

    This does a best guess on the storage URL to return for a given
    request. It allows $HOST to be used in the storage URL configuration,
    where $HOST will resolve to scheme://host:port. It bases the scheme
    on how the server is running or on storage_url_scheme if set. The
    host:port comes from the request's Host header if it exists, and
    falls back to the WSGI SERVER_NAME:SERVER_PORT otherwise.

    Fixes: bug #959953
    DocImpact

    Change-Id: Ia494bcb99a04490911ee8d2cb8b12a94e77820c5

Changed in swift:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in swift:
milestone: none → 1.7.6
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.