Mikrotik – Send email with information about clients connecting to WiFi network

Mikrotik devices give a lot of configuration options to play with, and this post is one of those configuration which automatically register information about login/logouts in wifi network, and at daily basis send them to custom email address.

Let assume you have already configure email capability in mikrotik system.

Next we want to set topic of information we want to store to file (ex. wifi.log):

Next lets create script that will be backuping log file, send it to your email account, delete backup to free up some space and delete user that will do those things to not make it a easy target:

 

Don’t forget to setup scheduler that will run our script on daily basis:

 

Facebooktwittergoogle_plusreddit

Linux – Monitoring sendmail function (php) usage

Often we can encounter server that started to send spam (infected page, virus inside php file, bad plugin).

If its our own server we can very easily monitor usage of sendmail which is commonly used in php to send mails, and we will do it with usage of simply ‘wrapper’ .

 

1. Create /usr/local/bin/phpsendmail:

Lets check where is sendmail:

If its not in this localization /usr/sbin/sendmail then we will need to edit above script

Setup right permissions for file:

2.  Next we need edit php.ini file

If we use PHP as CGI or suPHP, you need edit also /etc/php5/cgi/php.ini

Restart service:

3. Lets test our wrapper

Create mailtest.php in www directory ex. /var/www/example.com/public_html

Open file in browser

Check if you have something in log file:

 

Facebooktwittergoogle_plusreddit

Linux – change Pure-FTPD log path

Default pure-ftpd settings store logs thru  ‘syslog’. Thanks to this we can forward logs inside syslog/rsyslog.

 

Facebooktwittergoogle_plusreddit