Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #644 from teclator/ifcfg_zone
Added known zones to firewalld (fate#323460)
- Loading branch information
Showing
7 changed files
with
116 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# encoding: utf-8 | ||
|
||
# ------------------------------------------------------------------------------ | ||
# Copyright (c) 2017 SUSE LLC | ||
# | ||
# | ||
# This program is free software; you can redistribute it and/or modify it under | ||
# the terms of version 2 of the GNU General Public License as published by the | ||
# Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | ||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along with | ||
# this program; if not, contact SUSE. | ||
# | ||
# To contact SUSE about this file by physical or electronic mail, you may find | ||
# current contact information at www.suse.com. | ||
# ------------------------------------------------------------------------------ | ||
|
||
require "yast" | ||
require "y2firewall/firewalld/api" | ||
|
||
module Y2Firewall | ||
class Firewalld | ||
# Class to work with Firewalld zones | ||
class Zone | ||
include Yast::I18n | ||
extend Yast::I18n | ||
# Map of known zone names and description | ||
KNOWN_ZONES = { | ||
"block" => N_( | ||
"Block Zone" | ||
), | ||
"dmz" => N_( | ||
"Demilitarized Zone" | ||
), | ||
"drop" => N_( | ||
"Drop Zone" | ||
), | ||
"external" => N_( | ||
"External Zone" | ||
), | ||
"home" => N_( | ||
"Home Zone" | ||
), | ||
"internal" => N_( | ||
"Internal Zone" | ||
), | ||
"public" => N_( | ||
"Public Zone" | ||
), | ||
"trusted" => N_( | ||
"Trusted Zone" | ||
), | ||
"work" => N_( | ||
"Work Zone" | ||
) | ||
}.freeze | ||
|
||
def self.known_zones | ||
KNOWN_ZONES | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/usr/bin/env rspec | ||
# encoding: utf-8 | ||
# | ||
# Copyright (c) [2017] SUSE LLC | ||
# | ||
# All Rights Reserved. | ||
# | ||
# This program is free software; you can redistribute it and/or modify it | ||
# under the terms of version 2 of the GNU General Public License as published | ||
# by the Free Software Foundation. | ||
# | ||
# This program is distributed in the hope that it will be useful, but WITHOUT | ||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
# more details. | ||
# | ||
# You should have received a copy of the GNU General Public License along | ||
# with this program; if not, contact SUSE LLC. | ||
# | ||
# To contact SUSE LLC about this file by physical or electronic mail, you may | ||
# find current contact information at www.suse.com. | ||
|
||
require_relative "../../test_helper" | ||
require "y2firewall/firewalld/zone" | ||
|
||
describe Y2Firewall::Firewalld::Zone do | ||
describe ".known_zones" do | ||
it "returns a hash with known zone names and descriptions" do | ||
expect(described_class.known_zones).to be_a(Hash) | ||
expect(described_class.known_zones).to include "public" | ||
expect(described_class.known_zones["dmz"]).to eq(N_("Demilitarized Zone")) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters