YaST2 Developers Documentation: Firewall Services, Ports Aliases.

Firewall Services, Ports Aliases.

modules/SuSEFirewallServices.ycp
Definition of Supported Firewall Services and Port Aliases.
  • Lukas Ocilka

This module has an unstable interface.

Global Definition of Firewall Services Defined using TCP, UDP and RPC ports and IP protocols and Broadcast UDP ports. Results are cached, so repeating requests are answered faster.

Imports

  • FileUtils

Structures

Global Functions

Local Variables

Local Functions

local services_definitions_in -> string

Format of SERVICES

"service-id" : $[ "name" : _("Service Name"), "tcp_ports" : list , "udp_ports" : list , "rpc_ports" : list , "ip_protocols" : list , "broadcast_ports" : list , ],

Info:

Services definitions for conversion to the new ones.

Info:

Definitions were moved to OLD_SERVICES for conversion and replaced by definitions in packages. FATE #300687: Ports for SuSEfirewall added via packages.

global ServiceDefinedByPackage (string service) -> boolean

Returns whether the service ID is defined by package. Returns 'false' if it isn't.

Parameters:
service
Return value:
whether service is defined by package
Example

	ServiceDefinedByPackage ("http-server") -> false
	ServiceDefinedByPackage ("service:http-server") -> true
global GetFilenameFromServiceDefinedByPackage (string service) -> string

Creates a file name from service name defined by package. Service MUST be defined by package, otherwise it returns 'nil'.

Parameters:
service
Return value:
file name (e.g., 'abc')
Example

	GetFilenameFromServiceDefinedByPackage ("service:abc") -> "abc"
	GetFilenameFromServiceDefinedByPackage ("abc") -> nil
local GetMetadataAgent (string filefullpath) -> term

Returns SCR Agent definition.

Parameters:
filefullpath
Return value:
with agent definition
global ReadServicesDefinedByRPMPackages () -> boolean

Reads definition of services that can be used in FW_CONFIGURATIONS_[EXT|INT|DMZ] in SuSEfirewall2.

Return value:
if successful
global IsKnownService (string service_id) -> boolean

Function returns if the service_id is a known (defined) service

Parameters:
service_id
Return value:
if is known (defined)
global GetSupportedServices () -> map <string, string>

Function returns the map of supported (known) services.

Structure

	$[ service_id : localized_service_name ]
	$[
	  "dns-server" : "DNS Server",
    "vnc" : "Remote Administration",
  ]
Return value:
supported services
global GetListOfServicesAddedByPackage () -> list <string>

Returns list of service-ids defined by packages.

Return value:
service ids
global GetNeededTCPPorts (string service) -> list <string>

Function returns needed TCP ports for service

Parameters:
service
Return value:
of needed TCP ports
global GetNeededUDPPorts (string service) -> list <string>

Function returns needed UDP ports for service

Parameters:
service
Return value:
of needed UDP ports
global GetNeededRPCPorts (string service) -> list <string>

Function returns needed RPC ports for service

Parameters:
service
Return value:
of needed RPC ports
global GetNeededIPProtocols (string service) -> list <string>

Function returns needed IP protocols for service

Parameters:
service
Return value:
of needed IP protocols
global GetDescription (string service) -> string

Function returns description of a firewall service

Parameters:
service
Return value:
service description
global SetModified () -> void

Sets that configuration was modified

global ResetModified () -> void

Sets that configuration was not modified

global GetModified () -> boolean

Returns whether configuration was modified

Return value:
modified
global GetNeededBroadcastPorts (string service) -> list <string>

Function returns needed ports allowing broadcast

Parameters:
service
Return value:
of needed broadcast ports
global GetNeededPortsAndProtocols (string service) -> map <string, list <string> >

Function returns needed ports and protocols for service. Function cares about if the service is defined or not.

Parameters:
service
Return value:
of needed ports and protocols
Example

	GetNeededPortsAndProtocols ("service:aaa") -> $[
		"tcp_ports"       : [ "122", "ftp-data" ],
		"udp_ports"       : [ "427" ],
		"rpc_ports"       : [ "portmap", "ypbind" ],
		"ip_protocols"    : [],
		"broadcast_ports" : [ "427" ],
	];
global SetNeededPortsAndProtocols (string service, map <string, list <string> > store_definition) -> boolean

Immediately writes the configuration of service defined by package to the service definition file. Service must be defined by package, this function doesn't work for hard-coded services (SuSEFirewallServices).

Parameters:
service
store_definition
Return value:
if successful (nil in case of developer's mistake)
Example

	SetNeededPortsAndProtocols (
		"service:something",
		$[
			"tcp_ports"       : [ "22", "ftp-data", "400:420" ],
			"udp_ports"       : [ ],
			"rpc_ports"       : [ "portmap", "ypbind" ],
			"ip_protocols"    : [ "esp" ],
			"broadcast_ports" : [ ],
		]
	);
See
IsKnownService() ServiceDefinedByPackage()
global GetPossiblyConflictServices () -> list <string>

Function returns list of possibly conflicting services. Conflicting services are for instance nis-client and nis-server. DEPRECATED - we currently don't have such services - services are defined by packages.

Return value:
of conflicting services