Bug 1620734

Summary: [rgw] Not able to create s3 bucket with s3website enabled
Product: [Red Hat Storage] Red Hat Ceph Storage Reporter: Persona non grata <nobody+410372>
Component: RGWAssignee: Matt Benjamin (redhat) <mbenjamin>
Status: CLOSED WORKSFORME QA Contact: Persona non grata <nobody+410372>
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.1CC: anharris, cbodley, ceph-eng-bugs, hnallurv, kbader, mbenjamin, owasserm, sweil
Target Milestone: z1Keywords: Regression
Target Release: 3.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-08-30 09:43:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
rgw log none

Description Persona non grata 2018-08-23 10:53:56 UTC
Created attachment 1478132 [details]
rgw log

Description of problem:
Not able to create s3 bucket with s3website enabled 

ceph.conf:
[client.rgw.magna064]
host = magna064
keyring = /var/lib/ceph/radosgw/ceph-rgw.magna064/keyring
log file = /var/log/ceph/ceph-rgw-magna064.log
rgw frontends = civetweb port=10.8.128.64:8080 num_threads=100
rgw_enable_static_website = true
rgw_enable_apis = s3, swift, s3website
rgw dns s3website name = website.magna064.ceph.redhat.com
rgw_dns_name = magna064.ceph.redhat.com
rgw_resolve_cname = true
debug_rgw = 20

----------------------
/etc/hosts
10.8.128.64 magna064.ceph.redhat.com magna064
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
10.8.128.64 website.magna064.ceph.redhat.com
----------------------
=====================
boto script with aws2:
---
access_key = 'JA681ZXDB6HPKD9FEH3X'
secret_key = 'PUw1vVjuDKZgkMcYGJ8ziNvVuhEaVmf8TuewKTix'
#boto.config.add_section('s3')
#boto.config.set('s3', 'use-sigv4', 'True')

conn = boto.connect_s3(
    aws_access_key_id=access_key,
    aws_secret_access_key=secret_key,
    host='magna064',
    port=8080,
    is_secure=False,  # uncomment if you are not using ssl

    calling_format=boto.s3.connection.OrdinaryCallingFormat(),
)
#conn.auth_region_name = 'default'


website_bucket = conn.create_bucket("website")
----
[root@magna064 ~]# python s3website.py 
Traceback (most recent call last):
  File "s3website.py", line 22, in <module>
    website_bucket = conn.create_bucket("website")
  File "/usr/lib/python2.7/site-packages/boto/s3/connection.py", line 628, in create_bucket
    response.status, response.reason, body)
boto.exception.S3ResponseError: S3ResponseError: 403 Forbidden
<?xml version="1.0" encoding="UTF-8"?><Error><Code>SignatureDoesNotMatch</Code><RequestId>tx000000000000000000002-005b7e7f64-1087-default</RequestId><HostId>1087-default-default</HostId></Error>
==========================
boto script with aws4:
---
access_key = 'JA681ZXDB6HPKD9FEH3X'
secret_key = 'PUw1vVjuDKZgkMcYGJ8ziNvVuhEaVmf8TuewKTix'
boto.config.add_section('s3')
boto.config.set('s3', 'use-sigv4', 'True')

conn = boto.connect_s3(
    aws_access_key_id=access_key,
    aws_secret_access_key=secret_key,
    host='magna064',
    port=8080,
    is_secure=False,  # uncomment if you are not using ssl

    calling_format=boto.s3.connection.OrdinaryCallingFormat(),
)
conn.auth_region_name = 'default'


website_bucket = conn.create_bucket("website")
---

[root@magna064 ~]# python s3website.py 
Traceback (most recent call last):
  File "s3website.py", line 22, in <module>
    website_bucket = conn.create_bucket("website")
  File "/usr/lib/python2.7/site-packages/boto/s3/connection.py", line 628, in create_bucket
    response.status, response.reason, body)
boto.exception.S3ResponseError: S3ResponseError: 404 Not Found
<?xml version="1.0" encoding="UTF-8"?><Error><Code>NoSuchBucket</Code><BucketName>magna064</BucketName><RequestId>tx000000000000000000001-005b7e7f3a-1087-default</RequestId><HostId>1087-default-default</HostId></Error>
===============================

Version-Release number of selected component (if applicable):

ceph-ansible-3.1.0-0.1.rc21.el7cp.noarch

ceph version 12.2.5-39.el7cp (f12d44e46a54948a86dd27b16c77d97475ba2d4e) luminous (stable)

How reproducible:
Always

Steps to Reproduce:
1.Setup a ceph cluster with rgw. Add 
rgw_enable_static_website = true
rgw_enable_apis = s3, swift, s3website
rgw dns s3website name = s3website.magna064.ceph.redhat.com
rgw_dns_name = magna064.ceph.redhat.com
rgw_resolve_cname = true in ceph.conf, restart the rgw service
Make entries in /etc/hosts:
10.8.128.64 website.magna064.ceph.redhat.com

2. Create rgw user, try to create bucket with s3website using boto2


Actual results:

Not able to create the bucket 
----
boto.exception.S3ResponseError: S3ResponseError: 404 Not Found
<?xml version="1.0" encoding="UTF-8"?><Error><Code>NoSuchBucket</Code><BucketName>magna064</BucketName><RequestId>tx000000000000000000001-005b7e7f3a-1087-default</RequestId><HostId>1087-default-default</HostId></Error>
----
Expected results:

Bucket should get created

Additional info:

Comment 12 Persona non grata 2018-08-30 09:43:48 UTC
Using doc https://access.redhat.com/documentation/en-us/red_hat_ceph_storage/3/html-single/object_gateway_guide_for_red_hat_enterprise_linux/#setting_up_the_gateway, was causing the problem which is mentioned in comments 14,15.
'rgw_enable_apis = s3website' was causing the problem, where RGW with s3website enabled , was not able to create the bucket because 's3' api was enabled.

'rgw_enable_apis = s3,s3website' --> is the solution for this problem of not able to create s3webiste bucket. Doc needs to be corrected

Comment 13 Persona non grata 2018-08-30 09:44:41 UTC
Using doc https://access.redhat.com/documentation/en-us/red_hat_ceph_storage/3/html-single/object_gateway_guide_for_red_hat_enterprise_linux/#setting_up_the_gateway, was causing the problem which is mentioned in comments 14,15 of bz https://bugzilla.redhat.com/show_bug.cgi?id=1505400
'rgw_enable_apis = s3website' was causing the problem, where RGW with s3website enabled , was not able to create the bucket because 's3' api was enabled.

'rgw_enable_apis = s3,s3website' --> is the solution for this problem of not able to create s3webiste bucket. Doc needs to be corrected