Skip to content

Instantly share code, notes, and snippets.

@frogkind
Last active June 25, 2024 11:43
Show Gist options
  • Save frogkind/8ec0d09caaa26bbf606c8c6b6b2b3fea to your computer and use it in GitHub Desktop.
Save frogkind/8ec0d09caaa26bbf606c8c6b6b2b3fea to your computer and use it in GitHub Desktop.

Revisions

  1. frogkind revised this gist Jun 25, 2024. No changes.
  2. frogkind revised this gist Jun 25, 2024. No changes.
  3. frogkind created this gist Jun 25, 2024.
    17 changes: 17 additions & 0 deletions openvpn.user
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    #!/bin/sh
    #
    # This file is interpreted as shell script.
    # Put your custom openvpn action here, they will
    # be executed with each opevnp event.
    #
    # $ACTION
    # <down> down action is generated after the TUN/TAP device is closed
    # <up> up action is generated after the TUN/TAP device is opened
    # $INSTANCE Name of the openvpn instance which went up or down

    if [[ "$ACTION" == "up" && "$2" == "tun0" ]] ; then
    uci set tinyproxy.@tinyproxy[0].Bind=$5
    uci commit tinyproxy
    service tinyproxy restart
    logger -t "openvpn($INSTANCE)" -p daemon.notice "set tinyproxy bind ip $5"
    fi