On Wednesday, June 8th, 2022 at 05:54, Dan Cyr <rabidfly@hotmail.com> wrote:
> Hi,
> Signoff: Do what you like with what is provided. Pretend you found it on the street.
> I'm kind of an old school admin and know nothing of how to use git pulls/pushes. I'm providing a Unified Diff Patch.
> This adds a feature to Easy-TLS that allows the execution of custom Client-Connect/Disconnect scripts. This gives us back control to runs scripts that Easy-TLS took away. I use it to bring up/down custom iptables rules based on the OpenVPN config file, or client-config-dir, '^push "route *"' commands.
> Patch is both attached and inline below (not sure how Hotmail will wack it). I hope you add this to your program so it helps others and so I don't have to maintain it myself! 🙂
> Thanks for all you do with OpenVPN!!Dan Cyr
>
> -- BEGIN INLINE PATCH --
> diff -ur easytls-2.8.0/easytls easytls/easytls--- easytls-2.8.0/easytls 2022-05-27 13:27:30.364560488 -0700+++ easytls/easytls 2022-06-07 21:27:12.377525173 -0700@@ -7521,6 +7521,7 @@ xaprint "#key_hwaddr_required=1" xaprint "ENABLE_CONN_TRAC=1" xaprint "VERBOSE_CONN_TRAC=1"+ xaprint "#CUSTOM_CLIENT_CONNECT=/path/to/custom-client-connect.sh" xdprint "EASYTLS_tmp_dir=\"${EASYTLS_tmp_dir}\"" } > "${EASYTLS_CLICON_VARS}" || die "Failed to create vars file"
>
> @@ -7529,6 +7530,7 @@ xaprint "EASYTLS_VERBOSE=1" xaprint "ENABLE_CONN_TRAC=1" xaprint "VERBOSE_CONN_TRAC=1"+ xaprint "#CUSTOM_CLIENT_DISCONNECT=/path/to/custom-client-disconnect.sh" xdprint "EASYTLS_tmp_dir=\"${EASYTLS_tmp_dir}\"" } > "${EASYTLS_CLIDIS_VARS}" || die "Failed to create vars file"
>
> diff -ur easytls-2.8.0/easytls-client-connect.sh easytls/easytls-client-connect.sh--- easytls-2.8.0/easytls-client-connect.sh 2022-05-17 09:25:55.066727800 -0700+++ easytls/easytls-client-connect.sh 2022-06-07 20:29:35.859517938 -0700@@ -918,6 +918,17 @@
>
> }
>
> +custom_client_connect()+{+ client_connect="${CUSTOM_CLIENT_CONNECT}"++ # Execute Custom client-connect script+ if [ -x "${client_connect}" ]; then+ ${client_connect}+ fi+}++ #######################################
>
> # Initialise@@ -1389,6 +1400,12 @@ verbose_print "${local_date_ascii} <EXOK> ${status_msg}" [ -z "${EASYTLS_FOR_WINDOWS}" ] || "${EASYTLS_PRINTF}" "%s\n" \ "${status_msg}" > "${EASYTLS_WLOG}"++ # Custom client-connect script+ if [ -n "${CUSTOM_CLIENT_CONNECT}" ]; then+ custom_client_connect || die "custom_client_connect FAIL" 180+ fi+ exit 0 fi
>
> diff -ur easytls-2.8.0/easytls-client-disconnect.sh easytls/easytls-client-disconnect.sh--- easytls-2.8.0/easytls-client-disconnect.sh 2022-05-17 09:26:09.236861402 -0700+++ easytls/easytls-client-disconnect.sh 2022-06-07 21:38:56.461246424 -0700@@ -604,6 +604,15 @@ EASYTLS_KILL_FILE="${temp_stub}-kill-client" }
>
> +custom_client_disconnect()+{+ client_disconnect="${CUSTOM_CLIENT_DISCONNECT}"++ # Execute client-disconnect script+ if [ -x "${client_disconnect}" ]; then+ ${client_disconnect}+ fi+}
>
> #######################################@@ -756,6 +765,12 @@ verbose_print "${local_date_ascii} <EXOK> ${status_msg}" [ -z "${EASYTLS_FOR_WINDOWS}" ] || "${EASYTLS_PRINTF}" "%s\n" \ "${status_msg}" > "${EASYTLS_WLOG}"++ # Custom client-disconnect script+ if [ -n "${CUSTOM_CLIENT_DISCONNECT}" ]; then+ custom_client_disconnect || die "custom_client_disconnect FAIL" 180+ fi+ exit 0 fi
>
> -- END INLINE PATCH --
>