community.general.seport (8.5.0) — module

Manages SELinux network port type definitions

Authors: Dan Keder (@dankeder)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

Manages SELinux network port type definitions.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Allow Apache to listen on tcp port 8888
  community.general.seport:
    ports: 8888
    proto: tcp
    setype: http_port_t
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Allow sshd to listen on tcp port 8991
  community.general.seport:
    ports: 8991
    proto: tcp
    setype: ssh_port_t
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Allow memcached to listen on tcp ports 10000-10100 and 10112
  community.general.seport:
    ports: 10000-10100,10112
    proto: tcp
    setype: memcache_port_t
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Allow memcached to listen on tcp ports 10000-10100 and 10112
  community.general.seport:
    ports:
      - 10000-10100
      - 10112
    proto: tcp
    setype: memcache_port_t
    state: present
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Remove tcp port 22 local modification if exists
  community.general.seport:
    ports: 22
    protocol: tcp
    setype: ssh_port_t
    state: absent
    local: true

Inputs

    
local:
    default: false
    description:
    - Work with local modifications only.
    type: bool
    version_added: 5.6.0
    version_added_collection: community.general

ports:
    description:
    - Ports or port ranges.
    - Can be a list (since 2.6) or comma separated string.
    elements: str
    required: true
    type: list

proto:
    choices:
    - tcp
    - udp
    description:
    - Protocol for the specified port.
    required: true
    type: str

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Desired boolean value.
    type: str

reload:
    default: true
    description:
    - Reload SELinux policy after commit.
    type: bool

setype:
    description:
    - SELinux type for the specified port.
    required: true
    type: str

ignore_selinux_state:
    default: false
    description:
    - Run independent of selinux runtime state
    type: bool