Monday, September 21, 2015

How to generate tempurl for Swift object in Openstack.

tempurl is a good feature when you are using object storage, since you can generate a link and share your object to the people quick. They can download your object (file) directly from the link without credentail within the expiration time.

However, I was struggling for tempurl for pass days. Because during the days, I was dispirited and can't find too much logical info. People said about tempurl is more complicated than what's I thought and didn't explain the basic logic but just the cli (command lines).


Other than that, the some reference links includes the unit test cli but didn't give an overall summary. Here, I will explain the how curl and swift-client works to operate the tempurl and give a unit test example.


In sum, I really want give a quick intro about the basic logic, and after you aware of it, the cli for you will be logical as nature. Here are the items I would like to talk.

  1. tempurl basic logic with python example
  2. tempurl Lab Setup 
    1. Server: Swift AIO setup
    2. Client: curl / swift-client setup
  3. tempurl configuration.
  4. tempurl unit test
  5. swift over swift vs swift over ceph.
    1. swift on ceph won't work regarding the limitation

1. tempurl basic logic with python example

For generate the tempurl from OpenStack Swift, the basic idea is you have a ID ( key ) with your account then you know where is your object your would like to share with other people. After that you hash the key and a expiration date/time with the link ( url ). That's it !
  1. Key
  2. Path
  3. Expiration Date/Time

python example

The python example as below explain all the logics.












The info you need to assign.
  1. method: eg: GET
  2. host: if you test in your POC SAIO VM, you can give "http://127.0.0.1:8080"
  3. expiration: give the seconds for temp url expired.
  4. path: the path for your object, eg: '/v1/AUTH_test/testCon/test.txt'
  5. key: the key you would like to have or assign, eg: 'secret'
  6. sig: generate signature for combining 1, 2, 3 and 4
  7. tempurl: combine with hostname, object directory and temp_url_sign
--------python code start--------
'''
Created on Sep 21, 2015

@author: johnnywang
'''

import hmac
from hashlib import sha1
from time import time

#1
method = 'GET'

#2
host = "http://127.0.0.1:8080"

#3
duration_in_seconds = 6000  # Duration for which the url is valid
expires = int(time() + duration_in_seconds)

#4
path = '/v1/AUTH_test/testCon/test.txt'

#5
key = 'secret'

hmac_body = '%s\n%s\n%s' % (method, expires, path)
hmac_body = hmac.new(key, hmac_body, sha1).hexdigest()

#6
sig = hmac.new(key, hmac_body, sha1).hexdigest()

#7
rest_uri = "{host}{path}?temp_url_sig={sig}&temp_url_expires={expires}".format(
            host=host, path=path, sig=sig, expires=expires)
print rest_uri

--------python code end--------


output:

http://127.0.0.1:8080/v1/AUTH_test/testCon/test.txt?temp_url_sig=efbd2cad15e098d2327b8c7109886882f4a7afec&temp_url_expires=1442870614

2. tempurl Lab setup ( Swift over Swift )

SAIO setup - Server

SAIO is swift all in one lab, you can follow the links as below I present before, setup a POC lab for verify tempurl quick. It's quick and easy.
PS: you can configure port forwarding then you can ssh to your virtualbox SAIO vm.


There has two major client tools which can operate the swift, there are curl and swift-client.


curl setup - Client

in ubuntu

#sudo apt-get install curl libcurl3 libcurl3-dev


in mac

#brew install curl


swift-client - Client

in ubuntu

#sudo aptitude install python-pip
#sudo pip install python-swiftclient


in mac

#sudo easy_install pip
#sudo pip install --upgrade setuptools
#sudo pip install python-swiftclient

http://thornelabs.net/2014/10/29/installing-python-swiftclient-on-os-x-yosemite.html 

3. tempurl configuration

The key for make tempurl works is inject a key or second key in account level metadata. You can use curl or swift-client. Both should be all working well.


Get token and endpoint url via Swift-client


  • Get Auth-token or you username and password directly
swift@swift-VirtualBox:~$ swift -A http://127.0.0.1:8080/auth/v1.0 -U swift -K swift auth
export OS_STORAGE_URL=http://127.0.0.1:8080/v1/AUTH_swift
export OS_AUTH_TOKEN=AUTH_tk5050d2a92c43422e871d60cffa309022

swift@swift-VirtualBox:~$ swift -A http://127.0.0.1:8080/auth/v1.0 -U swift -K swift auth -v

export ST_AUTH=http://127.0.0.1:8080/auth/v1.0
export ST_USER=swift
export ST_KEY=swift

  • Once you get the endpoint and token you can insert a key into account's metadata (X-Account-Meta-Temp-Url-Key: secret)
  • Or you can access swift via username and password directly.
swift@swift-VirtualBox:~$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing stat
                    Account: AUTH_test
                 Containers: 2
                    Objects: 0
                      Bytes: 0
Containers in policy "gold": 2
   Objects in policy "gold": 0
     Bytes in policy "gold": 0
          Meta Temp-Url-Key: secret
                X-Timestamp: 1439949170.11303
                 X-Trans-Id: tx81e1acbb06f544af90429-0055d5654d
               Content-Type: text/plain; charset=utf-8

              Accept-Ranges: bytes


Inject tempurl key



using swift-client

post "Temp-Url-Key"
swift@swift-VirtualBox:~$ swift --os-auth-token AUTH_tk29ec321ad87b43d0bfd8a7b687ab4a2f --os-storage-url http://127.0.0.1:8080/v1/AUTH_test post -m "Temp-URL-Key: secret"

Double check

