{"id":256,"date":"2025-03-18T00:09:27","date_gmt":"2025-03-17T23:09:27","guid":{"rendered":"https:\/\/tillnet.se\/?p=256"},"modified":"2025-03-18T00:16:11","modified_gmt":"2025-03-17T23:16:11","slug":"encrypt-communication-between-zabbix-agent2-and-zabbix-server-7-0-lts-with-psk","status":"publish","type":"post","link":"https:\/\/www.tillnet.se\/index.php\/2025\/03\/18\/encrypt-communication-between-zabbix-agent2-and-zabbix-server-7-0-lts-with-psk\/","title":{"rendered":"Encrypt communication between Zabbix Agent2 and Zabbix Server 7.0 LTS with PSK"},"content":{"rendered":"\n<p>These instructions are for Ubuntu 24.04 LTS but would work on other versions and flavours with some modifications.<\/p>\n\n\n\n<p>We&#8217;ll start on the client side. Open a terminal or connect via SSH. Either prefix all commands with <code>sudo<\/code> or run <code>sudo su -<\/code>, just remember to exit after you&#8217;re done.<\/p>\n\n\n\n<p>First install the agent, skip if it&#8217;s already installed.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/repo.zabbix.com\/zabbix\/7.0\/ubuntu\/pool\/main\/z\/zabbix-release\/zabbix-release_latest_7.0+ubuntu24.04_all.deb\n\ndpkg -i zabbix-release_latest_7.0+ubuntu24.04_all.deb\n\napt update\n\napt install zabbix-agent2 zabbix-agent2-plugin-*\n\nsystemctl enable zabbix-agent2<\/code><\/pre>\n\n\n\n<p>Generate PSK-key and write it to file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl rand -hex 32 &gt; \/etc\/zabbix\/zabbix_agentd.psk<\/code><\/pre>\n\n\n\n<p>Set correct owner and group on the PSK-file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chown zabbix \/etc\/zabbix\/zabbix_agentd.psk\n\nchgrp zabbix \/etc\/zabbix\/zabbix_agentd.psk<\/code><\/pre>\n\n\n\n<p>Change access rights to the PSK-file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod 600 \/etc\/zabbix\/zabbix_agentd.psk<\/code><\/pre>\n\n\n\n<p>Edit the Zabbix Agent config-file.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano \/etc\/zabbix\/zabbix_agent2.conf<\/code><\/pre>\n\n\n\n<p>Add\/edit the following lines (TLSPSKIdentity is unike for every client):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>TLSConnect=psk\nTLSAccept=psk\nTLSPSKIdentity=PSK001-STLLOSTSELLA001\nTLSPSKFile=\/etc\/zabbix\/zabbix_agentd.psk<\/code><\/pre>\n\n\n\n<p>Also edit\/add necessary information:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Server=zabbix.domain.com\nServerActive=zabbix.domain.com\nHostname=stllostsella001<\/code><\/pre>\n\n\n\n<p>Save and exit nano:<br>Ctrl + O<br>Enter<br>Ctrl + X<\/p>\n\n\n\n<p>Start the service.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl start zabbix-agent2<\/code><\/pre>\n\n\n\n<p>Write out the PSK-key and copy it.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/etc\/zabbix\/zabbix_agentd.psk<\/code><\/pre>\n\n\n\n<p>We are now done on the client side and we can close the terminal or connection.<\/p>\n\n\n\n<p>Go to your Zabbix web-frontend ex.: https\/\/zabbix.domain.com\/zabbix<br>Login and go to Data Collection\/Hosts.<br>Create host or click on a existing host.<br>Go to the Encryption tab.<br>Select PSK and PSK, also supply the identity and paste the PSK-key. Hit Update.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"832\" height=\"323\" src=\"https:\/\/tillnet.se\/wp-content\/uploads\/2025\/03\/Screenshot-2025-03-17-235406.png\" alt=\"\" class=\"wp-image-257\" srcset=\"https:\/\/www.tillnet.se\/wp-content\/uploads\/2025\/03\/Screenshot-2025-03-17-235406.png 832w, https:\/\/www.tillnet.se\/wp-content\/uploads\/2025\/03\/Screenshot-2025-03-17-235406-300x116.png 300w, https:\/\/www.tillnet.se\/wp-content\/uploads\/2025\/03\/Screenshot-2025-03-17-235406-768x298.png 768w\" sizes=\"auto, (max-width: 832px) 100vw, 832px\" \/><\/figure>\n\n\n\n<p>Look at the far right under &#8220;Agent encryption&#8221; it should look like this, PSK in green:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"54\" src=\"https:\/\/tillnet.se\/wp-content\/uploads\/2025\/03\/Screenshot-2025-03-17-235907-1024x54.png\" alt=\"\" class=\"wp-image-258\" srcset=\"https:\/\/www.tillnet.se\/wp-content\/uploads\/2025\/03\/Screenshot-2025-03-17-235907-1024x54.png 1024w, https:\/\/www.tillnet.se\/wp-content\/uploads\/2025\/03\/Screenshot-2025-03-17-235907-300x16.png 300w, https:\/\/www.tillnet.se\/wp-content\/uploads\/2025\/03\/Screenshot-2025-03-17-235907-768x41.png 768w, https:\/\/www.tillnet.se\/wp-content\/uploads\/2025\/03\/Screenshot-2025-03-17-235907.png 1194w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>All done.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>These instructions are for Ubuntu 24.04 LTS but would work on other versions and flavours with some modifications. We&#8217;ll start on the client side. Open &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[6],"tags":[],"class_list":["post-256","post","type-post","status-publish","format-standard","hentry","category-it"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.tillnet.se\/index.php\/wp-json\/wp\/v2\/posts\/256","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tillnet.se\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tillnet.se\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tillnet.se\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tillnet.se\/index.php\/wp-json\/wp\/v2\/comments?post=256"}],"version-history":[{"count":3,"href":"https:\/\/www.tillnet.se\/index.php\/wp-json\/wp\/v2\/posts\/256\/revisions"}],"predecessor-version":[{"id":261,"href":"https:\/\/www.tillnet.se\/index.php\/wp-json\/wp\/v2\/posts\/256\/revisions\/261"}],"wp:attachment":[{"href":"https:\/\/www.tillnet.se\/index.php\/wp-json\/wp\/v2\/media?parent=256"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tillnet.se\/index.php\/wp-json\/wp\/v2\/categories?post=256"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tillnet.se\/index.php\/wp-json\/wp\/v2\/tags?post=256"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}