Ask Your Question
0

401 Unauthorized

asked 2011-08-08 11:07:16 -0500

moubarik-siham gravatar image

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>

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.

</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 ... (more)

edit retag flag offensive close merge delete

9 answers

Sort by » oldest newest most voted
0

answered 2011-08-09 06:05:34 -0500

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

edit flag offensive delete link more
0

answered 2011-08-10 09:04:54 -0500

moubarik-siham gravatar image

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

edit flag offensive delete link more
0

answered 2011-08-16 08:49:15 -0500

moubarik-siham gravatar image

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

edit flag offensive delete link more
0

answered 2011-08-09 00:51:11 -0500

moubarik-siham gravatar image

any idea's .?

edit flag offensive delete link more
0

answered 2012-03-15 06:51:12 -0500

sunny790821 gravatar image

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

edit flag offensive delete link more
0

answered 2011-08-09 06:10:28 -0500

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?

edit flag offensive delete link more
0

answered 2011-08-09 10:37:38 -0500

moubarik-siham gravatar image

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

edit flag offensive delete link more
0

answered 2011-08-10 06:09:45 -0500

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

edit flag offensive delete link more
0

answered 2012-10-26 12:04:02 -0500

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower

Stats

Asked: 2011-08-08 11:07:16 -0500

Seen: 1,276 times

Last updated: Oct 26 '12