Skip to content

Commit

Permalink
Merge 844cb19 into b0758ce
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Oct 23, 2020
2 parents b0758ce + 844cb19 commit a19eec2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 7 deletions.
8 changes: 8 additions & 0 deletions package/yast2-firewall.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Oct 22 20:44:20 UTC 2020 - Josef Reidinger <jreidinger@suse.com>

- Do not warn user about ssh key only authentication when
ssh port is closed, but firewall is disabled.
(bsc#1177953)
- 4.3.8

-------------------------------------------------------------------
Fri Oct 16 15:15:49 UTC 2020 - Josef Reidinger <jreidinger@suse.com>

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-firewall.spec
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


Name: yast2-firewall
Version: 4.3.7
Version: 4.3.8
Release: 0
Summary: YaST2 - Firewall Configuration
Group: System/YaST
Expand Down
7 changes: 6 additions & 1 deletion src/lib/y2firewall/proposal_settings.rb
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,14 @@ def close_vnc!
# @return [Boolean] true if the root user uses only public key
# authentication and the system is not accesible through ssh
def access_problem?
# public key is not the only way
return false unless only_public_key_auth

!(@open_ssh && @enable_sshd)
# without running sshd it is useless
return true unless @enable_sshd

# firewall is up and port for ssh is not open
@enable_firewall && !@open_ssh
end

private
Expand Down
22 changes: 17 additions & 5 deletions test/lib/y2firewall/proposal_settings_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -209,25 +209,37 @@

describe "#access_problem?" do
let(:ssh_enabled) { true }
let(:firewall_enabled) { true }
let(:ssh_open) { true }
let(:only_ssh_key_auth) { true }

before do
subject.enable_sshd = ssh_enabled
subject.enable_firewall = firewall_enabled
subject.open_ssh = ssh_open
allow(subject).to receive(:only_public_key_auth).and_return(only_ssh_key_auth)
end

context "when the root user uses only SSH key based authentication" do
context "when sshd is enabled" do
context "and the SSH port is open" do
it "returns false" do
expect(subject.access_problem?).to eql(false)
context "and firewall is enabled" do
context "and the SSH port is open" do
it "returns false" do
expect(subject.access_problem?).to eql(false)
end
end

context "and the SSH port is close" do
let(:ssh_open) { false }

it "returns true" do
expect(subject.access_problem?).to eql(true)
end
end
end

context "and the SSH port is close" do
let(:ssh_open) { false }
context "and firewall is disabled" do
let(:firewall_enabled) { false }

it "returns true" do
expect(subject.access_problem?).to eql(true)
Expand Down

0 comments on commit a19eec2

Please sign in to comment.