Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Is there a way to determine if firewall-cmd changes a setting? #46

Closed
MikeParkin opened this issue Sep 19, 2015 · 4 comments
Closed

Comments

@MikeParkin
Copy link

I'm using firewalld within a devops situation, and it would be helpful to know if firewall-cmd has changed the active configuration after a command has run. Is there a way to do this?

If i run this multiple times I get 0 exit code and the message 'success'

/bin/firewall-cmd --permanent --zone=trusted --add-source=x.x.x.x

Would you ever consider changing it to 'Success [no change]' or is this out of the scope of firewall-cmds responsibilities?

@MikeParkin MikeParkin changed the title Is there a way to determine if firewall-cmd changes a setting? [Question] Is there a way to determine if firewall-cmd changes a setting? Sep 19, 2015
@t-woerner
Copy link
Collaborator

firewall-cmd is only returning "Success" if the command succeeded. Here are some examples:

# firewall-cmd --permanent --zone=trusted --add-source=1.2.3.4
success
# firewall-cmd --permanent --zone=trusted --add-source=1.2.3.4
Warning: ALREADY_ENABLED: 1.2.3.4
# firewall-cmd --permanent --zone=trusted --remove-source=1.2.3.4
success
# firewall-cmd --permanent --zone=trusted --remove-source=1.2.3.4
Warning: NOT_ENABLED: 1.2.3.4

I just noticed that the return value is not correct in the warning case. I will fix this.

@MikeParkin
Copy link
Author

Thanks for the quick response! What version was this functionality added?

[root@localhost vagrant]# /bin/firewall-cmd --permanent --zone=trusted --add-source=8.8.8.8
success
[root@localhost vagrant]# /bin/firewall-cmd --permanent --zone=trusted --add-source=8.8.8.8
success
[root@localhost vagrant]# /bin/firewall-cmd --version
0.3.9

I'm using 0.3.9 which was stock from Centos7 which doesn't seem to have the same behaviour.

@t-woerner
Copy link
Collaborator

That has been added with 0.3.12.

@t-woerner
Copy link
Collaborator

You will get this with the rebase to 0.4.3.

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

No branches or pull requests

2 participants