Deleting iptables rule is erroring with illegal operation

You can remove a rule either by its number in the order in which it currently appears in the running firewall rules, or by specifying that rule's parameters exactly. Your command line seems to be trying to do both, which is not going to work. Choose one or the other.

To remove a rule by number:

iptables -D INPUT 1

To remove a rule by specification:

iptables -D INPUT --protocol tcp --dport 5672 -j ACCEPT