Hi how to is possible to convert iptables rules into pf rules file?
One method would be to use the application FWBuilder. It is primarily a graphical application that can be used to manage firewall rule sets. It also, however, has an import/export feature that can be used to translate between different firewall types. And yes, both iptables and pf are supported.
So it looks like FWBuilder is more tricksome than I remembered. While you can import rulesets from Cisco and IPTables, you cannot directly export. I went through the process of translating a desktop IPTables ruleset from iptables to pf, and it was a fair amount of effort. Whether it is easier than learning pf syntax and doing a manual conversion, I don't know. That being said, this is the process I took to go from iptables -> pf using fwbuilder.
From this point I used an iterative process to filter out any parse problems that fwbuilder had, primiarily the direction issues above and things like my rule to drop XMAS packets. I did this by issuing the compile commands directly, instead of using the interface.
This will, eventually, leave you with two files that contain your new pf firewall config,
Assuming your talking about Pfsense. No, this isn't possible, you'll have to enter them by hand.