Disconnect connected user

This forum is for admins who are looking to build or expand their OpenVPN setup.
Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
robmorin
OpenVpn Newbie
Posts: 2
Joined: Thu Apr 20, 2017 1:01 pm

Disconnect connected user

Post by robmorin » Thu Apr 20, 2017 1:06 pm

Hello all, I tried to search the forum for this , but most search terms come up as too common??

What i would like to know how to do is, how to drop/disconnect a specific connected user/client?

So joe blow is connected, he did something bad or he was fired, but is currently connected, i need to be able to drop his connection without disturbing others that are connected.

How do i do this?

Thanks..

Pippin
OpenVPN Expert
Posts: 256
Joined: Wed Jul 01, 2015 8:03 am

Re: Disconnect connected user

Post by Pippin » Thu Apr 20, 2017 2:19 pm

Revoke the user`s certificate or write disable in user`s ccd file, I guess the first option is how it should be done.
Then log on to management interface and type help:
login as: root
root@xxx.xxx.xxx.xxx's password:

ovpn01b> telnet 127.0.0.1 1197

>INFO:OpenVPN Management Interface Version 1 -- type 'help' for more info
help
Management Interface for OpenVPN 2.3.6 armle-unknown-linux-gnu [SSL (OpenSSL)] [LZO] [EPOLL] [MH] [IPv6] built on Aug 11 2015
Commands:
...
...
kill cn : Kill the client instance(s) having common name cn.
kill IP:port : Kill the client instance connecting from IP:port.
...
...
END
If you kill the connection without ccd disable or revoking certificate, the client can still reconnect.
I`m sure there will be better ways...let`s hear it from the knowledgeable :)

robmorin
OpenVpn Newbie
Posts: 2
Joined: Thu Apr 20, 2017 1:01 pm

Re: Disconnect connected user

Post by robmorin » Thu Apr 20, 2017 6:05 pm

Apparently i cannot connect to port 1197 on localhost. :)

Pippin
OpenVPN Expert
Posts: 256
Joined: Wed Jul 01, 2015 8:03 am

Re: Disconnect connected user

Post by Pippin » Thu Apr 20, 2017 6:51 pm

Hello,

For example in server config:

Code: Select all

management 127.0.0.1 1197
Please read --management in manual:
https://openvpn.net/index.php/open-sour ... nuals.html
And:
https://openvpn.net/index.php/open-sour ... rface.html
https://github.com/OpenVPN/openvpn/tree/master/doc

Another option could be to block the user`s WAN IP in firewall...

Post Reply