diff options
| author | Simeon Simeonov | 2015-04-17 15:17:59 +0200 |
|---|---|---|
| committer | Simeon Simeonov | 2015-04-17 15:17:59 +0200 |
| commit | c7e57ae16ea9024ec55f401a18158c09bc45a1a3 (patch) | |
| tree | 5501acebecb777219c45f781de825d7a92f08de0 | |
| parent | b2120ed79c11505a326f18d8b465449dd0f6d57c (diff) | |
Last polishing before v2.0
| -rw-r--r-- | beinc_config_sample.json | 5 | ||||
| -rw-r--r-- | beinc_config_sample.json.readme | 6 | ||||
| -rwxr-xr-x | beinc_server.py | 4 | ||||
| -rw-r--r-- | beinc_weechat.py | 14 |
4 files changed, 16 insertions, 13 deletions
diff --git a/beinc_config_sample.json b/beinc_config_sample.json index c61a033..046e3fa 100644 --- a/beinc_config_sample.json +++ b/beinc_config_sample.json | |||
| @@ -4,14 +4,13 @@ | |||
| 4 | "ssl_private_key": "key.pem", | 4 | "ssl_private_key": "key.pem", |
| 5 | "ssl_certificate": "cert.crt", | 5 | "ssl_certificate": "cert.crt", |
| 6 | "ssl_acceptable_ciphers": "auto", | 6 | "ssl_acceptable_ciphers": "auto", |
| 7 | "ssl_method": "auto", | 7 | "ssl_version": "auto" |
| 8 | "daemonize": 1 | ||
| 9 | }, | 8 | }, |
| 10 | "instances": [ | 9 | "instances": [ |
| 11 | { | 10 | { |
| 12 | "name": "test", | 11 | "name": "test", |
| 13 | "password": "changeme", | 12 | "password": "changeme", |
| 14 | "osd_system": "pynotify", | 13 | "osd_system": "pyosd", |
| 15 | "osd_timeout": 5, | 14 | "osd_timeout": 5, |
| 16 | "pyosd_font": "", | 15 | "pyosd_font": "", |
| 17 | "pyosd_vertical_offset": 120, | 16 | "pyosd_vertical_offset": 120, |
diff --git a/beinc_config_sample.json.readme b/beinc_config_sample.json.readme index 67cc5c2..9c5aecc 100644 --- a/beinc_config_sample.json.readme +++ b/beinc_config_sample.json.readme | |||
| @@ -26,7 +26,7 @@ documentation to better illustrate the comments. | |||
| 26 | 26 | ||
| 27 | # A list of allowed ciphers in the format of 'openssl ciphers' | 27 | # A list of allowed ciphers in the format of 'openssl ciphers' |
| 28 | # "auto" - use the Twisted / OpenSSL defaults | 28 | # "auto" - use the Twisted / OpenSSL defaults |
| 29 | "ssl_acceptable_ciphers": "auto", # default: "auto" | 29 | "ssl_ciphers": "auto", # default: "auto" |
| 30 | 30 | ||
| 31 | # Encryption method for the BEINC server | 31 | # Encryption method for the BEINC server |
| 32 | # Possible values: | 32 | # Possible values: |
| @@ -35,7 +35,7 @@ documentation to better illustrate the comments. | |||
| 35 | # "TLSv1" - TLSv1.0 | 35 | # "TLSv1" - TLSv1.0 |
| 36 | # "TLSv1_1" - TLSv1.1 | 36 | # "TLSv1_1" - TLSv1.1 |
| 37 | # "TLSv1_2" - TLSv1.2 (most secure, but requires OpenSSL >= 1.0.1e) | 37 | # "TLSv1_2" - TLSv1.2 (most secure, but requires OpenSSL >= 1.0.1e) |
| 38 | "ssl_method": "auto", # default: "auto" | 38 | "ssl_version": "auto", # default: "auto" |
| 39 | 39 | ||
| 40 | }, | 40 | }, |
| 41 | 41 | ||
| @@ -119,7 +119,7 @@ documentation to better illustrate the comments. | |||
| 119 | 119 | ||
| 120 | # A list of preferred ciphers for this target | 120 | # A list of preferred ciphers for this target |
| 121 | # Default: "" (use the OpenSSL default ciphers) | 121 | # Default: "" (use the OpenSSL default ciphers) |
| 122 | "ciphers": "ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384", | 122 | "ssl_ciphers": "ECDHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384", |
| 123 | 123 | ||
| 124 | # Don't check whether the target's hostname matches the server's | 124 | # Don't check whether the target's hostname matches the server's |
| 125 | # certificate. (Only Python >= 2.7.9) | 125 | # certificate. (Only Python >= 2.7.9) |
diff --git a/beinc_server.py b/beinc_server.py index cf4f7c7..53f12c5 100755 --- a/beinc_server.py +++ b/beinc_server.py | |||
| @@ -361,9 +361,9 @@ def main(): | |||
| 361 | ssl_private_key = config_dict['server']['general'].get( | 361 | ssl_private_key = config_dict['server']['general'].get( |
| 362 | 'ssl_private_key') | 362 | 'ssl_private_key') |
| 363 | ssl_method_str = config_dict['server']['general'].get( | 363 | ssl_method_str = config_dict['server']['general'].get( |
| 364 | 'ssl_method', 'auto') | 364 | 'ssl_version', 'auto') |
| 365 | ssl_acceptable_ciphers_str = config_dict['server']['general'].get( | 365 | ssl_acceptable_ciphers_str = config_dict['server']['general'].get( |
| 366 | 'ssl_acceptable_ciphers', 'auto') | 366 | 'ssl_ciphers', 'auto') |
| 367 | beinc_server = XMLRPCNotifyServer(config_dict) | 367 | beinc_server = XMLRPCNotifyServer(config_dict) |
| 368 | if ssl_certificate and ssl_private_key: | 368 | if ssl_certificate and ssl_private_key: |
| 369 | # SSL connection | 369 | # SSL connection |
diff --git a/beinc_weechat.py b/beinc_weechat.py index c52396d..5082c1d 100644 --- a/beinc_weechat.py +++ b/beinc_weechat.py | |||
| @@ -154,7 +154,7 @@ class WeechatTarget(object): | |||
| 154 | self.__debug = bool(target_dict.get('debug', False)) | 154 | self.__debug = bool(target_dict.get('debug', False)) |
| 155 | self.__enabled = bool(target_dict.get('enabled', True)) | 155 | self.__enabled = bool(target_dict.get('enabled', True)) |
| 156 | self.__socket_timeout = int(target_dict.get('socket_timeout', 3)) | 156 | self.__socket_timeout = int(target_dict.get('socket_timeout', 3)) |
| 157 | self.__ciphers = target_dict.get('ciphers', '') | 157 | self.__ssl_ciphers = target_dict.get('ssl_ciphers', '') |
| 158 | self.__disable_hostname_check = bool( | 158 | self.__disable_hostname_check = bool( |
| 159 | target_dict.get('disable-hostname-check', False)) | 159 | target_dict.get('disable-hostname-check', False)) |
| 160 | self.__ssl_version = target_dict.get('ssl_version', 'auto') | 160 | self.__ssl_version = target_dict.get('ssl_version', 'auto') |
| @@ -333,6 +333,10 @@ class WeechatTarget(object): | |||
| 333 | """ | 333 | """ |
| 334 | if self.__connection: | 334 | if self.__connection: |
| 335 | return True | 335 | return True |
| 336 | if self.__debug: | ||
| 337 | beinc_prnt( | ||
| 338 | 'BEINC DEBUG: (Re)Establishing connection to: {0}'.format( | ||
| 339 | self.__url)) | ||
| 336 | try: | 340 | try: |
| 337 | ssl_version = BEINC_SSL_METHODS.get(self.__ssl_version, | 341 | ssl_version = BEINC_SSL_METHODS.get(self.__ssl_version, |
| 338 | ssl.PROTOCOL_SSLv23) | 342 | ssl.PROTOCOL_SSLv23) |
| @@ -346,8 +350,8 @@ class WeechatTarget(object): | |||
| 346 | self.__cert_file)) | 350 | self.__cert_file)) |
| 347 | context.check_hostname = bool( | 351 | context.check_hostname = bool( |
| 348 | not self.__disable_hostname_check) | 352 | not self.__disable_hostname_check) |
| 349 | if self.__ciphers: | 353 | if self.__ssl_ciphers: |
| 350 | context.set_ciphers(self.__ciphers) | 354 | context.set_ciphers(self.__ssl_ciphers) |
| 351 | transport = xmlrpclib.SafeTransport(context=context) | 355 | transport = xmlrpclib.SafeTransport(context=context) |
| 352 | else: | 356 | else: |
| 353 | # Python < 2.7.9 | 357 | # Python < 2.7.9 |
| @@ -357,8 +361,8 @@ class WeechatTarget(object): | |||
| 357 | ssl_options['ca_certs'] = os.path.expanduser( | 361 | ssl_options['ca_certs'] = os.path.expanduser( |
| 358 | self.__cert_file) | 362 | self.__cert_file) |
| 359 | ssl_options['cert_reqs'] = ssl.CERT_REQUIRED | 363 | ssl_options['cert_reqs'] = ssl.CERT_REQUIRED |
| 360 | if self.__ciphers: | 364 | if self.__ssl_ciphers: |
| 361 | ssl_options['ciphers'] = self.__ciphers | 365 | ssl_options['ciphers'] = self.__ssl_ciphers |
| 362 | transport = BEINCCustomSafeTransport( | 366 | transport = BEINCCustomSafeTransport( |
| 363 | custom_ssl_options=ssl_options) | 367 | custom_ssl_options=ssl_options) |
| 364 | self.__connection = xmlrpclib.ServerProxy(self.__url, | 368 | self.__connection = xmlrpclib.ServerProxy(self.__url, |
