pptpd PPP VPN LOG

vpn 服务,但通过last查看的时候,只有登录的IP信息,

 
无法查看VPN客户端登录的用户名,登录地址,断开时间等信息。
 
请同事写了两个脚本。用于记录登录信息及登出信息。记一下,以备后用
 
修改ip-up ,ip-down文件,增加以下内容(export PATH 行后面),将日志信息记录到
/var/log/pptpd.log文件 中
 
vim /etc/ppp/ip-up 

echo "" >> /var/log/pptpd.log 
echo "IP UP        \ 
    `date -d today +%F_%T`        \ 
$6        \ 
$PEERNAME        \ 
$1        \ 
$5" >> /var/log/pptpd.log
 
vim /etc/ppp/ip-down文件。ip-down写入pptpd.log与最后一个 ip-up进行配对,以方便查看
 
 

 

tac /var/log/pptpd.log | while read line 
do 
        _tmphead=$(echo $line | cut -d" " -f1,2) 
        _tmptime=$(echo $line | cut -d" " -f3) 
        _tmpuser=$(echo $line | cut -d" " -f5) 
        if [ "IP UP" = "$_tmphead" -a "$PEERNAME" = "$_tmpuser" ] 
        then 
                _rep_line="$line" 
                sed -i "s/$line/$_rep_line\nIP DOWN        \ 
`date -d today +%F_%T`        \ 
$6        \ 
$PEERNAME        \ 
$1        \ 
$5/" /var/log/pptpd.log 
                break 
        fi 
done

Last modified onSaturday, 05 January 2013 10:06

( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169
Call Stack
#TimeMemoryFunctionLocation
10.0010413728{main}( ).../index.php:0
20.11874718232Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.11874718232Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.320712446208Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.321212470552Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.322012525880Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.322212554704require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.332712990112K2ControllerItem->execute( ).../k2.php:64
90.332712990112K2ControllerItem->display( ).../BaseController.php:710
100.342713715312K2ControllerItem->display( ).../item.php:78
110.342713715312K2ControllerItem->display( ).../controller.php:19
120.347014111680Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.349214132048K2ViewItem->display( ).../ViewController.php:102
140.411417099768K2ViewItem->display( ).../view.html.php:742
150.411417099768K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.417517279968include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701
  • Published in VPN
  • Read 3123 times

( ! ) Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478
Call Stack
#TimeMemoryFunctionLocation
10.0010413728{main}( ).../index.php:0
20.11874718232Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.11874718232Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.320712446208Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.321212470552Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.322012525880Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.322212554704require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.332712990112K2ControllerItem->execute( ).../k2.php:64
90.332712990112K2ControllerItem->display( ).../BaseController.php:710
100.342713715312K2ControllerItem->display( ).../item.php:78
110.342713715312K2ControllerItem->display( ).../controller.php:19
120.347014111680Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.349214132048K2ViewItem->display( ).../ViewController.php:102
140.411417099768K2ViewItem->display( ).../view.html.php:742
150.411417099768K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.417517279968include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701
back to top