Can the user in swift certified by swauth be seen by S3?

Asked by Qi Weining

I installed swift and swauth in four DELL servers.

(1) proxy and swauth. IP:210.*.*.*,192.168.1.2.
(2)storage node,IP:192.168.1.3.
(3)storage node,IP:192.168.1.4.
(4)storage node,IP:192.168.1.5.

I use swauth add users in swift, and upload containers and objects.
I want to use a S3 client access the containers and objects.
How can I do that?

Thanks a lot.

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Object Storage (swift) Edit question
Assignee:
No assignee Edit question
Solved by:
Qi Weining
Solved:
Last query:
Last reply:
Revision history for this message
Kun Huang (academicgareth) said :
#1

If you have to use S3 client, you need your swift response S3-style-api for your swift servers. Currently, for swift, there is a middleware to implement the S3-style-api: https://github.com/fujita/swift3

It's not difficult and you could clone the source codes and have a run

Revision history for this message
Qi Weining (qi-weining) said :
#2

Thank you, Kun Huang.

I have installed swift3 and it run. The auth in my swift is swauth.

I have changed the proxy_server.conf.

The cyberduck can be used to access my swift.

However, I can not use s3curl asscessed my swift with s3.

I need a client to let my mates apply for new account and changed their password.

Any one know such a S3 client?

Revision history for this message
Kun Huang (academicgareth) said :
#3

I have used boto(https://github.com/boto/boto) to test s3 api for swift.

But which api did you use in cyberduck for swift, s3-style or swift-style?

Revision history for this message
Qi Weining (qi-weining) said :
#4

I use the conf file from "•​Download the Openstack Swift (Swauth HTTP) profile for preconfigured settings. "

If I have used a swift-style, Does it mean that I need another test?

I have installed boto. But I can not connect to my swift.

Can you give me some advice about boto. Or can you give me the python examples?

Revision history for this message
Kun Huang (academicgareth) said :
#5

1st, you should install swift3 middleware to enable s3-style api
2nd, setup boto connection and try boto's libraries, like this:

import boto
from boto.s3.connection import S3Connection
conn= S3Connection(
    aws_access_key_id='system:root',
    aws_secret_access_key='testpass',
    port=8080,
    host='127.0.0.1',
    is_secure=False,
    calling_format=boto.s3.connection.OrdinaryCallingFormat())

Revision history for this message
Qi Weining (qi-weining) said :
#6

Thanks, Kun huang. Your advices help me.
There is another problem.
Boto conncetion is OK. But when I want to create a bucket, 403 forbidden.

>>> conn.create_bucket('testforq')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "boto/s3/connection.py", line 441, in create_bucket
    response.status, response.reason, body)
boto.exception.S3ResponseError: S3ResponseError: 403 Forbidden
<?xml version="1.0" encoding="UTF-8"?>
<Error>
  <Code>AccessDenied</Code>
  <Message>Access denied</Message>
</Error>

Revision history for this message
Kun Huang (academicgareth) said :
#7

What is your aws_access_key_id and its key?
And what content have you used in swauth section in config file

Revision history for this message
Qi Weining (qi-weining) said :
#8

aws_access_key_id:test1:tester1
key:testing

>>> conn.access_key
'test1:tester1'
>>> conn.aws_access_key_id
'test1:tester1'
>>> conn.aws_secret_access_key
'testing'

my config file

[DEFAULT]
bind_port = 8080
user = swift
log_facility = LOG_LOCAL0

[pipeline:main]
pipeline = healthcheck cache swift3 swauth proxy-server

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

[filter:swauth]
use = egg:swauth#swauth
# Highly recommended to change this.
super_admin_key = swauthkey
default_swift_cluster = local#http://210.*.*.*:8080/v1#http://192.168.1.2:8080/v1

[filter:swift3]
use = egg:swift3#swift3

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

[filter:cache]
use = egg:swift#memcache
memcache_servers = 192.168.1.2:11211

Revision history for this message
Kun Huang (academicgareth) said :
#9

I found you didn't use test or testing in your swauth section. You could have a try "admin:key" and "swauthkey"

Revision history for this message
Qi Weining (qi-weining) said :
#10

I have used these for adding users. And upload containers and objs.

I just want to test the S3 in swift.

swift and swauth are both OK.

swauth-add-user -A http://127.0.0.1:8080/auth/ -K swauthkey -a test tester testing

swauth-add-user -A http://127.0.0.1:8080/auth/ -K swauthkey -a test1 teste1 testing

swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing upload

Revision history for this message
Qi Weining (qi-weining) said :
#11

Thanks, Kun huang. You are so warm-hearted to give me many good avdices.

I do not add any thing in proxy-server.conf.

I restart the proxy server. And I can upload objects, create containers. I do not know why.