Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Change Log

# 1.0.1

* Removed Backport ssl in favor of built in ssl.

## 1.0.0

* Drop Python 2.7 support
Expand Down
13 changes: 8 additions & 5 deletions etc/st2packgen/files/sensors/sensor_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
except ImportError:
from http_parser.pyparser import HttpParser

from backports import ssl
import ssl
from st2reactor.sensor.base import Sensor


Expand Down Expand Up @@ -74,13 +74,16 @@ def run(self):

while True:
try:
context = ssl.create_default_context()
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if self.authmethod == "basic":
self.client = ssl.wrap_socket(self.sock)
self.client = context.wrap_socket(self.sock)
elif self.authmethod == "cert":
self.client = ssl.wrap_socket(self.sock,
keyfile=self.config['client_cert_key_path'],
certfile=self.config['client_cert_path'])
context.load_cert_chain(
certfile=self.config['client_cert_path'],
keyfile=self.config['client_cert_key_path']
)
self.client = context.wrap_socket(self.sock)
else:
raise KeyError('No authentication mechanisms defined')
self._log.debug('Connecting to %s %i' % (self.host, self.port))
Expand Down
2 changes: 1 addition & 1 deletion pack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ keywords:
- kubernetes
- sensors
- thirdpartyresource
version: 1.0.0
version: 1.0.1
python_versions:
- "3"
author: Andrew Moore
Expand Down
4 changes: 1 addition & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
pyswagger
jinja2
http_parser
backports.ssl==0.0.9
pyopenssl==17.5.0

requests
13 changes: 8 additions & 5 deletions sensors/sensor_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
except ImportError:
from http_parser.pyparser import HttpParser

from backports import ssl
import ssl
from st2reactor.sensor.base import Sensor


Expand Down Expand Up @@ -80,13 +80,16 @@ def run(self):

while True:
try:
context = ssl.create_default_context()
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
if self.authmethod == "basic":
self.client = ssl.wrap_socket(self.sock)
self.client = context.wrap_socket(self.sock)
elif self.authmethod == "cert":
self.client = ssl.wrap_socket(self.sock,
keyfile=self.config['client_cert_key_path'],
certfile=self.config['client_cert_path'])
context.load_cert_chain(
certfile=self.config['client_cert_path'],
keyfile=self.config['client_cert_key_path']
)
self.client = context.wrap_socket(self.sock)
else:
raise KeyError('No authentication mechanisms defined')
self._log.debug('Connecting to %s %i' % (self.host, self.port))
Expand Down