• For those using free openvpn config files that time out on slow connections

    From Marion@marion@facts.com to alt.comp.microsoft.windows,alt.comp.os.windows-10,alt.msdos.batch on Tue Jul 15 18:48:23 2025
    From Newsgroup: alt.msdos.batch

    All you need to run VPN on Windows are two simple free things:
    a. You need the free openvpn.exe executable
    b. You need a no-registration free text openvpn configuration file

    That's it.

    There are plenty of openvpn.exe binaries compiled for Windows.
    One of which is at https://openvpn.net/community-downloads/
    Available for Windows 7, Windows 8, Windows 10, and Windows 11
    <https://swupdate.openvpn.org/community/releases/OpenVPN-2.6.14-I002-amd64.msi>

    There are literally thousands upon thousands of free openvpn config files
    on the Internet, many of which are rather slow (but they're fast enough for textual Usenet); so for those using them on a slow connection, this script
    I just wrote may be useful to you if your attempts time out unnecessarily.

    This worked for me just now for about three thousand free VPN config files. However, if you want to add improvements for all to benefit, please do.
    See note in the sig for those who have epileptic fits from the word "VPN".

    @echo off
    REM 20250714; append_ovpn.bat; Adds wait commands to prevent early timeout.
    REM This appends any number of lines (with comments) to a set of *.ovpn files.
    REM Useful when TLS/UDP/TCP handshake negotiations timeout on slow networks.
    REM Tested by me only on Microsoft Windows 10 using free *.ovpn text files.
    REM The time-out problem was solved, surprisingly so, with these additions.
    REM
    setlocal enabledelayedexpansion

    :: This will look for *.ovpn config files in the current working directory.
    set "config_dir=%~dp0"
    :: This will use whatever config directory you specify to run the script in.
    REM set config_dir="C:\path\folder"

    echo Updating .ovpn files in: %config_dir
    echo.

    for %%F in (%config_dir%\*.ovpn) do (
    echo Appending to: %%~nxF
    call :append_lines "%%F"
    )

    echo.
    echo Done. All .ovpn files updated.
    pause
    exit /b

    :: Subroutine needed because a "for loop" viciously hates funky characters.
    REM The uname/pass is usually something like "vpn" & "vpn" on separate lines.
    REM The data-ciphers is up to the free openvpn servers you're dealing with.
    REM The rest of the lines are to enable patience in the negotiation process.
    :append_lines
    %1 echo.
    %1 echo auth-user-pass C:\\path\\config\\username_password.txt
    %1 echo data-ciphers AES-256-GCM:AES-128-GCM:AES-128-CBC
    %1 echo hand-window 120 ; extended TLS handshake wait (default=60)
    %1 echo connect-timeout 30 ; connection timeout (default=10)
    %1 echo connect-retry 10 ; retry delay (default=5)
    %1 echo connect-retry-max 5 ; max retries (default=8)
    %1 echo keepalive 10 60 ; ping every 10s, restart after 60s
    exit /b
    --
    For those who are triggered into epilepsy by the mere mention of VPN, we
    are all well aware that free VPNs might not be secure and they may or may
    not report all your Usenet posts to a TLA, etc., but if you're using VPN simply as a "proxy" for your IP address on Usenet, then those risks are
    lower since you don't need the encryption (and you can still get it using
    port 563 if you really are worried about your public messages in transit).

    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Marion@marion@facts.com to alt.comp.microsoft.windows,alt.comp.os.windows-10,alt.msdos.batch on Tue Jul 22 01:10:20 2025
    From Newsgroup: alt.msdos.batch

    On Tue, 15 Jul 2025 18:48:23 -0000 (UTC), Marion wrote :


    There are literally thousands upon thousands of free openvpn config files
    on the Internet, many of which are rather slow (but they're fast enough for textual Usenet); so for those using them on a slow connection, this script
    I just wrote may be useful to you if your attempts time out unnecessarily.

    For some of the thousands of free openvpen server config files out there, I
    was still having trouble connecting due to timeouts - which took more work.

    I've been testing the following which drastically cuts down on the number
    of free openvpn config files which fail simply due to a timeout problem.

    These get appended to the thousands of free openvpn config files
    using the script posted in the opening post to append them in one step.

    REM hand-window 120 ; extended TLS handshake wait (default=60)
    REM connect-timeout 30 ; connection timeout (default=10)
    REM connect-retry 10 ; retry delay (default=5)
    REM connect-retry-max 5 ; max retries (default=8)
    REM keepalive 10 60 ; ping every 10s, restart after 60s
    REM tls-timeout 120 ; extends TLS negotiation timeout (default=60)
    REM resolv-retry infinite ; retries DNS resolution if needed
    REM auth-retry interact ; allows retries without restarting
    REM explicit-exit-notify 2 ; informs UDP servers (only) on disconnect
    REM nobind ; prevents binding to local addresses if IP changes
    REM float ; allows client to accept server IP changes
    REM pull-filter ignore "ping" ; ignore server ping override of 3
    REM pull-filter ignore "ping-restart" ; ignore server ping override of 10

    In addition, depending on the server, you can specify the uname/passwd in
    two lines such as "vpn" on one line & "vpn" on the other line as needed.
    REM auth-user-pass C:\\path\\to\\two-line_uname-passwd_file.txt

    And, lastly, free VPN servers are notoriously fickle about ciphers, e.g.,
    REM data-ciphers AES-256-GCM:AES-128-GCM:AES-128-CBC
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Marion@marion@facts.com to alt.comp.microsoft.windows,alt.comp.os.windows-10,alt.msdos.batch on Wed Jul 23 21:10:19 2025
    From Newsgroup: alt.msdos.batch

    On Tue, 22 Jul 2025 01:10:20 -0000 (UTC), Marion wrote :


    These get appended to the thousands of free openvpn config files
    using the script posted in the opening post to append them in one step.

    Drat. I had to add one more to get around the common error of "No Route to Host", which turned out to be odd because it happened to working configs.

    echo route-delay 5 ; give OS time to solve "No Route to Host" (default=0)

    Basically you need to give Microsoft Windows a few seconds to set the route where the default of 0 can be too quick for Windows to respond fast enough.
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Marion@marion@facts.com to alt.comp.microsoft.windows,alt.comp.os.windows-10,alt.msdos.batch on Thu Jul 24 15:07:05 2025
    From Newsgroup: alt.msdos.batch

    On Wed, 23 Jul 2025 21:10:19 -0000 (UTC), Marion wrote :


    Basically you need to give Microsoft Windows a few seconds to set the route where the default of 0 can be too quick for Windows to respond fast enough.

    Here's another very useful batch file, not just for the thousands of free
    VPN server configs out there but for anyone who needs to *remove* lines.

    This comments out specific lines from thousands of existing files (where it doesn't matter if the line itself has comments at the end of that line).

    BEFORE:
    auth-retry interact ; allows retries without restarting
    pull-filter ignore "ping" ; try to ignore server ping of 3
    pull-filter ignore "ping-restart" ; try to ignore server ping of 10

    AFTER
    ;auth-retry interact ; allows retries without restarting
    ;pull-filter ignore "ping" ; try to ignore server ping of 3
    ;pull-filter ignore "ping-restart" ; try to ignore server ping of 10

    ALL OTHER LINES LEFT ALONE (works on all *.ovpn files in cwd & deeper)

    @echo off
    REM commentovpn.bat (comments out specific lines found in cwd files & below)
    setlocal enabledelayedexpansion

    REM ##########################################################################
    REM ### WARNING: BACK UP YOUR OVPN FILES BEFORE RUNNING THIS SCRIPT! ###
    REM ### This script modifies .ovpn files to improve OpenVPN connection ###
    REM ### reliability by commenting out specific directives that might ###
    REM ### conflict with server settings. ###
    REM ##########################################################################

    REM Set the TARGET_DIR to the directory where your .ovpn files are located.
    REM If you leave it as '.', it will process files in the same directory as the script
    REM and all its subdirectories.
    set "TARGET_DIR=."

    echo.
    echo Starting to process .ovpn files in "%TARGET_DIR%" and its subdirectories...
    echo.

    for /r "%TARGET_DIR%" %%F in (*.ovpn) do (
    echo Processing "%%F"...
    set "TEMP_FILE=%%F.tmp"
    set "MODIFIED_FLAG=0" ; Flag to track if any changes were made to the current file

    REM Create a temporary file with the modified content
    (
    for /f "usebackq delims=" %%i in ("%%F") do (
    set "original_line=%%i"
    set "processed_line=!original_line!" ; Start with the original line for this iteration
    set "line_already_modified=0" ; Flag for current line to prevent multiple comments on one line

    REM Check if the line is already commented out. If so, don't modify it.
    if "!original_line:~0,1!"==";" (
    REM Do nothing, line is already commented.
    ) else if "!original_line:~0,1!"=="#" (
    REM Do nothing, line is already commented.
    ) else (
    REM The line is not commented, so check if it contains any of our target directives.

    REM Check for 'pull-filter ignore "ping"'
    echo "!original_line!" | findstr /I /L /C:"pull-filter ignore \"ping\"" >nul
    if not errorlevel 1 (
    set "processed_line=;!original_line!"
    set "MODIFIED_FLAG=1"
    set "line_already_modified=1"
    )

    REM Check for 'pull-filter ignore "ping-restart"'
    if "!line_already_modified!"=="0" (
    echo "!original_line!" | findstr /I /L /C:"pull-filter ignore \"ping-restart\"" >nul
    if not errorlevel 1 (
    set "processed_line=;!original_line!"
    set "MODIFIED_FLAG=1"
    set "line_already_modified=1"
    )
    )

    REM Check for 'auth-retry interact'
    if "!line_already_modified!"=="0" (
    echo "!original_line!" | findstr /I /L /C:"auth-retry interact" >nul
    if not errorlevel 1 (
    set "processed_line=;!original_line!"
    set "MODIFIED_FLAG=1"
    set "line_already_modified=1"
    )
    )
    )

    REM Always echo the (potentially modified) line to the temporary file
    echo !processed_line!
    )
    ) > "!TEMP_FILE!"

    REM Replace the original file with the modified temporary file, but only if changes were made
    if "!MODIFIED_FLAG!"=="1" (
    move /y "!TEMP_FILE!" "%%F" >nul
    echo Modified "%%F".
    ) else (
    del "!TEMP_FILE!" >nul
    echo No changes needed for "%%F".
    )
    echo.
    )

    echo All .ovpn files processed.
    echo.
    echo Remember to restart your OpenVPN client(s) for changes to take effect.
    pause
    --
    Obviously this works for all text files of any extension & content,
    which is why it's a generally useful script for commenting out
    spedific lines in any number of files in any Windows hierarchy.
    --- Synchronet 3.21a-Linux NewsLink 1.2