0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【kali】VPNに接続したときに通知する

0
Posted at

TL;DR

Bug BountyやPentestでl2tp VPNを使用する際に、「いつのまにか切れてしまっている」ことがあります。
これは大惨事になりかねないので、接続・切断時に通知させるロジックを作りました。

※User名のkaliは好きに変えてください。

接続時

以下を /etc/ppp/ip-up.d/99-vpn-notify に書き込み、実行権限をつける。

#!/bin/bash

USER_NAME="kali"
USER_ID=1000
BUS="unix:path=/run/user/$USER_ID/bus"

export DISPLAY=:0
export DBUS_SESSION_BUS_ADDRESS=$BUS

sudo -u "$USER_NAME" \
  DISPLAY=:0 \
  DBUS_SESSION_BUS_ADDRESS=$BUS \
  notify-send -u normal -t 5000 \
  -i /usr/share/icons/gnome/256x256/status/network-receive.png \
  "VPN connected" "VPN connection has been established."

切断時

接続時

以下を /etc/ppp/ip-down.d/99-vpn-notify に書き込み、実行権限をつける。

#!/bin/bash

USER_NAME="kali"
USER_ID=1000
BUS="unix:path=/run/user/$USER_ID/bus"

export DISPLAY=:0
export DBUS_SESSION_BUS_ADDRESS=$BUS

sudo -u "$USER_NAME" \
  DISPLAY=:0 \
  DBUS_SESSION_BUS_ADDRESS=$BUS \
  notify-send -u critical -t 10000 \
  -i /usr/share/icons/gnome/256x256/status/network-error.png \
  "VPN disconnected" "VPN you connected is now disconnected."

課題

どのVPNに接続したのか取得するのが難しかったので、そこは断念......。
今後実装したい。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?