Page 1 of 1

strange behavior with the --import-profile command

Posted: Fri Jan 27, 2023 7:52 pm
by gallakos

I created a bash script to add the VPN profiles, and randomly, I have the command --import-profile which does not run correctly.
On some computers, I have no response message.

On computers without output message. The profile is added in ~/Library/Application Support/OpenVPN Connect/profiles but it is not listed in the application or when I do a

Code: Select all

Even when restarting the OpenVPN, they are not listed.
The only thing in common is that a command does not create output. I have both M1 and Intel or computers that already have a profile installed and the gdpr is well accepted before any order.

Code: Select all

local OVPN="/Applications/OpenVPN Connect/OpenVPN Connect"

echo "User : $currentUser"

"$OVPN" --minimize --accept-gdpr 2>/dev/null

local profiles=$("$OVPN" --list-profiles 2>/dev/null)

if ! /usr/bin/grep -iEq '(?:"|\[)office_v2(?:"|\])' <<<"$profiles"; then


    if [ -e "$vpn_file" ]; then
        echo "Import..."
        result=$("$OVPN" --import-profile="$vpn_file" --name="office_v2" --pkp="$passphrase" 2>/dev/null)
        [[ "$result" =~ "success" ]] && echo "Import done" || echo "Error :" "$result"
        sleep 5
        "$OVPN" --list-profiles 2>/dev/null
        die ".ovpn file not exists"
    die "office_v2 is already done"


Re: strange behavior with the --import-profile command

Posted: Mon Jan 30, 2023 1:32 pm
by gallakos
Small update, after several attempts, I found how to bypass the bug.
The user has to manually quit the app and restart it. If I quit the app with --quit it doesn't work