thrnz / docker-wireguard-pia

A Docker container for using Wireguard with PIA.
279 stars 54 forks source link

Lack of clear error message when account is locked #116

Closed BouleJaune closed 1 month ago

BouleJaune commented 1 month ago

Hello,

My PIA account has been locked due to unrelated reasons however docker-wireguard-pia does not give a clear error message saying the account is locked :

serv@nasflix31:~/docker-compose-nas$ sudo docker compose logs vpn
vpn  | Wed Sep  4 20:16:56 UTC 2024: Generating auth token
vpn  | Fetching next-gen PIA server list
vpn  | Verified OK
vpn  | Verified server list
vpn  | Registering public key with PIA endpoint; id: swiss, cn: zurich408, ip: 169.150.197.132
vpn  | Auth failed

The direct curl showing that the HTTP response is telling us that the account is locked.

serv@nasflix31:~/docker-compose-nas$ curl --silent --location --show-error --request POST --max-time "15"         'https://www.privateinternetaccess.com/api/client/v2/token'         --form "username=theuser"         --form "password=thepassword"

{"status":"error","code":"too_many_attempts","message":"Try again later."}

Would it be possible to improve the get_auth_token function in pia-auth.sh to echo a satisfying error message ?

Thanks in advance

thrnz commented 1 month ago

From those logs it looks like the auth token itself is generating fine, but is then failing when using it to register the Wireguard keys with the endpoint. I guess a locked account means you can still generate the token, but just not use it.

Having it print out the raw response when it fails there sounds like a good idea though, and should be easy enough to do. It should already be showing the response when generating the token itself fails.

thrnz commented 1 month ago

Added in 71ea5bab8fe4e178c07e3464193435ac9deeed9e