L
L
L0ns2022-03-30 01:03:59
linux
L0ns, 2022-03-30 01:03:59

Trouble receiving telegram notifications when connecting to a VPN server?

I want to set up notifications in telegrams when connecting to a vpn server. I do it according to the instructions https://www.your-it-consultant.ru/post/libreswan-i...
Created a bot, created a script, made it executable, launched the script, a test notification came to the cart, now you need to bind it to connect events and disconnect, I do as described in the instructions in the /usr/lib/ipsec/_updown file and add the following lines:

case "$PLUTO_VERB:$1" in
....
up-client:)
        # connection to my client subnet coming up
        # If you are doing a custom version, firewall commands go here.
       /usr/local/bin/tg_say.sh User ${PLUTO_USERNAME} with ip ${PLUTO_PEER} is CONNECTED
        ;;
down-client:)
        # connection to my client subnet going down
        # If you are doing a custom version, firewall commands go here.
        /usr/local/bin/tg_say.sh User ${PLUTO_USERNAME} with ip ${PLUTO_PEER} is disconnected
        ;;
....


But for some reason, when connecting to vpn, notifications do not come to the cart, tell me, maybe something else needs to be registered somewhere?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Karabanov, 2022-03-30
@karabanov

Because the article is about Pluto and IKEv1, and you use IKEv2 and Charon.

L
L0ns, 2022-04-01
@L0ns

Just in case, I’ll write a solution here: I
added a parameter to /etc/ipsec.conf:
leftupdown=/usr/lib/ipsec/_updown
and added 2 lines in the /usr/lib/ipsec/_updown script itself:

...
case "$PLUTO_VERB:$1" in
...
up-client:)
        # connection to my client subnet coming up
        # If you are doing a custom version, firewall commands go here.
        /usr/local/bin/tg_say.sh User ${PLUTO_USERNAME} with ip ${PLUTO_PEER} is CONNECTED
        ;;
down-client:)
        # connection to my client subnet going down
        # If you are doing a custom version, firewall commands go here.
        /usr/local/bin/tg_say.sh User ${PLUTO_USERNAME} with ip ${PLUTO_PEER} is disconnected
...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question