Merge pull request #3 from atomaka/atomaka/feature/email-logins
Send email on user login
This commit is contained in:
commit
511cb12123
2 changed files with 43 additions and 0 deletions
36
files/profile
Normal file
36
files/profile
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
# /etc/profile: system-wide .profile file for the Bourne shell (sh(1))
|
||||||
|
# and Bourne compatible shells (bash(1), ksh(1), ash(1), ...).
|
||||||
|
|
||||||
|
if [ "$PS1" ]; then
|
||||||
|
if [ "$BASH" ] && [ "$BASH" != "/bin/sh" ]; then
|
||||||
|
# The file bash.bashrc already sets the default PS1.
|
||||||
|
# PS1='\h:\w\$ '
|
||||||
|
if [ -f /etc/bash.bashrc ]; then
|
||||||
|
. /etc/bash.bashrc
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ "`id -u`" -eq 0 ]; then
|
||||||
|
PS1='# '
|
||||||
|
else
|
||||||
|
PS1='$ '
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# The default umask is now handled by pam_umask.
|
||||||
|
# See pam_umask(8) and /etc/login.defs.
|
||||||
|
|
||||||
|
if [ -d /etc/profile.d ]; then
|
||||||
|
for i in /etc/profile.d/*.sh; do
|
||||||
|
if [ -r $i ]; then
|
||||||
|
. $i
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
unset i
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Send an email when someone logs in
|
||||||
|
if [ -n "$SSH_CLIENT" ]; then
|
||||||
|
remote=$(echo $SSH_CLIENT | awk '{ print $1 }')
|
||||||
|
echo | mail -s "SSH Login From ${USER}@${remote}" atomaka@gmail.com
|
||||||
|
fi
|
|
@ -40,6 +40,7 @@ user { 'jeff':
|
||||||
# PACKAGES
|
# PACKAGES
|
||||||
package { 'mosh': }
|
package { 'mosh': }
|
||||||
package { 'zsh': }
|
package { 'zsh': }
|
||||||
|
package { 'mailutils': }
|
||||||
|
|
||||||
# CLASSES
|
# CLASSES
|
||||||
include augeas
|
include augeas
|
||||||
|
@ -106,3 +107,9 @@ file { '/home/jeff/web':
|
||||||
target => '/var/www/tc362.atomaka.com',
|
target => '/var/www/tc362.atomaka.com',
|
||||||
require => [ User['jeff'], File['/var/www/tc362.atomaka.com'] ],
|
require => [ User['jeff'], File['/var/www/tc362.atomaka.com'] ],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
file { '/etc/profile':
|
||||||
|
ensure => present,
|
||||||
|
content => file('/tmp/puppet/files/profile'),
|
||||||
|
require => Package['mailutils'],
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue