OPNsense Forum

English Forums => General Discussion => Topic started by: Guybrush_Treepwood on May 09, 2023, 02:41:08 PM

Title: (auth-) issues using BitBucket for backups
Post by: Guybrush_Treepwood on May 09, 2023, 02:41:08 PM
Context:
1) Very satisfied OPNsense user for 10+ years
2) OPNsense 22.7.11_1 (APU4 device)
3) Required plugin name & status: os-git-backup (installed)   v1.0_3
4) Generated SSH keys (ed25519) on OPNsense device with following command:
    # ssh-keygen -t ed25519 -C "backup_up cfg OPNsense"
5) added id_ed25519.pub key to my personal BitBucket account.

Problem: unsuccessful backup of config (xml-) from opnsense node to a repo @ Bitbucket.org

From the generic logfile (filtered on 'error'): git-backup authentication failure (Warning: Permanently added 'bitbucket.org' (RSA) to the list of known hosts.\x0d Load key "/conf/backup/git/identity": invalid format\x0d <users_mail_address>@bitbucket.org: Permission denied (publickey).\x0d fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. )".

Solution direction:

Thnx for looking into this.

Guybrush_Treepwood.



Title: Re: (auth-) issues using BitBucket for backups
Post by: Martijn on June 12, 2023, 01:04:46 PM
by checking the source code I figured out how to get this working:

when using https, the url will become this: https://<username>:<token>@bitbucket.org/{workspace}/{repository}.git

According to the manual of Bitbucket, you need to use this:
https://x-token-auth:{repository_access_token}@bitbucket.org/{workspace}/{repository}.git
so the username should be "x-token-auth"
Title: Re: (auth-) issues using BitBucket for backups
Post by: Guybrush_Treepwood on September 06, 2023, 09:17:37 AM
Hi Martijn,

Thnx.  You have guided me into the right direction.  There are a few steps more to get to a working solution.  I know how to skin that cat.

./Guybrush_Treepwood
Title: Re: (auth-) issues using BitBucket for backups
Post by: gustvao on February 10, 2025, 07:44:47 PM
for anyone that was still struggling with bitbucket git backup:

URL: https://bitbucket.org/<workspace_name>/<repository_name>.git
Username: x-token-auth
Password: [ACCESS-TOKEN]

to generate the ACCESS-TOKEN:
https://bitbucket.org/<workspace_name>/<repository_name>/admin/access-tokens

cheers ;)