{"id":5771,"date":"2024-11-26T11:25:45","date_gmt":"2024-11-26T11:25:45","guid":{"rendered":"https:\/\/puvox.software\/blog\/?p=5771"},"modified":"2024-11-26T14:51:57","modified_gmt":"2024-11-26T14:51:57","slug":"using-firewalld-instead-of-ufw-for-docker","status":"publish","type":"post","link":"https:\/\/puvox.software\/blog\/using-firewalld-instead-of-ufw-for-docker\/","title":{"rendered":"Using Firewalld instead of UFW for docker"},"content":{"rendered":"<div class=\"default-content-clss content_5771 type_post \"><p>When you use docker, you might need to move away from <code>ufw<\/code>. The good alternative seems to be <code>firewalld.<\/code><\/p>\n<p>The installation:<\/p>\n<pre>sudo apt update\r\nsudo apt install firewalld\r\nsudo systemctl <span class=\"hljs-built_in\">enable<\/span> firewalld\r\nsudo systemctl start firewalld\r\nsudo firewall-cmd --state<\/pre>\n<p>To add things:<\/p>\n<pre>sudo firewall-cmd --add-service=ssh --permanent\r\nsudo firewall-cmd --add-service=http --permanent\r\nsudo firewall-cmd --add-service=https --permanent\r\nsudo firewall-cmd --add-port=5000\/tcp --permanent\r\nsudo firewall-cmd --reload<\/pre>\n<p>To list:<\/p>\n<pre>sudo firewall-cmd --list-all\r\nsudo firewall-cmd --list-ports\r\nsudo firewall-cmd --list-services<\/pre>\n<p>To remove things:<\/p>\n<pre>sudo firewall-cmd --remove-service=ssh --permanent\r\nsudo firewall-cmd --remove-port=5000\/tcp --permanent<\/pre>\n<p>Don&#8217;t forget to add &#8216;massquerade to allow outgoing trafic from docker containers , eg;<br \/>\n&#8220;`sudo firewall-cmd &#8211;zone=public &#8211;add-rich-rule=<span class=\"hljs-string\">&#8216;rule family=&#8221;ipv4&#8243; source address=&#8221;172.17.0.0\/16&#8243; accept&#8217;<\/span> &#8211;permanent<\/p>\n<p>sudo firewall-cmd &#8211;reload&#8220;`<\/p>\n<p>&nbsp;<\/p>\n<\/div>","protected":false},"excerpt":{"rendered":"<div class=\"default-content-clss excerpt_5771 type_post \"><p>When you use docker, you might need to move away from ufw. The good alternative seems to be firewalld. The installation: sudo apt update sudo apt install firewalld sudo systemctl<a class=\"excerpt-read-more\" href=\"https:\/\/puvox.software\/blog\/using-firewalld-instead-of-ufw-for-docker\/\">(Continue Reading)<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":5776,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[17],"tags":[],"class_list":["post-5771","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-coding"],"_links":{"self":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/posts\/5771","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/comments?post=5771"}],"version-history":[{"count":4,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/posts\/5771\/revisions"}],"predecessor-version":[{"id":5777,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/posts\/5771\/revisions\/5777"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/media\/5776"}],"wp:attachment":[{"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/media?parent=5771"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/categories?post=5771"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/puvox.software\/blog\/wp-json\/wp\/v2\/tags?post=5771"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}