Linux pptp vpn record login Username

Source: Internet
Author: User
Tags echo command


Most of the logs for logging on to the linux pptp vpn user name pptpd are stored in files such as/var/log/messages,/var/log/daemon. However, after careful reading, the user name is not found in the logs, I don't know which account the user used to log on. So I looked at pppd man and found some environment variables, such as IPLOCAL and IPREMOTE. After testing, I found that PEERNAME is the user name, in this way, you can record in/etc/ppp/ip-up and/etc/ppp/ip-down, and no user ip address is found. Later, we found that pppd is a sub-process of spawn to control the pptpd connection. The sub-process command line already contains the user's ip address. After many experiments, the command line parameter is found when ip-up is called. $6 is the user's ip address, so I wrote it in ip-up by using the echo command, it is a complete log of pptpd, including time, source ip address, user name, and ip address of the allocated ppp. My specific operations are as follows: add the script www.2cto.com Java code 1 to/etc/ppp/ip-up and/etc/ppp/ip-down. echo "time: 'date-d today + % F _ % t'">/var/log/pptpd. log 2. echo "clientIP: $6" >>/ var/log/pptpd. log 3. echo "username: $ PEERNAME">/var/log/pptpd. log 4. echo "device: $1" >>/ var/log/pptpd. log 5. echo "vpnIP: $4" >>/ var/log/pptpd. log 6. echo "assignIP: $5" >>/ var/log/pptpd. log author gaoming655

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.