Firewall rules not working in post script of kickstart

centos7firewalldkickstart

I am installing centos with kickstart and during installation in post script it suppose to update device over tftp.

in my script i trigger that device which ultimately copy firmware from my system(where my kickstart is running).

These firewall rules works after first reboot but i want to do it in post section of kickstart.

firewall --enabled --service=tftp --service=ssh 

%post --erroronfail --log=/tmp/ks-post.log --interpreter=/usr/bin/bash
echo -e $(firewall-cmd  --list-services)
telnet> copy tftp x.x.x.x device-firmware my.rom
%end

But echo command output that firewalld is not running

Best Answer

As far as I know firewalld is only configured by kickstart and not activated (neither with the new config or at all) during the kickstart installation itself.

Kickstart uses firewall-offline-cmd to configure the firewall settings and that is what you should use to query the firewall as well.

The alternative is that you explicitly start firewalld in your %post section after that you can use firewall-cmd .