fix(sshd): move login banner to zsh .zprofile

sshd Banner fires on every connection (scp, sftp, non-interactive), the wrong layer for a welcome banner. Move to .zprofile, interactive login shells only.
This commit is contained in:
Clément Désiles
2026-08-25 22:58:03 +02:00
parent 43b510e77f
commit 642a0f8ea4
5 changed files with 15 additions and 12 deletions
-1
View File
@@ -6,7 +6,6 @@ ssh_allowed_networks:
ssh_users: "jokester" # space separated if many
ssh_config_dir: "/etc/ssh"
sshd_config: "{{ ssh_config_dir }}/sshd_config"
sshd_banner: "{{ ssh_config_dir }}/banner"
sshd_binary: "/usr/sbin/sshd"
ssh_authorized_keys_fallback_enabled: false
ssh_authorized_keys_fallback_dir: "/etc/ssh/authorized_keys"
-8
View File
@@ -63,14 +63,6 @@
mode: "0600"
loop: "{{ ssh_users.split() }}"
- name: Create an SSH banner
ansible.builtin.template:
src: templates/sshd_banner.j2
dest: "{{ sshd_banner }}"
owner: root
group: root
mode: "0644"
- name: Remove motd on Debian
ansible.builtin.file:
path: /etc/motd
-69
View File
@@ -1,69 +0,0 @@
{% if ansible_host == 'andromeda' %}
*******************************************
Beep beep-wooOOoo! Brrrp! Zzt zzt-whirl!
*******************************************
⣠⣴⣾⣿⣿⣿⣿⣷⣦⣄
⢠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡄
⢀⣿⣿⣿⣿⡿⠛⢿⡿⠛⢻⣿⣿⣿⣿⡀ <IMPERIAL SECURITY
⢸⣿⣿⣿⣿⡇ ⢸⣷⣶⣾⣿⣿⣿⣿⡇ IDENTIFICATION DROID
⠈⠉⠉⠉⠉⠁ ⠈⠉⠉⠉⠉⠉⠉⠉⠁
⢀⣤⣀⣾⣿⣿⣿⠟⠛⠛⠛⠛⠻⣿⣿⣿⣷⣀⣤⡀
⢸⣿⣿⣿⣿⣿⣿⣤⣤⣤⣤⣤⣤⣿⣿⣿⣿⣿⣿⡇
⢸⣿⣿⣿⣿⣿⣿⣿⣿⡿⢿⣿⣿⣿⣿⣿⣿⣿⣿⡇
⢸⣿⣿⣿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⣿⣿⣿⡇
⢸⣿⡟⢿⣿⣿⣿⣿⣿ ⣿⣿⣿⣿⣿⡿⢻⣿⡇
⢸⣿⡇⠈⠙⠛⢛⣿⣿⣤⣤⣿⣿⡛⠛⠋⠁⢸⣿⡇
⣤⣼⣿⣧⣤⡀ ⠙⠛⠛⠛⠛⠛⠛⠋ ⢀⣤⣼⣿⣧⣤
⠛⠛⠛⠛⠛⠁ ⠈⠛⠛⠛⠛⠛
{% elif ansible_host == 'omega' %}
*******************************************
GALACTIC EMPIRE SECURE TERMINAL
*******************************************
⣀⣤⣴⣶⣾⣿⣿⣿⣿⣷⡶⠦
⢀⣴⣾⣿⣿⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣤⡄
⣰⣿⣿⣿⠋ ⠈⢻⣿⣿⣿⣿⣿⣿⡟⠛⠛⠃
⣼⣿⣿⣿⡇ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧
⢰⣿⣿⣿⣿⣧⡀ ⣠⣿⣿⣿⣿⣿⣿⠿⠟⠛⠁
⣾⣿⣿⣿⣿⣿⣿⣶⣤⣤⣴⣾⣿⣿⣿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣶⣶
⣉⠉⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠉⣉
⢿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⠿⠿
⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠛⠛⠋⠉
⢻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⣤⣤⣤⣤⡄
⠹⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠏
⠈⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣤⡄
⠉⠛⠻⠿⢿⣿⣿⣿⣿⠟⠉⠉⠉⠉
You have reached a terminal of the Galactic
Empire's secure network. Unauthorized access
will result in tracking and possible Force
action.
{% elif ansible_host == 'pinwheel' %}
*******************************************
May the shell be with you
*******************************************
⢀⣠⣄⣀⣀⣀ ⣀⣤⣴⣶⡾⠿⠿⠿⠿⢷⣶⣦⣤⣀⡀
⢰⣿⡟⠛⠛⠛⠻⠿⠿⢿⣶⣶⣦⣤⣤⣀⣀⡀⣀⣴⣾⡿⠟⠋⠉ ⠉⠙⠻⢿⣷⣦⣀ ⢀⣀⣀⣀⣀⣀⣀⣀⡀
⠻⣿⣦⡀ ⠉⠓⠶⢦⣄⣀⠉⠉⠛⠛⠻⠿⠟⠋⠁ ⣤⡀ ⢠ ⣠ ⠈⠙⠻⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠟⠛⠛⢻⣿
⠈⠻⣿⣦ ⠈⠙⠻⢷⣶⣤⡀ ⢀⣀⡀ ⠙⢷⡀⠸⡇ ⣰⠇ ⢀⣀⣀ ⣀⣠⣤⣤⣶⡶⠶⠶⠒⠂ ⣠⣾⠟
⠈⢿⣷⡀ ⠈⢻⣿⡄⣠⣴⣿⣯⣭⣽⣷⣆ ⠁ ⢠⣾⣿⣿⣿⣿⣦⡀ ⣠⣾⠟⠋⠁ ⣠⣾⡟⠁
⠈⢻⣷⣄ ⣿⡗⢻⣿⣧⣽⣿⣿⣿⣧ ⣀⣀ ⢠⣿⣧⣼⣿⣿⣿⣿⠗⠰⣿⠃ ⣠⣾⡿⠋
⠙⢿⣶⣄⡀ ⠸⠃⠈⠻⣿⣿⣿⣿⣿⡿⠃⠾⣥⡬⠗⠸⣿⣿⣿⣿⣿⡿⠛ ⢀⡟ ⣀⣠⣾⡿⠋
⠉⠛⠿⣷⣶⣤⣤⣄⣰⣄ ⠉⠉⠉⠁ ⢀⣀⣠⣄⣀⡀ ⠉⠉⠉ ⢀⣠⣾⣥⣤⣤⣤⣶⣶⡿⠿⠛⠉
⠈⠉⢻⣿⠛⢿⣷⣦⣤⣴⣶⣶⣦⣤⣤⣤⣤⣬⣥⡴⠶⠾⠿⠿⠿⠿⠛⢛⣿⣿⣿⣯⡉⠁
⠈⣿⣧⡀⠈⠉ ⠈⠁⣾⠛⠉⠉ ⣀⣴⣿⠟⠉⣹⣿⣇
⢀⣸⣿⣿⣦⣀ ⢻⡀ ⢀⣠⣤⣶⣿⠋⣿⠛⠃ ⣈⣿⣿
⣿⡿⢿⡀⠈⢹⡿⠶⣶⣼⡇ ⢀⣀⣀⣤⣴⣾⠟⠋⣡⣿⡟ ⢻⣶⠶⣿⣿⠛⢯
⠘⣿⣷⡈⢿⣦⣸⠇⢀⡿⠿⠿⡿⠿⠿⣿⠛⠋⠁ ⣴⠟⣿⣧⡀⠈⢁⣰⣿⠏ ⠏⡆
⢸⣿⢻⣦⣈⣽⣀⣾⠃ ⢸⡇ ⢸⡇ ⢀⣠⡾⠋⢰⣿⣿⣿⣿⡿⠟⠋
⠘⠿⢿⣿⣿⡟⠛⠃ ⣾ ⢸⡇⠐⠿⠋ ⣿⢻⣿⣿
⢸⣿⠁⢀⡴⠋ ⣿ ⢸⠇ ⠁⢸⣿⣿
⢀⣿⡿⠟⠋ ⣿ ⣸ ⢸⣿⣿
⢸⣿⣁⣀ ⣿⡀ ⣿ ⢀⣈⣿⣿
⠘⠛⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠿⠟⠛⠋
{% else %}
JEDI LOST - UNKNOWN STAR SYSTEM
{% endif %}
{% if ansible_hostname is defined %}
{{ group_names | first }}: {{ ansible_hostname }}
{% endif %}
-3
View File
@@ -44,9 +44,6 @@ PermitUserEnvironment no
SyslogFacility AUTH
LogLevel VERBOSE
# Banner
Banner /etc/ssh/banner
# SFTP
Subsystem sftp internal-sftp