mirror of
https://github.com/cmehay/docker-tor-hidden-service.git
synced 2025-04-19 21:39:13 +00:00
Remove double base64 decode when importing key from environment
This commit is contained in:
parent
7ab49bfde4
commit
cf419a7d48
2 changed files with 2 additions and 10 deletions
|
@ -35,8 +35,8 @@ services:
|
||||||
FOO_TOR_SERVICE_VERSION: '3'
|
FOO_TOR_SERVICE_VERSION: '3'
|
||||||
# tor v3 address private key base 64 encoded
|
# tor v3 address private key base 64 encoded
|
||||||
FOO_TOR_SERVICE_KEY: |
|
FOO_TOR_SERVICE_KEY: |
|
||||||
PT0gZWQyNTUxOXYxLXNlY3JldDogdHlwZTAgPT0AAACArobDQYyZAWXei4QZwr++
|
PT0gZWQyNTUxOXYxLXNlY3JldDogdHlwZTAgPT0AAABYZRzL3zScTEqA8/5wfvHw
|
||||||
j96H1X/gq14NwLRZ2O5DXuL0EzYKkdhZSILY85q+kfwZH8z4ceqe7u1F+0pQi/sM
|
yLIzmih73lhgPGPh7SuOS6GTou4tXgNlTYSNb/Fvk1ajTTUno4tIQn/jMENO/20G
|
||||||
|
|
||||||
# Keep keys in volumes
|
# Keep keys in volumes
|
||||||
volumes:
|
volumes:
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
'This class define a service link'
|
'This class define a service link'
|
||||||
import base64
|
|
||||||
import binascii
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import pathlib
|
import pathlib
|
||||||
|
@ -77,12 +75,6 @@ class ServicesGroup(object):
|
||||||
def add_key(self, key):
|
def add_key(self, key):
|
||||||
if self.imported_key:
|
if self.imported_key:
|
||||||
logging.warning('Secret key already set, overriding')
|
logging.warning('Secret key already set, overriding')
|
||||||
# Try to decode key from base64 encoding
|
|
||||||
# import the raw data if the input cannot be decoded as base64
|
|
||||||
try:
|
|
||||||
key = base64.b64decode(key)
|
|
||||||
except binascii.Error:
|
|
||||||
pass
|
|
||||||
if isinstance(key, str):
|
if isinstance(key, str):
|
||||||
key = key.encode('ascii')
|
key = key.encode('ascii')
|
||||||
self._onion.set_private_key(key)
|
self._onion.set_private_key(key)
|
||||||
|
|
Loading…
Add table
Reference in a new issue