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:
- Add one (1) additional section 'Bitbucket' to the "System: Configuration: Backups" page
- make new plugin 'os-bitbucket-backup' (based on the 'os-git-backup' plugin)
- Solve ( / clarify-) the authentication URL formatting for BitBucket.
- I would think that the following formatting could work:
- URL: 'ssh://bitbucket.org:<workspace_name>/<repo_name.git>'
Thnx for looking into this.
Guybrush_Treepwood.
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"
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
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 ;)