diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-12-11 20:47:23 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-12-11 20:48:22 +0100 |
commit | 9ccc353893a3a9a1dc7dfd59463d34449bf05afb (patch) | |
tree | e7718860dacf54c4318e085acf2a355bee334a8c | |
parent | 86ab3b7dad7f2ad2c39a8b110e4a845195cda32e (diff) | |
download | vyos-1x-9ccc353893a3a9a1dc7dfd59463d34449bf05afb.tar.gz vyos-1x-9ccc353893a3a9a1dc7dfd59463d34449bf05afb.zip |
T3912: migrate "Welcome to VyOS" from issue file to motd to not silently expose OS
-rwxr-xr-x | src/conf_mode/system-login-banner.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/conf_mode/system-login-banner.py b/src/conf_mode/system-login-banner.py index 2220d7b66..9642b2aae 100755 --- a/src/conf_mode/system-login-banner.py +++ b/src/conf_mode/system-login-banner.py @@ -15,13 +15,16 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. from sys import exit + from vyos.config import Config +from vyos.util import write_file from vyos import ConfigError - from vyos import airbag airbag.enable() motd=""" +Welcome to VyOS + Check out project news at https://blog.vyos.io and feel free to report bugs at https://phabricator.vyos.net @@ -38,7 +41,7 @@ POSTLOGIN_FILE = r'/etc/motd' default_config_data = { 'issue': 'Welcome to VyOS - \\n \\l\n\n', - 'issue_net': 'Welcome to VyOS\n', + 'issue_net': '', 'motd': motd } @@ -92,14 +95,9 @@ def generate(banner): pass def apply(banner): - with open(PRELOGIN_FILE, 'w') as f: - f.write(banner['issue']) - - with open(PRELOGIN_NET_FILE, 'w') as f: - f.write(banner['issue_net']) - - with open(POSTLOGIN_FILE, 'w') as f: - f.write(banner['motd']) + write_file(PRELOGIN_FILE, banner['issue']) + write_file(PRELOGIN_NET_FILE, banner['issue_net']) + write_file(POSTLOGIN_FILE, banner['motd']) return None |