Can I specify both source port and (target) port in one firewalld rich rule?

Viewed 257

I want to add a rich rule to allow access to a target port from specific source port, I tried to add the rule like this:

firewall-cmd --add-rich-rule='rule family="ipv4" source address="192.168.1.x" source-port port="1234" protocol="tcp" port port=80 protocol="tcp" accept'
firewall-cmd --add-rich-rule='rule family="ipv4" source address="192.168.1.x" source-port port="1234" protocol="tcp" service name="http" accept'

And I just get error like:

Error: INVALID_RULE: more than one element. There cannot be both 'source-port' and 'port port="80" protocol="tcp"' in one rule.

Can anyone help to find a way to add a rich rule with source ip, source port and target port at the same time?

thank you.

0 Answers
Related