Search code examples
cloudopenstackopenstack-swiftobject-storageovh

How to disable object lists in Openstack Swift container


We are using Openstack Object Storage (SWIFT) to store large files
When we using browser navigate to a container, it listed all objects belong in.
The document locate at: https://developer.openstack.org/api-ref/object-storage/?expanded=#show-container-details-and-list-objects
We don't want customer can browser this list file by security How can we disable it ?


Solution

  • Probably your container has the header "X-Container-Read" with this values:

    .r:*,.rlistings

    Where:
    .r:* => public reading
    .rlistings => public listing

    You should remove the public listing conf, upadating the header "X-Container-Read".

    Using curl, it would be something like this:

    curl -X POST -H 'X-Auth-Token: <token-id>'  -H 'X-Container-Read: .r:*' <AdminURL>/<container>
    

    Using python-swiftclient, this syntax should work:

    swift post --read-acl .r:* container
    

    Btw, just remember to set you environment variables or inform your credential on the command line to the correct use of python-swiftclient.

    PS: it won't remove the reading permission, just the listing permission.