Last time I presented a Swift REST API example. Now I’ll explain the Openstack Swift Test Authentication and Authorization System (tempauth). This is an excellent authentication module for Swift All In One (SAIO) and for development work.
Add Tempauth to Openstack Swift Proxy Server
The first thing that you will need to do is to add tempauth to the Proxy Server configuration. So make sure that the following is in proxy-server.conf:
pipeline = catch_errors cache tempauth proxy-server
account_autocreate = true
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
The configuration lines under the [filter:tempauth] section that begin with “user_”, define a users login, password, and privileges. These lines are of the form: user_<login1>_<login2> = <password> <privileges>
Four Users, Four Permissions
This configuration enables tempauth and creates the following four users, each with different permissions.
1) login = admin:admin
password = admin
privileges = .admin, .reseller_admin
2) login = test:tester
password = testing
privileges = .admin
3) login = test2:tester2
password = testing2
privileges = .admin
4) login = test:tester3
password = testing3
privileges = None
Openstack Swift Privileges
So what do the privileges mean?
Admin users can do anything within their account.
Reseller Admin users can do anything to any account.
Non-Admin users can only perform operations per container based on the container’s X-Container-Read and
To allow a “user” to read the objects in container, then set the container header “X-Container-Read: .r:user”.
To allow a “user” to list the contents of a container, then set the container header “X-Container-Read: .rlistings”.
To allow a “user” to read and list the objects in container, then set the container header
“X-Container-Read: .r:user, .rlistings”.
To allow anyone to write to a container, then set the container header “X-Container-Write: .r:*”.
For complete ACL details, check out Openstack Swift dev documentation.
When a Non-Admin user is created, then the only way to create X-Container-Read and X-Container-Write headers is via a Reseller Admin user. Or, do you have another solution?