feat: deprecate basic auth with syslog warning (#244)

Basic auth (username/password) has been supported since the plugin's
origin but TrueNAS API keys have been available since TrueNAS 12 (2020).
Sending credentials on every API call is a security risk and TrueNAS
may stop accepting it in future releases.

Log a syslog(warn) on every connection attempt that uses Basic Auth so
operators see the deprecation message in their Proxmox logs. The warning
links to issue #244 which tracks removal in v3.0.0.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Kevin Adams 2026-05-22 22:42:39 -04:00
parent ee708f3148
commit e9907d0041
1 changed files with 1 additions and 1 deletions

View File

@ -376,7 +376,7 @@ sub freenas_api_connect {
}
$host->{client}->addHeader('Authorization', 'Bearer ' . $scfg->{truenas_secret});
} else {
syslog("info", (caller(0))[3] . " : Authentication using Basic Auth");
syslog("warn", (caller(0))[3] . " : Authentication using Basic Auth (username/password) -- DEPRECATED. Generate an API key in TrueNAS and switch to token auth. Basic auth will be removed in v3.0.0.");
$host->{client}->addHeader('Authorization', 'Basic ' . encode_base64($scfg->{freenas_user} . ':' . $scfg->{freenas_password}));
}
# If using SSL, don't verify SSL certs