Added configuration section

develop
Sven Slootweg 13 years ago
parent 24719232ec
commit 69c5b5c4a1

@ -1,5 +1,14 @@
#!/usr/bin/python
################################
# Configuration starts here
cert_path = '/home/sven/ssl/cert'
key_path = '/home/sven/ssl/private'
# Configuration ends here
################################
import socket, ssl
client_list = []
@ -30,8 +39,8 @@ while True:
newsocket, fromaddr = bindsocket.accept()
connstream = ssl.wrap_socket(newsocket,
server_side=True,
certfile="/home/sven/ssl/cert",
keyfile="/home/sven/ssl/private",
certfile=cert_path,
keyfile=key_path,
ssl_version=ssl.PROTOCOL_TLSv1)
try:
client_list.append(Client(connstream))

@ -1,9 +1,17 @@
#!/usr/bin/python
################################
# Configuration starts here
allowed_certs = '/home/sven/ssl/allowed'
# Configuration ends here
################################
import socket, ssl, pprint
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ssl_sock = ssl.wrap_socket(s, cert_reqs=ssl.CERT_REQUIRED, ca_certs='/home/sven/ssl/allowed')
ssl_sock = ssl.wrap_socket(s, cert_reqs=ssl.CERT_REQUIRED, ca_certs=allowed_certs)
ssl_sock.connect(('localhost', 9151))
ssl_sock.write('test data')

Loading…
Cancel
Save