summaryrefslogtreecommitdiff
path: root/src/conf_mode/system-login-banner.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-12-11 20:47:23 +0100
committerChristian Poessinger <christian@poessinger.com>2021-12-11 20:48:50 +0100
commit2c96336702b1f08a2c6f997463a0aa48b0d8c0af (patch)
tree6f6218ef73c2af3e71f9379fc238cef1998a381f /src/conf_mode/system-login-banner.py
parent91f92cbf84ea1ce7199301f2ec89890337728ebe (diff)
downloadvyos-1x-2c96336702b1f08a2c6f997463a0aa48b0d8c0af.tar.gz
vyos-1x-2c96336702b1f08a2c6f997463a0aa48b0d8c0af.zip
T3912: migrate "Welcome to VyOS" from issue file to motd to not silently expose OS
(cherry picked from commit 9ccc353893a3a9a1dc7dfd59463d34449bf05afb)
Diffstat (limited to 'src/conf_mode/system-login-banner.py')
-rwxr-xr-xsrc/conf_mode/system-login-banner.py18
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