Openstack Swift with SSL(https)

Following are the steps to enable ssl for Openstack swift Proxy for secure data transfer between Openstack Swift Proxy server and the swift client.

Prerequisite :
– Set of ssl certificate (CA signed or Locally generated)
– Up and Running Openstack Keystone and Swift.

WARNING: SSL should only be enabled for testing purposes. Use external SSL termination for a production deployment. 

1. Copy the the ssl certificates under /etc/swift directory on all protocol nodes. Make sure CN in certificate is matching the swift endpoint hostname. In our case it is Node3

2. Swift user must have read permission on certificate files on all protocol nodes
[root@Node3]# ls -al /etc/swift/ssl_*
-rw——-. 1 swift swift 2864 Dec 8 23:56 /etc/swift/ssl_cert.pem
-rw——-. 1 swift swift 887 Dec 8 23:56 /etc/swift/ssl_key.pem

3 Update ssl certificate details in proxy-server.conf
[root@Node3]#mmobj config change –ccrfile proxy-server.conf –section DEFAULT –property key_file –value /etc/swift/ssl_key.pem

[root@Node3]#mmobj config change –ccrfile proxy-server.conf –section DEFAULT –property cert_file –value /etc/swift/ssl_cert.pem

4. Update swift endpoint with https
#content of ~/openrc

[root@Node3 ~]# cat openrc
export OS_AUTH_URL=”http://Node3:35357/v3
export OS_IDENTITY_API_VERSION=3
export OS_AUTH_VERSION=3
export OS_USERNAME=”admin”
export OS_PASSWORD=”passw0rd”
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_NAME=admin
export OS_PROJECT_DOMAIN_NAME=Default

[root@Node3 ~] source ~/openrc

Existing swift endpoints look like
[root@Node3 swift]# openstack endpoint list
+———————————-+———–+————–+————–+———+———–
| ID | Region | Service Name | Service Type | Enabled | Interface | URL |
+———————————-+———–+————–+————–+———+———– |
| 93fa11d1fa7b4622abc857f964676e68 | RegionOne | swift | object-store | True | public | http://Node3:8080/v1/AUTH_%(tenant_id)s |
| 9f271a9d2b14471c8bbad7edca8c4a18 | RegionOne | swift | object-store | True | internal | http://Node3:8080/v1/AUTH_%(tenant_id)s |
| d70496da0a884381a818623ca5b7c501 | RegionOne | swift | object-store | True | admin | http://Node3:8080 |

Change the swift endpoint to https [change the endpoint ID as per your environment]
openstack endpoint set –url ‘https://Node3:8080/v1/AUTH_%(tenant_id)s‘ 93fa11d1fa7b4622abc857f964676e68
openstack endpoint set –url ‘https://Node3:8080/v1/AUTH_%(tenant_id)s‘ 9f271a9d2b14471c8bbad7edca8c4a18
openstack endpoint set –url ‘https://Node3:8080‘ d70496da0a884381a818623ca5b7c501

Updated swift endpoint look like
[root@Node3 swift]# openstack endpoint list
+———————————-+———–+————–+————–+———+———–
| ID | Region | Service Name | Service Type | Enabled | Interface | URL |
+———————————-+———–+————–+————–+———+———–
| 93fa11d1fa7b4622abc857f964676e68 | RegionOne | swift | object-store | True | public | https://Node3:8080/v1/AUTH_%(tenant_id)s |
| 9f271a9d2b14471c8bbad7edca8c4a18 | RegionOne | swift | object-store | True | internal | https://Node3:8080/v1/AUTH_%(tenant_id)s |
| d70496da0a884381a818623ca5b7c501 | RegionOne | swift | object-store | True | admin | https://Node3:8080 |

5. Sample swift client command
[root@Node3]# swift –os-cacert ssl_cacert.pem stat
Account: AUTH_afcc267ea2c842e59082162118d5047e
Containers: 0
Objects: 0
Bytes: 0
X-Put-Timestamp: 1449638753.75244
X-Timestamp: 1449638753.75244
X-Trans-Id: txe9e7ceb7a31c48e193495-005667bb61
Content-Type: text/plain; charset=utf-8

“These are my personal views and do not necessarily reflect that of my employer”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s