Phase out serial TTY, update SSH MOTD

This commit is contained in:
Disassembler 2019-03-22 09:58:53 +01:00
parent bba7e0383c
commit 81d9bb74ee
No known key found for this signature in database
GPG Key ID: 524BD33A0EE29499
3 changed files with 12 additions and 8 deletions

View File

@ -21,6 +21,7 @@ LXC_ROOT = '/var/lib/lxc'
# OS
ISSUE_FILE = '/etc/issue'
MOTD_FILE = '/etc/motd'
NGINX_DIR = '/etc/nginx/conf.d'
# Remote access

View File

@ -88,11 +88,11 @@ server {{
ISSUE = '''
\x1b[1;32m _____ _ _ __ ____ __
/ ____| | | | | \\\\ \\\\ / / \\\\/ |
| (___ _ __ ___ | |_| |_ ___ _ _\\\\ \\\\ / /| \\\\ / |
\\\\___ \\\\| '_ \\\\ / _ \\\\| __| __/ _ \\\\ '__\\\\ \\\\/ / | |\\\\/| |
____) | |_) | (_) | |_| || __/ | \\\\ / | | | |
|_____/| .__/ \\\\___/ \\\\__|\\\\__\\\\___|_| \\\\/ |_| |_|
/ ____| | | | | \\ \\ / / \\/ |
| (___ _ __ ___ | |_| |_ ___ _ _\\ \\ / /| \\ / |
\\___ \\| '_ \\ / _ \\| __| __/ _ \\ '__\\ \\/ / | |\\/| |
____) | |_) | (_) | |_| || __/ | \\ / | | | |
|_____/| .__/ \\___/ \\__|\\__\\___|_| \\/ |_| |_|
| |
|_|\x1b[0m

View File

@ -10,7 +10,7 @@ import urllib
from . import crypto
from . import templates
from . import net
from .paths import ACME_CRON, ACME_DIR, ISSUE_FILE, NGINX_DIR, RELOAD_URL
from .paths import ACME_CRON, ACME_DIR, ISSUE_FILE, MOTD_FILE, NGINX_DIR, RELOAD_URL
class VMMgr:
def __init__(self, conf):
@ -74,9 +74,12 @@ class VMMgr:
subprocess.run(['/sbin/service', 'nginx', 'restart'])
def rebuild_issue(self):
# Compile the URLs displayed in terminal banner and rebuild the file
# Compile the URLs displayed in terminal banner and rebuild the issue and motd files
issue = templates.ISSUE.format(url=net.compile_url(self.domain, self.port), ip=net.compile_url(net.get_local_ip(), self.port))
with open(ISSUE_FILE, 'w') as f:
f.write(templates.ISSUE.format(url=net.compile_url(self.domain, self.port), ip=net.compile_url(net.get_local_ip(), self.port)))
f.write(issue)
with open(MOTD_FILE, 'w') as f:
f.write(issue)
def update_common_settings(self, email, gmaps_api_key):
# Update common configuration values