%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/pf.pyc

�
���^c@@s�dZddlmZmZmZddlZddlZddlZddl	m
Z
mZeje
�Zd�Zd�Zd�Zd�Zd	ed
�Zd�Zd�Zd
�ZdS(u{
Control the OpenBSD packet filter (PF).

:codeauthor: Jasper Lievisse Adriaanse <j@jasper.la>

.. versionadded:: 2019.2.0
i(tabsolute_importtprint_functiontunicode_literalsN(tCommandExecutionErrortSaltInvocationErrorcC@s3tddkr)tjjjd�r)tStdfS(u�
    Only works on OpenBSD for now; other systems with pf (macOS, FreeBSD, etc)
    need to be tested before enabling them.
    uosuOpenBSDupfctlulThe pf execution module cannot be loaded: either the system is not OpenBSD or the pfctl binary was not found(t
__grains__tsalttutilstpathtwhichtTruetFalse(((s3/usr/lib/python2.7/site-packages/salt/modules/pf.pyt__virtual__s%cC@s�i}tdddddt�}|ddkrIidd	6td
6}nN|ddkrpid
d	6td
6}n'tddi|dgd6td
6��|S(uk
    Enable the Packet Filter.

    CLI example:

    .. code-block:: bash

        salt '*' pf.enable
    ucmd.run_allupfctl -etoutput_loglevelutracetpython_shelluretcodeiu
pf enableducommentuchangesustderrupfctl: pf already enabledupf already enableduCould not enable pftinfouerrors(t__salt__RR
R(trettresult((s3/usr/lib/python2.7/site-packages/salt/modules/pf.pytenable"s

	cC@s�i}tdddddt�}|ddkrIidd	6td
6}nN|ddkrpid
d	6td
6}n'tddi|dgd6td
6��|S(um
    Disable the Packet Filter.

    CLI example:

    .. code-block:: bash

        salt '*' pf.disable
    ucmd.run_allupfctl -dR
utraceRuretcodeiupf disableducommentuchangesustderrupfctl: pf not enabledupf already disableduCould not disable pfRuerrors(RRR
R(RR((s3/usr/lib/python2.7/site-packages/salt/modules/pf.pytdisableAs

	cC@s�itd6}dddddddd	g}||krOtd
j|���ntddj|�d
ddt�}|ddkr�tddi|dgd6td6��n|S(u-
    Set the debug level which limits the severity of log messages printed by ``pf(4)``.

    level:
        Log level. Should be one of the following: emerg, alert, crit, err, warning, notice,
        info or debug.

    CLI example:

    .. code-block:: bash

        salt '*' pf.loglevel emerg
    uchangesuemergualertucrituerruwarningunoticeuinfoudebuguUnknown loglevel: {0}ucmd.run_allupfctl -x {0}R
utraceRuretcodeiu$Problem encountered setting loglevelRustderruerrors(R
RtformatRRR(tlevelRt
all_levelsR((s3/usr/lib/python2.7/site-packages/salt/modules/pf.pytloglevel`s
	!u/etc/pf.confcC@s�itd6}dd|g}|r<t|d<|jd�ntd|dddt�}|d	d
kr�tdj|�di|d
gd6td6��n|S(uA
    Load a ruleset from the specific file, overwriting the currently loaded ruleset.

    file:
        Full path to the file containing the ruleset.

    noop:
        Don't actually load the rules, just parse them.

    CLI example:

    .. code-block:: bash

        salt '*' pf.load /etc/pf.conf.d/lockdown.conf
    uchangesupfctlu-fu-nucmd.run_allR
utraceRuretcodeiu$Problem loading the ruleset from {0}Rustderruerrors(R
RtappendRRR(tfiletnoopRtcmdR((s3/usr/lib/python2.7/site-packages/salt/modules/pf.pytload�s


	!cC@s)i}dddddddg}dd	g}||7}|j�|krX|j�}n||kr|td
j|���ndj|�}td|d
ddt�}|ddkr�tjd|d�r�t|d<n
t|d<|d|d<n0tdj|�di|dgd6td6��|S(u�
    Flush the specified packet filter parameters.

    modifier:
        Should be one of the following:

        - all
        - info
        - osfp
        - rules
        - sources
        - states
        - tables

        Please refer to the OpenBSD `pfctl(8) <https://man.openbsd.org/pfctl#T>`_
        documentation for a detailed explanation of each command.

    CLI example:

    .. code-block:: bash

        salt '*' pf.flush states
    urulesustatesuinfouosfpuallusourcesutablesuSourcesuTablesuUnknown modifier: {0}upfctl -v -F {0}ucmd.run_allR
utraceRuretcodeiu^0.*ustderruchangesucommentuCould not flush {0}Ruerrors(	ttitleRRRRtretmatchR
R(tmodifierRt
all_modifierstcapital_modifiersRR((s3/usr/lib/python2.7/site-packages/salt/modules/pf.pytflush�s*

	

c	K@s�i}ddddddddd	g	}||krKtd
j|���ndd|d
|g}|d!kr�||jdg�7}nC|dkr�|jdd"�}|s�td��q�|j|�ntd|dddt�}|ddkr|dkri|dj�d6}q�|dkrAi|dd6td6}q�t	j
d|d�rdt|d<n
t|d<|d|d<np|dkr�t	j
d|d�r�i|dd6td6}n3tdj||�di|dgd 6td6��|S(#u�
    Apply a command on the specified table.

    table:
        Name of the table.

    command:
        Command to apply to the table. Supported commands are:

        - add
        - delete
        - expire
        - flush
        - kill
        - replace
        - show
        - test
        - zero

        Please refer to the OpenBSD `pfctl(8) <https://man.openbsd.org/pfctl#T>`_
        documentation for a detailed explanation of each command.

    CLI example:

    .. code-block:: bash

        salt '*' pf.table expire table=spam_hosts number=300
        salt '*' pf.table add table=local_hosts addresses='["127.0.0.1", "::1"]'
    ukilluflushuaddudeleteuexpireureplaceushowutestuzerouUnknown table command: {0}upfctlu-tu-Tu	addressesunumberu.need expire_number argument for expire commanducmd.run_alltoutput_levelutraceRuretcodeiustdoutucommentustderrumatchesu^(0.*|no changes)uchangesu^\d+/\d+ addresses match.$u Could not apply {0} on table {1}Ruerrors(uaddudeleteureplaceutestN(RRtgettNoneRRRtsplitR
RR R(tcommandttabletkwargsRtall_commandsRtnumberR((s3/usr/lib/python2.7/site-packages/salt/modules/pf.pyR*�s<!
	

"cC@s�itd6}dg}dddg}||7}|j�|krP|j�}n||krttdj|���ndj|�}td|d	d
dt�}|dd
kr�|djd�|d<n0tdj|�di|dgd6td6��|S(u#
    Show filter parameters.

    modifier:
        Modifier to apply for filtering. Only a useful subset of what pfctl supports
        can be used with Salt.

        - rules
        - states
        - tables

    CLI example:

    .. code-block:: bash

        salt '*' pf.show rules
    uchangesuTablesurulesustatesutablesuUnknown modifier: {0}upfctl -s {0}ucmd.run_allR
utraceRuretcodeiustdoutu
ucommentuCould not show {0}Rustderruerrors(RRRRRR(R(R!RR#R"RR((s3/usr/lib/python2.7/site-packages/salt/modules/pf.pytshow2s$
	

	(t__doc__t
__future__RRRtloggingRtsalt.utils.pathRtsalt.exceptionsRRt	getLoggert__name__tlogRRRRRRR$R*R.(((s3/usr/lib/python2.7/site-packages/salt/modules/pf.pyt<module>s				#&	;	N

Zerion Mini Shell 1.0