Browse Source

add last ssh logins to motd

python3
Edoardo Putti 7 years ago
parent
commit
f68e03eb31
2 changed files with 17 additions and 3 deletions
  1. +7
    -0
      files/last_ssh_login
  2. +10
    -3
      roles/ssh_server/tasks/main.yaml

+ 7
- 0
files/last_ssh_login View File

@ -0,0 +1,7 @@
#! /usr/bin/env bash
LOGINS=5
echo ""
echo "Last $LOGINS SSH accepted logins"
grep Accepted /var/log/auth.log | tail -n $LOGINS | cut -f 1,2,3,11,15,16,17,18,19,20,21,22 -d " "

+ 10
- 3
roles/ssh_server/tasks/main.yaml View File

@ -1,10 +1,17 @@
# We can not use include_role here since it not share the connection with the current role
# We can not use include_role here since it not
# share the connection with the current role
---
- include: roles/service/tasks/main.yaml
vars:
service_name: ssh
service_packages:
- openssh-server
- openssh-sftp-server
- openssh-server
- openssh-sftp-server
- name: Add last logins to MOTD
file:
dest: /etc/update-motd.d/11-last-ssh-login
src: last_ssh_login
- name: lookup user ca key
set_fact:


Loading…
Cancel
Save