<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Digital Journal &#187; ssh login notification</title>
	<atom:link href="http://digitaljournal.sg/wp/?feed=rss2&#038;tag=ssh-login-notification" rel="self" type="application/rss+xml" />
	<link>http://digitaljournal.sg/wp</link>
	<description>My Digital Journal</description>
	<lastBuildDate>Mon, 20 Oct 2014 00:32:27 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<item>
		<title>Send email notification on successful ssh login using ssmtp</title>
		<link>http://digitaljournal.sg/wp/?p=133</link>
		<comments>http://digitaljournal.sg/wp/?p=133#comments</comments>
		<pubDate>Thu, 15 Nov 2012 01:33:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Network]]></category>
		<category><![CDATA[Tips&Info]]></category>
		<category><![CDATA[Send email notification on successful ssh login using ssmtp]]></category>
		<category><![CDATA[ssh login notification]]></category>
		<category><![CDATA[ssmtp tips]]></category>

		<guid isPermaLink="false">http://digitaljournal.sg/wp/?p=133</guid>
		<description><![CDATA[Sometime i wants to know who is login and when user login to my server  but i don&#8217;t want to setup and run my own mail server, this can be done easily by using tcpwrapper and ssmtp , first make sure ssmtp is installed # dpkg -l&#124;grep ssmtp iF  ssmtp                                  2.64-4fakesync1                                 extremely simple MTA to [...]]]></description>
			<content:encoded><![CDATA[<p>Sometime i wants to know who is login and when user login to my server  but i don&#8217;t want to setup and run my own mail server, this can be done easily by using tcpwrapper and ssmtp , first make sure ssmtp is installed</p>
<p><strong><em># dpkg -l|grep ssmtp</em></strong><br />
iF  ssmtp                                  2.64-4fakesync1                                 extremely simple MTA to get mail off the sys</p>
<p>&nbsp;</p>
<p>if ssmtp is not installed yet, install it by using</p>
<p><em><strong># apt-get install ssmtp</strong></em></p>
<p>&nbsp;</p>
<p>If you are using Gmail account , change the <em>root</em>, <em>authuser</em>, and <em>authpass</em> options to the email address, username, and password of your email account. If you’re using another mail service you’ll need to change <em>mailhub</em> to the relevant SMTP server.</p>
<p>edit /etc/ssmtp/ssmtp.conf and add these lines</p>
<p><code>--------------------------------------------<br />
root=alert@example.com<br />
mailhub=smtp.example.com:587<br />
rewriteDomain=<br />
hostname=smtp.example.com:587<br />
UseSTARTTLS=YES<br />
UseTLS=YES<br />
AuthUser=alert@example.com<br />
AuthPass=password<br />
AuthMethod=LOGIN<br />
FromLineOverride=YES # optional<br />
--------------------------------------------</code></p>
<p>&nbsp;</p>
<p>Change the &#8216;From&#8217; text by editing /etc/passwd to receive mail from &#8216;root@server1.example.com&#8217; instead of just &#8216;root&#8217;.<br />
<strong># chfn -f root@server1.example.com root</strong><em><br />
</em></p>
<p>edit /etc/ssmtp/revaliases and add this line or add more line for another user<br />
<code>--------------------------------------------<br />
# sSMTP aliases<br />
#<br />
# Format:    local_account:outgoing_address:mailhub<br />
#<br />
# Example: root:your_login@your.domain:mailhub.your.domain[:port]<br />
# where [:port] is an optional port number that defaults to 25.<br />
root:alert@example.com:smtp.example.com:587<br />
--------------------------------------------</code></p>
<p>to test it</p>
<p><em><strong># echo &#8220;test send email using ssmtp|mail -s &#8220;TEST&#8221; alert@example.com</strong></em></p>
<p>&nbsp;</p>
<p>once you are able to receive that test message, proceed to edit /etc/hosts.allow and add these 2 lines, so you will be notified if someone login to your sever</p>
<p><code>--------------------------------------------<br />
SSHD: ALL: spawn (/bin/echo "SSH connection to %H from %h[%a]" | \<br />
/usr/bin/mail -s "SSH Login Alert [server1.example.com]" alert@example.com)<br />
--------------------------------------------</code></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://digitaljournal.sg/wp/?feed=rss2&#038;p=133</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
