File: //opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/pf.cpython-310.pyc
o
�N�g�% � @ s| d Z ddlZddlZddlZddlmZmZ e�e �Z
dd� Zdd� Zdd � Z
d
d� Zddd�Zdd� Zdd� Zdd� ZdS )z{
Control the OpenBSD packet filter (PF).
:codeauthor: Jasper Lievisse Adriaanse <j@jasper.la>
.. versionadded:: 2019.2.0
� N)�CommandExecutionError�SaltInvocationErrorc C s8 ddg} t d | v rtjj�d�rdS dd�t d �fS )z�
Only works on OpenBSD and FreeBSD for now; other systems with pf (macOS,
FreeBSD, etc) need to be tested before enabling them.
�FreeBSDZOpenBSD�os�pfctlTFzlThe pf execution module cannot be loaded: either the OS ({}) is not tested or the pfctl binary was not found)�
__grains__�salt�utils�path�which�format)Ztested_oses� r
�C/opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/pf.py�__virtual__ s
�r c C �b i } t d dddd�}|d dkrdd d
�} | S |d dkr%d
dd
�} | S td|d gdd�d��)zk
Enable the Packet Filter.
CLI Example:
.. code-block:: bash
salt '*' pf.enable
�cmd.run_allzpfctl -e�traceF�Zoutput_loglevel�python_shell�retcoder z
pf enabledT��comment�changes�stderrzpfctl: pf already enabledzpf already enabledzCould not enable pf��errorsr ��info��__salt__r ��ret�resultr
r
r �enable"