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

Issue with "ufw reset" function in Ubuntu 22.04 #275

Open
middleagedman opened this issue Apr 3, 2023 · 0 comments
Open

Issue with "ufw reset" function in Ubuntu 22.04 #275

middleagedman opened this issue Apr 3, 2023 · 0 comments

Comments

@middleagedman
Copy link

🗣️ Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

👻 Brief Description

I am creating a recipe that will flush all the rules before implementing the ones I want. I'm doing this to dynamically clear out IPs that are no longer around. I get an error every time from chef-client:

   ---- Begin output of ["ufw", "reset"] ----
     STDOUT: Resetting all rules to installed defaults. Proceed with operation (y|n)?
     STDERR: ERROR: '/etc/ufw/user.rules.20230403_002136' already exists. Aborting
     ---- End output of ["ufw", "reset"] ----
     Ran ["ufw", "reset"] returned 1

However, inspecting with "ufw status" shows the firewall disabled and the rules flushed.

🥞 Cookbook version

firewall (6.2.10)

👩‍🍳 Chef-Infra Version

Chef Infra Client, version 18.1.0

🎩 Platform details

Testing on kitchen-dokken on Arch Linux with docker container stock ubuntu 22.04

Steps To Reproduce

Steps to reproduce the behavior:

Create simple firewall recipe:

# enable platform default firewall
firewall 'default' do
  action :install
end

firewall 'default' do
  action :flush
end

firewall_rule 'ssh' do
  source 'xx.xx.xx.xx/32'
  port 22
  protocol :tcp
  command :allow
end

However, I get the error indicated above. But when I run "ufw status" it is disabled and the rules are flushed. So it aborts after the initial flush prompt and doesn't create the port 22 rule

🚓 Expected behavior

ufw flush works correctly, then ufw is re-enabled and IP addresses added.

➕ Additional context

I can't seem to reproduce this manually. If I run a "ufw reset" by hand, it flushes the rules and disables UFW properly.

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

1 participant