using curl with token
swift@swift-VirtualBox:~$ curl -v -H 'X-Auth-Token: AUTH_tk71106acb07784da1859cd2e434eba109' http://127.0.0.1:8080/v1/AUTH_test/
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8080 (#0)
> GET /v1/AUTH_test/ HTTP/1.1
> User-Agent: curl/7.35.0
> Host: 127.0.0.1:8080
> Accept: */*
> X-Auth-Token: AUTH_tk71106acb07784da1859cd2e434eba109
< HTTP/1.1 200 OK
< X-Account-Storage-Policy-Gold-Bytes-Used: 0
< Content-Length: 19
< X-Account-Storage-Policy-Gold-Object-Count: 0
< X-Account-Object-Count: 0
< X-Timestamp: 1439949170.11303
X-Account-Meta-Temp-Url-Key: secret
< X-Account-Storage-Policy-Gold-Container-Count: 2
< X-Account-Bytes-Used: 0
< X-Account-Container-Count: 2
< Content-Type: text/plain; charset=utf-8
< Accept-Ranges: bytes
< X-Trans-Id: tx1d08eb3202cb44a49bc6e-0055d409fd
< Date: Wed, 19 Aug 2015 04:45:49 GMT
testCon
testFolder
* Connection #0 to host 127.0.0.1 left intact

swift@swift-VirtualBox:~$ 

via token
swift@swift-VirtualBox:~$ swift --os-auth-token AUTH_tk29ec321ad87b43d0bfd8a7b687ab4a2f --os-storage-url http://127.0.0.1:8080/v1/AUTH_test stat
                    Account: AUTH_test
                 Containers: 2
                    Objects: 0
                      Bytes: 0
Containers in policy "gold": 2
   Objects in policy "gold": 0
     Bytes in policy "gold": 0
          Meta Temp-Url-Key: secret
                X-Timestamp: 1439949170.11303
                 X-Trans-Id: tx2a025cd404df4b8c9c8c4-0055d55f12
               Content-Type: text/plain; charset=utf-8
              Accept-Ranges: bytes

via username/password
swift@swift-VirtualBox:~$ swift -A http://127.0.0.1:8080/auth/v1.0 -U test:tester -K testing stat
                    Account: AUTH_test
                 Containers: 2
                    Objects: 0
                      Bytes: 0
Containers in policy "gold": 2
   Objects in policy "gold": 0
     Bytes in policy "gold": 0
          Meta Temp-Url-Key: secret
                X-Timestamp: 1439949170.11303
                 X-Trans-Id: tx81e1acbb06f544af90429-0055d5654d
               Content-Type: text/plain; charset=utf-8

              Accept-Ranges: bytes

As long as you can see the key in account level metadata, you can use the python script in above to put the path for the object and generate the tempurl.


PS: above is V1 authentication, here is V2 example if your keystone server is running V2 authentication.


swift@swift-VirtualBox:~$ swift -V 2.0 -A http://127.0.0.1:8080/auth/v2.0 -U swift -K swift post -m Temp-URL-Key:secret

swift@swift-VirtualBox:~$ swift -V 2.0 -A http://127.0.0.1:8080/auth/v2.0 -U swift -K swift stat -v

4. tempurl unit test

Here is the example you can use tempcurl to download the file, or you can copy the whole tempurl hyper-link and put on any browser to get the file.

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    15  100    15    0     0    450      0 --:--:-- --:--:-- --:--:--   483

swift@swift-VirtualBox:~$ cat download.txt 
This is a TEST

PS: since download link with hash, you might want to use curl -L to trust the hash as a part of url, and -O is output into what's the name you would like to have for the object content.

5. tempurl for Swift over Ceph 

Except the swift over swift, you can run swift over ceph which means leverage radosgateway for accessing your object in ceph. For POC, you can setup a Ceph lab follow these links.
tempurl available in RGW (http://ceph.com/docs/master/radosgw/swift/tempurl). unfortunately, it's not working in my lap or the environment I aware. 

This is what’s I realized. For temp url, we need to inject a temp-url-key in account metadata, but in Swift over ceph (http://ceph.com/docs/master/radosgw/swift/) API, it doesn’t seem to allow us to change it but only read it.  Without temp-url-key in account metadata, the tempurl will never work. 

Feature
Status
Remarks
Authentication
Supported

Get Account Metadata
Supported
No custom metadata
Swift ACLs
Supported
Supports a subset of Swift ACLs
List Containers
Supported

Delete Container
Supported

Create Container
Supported

Get Container Metadata
Supported

Update Container Metadata
Supported

Delete Container Metadata
Supported

List Objects
Supported

Static Website
Not Supported

Create Object
Supported

Create Large Object
Supported

Delete Object
Supported

Get Object
Supported

Copy Object
Supported

Get Object Metadata
Supported

Update Object Metadata
Supported

Expiring Objects
Not Supported

Object Versioning
Not Supported

CORS
Not Supported


So if you know above statement is wrong or you figure the way out, please share with me.

Reference:

Thursday, September 3, 2015

How to use HAProxy as Load Balancer in RHEL

In general, the load balance is highly required for the cloud environment, since all the requests should go through the proper resource allocator. And the balancer should be able to scale out via adding more resource to support heavier loading in the coming future.

Recently, I have played around the open-source HAProxy as load balancer for my Openstack Swift Proxy nodes. I found couple useful links in reference but none of them collect what's exactly I need which is setup HAProxy in REHL and combine rsyslogd properly. 

In this post, I will list the steps how you setup/configure HAProxy , Rsyslogd and Unit Test the whole load balance feature. Here is the highlight for whole process.


  1. Setup/Configure HAProxy
  2. Start/Enable HAProxy
  3. Add HAPRoxy log Configure in Rsyslog
  4. Restart Rsyslog
  5. Unit Test for load balance feature.

Before we start, here is the assumption, you have one server as HAProxy and three servers which needs to be balanced the loading via round robin strategy. The servers list can be as blow.

  • HAProxy: 10.0.0.1
  • Server-001: 10.0.0.2
  • Server-002: 10.0.0.3
  • Server-003: 10.0.0.4
  • Swift Cluster: swift

1. Setup/Configure HAPRoxy

Install haproxy for redhat
#yum install haproxy

eg:
[root@xxx-001 ~]# yum install haproxy
Loaded plugins: product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
ccs-secure-repo                                                                                                                            | 2.9 kB  00:00:00     
ice-1.2.2-ceph                                                                                                                             | 2.9 kB  00:00:00     
ice-1.2.2-ceph-deploy                                                                                                                      | 2.9 kB  00:00:00     
mongodb                                                                                                                                    | 2.9 kB  00:00:00     
osp5-hotfix                                                                                                                                | 2.9 kB  00:00:00     
percona-centos6                                                                                                                            | 2.9 kB  00:00:00     
rhel-7-server-ansible-rpms                                                                                                                 | 2.9 kB  00:00:00     
rhel-7-server-cisco-rpms                                                                                                                   | 2.9 kB  00:00:00     
rhel-7-server-extras-rpms                                                                                                                  | 2.9 kB  00:00:00     
rhel-7-server-hybrid-rpms                                                                                                                  | 2.9 kB  00:00:00     
rhel-7-server-openstack-5.0-rpms                                                                                                           | 2.9 kB  00:00:00     
rhel-7-server-optional-rpms                                                                                                                | 2.9 kB  00:00:00     
rhel-7-server-rabbitmq-rpms                                                                                                                | 2.9 kB  00:00:00     
rhel-7-server-rhn-tools-rpms                                                                                                               | 2.9 kB  00:00:00     
rhel-7-server-rpms                                                                                                                         | 2.9 kB  00:00:00     
rhel-7-server-supplementary-rpms                                                                                                           | 2.9 kB  00:00:00     
svl-pod-3                                                                                                                                  | 2.9 kB  00:00:00     
(1/2): ccs-secure-repo/primary_db                                                                                                          | 1.0 MB  00:00:00     
(2/2): svl-pod-3/primary_db                                                                                                                | 7.2 MB  00:00:00     
Package haproxy-1.5.4-2.el7.x86_64 already installed and latest version
Nothing to do

Edit haproxy configuration file.
#vi /etc/haproxy/haproxy.cfg

eg:
#cat /etc/haproxy/haproxy.cfg
global
#    local2.*                       /var/log/haproxy.log
log 127.0.0.1 local2
maxconn 4096
user haproxy
group haproxy
daemon

defaults
        log     global
        mode    http
        option  httplog
        option  dontlognull
        retries 3
        option  redispatch
        maxconn 2000
    timeout queue           1m
    timeout connect         10s
    timeout client          10m
    timeout server          10m


listen swift 10.0.0.1:80
        mode    http
        stats   enable
        stats   auth username:password
        balance roundrobin
        option  httpchk HEAD /healthcheck HTTP/1.0
        option  forwardfor
        option  httpclose
        server  server-001 10.0.0.2:80 weight 5 check inter 2000
        server  server-002 10.0.0.3:80 weight 5 check inter 2000
        server  server-003 10.0.0.4:80 weight 5 check inter 2000


2. Start/Enable HAProxy

[root@xxx-001 haproxy]# systemctl start haproxy.service
[root@xxx-001 haproxy]# systemctl enable haproxy.service
ln -s '/usr/lib/systemd/system/haproxy.service' '/etc/systemd/system/multi-user.target.wants/haproxy.service'
[root@xxx-001 haproxy]# systemctl status haproxy.service

PS: In REHL, start is start the daemon and enable can make sure after server reboot the daemon will be stared automatically.

3. Add HAPRoxy log Configure in rsyslog.conf

#vi /etc/rsyslog.conf 


Remove comment: find the line as below and remove the '#' before '$'.The final result should looks like as below.

# Provides UDP syslog reception
$ModLoad imudp
$UDPServerRun 514

# Provides TCP syslog reception
$ModLoad imtcp
$InputTCPServerRun 514

Add this line
local2.*                                                /var/log/haproxy.log

PS: you can run #yum install rsyslog to install rsyslog if you don't have in RHEL, but in my RHEL 7/7.1. The rsyslog is default.


4. Restart Rsyslog 

Restart the rsyslog service
#systemctl restart rsyslog.service


Check rsyslogd status
#systemctl status rsyslog.service

5. Unit Test

Unit test for loadbalance via checking the log, 
eg: just refresh the web portal
or 
You can use the swift command to get the account status for triggering the request against the Load Balancer.
#swift -A http://HAProxy/auth/v1.0 -U swift -K swift stat
                                Account: AUTH_swift
                             Containers: 4
                                Objects: 5
                                  Bytes: 868960818
Containers in policy "standard-replica": 4
   Objects in policy "standard-replica": 5
     Bytes in policy "standard-replica": 868960818
                      Meta Temp-Url-Key: d4cfaa78-034d-42ac-a197-9f9d431f7e60
                          Accept-Ranges: bytes
                             Connection: close
                            X-Timestamp: 1440183945.29423
                             X-Trans-Id: tx8733adb891334aedb929f-0055e9340f

                           Content-Type: text/plain; charset=utf-8
#tail -f /var/log/haproxy.log

If you have any issue, you might try to check message directlry, then troubleshooting from there.
#tail -f /var/log/message

Both log's content, you can see the it most like follow round robin strategy.
PS: both network log in message and haproxy.log should be the same.

[root@xxx-001 ~]# tail -f /var/log/haproxy.log
Sep  4 04:33:22 localhost haproxy[5015]: 10.24.104.76:57582 [04/Sep/2015:04:33:22.846] swift swift/server-003 0/0/0/106/107 200 168 - - ---- 0/0/0/0/0 0/0 "GET /console/css/extra-styles.css HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57589 [04/Sep/2015:04:33:49.186] swift swift/server-001 5/0/0/2/7 200 817 - - ---- 1/1/0/0/0 0/0 "GET /console/ HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57591 [04/Sep/2015:04:33:49.195] swift swift/server-003 26/0/0/106/132 200 14696 - - ---- 5/5/5/1/0 0/0 "GET /console/css/lib/bootstrap-responsive.css HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57593 [04/Sep/2015:04:33:49.195] swift swift/server-001 26/0/0/110/153 200 24192 - - ---- 4/4/4/1/0 0/0 "GET /console/css/lib/glyphicons.css HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57592 [04/Sep/2015:04:33:49.195] swift swift/server-003 31/0/0/198/229 200 168 - - ---- 3/3/3/0/0 0/0 "GET /console/css/extra-styles.css HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57594 [04/Sep/2015:04:33:49.195] swift swift/server-002 26/0/0/212/239 200 4556 - - ---- 2/2/2/1/0 0/0 "GET /console/css/app/app.css HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57595 [04/Sep/2015:04:33:49.253] swift swift/server-001 0/0/0/181/181 200 14999 - - ---- 1/1/1/0/0 0/0 "GET /console/js/lib/require.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57590 [04/Sep/2015:04:33:49.186] swift swift/server-002 36/0/0/211/304 200 100347 - - ---- 0/0/0/0/0 0/0 "GET /console/css/lib/bootstrap.css HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57596 [04/Sep/2015:04:33:49.563] swift swift/server-002 0/0/0/2/2 200 1245 - - ---- 0/0/0/0/0 0/0 "GET /console/js/main.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57597 [04/Sep/2015:04:33:49.616] swift swift/server-003 0/0/0/2/2 200 3574 - - ---- 0/0/0/0/0 0/0 "GET /console/js/app/app.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57601 [04/Sep/2015:04:33:49.673] swift swift/server-003 6/0/0/4/10 200 2147 - - ---- 5/5/5/1/0 0/0 "GET /console/js/app/router.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57600 [04/Sep/2015:04:33:49.673] swift swift/server-002 6/0/0/4/10 200 6257 - - ---- 4/4/4/1/0 0/0 "GET /console/js/app/collections/containers.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57602 [04/Sep/2015:04:33:49.673] swift swift/server-001 6/0/0/4/10 200 1620 - - ---- 3/3/3/1/0 0/0 "GET /console/js/app/models/user.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57603 [04/Sep/2015:04:33:49.673] swift swift/server-003 6/0/0/4/11 200 6122 - - ---- 2/2/2/0/0 0/0 "GET /console/js/app/collections/accounts.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57599 [04/Sep/2015:04:33:49.673] swift swift/server-001 6/0/0/3/24 200 42791 - - ---- 1/1/1/0/0 0/0 "GET /console/js/lib/underscore.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57605 [04/Sep/2015:04:33:49.745] swift swift/server-002 0/0/0/2/2 200 4296 - - ---- 4/4/4/1/0 0/0 "GET /console/js/app/collections/queue.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57606 [04/Sep/2015:04:33:49.745] swift swift/server-003 0/0/0/2/2 200 1987 - - ---- 3/3/3/0/0 0/0 "GET /console/js/app/views/authentication.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57607 [04/Sep/2015:04:33:49.745] swift swift/server-001 0/0/0/3/3 200 4349 - - ---- 2/2/2/1/0 0/0 "GET /console/js/app/models/account.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57604 [04/Sep/2015:04:33:49.745] swift swift/server-001 0/0/0/4/4 200 4355 - - ---- 1/1/1/0/0 0/0 "GET /console/js/app/views/root.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57608 [04/Sep/2015:04:33:49.785] swift swift/server-002 0/0/0/2/2 200 487 - - ---- 1/1/1/1/0 0/0 "GET /console/js/lib/swift-jquery.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57598 [04/Sep/2015:04:33:49.673] swift swift/server-002 6/0/0/3/147 200 253694 - - ---- 0/0/0/0/0 0/0 "GET /console/js/lib/jquery.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57610 [04/Sep/2015:04:33:49.840] swift swift/server-003 0/0/0/2/2 200 2008 - - ---- 2/2/1/0/0 0/0 "GET /console/js/app/models/container.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57609 [04/Sep/2015:04:33:49.840] swift swift/server-001 0/0/0/3/3 200 1904 - - ---- 1/1/0/0/0 0/0 "GET /console/js/app/collections/pagination.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57611 [04/Sep/2015:04:33:49.840] swift swift/server-002 4/0/0/2/6 200 8477 - - ---- 0/0/0/0/0 0/0 "GET /console/js/app/collections/objects.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57612 [04/Sep/2015:04:33:49.861] swift swift/server-003 0/0/0/1/1 200 2847 - - ---- 1/1/1/0/0 0/0 "GET /console/js/app/views/modal.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57613 [04/Sep/2015:04:33:49.861] swift swift/server-001 0/0/0/2/2 200 12602 - - ---- 0/0/0/0/0 0/0 "GET /console/js/lib/text.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57615 [04/Sep/2015:04:33:49.903] swift swift/server-003 0/0/0/1/1 200 1971 - - ---- 3/3/1/0/0 0/0 "GET /console/js/app/templates/root.html HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57614 [04/Sep/2015:04:33:49.903] swift swift/server-002 0/0/0/2/2 200 1250 - - ---- 2/2/0/0/0 0/0 "GET /console/js/app/templates/authentication.html HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57617 [04/Sep/2015:04:33:49.903] swift swift/server-002 5/0/0/1/6 200 676 - - ---- 1/1/1/0/0 0/0 "GET /console/js/lib/uuid.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57616 [04/Sep/2015:04:33:49.903] swift swift/server-001 5/0/0/2/7 200 1668 - - ---- 0/0/0/0/0 0/0 "GET /console/js/app/models/queue.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57618 [04/Sep/2015:04:33:49.925] swift swift/server-003 0/0/0/1/1 200 1058 - - ---- 1/1/1/0/0 0/0 "GET /console/js/app/views/alert.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57623 [04/Sep/2015:04:33:49.960] swift swift/server-001 0/0/0/1/1 200 5914 - - ---- 4/4/4/1/0 0/0 "GET /console/js/app/views/container.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57621 [04/Sep/2015:04:33:49.960] swift swift/server-003 0/0/0/1/1 200 1811 - - ---- 3/3/3/0/0 0/0 "GET /console/js/app/core/swift-search.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57620 [04/Sep/2015:04:33:49.960] swift swift/server-002 0/0/0/2/2 200 571 - - ---- 2/2/2/1/0 0/0 "GET /console/js/app/templates/alert.html HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57619 [04/Sep/2015:04:33:49.925] swift swift/server-001 0/0/0/1/39 200 73141 - - ---- 1/1/1/0/0 0/0 "GET /console/js/lib/handlebars.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57622 [04/Sep/2015:04:33:49.960] swift swift/server-002 0/0/0/2/17 200 22777 - - ---- 0/0/0/0/0 0/0 "GET /console/js/app/views/object.js HTTP/1.1"
Sep  4 04:33:49 localhost haproxy[5015]: 10.24.104.76:57624 [04/Sep/2015:04:33:49.984] swift swift/server-003 3/0/0/1/4 200 401 - - ---- 0/0/0/0/0 0/0 "GET /console/js/app/templates/container.html HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57627 [04/Sep/2015:04:33:50.026] swift swift/server-001 0/0/0/1/1 200 1358 - - ---- 2/2/0/0/0 0/0 "GET /console/js/app/templates/container/list.html HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57626 [04/Sep/2015:04:33:50.026] swift swift/server-002 5/0/0/2/7 200 1475 - - ---- 1/1/1/0/0 0/0 "GET /console/js/app/templates/object.html HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57625 [04/Sep/2015:04:33:50.026] swift swift/server-003 5/0/0/2/7 200 2346 - - ---- 0/0/0/0/0 0/0 "GET /console/js/app/templates/object/list.html HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57630 [04/Sep/2015:04:33:50.049] swift swift/server-002 0/0/0/1/1 200 1136 - - ---- 2/2/2/0/0 0/0 "GET /console/js/app/views/search-result.js HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57628 [04/Sep/2015:04:33:50.049] swift swift/server-001 0/0/0/1/1 200 4613 - - ---- 1/1/1/0/0 0/0 "GET /console/js/app/views/queue.js HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57629 [04/Sep/2015:04:33:50.049] swift swift/server-003 0/0/0/1/1 200 4876 - - ---- 0/0/0/0/0 0/0 "GET /console/js/app/views/account.js HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57631 [04/Sep/2015:04:33:50.078] swift swift/server-001 0/0/0/1/1 200 375 - - ---- 2/2/0/0/0 0/0 "GET /console/js/app/templates/queue.html HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57633 [04/Sep/2015:04:33:50.078] swift swift/server-002 5/0/0/2/7 200 445 - - ---- 1/1/1/0/0 0/0 "GET /console/js/app/templates/queue/item.html HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57632 [04/Sep/2015:04:33:50.078] swift swift/server-003 5/0/0/2/7 200 264 - - ---- 0/0/0/0/0 0/0 "GET /console/js/app/templates/queue/list.html HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57634 [04/Sep/2015:04:33:50.107] swift swift/server-001 0/0/0/1/1 200 1591 - - ---- 2/2/2/0/0 0/0 "GET /console/js/app/templates/search-result.html HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57635 [04/Sep/2015:04:33:50.107] swift swift/server-002 0/0/0/1/1 200 1146 - - ---- 1/1/1/0/0 0/0 "GET /console/js/app/templates/account/list.html HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57636 [04/Sep/2015:04:33:50.107] swift swift/server-003 0/0/0/2/2 200 553 - - ---- 0/0/0/0/0 0/0 "GET /console/js/app/templates/account.html HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57637 [04/Sep/2015:04:33:50.131] swift swift/server-002 0/0/0/1/1 200 4910 - - ---- 1/1/1/0/0 0/0 "GET /console/js/lib/swift-jquery/auth.js HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57638 [04/Sep/2015:04:33:50.131] swift swift/server-001 0/0/0/1/1 200 5924 - - ---- 0/0/0/0/0 0/0 "GET /console/js/lib/swift-jquery/core.js HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57639 [04/Sep/2015:04:33:50.136] swift swift/server-003 0/0/0/1/1 200 5698 - - ---- 0/0/0/0/0 0/0 "GET /console/js/lib/swift-jquery/container.js HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57641 [04/Sep/2015:04:33:50.158] swift swift/server-002 0/0/0/1/1 200 4201 - - ---- 2/2/2/0/0 0/0 "GET /console/js/app/models/object.js HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57640 [04/Sep/2015:04:33:50.158] swift swift/server-001 0/0/0/1/1 200 9412 - - ---- 1/1/1/0/0 0/0 "GET /console/js/app/core/paginator.js HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57645 [04/Sep/2015:04:33:50.185] swift swift/server-002 0/0/0/1/1 200 1687 - - ---- 3/3/3/0/0 0/0 "GET /console/js/app/core/number-formatter.js HTTP/1.1"
Sep  4 04:33:50 localhost haproxy[5015]: 10.24.104.76:57644 [04/Sep/2015:04:33:50.185] swift swift/server-003 0/0/0/1/1 200 2432 - - ---- 2/2/2/0/0 0/0 "GET /console/js/app/views/container/create.js HTTP/1.1"


Configure HAProxy to Load Balance Site with SSL PassThrough


Another method of load balancing SSL is to just pass through the traffic. With this approach since everything is encrypted, you won’t be able to monitor and tweak HTTP headers/traffic. Here are a couple of sample setups:

$ cat /etc/haproxy/haproxy.cfg.bypassssl
global
    log 127.0.0.1 local0
    maxconn 4000
    daemon
    uid 99
    gid 99

defaults
    log     global
    timeout server 5s
    timeout connect 5s
    timeout client 5s

frontend https_frontend
    bind *:443
    mode tcp
    default_backend varnish_cluster

backend varnish_cluster
    mode tcp
    balance roundrobin
    stick-table type ip size 200k expire 30m
    stick on src
    server s1 10.32.0.6:443
    server s2 10.32.0.8:443

If you want load-balancing of HTTPS sessions handle cert at haproxy server, you can use this configuration, you might try 

frontend https_frontend

    bind *:443 ssl crt /home/ubuntu/varnish_ssl/stunnel.pem

PS: 
  • $ cat wild-elatov-local-cert.pem wild-elatov-local-priv-key.pem > elatov-local-cert-key.pem

Reference:

http://virtuallyhyper.com/2013/05/configure-haproxy-to-load-balance-sites-with-ssl/