Skip to content

Commit 04419ce

Browse files
committed
Fix /etc/issue - it was not appended, add also /etc/motd
1 parent 9e3e5c3 commit 04419ce

File tree

4 files changed

+27
-11
lines changed

4 files changed

+27
-11
lines changed

tasks/configure-ssh.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
- name: Apply sshd configuration
22
become: yes
33
template:
4-
src: etc/ssh/sshd_config.j2
5-
dest: /etc/ssh/sshd_config
4+
src: "{{ item }}.j2"
5+
dest: "/{{ item }}"
6+
with_items:
7+
- etc/ssh/sshd_config
8+
- etc/issue
9+
- etc/motd
610

711
- name: Enable sshd on system startup
812
become: yes

templates/etc/issue.j2

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
=======================================
2-
== This server is managed by Ansible ==
3-
=======================================
1+
=====================================================================
2+
WARNING! You are attempting to reach a secured zone.
3+
Intrusion Prevention System is running on this machine.
4+
This server is MONITORED.
5+
=====================================================================
46

5-
Welcome to {{ ssh_host_title }}. {% if anonymize_logs %}
6-
- This server is anonymizing logs.{% endif %}{% if configure_firewall %}
7-
- UFW firewall is turned on, not all outgoing ports are allowed.{% endif %}{% if not ssh_gateway_ports %}
8-
- Forwarding SSH tunnels to the gateway is not allowed{% endif %}
7+
NOTICE: Multiple failed login attemps will result in a temporary ban.
8+
---------------------------------------------------------------------
99

10-
Have a nice day!

templates/etc/motd.j2

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
=======================================
2+
== This server is managed by Ansible ==
3+
=======================================
4+
5+
Welcome to {{ ssh_host_title }}. {% if anonymize_logs %}
6+
- This server is anonymizing logs.{% endif %}{% if configure_firewall %}
7+
- UFW firewall is turned on, not all outgoing ports are allowed.{% endif %}{% if not ssh_gateway_ports %}
8+
- Forwarding SSH tunnels to the gateway is not allowed{% endif %}{% if clear_shell_history %}
9+
- The bash, python and other tools history is erased periodically for security reasons{% endif %}
10+
11+
NOTICE: Users can have personalized SSH rules (eg. some users can have enabled forwarding or gateway ports)
12+
NOTICE: Any changes in /etc can be overwritten by Ansible deployment. Please add everything to Ansible roles and push deployment to manage server configuration
13+
14+
Have a nice day!

templates/etc/ssh/sshd_config.j2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ GatewayPorts {% if ssh_gateway_ports %}yes{% else %}no{% endif %}
1010

1111
AllowAgentForwarding yes
1212
Subsystem sftp /usr/lib/sftp-server
13-
AcceptEnv W_INFRA_AUTH
1413

1514
# kick off after idle time
1615
ClientAliveInterval {{ ssh_idle_time }}

0 commit comments

Comments
 (0)