Find the answer to your Linux question:
Results 1 to 6 of 6
Like Tree1Likes
  • 1 Post By Kloschüssel
I've got a PPTP server setup on my Ubuntu box. Was wondering if it was possible to get the IP address of a connecting client, whether the connection was successful ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    22

    Get IP Address and username of connecting VPN client


    I've got a PPTP server setup on my Ubuntu box.

    Was wondering if it was possible to get the IP address of a connecting client, whether the connection was successful or not, and the username of said connection?

    I've looked into using IPtables to do this, but it doesn't appear IPtables can execute commands based off rules (It will only log).

    Is there some other way of doing this, similar to the DHCP on commit function?

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,317
    what are you using for your VPN software? Perhaps it has its own internal logging facility that you could leverage. For example, I think w/OpenVPN, you can control logging aspects of the daemon, or have it send output to syslog. Have you already checked /var/log/messages and /var/log/secure for any indications of connection attempts?

  3. #3
    Just Joined!
    Join Date
    Sep 2007
    Posts
    22
    Hey Atreyu,

    Off topic, but are you the same Atreyu on the vbforums =D?

    Any way, I'm just using the stock standard PPTP server, "apt-get install pptpd". It logs in syslog the IP Address of the connecting client, but I'm unsure of where this is triggered, and if it's possible to inject my own command into there.

  4. #4
    Linux Engineer Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    773
    Now that it logs the ip address, you could parse the logfile (scheduled by crond) and do whatever you need to do whenever you see a change. i.e. roughly something like:

    Code:
    grep /var/log/syslog "someregex" > /tmp/blah
    if [ -e /tmp/blah2 ]; then
      $DIFFLINES=`diff /tmp/blah /tmp/blah2`
      if [ `echo $DIFFLINES | wc -l` -gt 0 ]; then
        # got a new line
        # do something here
        # preserve current status
        cp /tmp/blah /tmp/blah2
      fi
    fi
    Last edited by Kloschüssel; 07-09-2012 at 02:12 PM.
    Slyke likes this.

  5. #5
    Just Joined!
    Join Date
    Sep 2007
    Posts
    22
    Quote Originally Posted by Kloschüssel View Post
    Now that it logs the ip address, you could parse the logfile (scheduled by crond) and do whatever you need to do whenever you see a change. i.e. roughly something like:

    Code:
    grep /var/log/syslog "someregex" > /tmp/blah
    if [ /tmp/blah2 ]; then
      $DIFFLINES=`diff /tmp/blah /tmp/blah2`
      if [ `echo $DIFFLINES | wc -l` -gt 0 ]; then
        # got a new line
        # do something here
        # preserve current status
        cp /tmp/blah /tmp/blah2
      fi
    fi
    This would work... but it's kind of messy way of doing it. Is there a config, or way to get it to execute a command from the PPTP daemon?

  6. #6
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,317
    Quote Originally Posted by Slyke View Post
    Off topic, but are you the same Atreyu on the vbforums =D?
    nope. i couldn't VB my way out of a paper sack.

    Any way, I'm just using the stock standard PPTP server, "apt-get install pptpd". It logs in syslog the IP Address of the connecting client, but I'm unsure of where this is triggered, and if it's possible to inject my own command into there.
    maybe try enabling the debug option in the pptpd daemon. see here for details.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •