Skip to content

Add firewalld configuration override specific to azl#15648

Closed
binujp wants to merge 6 commits intotomls/base/mainfrom
bphilip/firewalld-configuration
Closed

Add firewalld configuration override specific to azl#15648
binujp wants to merge 6 commits intotomls/base/mainfrom
bphilip/firewalld-configuration

Conversation

@binujp
Copy link
Contributor

@binujp binujp commented Feb 2, 2026

Merge Checklist

All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)

  • The toolchain has been rebuilt successfully (or no changes were made to it)
  • The toolchain/worker package manifests are up-to-date
  • Any updated packages successfully build (or no packages were changed)
  • Packages depending on static components modified in this PR (Golang, *-static subpackages, etc.) have had their Release tag incremented.
  • Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
  • All package sources are available
  • cgmanifest files are up-to-date and sorted (./cgmanifest.json, ./toolkit/scripts/toolchain/cgmanifest.json, .github/workflows/cgmanifest.json)
  • LICENSE-MAP files are up-to-date (./LICENSES-AND-NOTICES/SPECS/data/licenses.json, ./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md, ./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON)
  • All source files have up-to-date hashes in the *.signatures.json files
  • sudo make go-tidy-all and sudo make go-test-coverage pass
  • Documentation has been updated to match any changes to the build system
  • Ready to merge

Summary

What does the PR accomplish, why was it needed?

Firewalld configuration is driven of a top level config files and then zones tied to some or all interfaces and the zone configuration itself has the rules for the net filters. We are using nftables, an azurelinux zone policy which opens only ssh and optionally dhcpv6-client port. This change adds a sub-package to azurelinux-config which enables all that.

Change Log
  • Change
  • Change
  • Change
Does this affect the toolchain?

YES/NO

Associated issues
  • #xxxx
Links to CVEs
Test Methodology
  • Pipeline build id: xxxx

@binujp binujp requested review from Copilot, reubeno and tobiasb-ms and removed request for Copilot February 2, 2026 05:04
@@ -0,0 +1 @@
enable firewalld.service
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you looked at the 90-default.preset in azurelinux-release; it's already enabled. I would expect presets go there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I saw that presets all go there. My thought was unless azurelinux configuration is available should we enable and start firewalld. If we are sure that is the pattern we want to follow that sounds good.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those presets were mostly just inherited from Fedora; my recollection is that many services are preset-enabled in base Fedora, independent of product. Presumably the thinking is that a customer who doesn't want to use it can arrange not to install the package (or to remove it).

@@ -0,0 +1,6 @@
# We want systemd to manage all interfaces
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ddstreetmicrosoft I believe you had some input on the right approach here, what other distros typically do, etc.?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The most robust approach is to let one framework manage all interfaces. Given we are considering only azure cloud deployments I would rather not complicate things. I see there may be cases where the machine is in a DMZ zone and can have NICs in different networks. Let us consider those as special cases to be handled by the customer.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I should have clarified. My question was more around blanket DHCP enablement -- not having systemd-networkd manage the network interfaces.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<!--
<users>
<user name="root" password="INSERT-PASSWORD-HERE" groups="root" />
<user name="root" password="INSERT-PASSWORD-HERE" groups="root" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove these changes; you should be able to use cloud-init config to inject user account configs / credentials (e.g., via azldev image boot).

I'm happy to chat separately to get you unblocked with that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops!

@@ -1,10 +1,10 @@
[images.vm-base]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you up to date with the target branch? These comments were removed last week.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did rebase, this change was on top of my other PR #15599. Maybe that messed this up? I will check.

#
# NOTE: This script is a throwaway script. Please think ~~twice~~ thrice before you
# consider adding anything to it.
# consider adding anything to it. Let us push all dev-tooling into azldev.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed!


%install
install -d %{buildroot}%{_sysconfdir}/systemd/network
install -m 644 %{_sourcedir}/50-default.network %{buildroot}%{_sysconfdir}/systemd/network/50-default.network
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see https://docs.fedoraproject.org/en-US/packaging-guidelines/RPM_Source_Dir/

Packages which use files itemized as Source# files, must refer to those files by their %{SOURCE#} macro name, and must not use $RPM_SOURCE_DIR or %{_sourcedir} to refer to those files.

This is done to ensure that Fedora SRPMS are properly generated. If a Source# item is renamed, a spec which refers to its old name may succeed locally (because the file is still in %{_sourcedir} along with the new file), but the proper file will not be included in the SRPM.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL something, thanks Reuben!

BuildArch: noarch

%description
Provides AZL specifc configuration overrides via sub-packages. These sub-packages will be pulled in by the relevant owning packages via reverse dependencies.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: specifc

Copilot AI review requested due to automatic review settings February 2, 2026 20:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces firewalld configuration support for Azure Linux, establishing a zero-trust security posture for VM deployments. The changes enable firewalld with nftables backend and an Azure Linux-specific zone policy that only allows SSH access by default.

Changes:

  • Added azurelinux-config meta-package with firewalld and systemd-networkd sub-packages for distro-specific configurations
  • Integrated firewalld into the VM base image with Azure Linux zone policy restricting access to SSH only
  • Enhanced demo build script to support VM image building and testing with QEMU

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
scripts/demo-build.sh Extended script to support VM image building, QEMU booting, and added validation checks for prerequisites
distro/azurelinux.distro.toml Updated RHEL compatibility version from 10 to 11
base/images/vm-base/vm-base.kiwi Added firewalld packages, increased disk size, and enabled systemd networkd configuration
base/images/images.toml Uncommented vm-base image definition to enable VM builds
base/comps/components.toml Registered firewalld component
base/comps/azurelinux-config/firewalld-azurelinux.conf Added comprehensive firewalld configuration with nftables backend and security settings
base/comps/azurelinux-config/azurelinux-firewalld-zone.xml Defined Azure Linux firewall zone with SSH-only access policy
base/comps/azurelinux-config/azurelinux-config.spec Created spec file for azurelinux-config meta-package with firewalld and systemd-networkd sub-packages
base/comps/azurelinux-config/azurelinux-config.comp.toml Added component definition for azurelinux-config
base/comps/azurelinux-config/50-default.network Added systemd-networkd configuration to manage all interfaces with DHCP

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ln -sf %{_sysconfdir}/firewalld/firewalld-azurelinux.conf %{_sysconfdir}/firewalld/firewalld.conf

%postun firewalld
ln -sf %{_sysconfdir}/firewalld/firewalld-standard.conf %{_sysconfdir}/firewalld/firewalld.conf
Copy link

Copilot AI Feb 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The %postun script references 'firewalld-standard.conf' which may not exist. When the package is uninstalled, this symlink creation will fail if the target file doesn't exist. Consider verifying the file exists or using a conditional check before creating the symlink.

Suggested change
ln -sf %{_sysconfdir}/firewalld/firewalld-standard.conf %{_sysconfdir}/firewalld/firewalld.conf
if [ -f %{_sysconfdir}/firewalld/firewalld-standard.conf ]; then
ln -sf %{_sysconfdir}/firewalld/firewalld-standard.conf %{_sysconfdir}/firewalld/firewalld.conf
fi

Copilot uses AI. Check for mistakes.
%description firewalld
Provides Azure Linux specific policies and zones for firewalld.

%install
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as with the other PR, distro-provided files should go into /usr/lib; the /etc dir is generally for users/admins

@@ -0,0 +1,121 @@
# firewalld config file
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would greatly like to see a PR with individual commits for every single configuration parameter added here, with specific explanation for why we need to add the config

[components.file]
[components.filesystem]
[components.findutils]
[components.firewalld]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this PR both adding the firewalld package itself, and adding azl-specific config in a separate package? IMHO simply adding firewalld should be completely separate - that should be simple to review/commit.

format="vhdx"
initrd_system="dracut"
filesystem="ext4"
kernelcmdline="console=ttyS0 rd.shell=0 systemd.getty_auto=false"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do these changes have to do with firewalld configuration overrides?

@ddstreet
Copy link
Contributor

ddstreet commented Feb 4, 2026

Similiar to my comment in the networkd pr, I set up a branch that I think logically breaks up this pr into parts, specifically:

feat: add firewalld package to kiwi vm-base definition
ix: remove duplicate systemd-resolved entry from kiwi vm-base definition

i put both of these in a separate pr

update gitignore file
update azurelinux.distro.toml to change rhel from 10->11

these 2 are also in the network pr; i think the gitignore change can wait for @binujp to get back, and the rhel version bump needs explanation

uncomment kiwi vm xml to add definition for root user

this shouldn't be merged, in fact i think the root user definition (even though its commented out) needs to be removed from the file

add azurelinux-config spec file with a definition for azurelinux-config-firewalld

this defines the azurelinux-config rpm (spec and firewall subpackage, plus config files). I do not think this is how we should deliver firewalld configuration; I think we should look at how the firewalld package currently provides distro-provided config, and do something similar.

add systemd-networkd config to azurelinux-config package

this seems to be carried over from the networkd pr, and doesn't belong in this pr

feat: add azurelinux-config packages to kiwi vm-base definition

since I don't think we should create the azurelinux-config package, we don't need to add its rpms to the kiwi vm-base image definition.

update scripts/demo-build.sh

same opinion as the other pr; don't update this script, as it should be removed

@ddstreet
Copy link
Contributor

ddstreet commented Feb 4, 2026

I rebased my branch so the links in the previous comment are stale, but you can go direction to my branch to see the commits:
https://github.com/ddstreet/azurelinux/commits/firewalld-config/

@ddstreet
Copy link
Contributor

ddstreet commented Feb 4, 2026

Ok, after comparing the firewalld-azurelinux.conf and azurelinux-firewalld-zone.xml to what's provided out of the box, there are no differences in the .conf file (besides default zone name pointing to the azurelinux zone), and the azurelinux zone only differs from the standard default zone (public) by closing the mdns and dhcpv6-client ports.

I think we should close this PR and go with the firewalld defaults as currently provided. Closing the dhcpv6-client port in particular will very likely lead to confused and complaining users when their cloud ipv6 configuration doesn't work properly. I don't know how much mdns is used in the cloud, but we can decide to close that later if really needed.

@ddstreetmicrosoft
Copy link
Contributor

I opened pr #15740 to remove mdns from the public zone, and am closing this pr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants