summaryrefslogtreecommitdiff
path: root/src/migration-scripts
diff options
context:
space:
mode:
authorOleksandr Kuchmystyi <o.kuchmystyi@vyos.io>2026-11-02 16:41:41 +0300
committerOleksandr Kuchmystyi <o.kuchmystyi@vyos.io>2026-11-11 10:29:46 +0300
commitdf579f5727d93837fe9feee70dbcb3814bdbabc6 (patch)
tree77eeb145bb87dd063b4b8e52269b7d189df377e1 /src/migration-scripts
parentf46c01ccdc9075602546873c4d1bbdaea8df32eb (diff)
downloadvyos-1x-df579f5727d93837fe9feee70dbcb3814bdbabc6.tar.gz
vyos-1x-df579f5727d93837fe9feee70dbcb3814bdbabc6.zip
telegraf: T9329: Add PKI based TLS options for InfluxDB output
Add a reusable `tls` node for Telegraf outputs and use it for InfluxDB: `ca-certificate`, `certificate`, `server-name` and `insecure`. Referenced PKI objects are written to `/run/telegraf/certs`.
Diffstat (limited to 'src/migration-scripts')
-rw-r--r--src/migration-scripts/monitoring/2-to-338
1 files changed, 38 insertions, 0 deletions
diff --git a/src/migration-scripts/monitoring/2-to-3 b/src/migration-scripts/monitoring/2-to-3
new file mode 100644
index 000000000..cd85374d6
--- /dev/null
+++ b/src/migration-scripts/monitoring/2-to-3
@@ -0,0 +1,38 @@
+# Copyright (C) VyOS Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# T9329: The InfluxDB output used to unconditionally skip verification of the
+# remote server certificate (`insecure_skip_verify = true`). Certificate
+# verification is now enabled by default and can be configured via the new
+# 'tls' node. Preserve the previous behavior for existing HTTPS endpoints by
+# explicitly setting 'tls insecure'.
+
+from vyos.configtree import ConfigTree
+
+base = ['service', 'monitoring', 'telegraf', 'influxdb']
+
+
+def migrate(config: ConfigTree) -> None:
+ url_path = base + ['url']
+ if not config.exists(url_path):
+ # Nothing to do
+ return
+
+ # Prevent migration for already enabled TLS
+ if config.exists(base + ['tls']):
+ return
+
+ url = config.return_value(url_path)
+ if url.lower().startswith('https://'):
+ config.set(base + ['tls', 'insecure'])