Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config.ini: certfile,keyfile options are ignored #261

Open
micressor opened this issue Mar 10, 2022 · 2 comments
Open

config.ini: certfile,keyfile options are ignored #261

micressor opened this issue Mar 10, 2022 · 2 comments

Comments

@micressor
Copy link

When i set certificate paths to

certfile = /etc/ssl/certs/electrumpersonalserver.crt
keyfile = /etc/ssl/private/electrumpersonalserver.key

startup of eps still says

DEBUG:2022-03-10 19:10:52,100: using cert: /home/bitcoin/.local/lib/python3.9/site-packages/electrumpersonalserver/certs/cert.crt, key: /home/bitcoin/.local/lib/python3.9/si
te-packages/electrumpersonalserver/certs/cert.key

I think there is something wrong.
all other options are applied.

eps version: 0.2.3

@micressor
Copy link
Author

Found the root cause. Permission to the key file was not correct.
But the error handling in this case could be better.

def get_certs(config):
from pkg_resources import resource_filename
from electrumpersonalserver import __certfile__, __keyfile__
logger = logging.getLogger('ELECTRUMPERSONALSERVER')
certfile = config.get('electrum-server', 'certfile', fallback=None)
keyfile = config.get('electrum-server', 'keyfile', fallback=None)
if (certfile and keyfile) and \
(os.path.exists(certfile) and os.path.exists(keyfile)):
return certfile, keyfile
else:
certfile = resource_filename('electrumpersonalserver', __certfile__)
keyfile = resource_filename('electrumpersonalserver', __keyfile__)
if os.path.exists(certfile) and os.path.exists(keyfile):
return certfile, keyfile
else:
raise ValueError('invalid cert: {}, key: {}'.format(
certfile, keyfile))

@chris-belcher
Copy link
Owner

Thanks for the issue.

I guess a debug print statement could be added to the else: branch?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants