Page MenuHomeDevCentral

D1130.id2889.diff
No OneTemporary

D1130.id2889.diff

diff --git a/map.jinja b/map.jinja
--- a/map.jinja
+++ b/map.jinja
@@ -142,3 +142,22 @@
'verbiste': 'fr-verbiste',
},
}, default='Debian') %}
+
+{# -------------------------------------------------------------
+ Capabilities of OS and distributions
+
+ :: MOTD-printed-at-login
+ Login mechanism, through PAM or dotfiles,
+ prints the MOTD when a session is opened.
+
+ When at False, OpenSSH will take care of it.
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #}
+
+{% set capabilities = salt['grains.filter_by']({
+ 'Debian': {
+ 'MOTD-printed-at-login': True,
+ },
+ 'FreeBSD' : {
+ 'MOTD-printed-at-login': False,
+ },
+}, default='Debian') %}
diff --git a/roles/core/sshd/files/sshd_config b/roles/core/sshd/files/sshd_config
--- a/roles/core/sshd/files/sshd_config
+++ b/roles/core/sshd/files/sshd_config
@@ -25,7 +25,7 @@
UsePAM yes
# Misc options
-PrintMotd no
+PrintMotd {{ "yes" if print_motd else "no" }}
AcceptEnv LANG LC_*
# SFTP
diff --git a/roles/core/sshd/init.sls b/roles/core/sshd/init.sls
--- a/roles/core/sshd/init.sls
+++ b/roles/core/sshd/init.sls
@@ -6,7 +6,7 @@
# License: Trivial work, not eligible to copyright
# -------------------------------------------------------------
-{% from "map.jinja" import paths with context %}
+{% from "map.jinja" import paths, capabilities with context %}
# -------------------------------------------------------------
# OpenSSH
@@ -18,6 +18,7 @@
- template: jinja
- context:
sftp: {{ paths.sftp }}
+ print_motd: {{ not capabilities['MOTD-printed-at-login'] }}
# -------------------------------------------------------------
# PAM

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 17, 03:44 (22 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2248475
Default Alt Text
D1130.id2889.diff (1 KB)

Event Timeline