certidude/pinecrypt/client/const.py

24 lines
630 B
Python
Raw Normal View History

2021-04-10 06:21:50 +00:00
import os
import socket
RUN_DIR = "/run/certidude"
CONFIG_DIR = "/etc/certidude"
CLIENT_CONFIG_PATH = os.path.join(CONFIG_DIR, "client.conf")
2021-06-05 04:50:27 +00:00
RE_FQDN = r"^(([a-z0-9]|[a-z0-9][a-z0-9\-_]*[a-z0-9])\.)+([a-z0-9]|[a-z0-9][a-z0-9\-_]*[a-z0-9])?$"
RE_HOSTNAME = r"^[a-z0-9]([a-z0-9\-_]{0,61}[a-z0-9])?$"
RE_COMMON_NAME = r"^[A-Za-z0-9\-\.\_@]+$"
2021-04-10 06:21:50 +00:00
2021-06-05 04:50:27 +00:00
FQDN = socket.getfqdn()
2021-04-10 06:21:50 +00:00
try:
HOSTNAME, DOMAIN = FQDN.split(".", 1)
2021-06-05 04:50:27 +00:00
except ValueError: # If FQDN is not configured
2021-04-10 06:21:50 +00:00
HOSTNAME = FQDN
DOMAIN = None
2021-04-14 11:26:50 +00:00
if os.path.exists("/etc/strongswan/ipsec.conf"):
STRONGSWAN_PREFIX = "/etc/strongswan"
else:
STRONGSWAN_PREFIX = "/etc"