aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src/meshbay_node/transport/tls_cert.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/transport/tls_cert.py')
-rw-r--r--packages/meshbay-node/src/meshbay_node/transport/tls_cert.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/transport/tls_cert.py b/packages/meshbay-node/src/meshbay_node/transport/tls_cert.py
index 374fd08..8d680ea 100644
--- a/packages/meshbay-node/src/meshbay_node/transport/tls_cert.py
+++ b/packages/meshbay-node/src/meshbay_node/transport/tls_cert.py
@@ -21,10 +21,12 @@ from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.x509.oid import NameOID
+from meshbay_node.platform import chmod_private, config_dir
+
log = logging.getLogger(__name__)
-DEFAULT_CERT = Path.home() / ".config" / "meshbay" / "node_tls.crt"
-DEFAULT_KEY = Path.home() / ".config" / "meshbay" / "node_tls.key"
+DEFAULT_CERT = config_dir() / "node_tls.crt"
+DEFAULT_KEY = config_dir() / "node_tls.key"
def generate_self_signed_cert(
@@ -64,8 +66,8 @@ def generate_self_signed_cert(
serialization.PrivateFormat.TraditionalOpenSSL,
serialization.NoEncryption(),
))
- cert_path.chmod(0o644)
- key_path.chmod(0o600)
+ chmod_private(cert_path, mode=0o644)
+ chmod_private(key_path)
log.info("TLS cert generated: %s", cert_path)
return cert_path, key_path