Zabbix changed authentication method #1003
Labels
No labels
blocked
breaking
bug
data loss
design finalized
good first issue
new feature area
question / support
security
waiting for response
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
borgmatic-collective/borgmatic#1003
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What I'm trying to do and why
I use Borgmatic Docker to back up my MailCow using this tutorial: Borgmatic Backup. This works really well—thanks for that!
Now, I want to log the backup states in Zabbix (7.2). I modified my config file as described here.
I think I did everything correctly, but Zabbix doesn't receive any data. After some research, I found out that Zabbix changed something about the authentication methods in version 7.2.
My question: Is Borgmatic compatible with Zabbix 7.2?
Steps to reproduce
No response
Actual behavior
No response
Expected behavior
No response
Other notes / implementation ideas
No response
borgmatic version
No response
borgmatic installation method
Docker Container
Borg version
No response
Python version
No response
Database version (if applicable)
No response
Operating system and version
Debian 12
The borgmatic Zabbix hook was initially implemented around the Zabbix 7.0 era—so prior to the 7.2 release. If 7.2 changed the API authentication method in a non-backwards-compatible way, then it's entirely possible that the hook won't work with it. Do you happen to have details on the authentication changes? I tried looking through some of the 7.2.x release notes but didn't find anything definitive.
Also, it may help to debug the problem to run borgmatic with
--verbosity 2and then paste the (redacted) logs here. Seeing your borgmatic Zabbix configuration would also help. Thanks!Since Zabbix 7.2, the "auth" parameter is no longer available. I have also read about some issues related to the Zabbix API and Grafana since version 7.2. I’m not sure to what extent the changes from Zabbix affect Borgmatic. Maybe I entered something incorrectly, but I don’t think so. My current configuration looks like this:
/opt/mailcow-dockerized/data/conf/borgmatic/etc/config.yaml
source_directories:
- /mnt/source/vmail
- /mnt/source/crypt
- /mnt/source/redis
- /mnt/source/rspamd
- /mnt/source/postfix
repositories:
- path: ssh://xxxxxx@xxxxx.xxxxxxx.xx:123/./mailcow
label: storagebox
exclude_patterns:
- '/mnt/source/postfix/public/'
- '/mnt/source/postfix/private/'
- '/mnt/source/rspamd/rspamd.sock'
keep_hourly: 24
keep_daily: 7
keep_weekly: 4
keep_monthly: 6
mariadb_databases:
- name: mailcow
username: mailcow
password: xxxxxxxxxxxxxx
options: "--default-character-set=utf8mb4 --skip-ssl"
list_options: "--skip-ssl"
restore_options: "--skip-ssl"
zabbix:
server: https://my.zabbix.server/api_jsonrpc.php
Authorization in Zabbix 7.0: Documentation
Authorization in Zabbix 7.2: Documentation
Problems in Grafana: Forum and Forum
https://www.zabbix.com/documentation/current/en/manual/api#authorization-methods
https://www.zabbix.com/documentation/7.0/en/manual/api#authorization-methods
https://github.com/grafana/grafana-zabbix/issues/1914#issuecomment-2532119209
https://github.com/grafana/grafana-zabbix/issues/1929
Thanks for all the details! That really helps. I'll look into implementing Zabbix 7.2 support if nobody else does first. It's convenient that Zabbix 7.0 appears to also support the
Authorizationheader as well, so the borgmatic Zabbix hook could likely just switch to using that for auth and thereby work with both 7.0 and 7.2.Thanks for your help. It seems I didn’t do anything wrong after all.:-)
Would you happen to have a Zabbix 7.2 instance I can use briefly for development/testing? I would use Zabbix Cloud, but they don't offer 7.2 yet. I don't need direct access to the web UI as long as I can get a temporary API token and host/key or item ID to write to.
It's okay if the answer is no; I just thought I'd ask since it'd make implementing this ticket a lot easier, given that I'm not a Zabbix user myself.
So you only need access to the API via token? Is access to the "history-push" function of the API sufficient, or do you need any other functions?
Yes, API access via token should be sufficient. (The code also supports
username/passwordlogin, but I wasn't planning on using that for this ticket.) As for your second question, it looks like the only two API methods that borgmatic uses so far with Zabbix 7.0 arehistory.pushanduser.login. But havinguser.logoutaccess may also be a good idea too.I'm guessing that'll be sufficient for 7.2 as well. Thanks!
You have a new mail ;-)
Thanks so much! I'm in, at least to the point of getting permissions errors, hopefully due to not using the correct Zabbix 7.2 authorization mechanism yet.
This is now implemented in main and will be part of the next release! Thanks again for bringing to this to my attention and for your help in supporting the development. And please feel free to delete the dev account at your leisure.
Thanks a lot, Dan! If you ever need someone with a Zabbix installation again, feel free to reach out.
Released in borgmatic 1.9.13!