-
Notifications
You must be signed in to change notification settings - Fork 166
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #124 from jasonrbriggs/SNI-integration
Sni integration
- Loading branch information
Showing
6 changed files
with
105 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
defaults | ||
mode tcp | ||
option tcplog | ||
|
||
frontend ft_test | ||
bind 0.0.0.0:65001 ssl crt tmp/myorg.pem crt tmp/mycom.pem no-sslv3 no-tls-tickets | ||
use_backend bk_com_cert if { ssl_fc_sni my.example.com } | ||
use_backend bk_org_cert if { ssl_fc_sni my.example.org } | ||
|
||
backend bk_com_cert | ||
server srv1 127.0.0.1:62613 | ||
|
||
backend bk_org_cert | ||
server srv2 127.0.0.1:62614 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import unittest | ||
|
||
import stomp | ||
from stomp.listener import TestListener | ||
from stomp.test.testutils import * | ||
|
||
|
||
class TestSNIMQSend(unittest.TestCase): | ||
""" | ||
To test SNI: | ||
- Run a STOMP server in 127.0.0.1:62613 | ||
- Add a couple fully qualified hostnames to your /etc/hosts | ||
# SNI test hosts | ||
127.0.0.1 my.example.com | ||
127.0.0.1 my.example.org | ||
- Run `make haproxy` which will generate keys and run the haproxy load balancer | ||
Connections with SNI to "my.example.com" will be routed to the STOMP server on port 62613. | ||
Connections without SNI won't be routed. | ||
""" | ||
|
||
def setUp(self): | ||
pass | ||
|
||
def testconnect(self): | ||
conn = stomp.Connection11(get_sni_ssl_host()) | ||
conn.set_ssl(get_sni_ssl_host()) | ||
listener = TestListener('123') | ||
conn.set_listener('', listener) | ||
conn.start() | ||
conn.connect(get_default_user(), get_default_password(), wait=True) | ||
conn.subscribe(destination='/queue/test', id=1, ack='auto') | ||
|
||
conn.send(body='this is a test', destination='/queue/test', receipt='123') | ||
|
||
listener.wait_on_receipt() | ||
conn.disconnect(receipt=None) | ||
|
||
self.assertTrue(listener.connections == 1, 'should have received 1 connection acknowledgement') | ||
self.assertTrue(listener.messages == 1, 'should have received 1 message') | ||
self.assertTrue(listener.errors == 0, 'should not have received any errors') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters