{"id":779,"date":"2025-11-22T12:38:05","date_gmt":"2025-11-22T11:38:05","guid":{"rendered":"https:\/\/activum24.pl\/?p=779"},"modified":"2025-11-23T12:40:41","modified_gmt":"2025-11-23T11:40:41","slug":"automatyzacja-zoraxy-whitelist","status":"publish","type":"post","link":"https:\/\/activum24.pl\/index.php\/2025\/11\/22\/automatyzacja-zoraxy-whitelist\/","title":{"rendered":"Automatyzacja &#8211; Zoraxy &#8211; White List"},"content":{"rendered":"\n<p>Analogiczne rozwi\u0105zanie z poprzedniego artyku\u0142u dla Zoraxy. W tym przypadku trzeba dzia\u0142a\u0107 na pliku konfiguracyjnym json.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nREMOTE=\"...................\"\nSAVE_IP_FILE=\"\/opt\/zoraxy\/conf\/access\/last_remote_ip.txt\"\nACCESS_FILE=\"\/opt\/zoraxy\/conf\/access\/default.json\"\nLTE_LABEL=\"D......\"\n\nNOWY_IP=$(ssh $REMOTE \"curl -s --max-time 8 ifconfig.me\")\n&#91;&#91; -z \"$NOWY_IP\" || \"$NOWY_IP\" =~ &#91;^0-9.] ]] &amp;&amp; { echo \"Nie pobrano IP\"; exit 1; }\n\necho \"Zdalny IP: $NOWY_IP\"\n\nif &#91;&#91; -f \"$SAVE_IP_FILE\" ]]; then\n    LAST_IP=$(cat \"$SAVE_IP_FILE\" | tr -d '&#91;:space:]')\nelse\n    LAST_IP=\"\"\nfi\n\nif &#91;&#91; -n \"$LAST_IP\" &amp;&amp; \"$LAST_IP\" != \"$NOWY_IP\" ]]; then\n    echo \"Usuwam stare IP z whitelisty: $LAST_IP\"\n    jq --arg ip \"$LAST_IP\" 'del(.WhiteListIP&#91;$ip])' \"$ACCESS_FILE\" > \"${ACCESS_FILE}.tmp\" \\\n        &amp;&amp; mv \"${ACCESS_FILE}.tmp\" \"$ACCESS_FILE\"\nfi\n\necho \"Dodaj\u0119\/aktualizuj\u0119 IP: $NOWY_IP ($LTE_LABEL)\"\njq \".WhiteListIP.\\\"$NOWY_IP\\\" = \\\"$LTE_LABEL\\\"\" \"$ACCESS_FILE\" > \"${ACCESS_FILE}.tmp\" \\\n    &amp;&amp; mv \"${ACCESS_FILE}.tmp\" \"$ACCESS_FILE\" \\\n    || { echo \"B\u0141\u0104D przy zapisie JSON!\"; exit 1; }\n\necho \"$NOWY_IP\" > \"$SAVE_IP_FILE\"\n\necho \"Gotowe! Restartuj\u0119 Zoraxy...\"\nsystemctl restart zoraxy || echo \"Nie uda\u0142o si\u0119 zrestartowa\u0107 Zoraxy (mo\u017ce nie dzia\u0142a jako serwis?)\"\n\necho \"Wszystko OK \u2013 IP $NOWY_IP jest na whiteliscie\"<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Analogiczne rozwi\u0105zanie z poprzedniego artyku\u0142u dla Zoraxy. W tym przypadku trzeba dzia\u0142a\u0107 na pliku konfiguracyjnym json.<\/p>\n","protected":false},"author":1,"featured_media":780,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[58],"tags":[62,72,124,157],"class_list":["post-779","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-software","tag-lte","tag-proxmox","tag-proxy","tag-zoraxy"],"_links":{"self":[{"href":"https:\/\/activum24.pl\/index.php\/wp-json\/wp\/v2\/posts\/779","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/activum24.pl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/activum24.pl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/activum24.pl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/activum24.pl\/index.php\/wp-json\/wp\/v2\/comments?post=779"}],"version-history":[{"count":2,"href":"https:\/\/activum24.pl\/index.php\/wp-json\/wp\/v2\/posts\/779\/revisions"}],"predecessor-version":[{"id":782,"href":"https:\/\/activum24.pl\/index.php\/wp-json\/wp\/v2\/posts\/779\/revisions\/782"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/activum24.pl\/index.php\/wp-json\/wp\/v2\/media\/780"}],"wp:attachment":[{"href":"https:\/\/activum24.pl\/index.php\/wp-json\/wp\/v2\/media?parent=779"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/activum24.pl\/index.php\/wp-json\/wp\/v2\/categories?post=779"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/activum24.pl\/index.php\/wp-json\/wp\/v2\/tags?post=779"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}