401 Unauthorized

Asked by moubariksiham

I am using a tutoriel :http://swift.openstack.org/development_saio.html

I'm currently trying to create a swift environment for some test, but got the following error when getting an X-Storage-Url and X-Auth-Token using test command.

root@dtv-110702:/var/log/swift# curl -v -H 'X-Storage-User: test:tester' -H 'X-Storage-Pass: testing' http://192.168.3.20:8080/auth/v1.0
* About to connect() to 192.168.3.20 port 8080 (#0)
* Trying 192.168.3.20... connected
* Connected to 192.168.3.20 (192.168.3.20) port 8080 (#0)
> GET /auth/v1.0 HTTP/1.1
> User-Agent: curl/7.21.3 (x86_64-pc-linux-gnu) libcurl/7.21.3 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: 192.168.3.20:8080
> Accept: */*
> X-Storage-User: test:tester
> X-Storage-Pass: testing
>
< HTTP/1.1 200 OK
< X-Storage-Url: http://127.0.0.1:8080/v1/AUTH_test
< X-Storage-Token: AUTH_tk6196b8a2736544088d24093ad91accdb
< X-Auth-Token: AUTH_tk6196b8a2736544088d24093ad91accdb
< Content-Length: 0
< Date: Mon, 08 Aug 2011 10:43:38 GMT
<
* Connection #0 to host 192.168.3.20 left intact
++++++++++++++++++++++++++++++++++++++++++++++++++++
root@dtv-110702:/var/log/swift# curl -v -H 'X-Auth-Token: AUTH_tk4944cfe283c748d9996b756b1a85cf1f' http://192.168.3.20:8080/v1/AUTH_test
* About to connect() to 192.168.3.20 port 8080 (#0)
* Trying 192.168.3.20... connected
* Connected to 192.168.3.20 (192.168.3.20) port 8080 (#0)
> GET /v1/AUTH_test HTTP/1.1
> User-Agent: curl/7.21.3 (x86_64-pc-linux-gnu) libcurl/7.21.3 OpenSSL/0.9.8o zlib/1.2.3.4 libidn/1.18
> Host: 192.168.3.20:8080
> Accept: */*
> X-Auth-Token: AUTH_tk4944cfe283c748d9996b756b1a85cf1f
>
< HTTP/1.1 401 Unauthorized
< Content-Length: 358
< Content-Type: text/html; charset=UTF-8
< Date: Mon, 08 Aug 2011 10:45:44 GMT
<
<html>
 <head>
  <title>401 Unauthorized</title>
 </head>
 <body>
  <h1>401 Unauthorized</h1>
  This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.<br /><br />

 </body>
* Connection #0 to host 192.168.3.20 left intact
* Closing connection #0
++++++++++++++++++++++++++++++++
I modified the file memcached.conf through ip address of my server
these are the log of the proxy

Aug 8 12:46:31 dtv-110702 proxy-server STDOUT: ERROR:root:Error connecting to memcached: 127.0.0.1:11211#012Traceback (most recent call last):#012 File "/root/swift/trunk/swift/common/memcached.py", line 111, in _get_conns#012 sock.connect((host, int(port)))#012 File "/usr/lib/pymodules/python2.7/eventlet/greenio.py", line 179, in connect#012 socket_checkerr(fd)#012 File "/usr/lib/pymodules/python2.7/eventlet/greenio.py", line 43, in socket_checkerr#012 raise socket.error(err, errno.errorcode[err])#012error: [Errno 111] ECONNREFUSED
+++++++++++++++++++++++++++++++
configuration the file proxy-server.conf
[DEFAULT]
bind_port = 8080
user = root
log_facility = LOG_LOCAL1

[pipeline:main]
pipeline = healthcheck cache tempauth proxy-server

[app:proxy-server]
use = egg:swift#proxy
allow_account_management = true

[filter:tempauth]
use = egg:swift#tempauth
user_admin_admin = admin .admin .reseller_admin
user_test_tester = testing .admin
user_test2_tester2 = testing2 .admin
user_test_tester3 = testing3

[filter:healthcheck]
use = egg:swift#healthcheck

[filter:cache]
use = egg:swift#memcache
+++++++++++++++++++++++++++++++
root@dtv-110702:/var/log/swift# swift -A http://192.168.3.20:8080/auth/v1.0 -U test:tester -K testing stat
Account HEAD failed: http://127.0.0.1:8080/v1/AUTH_test 401 Unauthorized
root@dtv-110702:/var/log/swift#

++++++++++++++++++++++++++++++
can you help me please

Question information

Language:
Chinese (Simplified) Edit question
Status:
Answered
For:
OpenStack Object Storage (swift) Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
moubariksiham (moubarik-siham) said :
#1

any idea's .?

Revision history for this message
Joe Arnold (joe-arnold) said :
#2

At first glance, I would try adding a '/' to the end of the URL used in the request.

root@dtv-110702:/var/log/swift# curl -v -H 'X-Auth-Token: AUTH_tk4944cfe283c748d9996b756b1a85cf1f' http://192.168.3.20:8080/v1/AUTH_test/

-Joe

Revision history for this message
Joe Arnold (joe-arnold) said :
#3

Also, tempauth needs memcache running. Try seeing if the token made it into memcache by taking a look at it’s entry in memcache

for example...
$ python
>>> import swift.common.memcached as memcached
>>> memcache = memcached.MemcacheRing(['127.0.0.1:11211'])
>>> print memcache.get('AUTH_/user/myaccount:me')
AUTH_tk58ad6d3ca1754ca78405828d72e37458
>>> print memcache.get('AUTH_/token/AUTH_tk58ad6d3ca1754ca78405828d72e37458')
(1308804765.9103661, 'myaccount,myaccount:me')

Does that work?

Revision history for this message
moubariksiham (moubarik-siham) said :
#4

thank you for your answer, I added proxy url-server.conf and it gave me these results later
but when I type URL in the browser it displays :
401 Unauthorized
This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.

root@dtv-110702:# swift -A http://192.168.3.20:8080/auth/v1.0 -U test:tester -K testing stat
   Account: AUTH_test
Containers: 0
   Objects: 0
     Bytes: 0
Accept-Ranges: bytes

Revision history for this message
Joe Arnold (joe-arnold) said :
#5

What you'll need to do is set an ACL on the container (or, coming soon, the object) to define how the container can be accessed without passing along your token in the http request.

-Joe

Revision history for this message
moubariksiham (moubarik-siham) said :
#6

tks Joe, I am beginner in OpenStack. can you tell me how I do it?

Revision history for this message
moubariksiham (moubarik-siham) said :
#7

i still have the same problem's, and i don't know how to set an ACL on the container.please i don't have much time
tks you

Revision history for this message
sunhee Park (sunny790821) said :
#8

You had better add "memcache_servers = 192.168.20.80:11211" in [filter:cache] of your proxy-server.conf file.

Revision history for this message
tudor lapusan (tlapusan) said :
#9

Hi,
I had this problem also and I succeeded to fix it.
I executed the command "ps -Af | grep memcached" and I saw the output with "/usr/bin/memcached -m 64 -p 11211 -u memcache -l my.ip.address" instead of "/usr/bin/memcached -m 64 -p 11211 -u memcache -l 127.0.0.1".

I changed the proxy-server.conf file for filter:cache:
[filter:cache]
use = egg:swift#memcache
memcache_servers = my.ip.address:11211

After that the command "curl -v -H 'X-Auth-Token: <token-from-x-auth-token-above>' <url-from-x-storage-url-above>" executed without any error message.

Can you help with this problem?

Provide an answer of your own, or ask moubariksiham for more information if necessary.

To post a message you must log in.