관리-도구
편집 파일: config_zone.cpython-39.pyc
a �������g������������������������@���s����d�dl�Z�d�dlZ�d�dlmZ�d�dlmZmZmZ�d�dlm Z �d�dl mZ�d�dlm Z �d�dlmZ�d�dlmZ�d�d lmZ�d�d lmZmZmZmZ�d�dlmZ�d�dlmZ�d�d lmZmZmZm Z �G�dd��de�Z!dS�)�����N)�config)�dbus_to_python�%dbus_introspection_prepare_properties�!dbus_introspection_add_properties)�Zone)�ifcfg_set_zone_of_interface)�DEFAULT_ZONE_TARGET)� Rich_Rule)�log)�DbusServiceObject)�handle_exceptions�dbus_handle_exceptions�dbus_service_method�dbus_polkit_require_auth)�errors)� FirewallError)�portStr�portInPortRange�coalescePortRange�breakPortRangec�����������������������s� ��e�Zd�ZdZdZejjZe ��fdd��Z edd���Zedd���Z ed d ���Zeejddd �ed�dd���Zeejddd �ed�dd���Zeejj�eejdd�ed�dd����Zejjejdd�dd���Zeejj�eejdd�ed���fdd� ���Zeejjd d�ed�d!d"���Zeejjdd�ed�d#d$���Zd%d&��Zeejjd d�ed�d'd(���Zeejjdd�ed�d)d*���Z eejj�ed�d+d,���Z!ejjejjdd�ed-d.����Z"eejj�ed�d/d0���Z#ejjejjdd�ed1d2����Z$eejjdd�ed�d3d4���Z%ejjejjdd�ed5d6����Z&eejjdd�ed�d7d8���Z'eejjdd�ed�d9d:���Z(eejjdd�ed�d;d<���Z)eejjdd�ed�d=d>���Z*eejjdd�ed�d?d@���Z+eejjdd�ed�dAdB���Z,eejjdd�ed�dCdD���Z-eejjdd�ed�dEdF���Z.eejjdGd�ed�dHdI���Z/eejjdGd�ed�dJdK���Z0eejjdd�ed�dLdM���Z1eejjdd�ed�dNdO���Z2eejjddPd �ed�dQdR���Z3eejjdSd�ed�dTdU���Z4eejjdSd�ed�dVdW���Z5eejjdd�ed�dXdY���Z6eejjdd�ed�dZd[���Z7eejjddPd �ed�d\d]���Z8eejjdGd�ed�d^d_���Z9eejjdGd�ed�d`da���Z:eejjdd�ed�dbdc���Z;eejjdd�ed�ddde���Z<eejjddPd �ed�dfdg���Z=eejjdSd�ed�dhdi���Z>eejjdSd�ed�djdk���Z?eejjdd�ed�dldm���Z@eejjdd�ed�dndo���ZAeejjddPd �ed�dpdq���ZBeejjdGd�ed�drds���ZCeejjdGd�ed�dtdu���ZDeejjdd�ed�dvdw���ZEeejjdd�ed�dxdy���ZFeejjddPd �ed�dzd{���ZGeejjdPd�ed�d|d}���ZHeejjdPd�ed�d~d���ZIeejj�ed�d�d����ZJeejj�ed�d�d����ZKeejjdPd�ed�d�d����ZLeejjdPd�ed�d�d����ZMeejjdPd�ed�d�d����ZNeejj�ed�d�d����ZOeejj�ed�d�d����ZPeejjdPd�ed�d�d����ZQeejjd�d�ed�d�d����ZReejjd�d�ed�d�d����ZSeejjd�d�ed�d�d����ZTeejjd�d�ed�d�d����ZUeejjd�dPd �ed�d�d����ZVeejjdGd�ed�d�d����ZWeejjdGd�ed�d�d����ZXeejjdd�ed�d�d����ZYeejjdd�ed�d�d����ZZeejjddPd �ed�d�d����Z[eejjdGd�ed�d�d����Z\eejjdGd�ed�d�d����Z]eejjdd�ed�d�d����Z^eejjdd�ed�d�d����Z_eejjddPd �ed�d�d����Z`eejjdGd�ed�d�d����ZaeejjdGd�e�d�d�d����Zbeejjdd�e�dd�d����Zceejjdd�e�dd�d����ZdeejjddPd �e�dd�d����Ze���ZfS�(���FirewallDConfigZonezFirewallD main classTc��������������������s`���t�t|��j|i�|���||�_||�_||�_||�_|d�|�_|d�|�_d|�j�|�_ t |�tjj��d�S�)Nr�������zconfig.zone.%d) �superr����__init__�parentr����obj�item_id�busname�path�_log_prefixr����dbus�DBUS_INTERFACE_CONFIG_ZONE)�selfr���Zconf�zoner����args�kwargs�� __class__���?/usr/lib/python3.9/site-packages/firewall/server/config_zone.pyr���8���s���� �zFirewallDConfigZone.__init__c�����������������C���s���d�S��Nr(����r"���r(���r(���r)����__del__E���s����zFirewallDConfigZone.__del__c�����������������C���s���|������d�S�r*���)Zremove_from_connectionr+���r(���r(���r)���� unregisterI���s����zFirewallDConfigZone.unregisterc�����������������C���s����|dkrt��|�jj�S�|dkr,t��|�jj�S�|dkrBt��|�jj�S�|dkrXt��|�jj�S�|dkrnt��|�jj�S�t�j � d|���d�S�)N�name�filenamer����default�builtinzDorg.freedesktop.DBus.Error.InvalidArgs: Property '%s' does not exist)r ����Stringr���r.���r/���r���ZBooleanr0���r1���� exceptions� DBusException)r"���� property_namer(���r(���r)���� _get_propertyQ���s������z!FirewallDConfigZone._get_property�ss�v)�in_signature� out_signatureNc�����������������C���sL���t�|t�}t�|t�}t�d|�j||��|tjjkrBtj� d|���|�� |�S�)Nz%s.Get('%s', '%s')�Jorg.freedesktop.DBus.Error.UnknownInterface: Interface '%s' does not exist)r����strr ����debug1r���r���r ���r!���r3���r4���r6���)r"����interface_namer5����senderr(���r(���r)����Getb���s���� ���zFirewallDConfigZone.Get�sza{sv}c�����������������C���s`���t�|t�}t�d|�j|��|tjjkr6tj� d|���i�}dD�]}|�� |�||<�q>tj|dd�S�)Nz%s.GetAll('%s')r;���)r.���r/���r���r0���r1����sv�Z signature)r���r<���r ���r=���r���r���r ���r!���r3���r4���r6���Z Dictionary)r"���r>���r?����ret�xr(���r(���r)����GetAlls���s���� ��zFirewallDConfigZone.GetAllZssv)r9���c�����������������C���sl���t�|t�}t�|t�}t�|�}t�d|�j|||��|�j�|��|tjj krXtj �d|���tj �d|���d�S�)Nz%s.Set('%s', '%s', '%s')r;���zGorg.freedesktop.DBus.Error.PropertyReadOnly: Property '%s' is read-only)r���r<���r ���r=���r���r����accessCheckr���r ���r!���r3���r4���)r"���r>���r5���Z new_valuer?���r(���r(���r)����Set����s$���� �����zFirewallDConfigZone.Setzsa{sv}asrC���c�����������������C���s2���t�|t�}t�|�}t�|�}t�d|�j|||��d�S�)Nz&%s.PropertiesChanged('%s', '%s', '%s'))r���r<���r ���r=���r���)r"���r>���Zchanged_propertiesZinvalidated_propertiesr(���r(���r)����PropertiesChanged����s���� �z%FirewallDConfigZone.PropertiesChanged)r:���c��������������������s8���t��d|�j��tt|���|�j|�j����}t |�|t jj�S�)Nz%s.Introspect()) r ���Zdebug2r���r���r���� Introspectr���r���Zget_busr���r���r ���r!���)r"���r?����datar&���r(���r)���rJ�������s���� � �zFirewallDConfigZone.Introspectz&(sssbsasa(ss)asba(ssss)asasasasa(ss)b)c�����������������C���sD���t��d|�j��|�j�|�j�}|d�tkr@t|�}d|d<�t|�}|S�)�get settings for zone z%s.getSettings()����r0���) r ���r=���r���r���Zget_zone_configr���r����list�tuple)r"���r?����settings� _settingsr(���r(���r)����getSettings����s����zFirewallDConfigZone.getSettingsc�����������������C���s4���t��d|�j��|�j�|�j�}|d�tkr0d|d<�|S�)rL���z%s.getSettings2()�targetr0���)r ���r=���r���r����get_zone_config_dictr���r����r"���r?���rP���r(���r(���r)����getSettings2����s ����z FirewallDConfigZone.getSettings2c�����������������C���s��|�j��|�j�}d|v�r"t|d��nt��}d|v�r<t|d��nt��}t|t�rzt|t�d���|�}t|t�d���|�}nDd|v�r�t|d��nt��}d|v�r�t|d��nt��}||�}||�}|D�]} |�j� | �r�t tj| ��q�|D�]} |�j� | �r�t tj| ��q�dS�)a ��Assignment of interfaces/sources to zones is different from other zone settings in the sense that particular interface/zone can be part of only one zone. So make sure added interfaces/sources have not already been bound to another zone.� interfaces�sourcesN)r���rT���r����set� isinstancerO���r���Zindex_ofr���ZgetZoneOfInterfacer���r���Z ZONE_CONFLICTZgetZoneOfSource)r"���rP���Zold_settingsZ old_ifacesZold_sourcesZadded_ifacesZ added_sourcesZ new_ifacesZnew_sourcesZiface�sourcer(���r(���r)���� _checkDuplicateInterfacesSources����s ���� z4FirewallDConfigZone._checkDuplicateInterfacesSourcesc�����������������C���st���t�|�}t�d|�j��|�j�|��|d�dkrFt|�}t|d<�t|�}|�� |��|�j �|�j|�|�_|�� |�jj��dS�)�!update settings for zone z%s.update('...')rM���r0���N)r���r ���r=���r���r���rG���rN���r���rO���r\���r���Zset_zone_configr����Updatedr.���)r"���rP���r?���rQ���r(���r(���r)����update����s���� zFirewallDConfigZone.updatec�����������������C���sl���t�|�}t�d|�j��|�j�|��d|v�r>|d�dkr>t|d<�|��|��|�j� |�j |�|�_ |��|�j j��dS�)r]���z%s.update2('...')rS���r0���N) r���r ���r=���r���r���rG���r���r\���r���Zset_zone_config_dictr���r^���r.���)r"���rP���r?���r(���r(���r)����update2����s���� zFirewallDConfigZone.update2c�����������������C���s<���t��d|�j��|�j�|��|�j�|�j�|�_|��|�jj ��dS�)z/load default settings for builtin zone z%s.loadDefaults()N) r ���r=���r���r���rG���r���Zload_zone_defaultsr���r^���r.����r"���r?���r(���r(���r)����loadDefaults��s����z FirewallDConfigZone.loadDefaultsc�����������������C���s���t��d|�j|f���d�S�)Nz%s.Updated('%s')�r ���r=���r����r"���r.���r(���r(���r)���r^��� ��s����zFirewallDConfigZone.Updatedc�����������������C���s:���t��d|�j��|�j�|��|�j�|�j��|�j�|�j��dS�)zremove zone z%s.removeZone()N) r ���r=���r���r���rG���r���Zremove_zoner���Z removeZonera���r(���r(���r)����remove��s����zFirewallDConfigZone.removec�����������������C���s���t��d|�j|f���d�S�)Nz%s.Removed('%s')rc���rd���r(���r(���r)����Removed��s����zFirewallDConfigZone.Removedc�����������������C���sF���t�|t�}t�d|�j|��|�j�|��|�j�|�j |�|�_ |�� |��dS�)zrename zone z%s.rename('%s')N)r���r<���r ���r=���r���r���rG���r���Zrename_zoner����Renamed)r"���r.���r?���r(���r(���r)����rename%��s ���� zFirewallDConfigZone.renamec�����������������C���s���t��d|�j|f���d�S�)Nz%s.Renamed('%s')rc���rd���r(���r(���r)���rg���1��s����zFirewallDConfigZone.Renamedc�����������������C���s���t��d|�j��|����d�S�)Nz%s.getVersion()r����r ���r=���r���rR���ra���r(���r(���r)���� getVersion8��s����zFirewallDConfigZone.getVersionc�����������������C���sH���t�|t�}t�d|�j|��|�j�|��t|�����}||d<�|�� |��d�S�)Nz%s.setVersion('%s')r���� r���r<���r ���r=���r���r���rG���rN���rR���r_���)r"����versionr?���rP���r(���r(���r)���� setVersion?��s���� zFirewallDConfigZone.setVersionc�����������������C���s���t��d|�j��|����d�S�)Nz %s.getShort()r���ri���ra���r(���r(���r)����getShortL��s����zFirewallDConfigZone.getShortc�����������������C���sH���t�|t�}t�d|�j|��|�j�|��t|�����}||d<�|�� |��d�S�)Nz%s.setShort('%s')r���rk���)r"���Zshortr?���rP���r(���r(���r)����setShortS��s���� zFirewallDConfigZone.setShortc�����������������C���s���t��d|�j��|����d�S�)Nz%s.getDescription()����ri���ra���r(���r(���r)����getDescription`��s����z"FirewallDConfigZone.getDescriptionc�����������������C���sH���t�|t�}t�d|�j|��|�j�|��t|�����}||d<�|�� |��d�S�)Nz%s.setDescription('%s')rp���rk���)r"����descriptionr?���rP���r(���r(���r)����setDescriptiong��s���� z"FirewallDConfigZone.setDescriptionc�����������������C���s.���t��d|�j��|����}|d�tkr*|d�S�dS�)Nz%s.getTarget()rM���r0���)r ���r=���r���rR���r���rU���r(���r(���r)���� getTargetw��s����zFirewallDConfigZone.getTargetc�����������������C���sT���t�|t�}t�d|�j|��|�j�|��t|�����}|dkr>|nt |d<�|�� |��d�S�)Nz%s.setTarget('%s')r0���rM���)r���r<���r ���r=���r���r���rG���rN���rR���r���r_���)r"���rS���r?���rP���r(���r(���r)���� setTarget��s���� zFirewallDConfigZone.setTarget�asc�����������������C���s���t��d|�j��|����d�S�)Nz%s.getServices()����ri���ra���r(���r(���r)����getServices���s����zFirewallDConfigZone.getServicesc�����������������C���sN���t�|t�}t�d|�jd�|���|�j�|��t|�����}||d<�|�� |��d�S�)Nz%s.setServices('[%s]')�,rw���� r���rN���r ���r=���r����joinr���rG���rR���r_���)r"���Zservicesr?���rP���r(���r(���r)����setServices���s���� �zFirewallDConfigZone.setServicesc�����������������C���sf���t�|t�}t�d|�j|��|�j�|��t|�����}||d�v�rJt t j|��|d��|��|�� |��d�S�)Nz%s.addService('%s')rw����r���r<���r ���r=���r���r���rG���rN���rR���r���r����ALREADY_ENABLED�appendr_����r"����servicer?���rP���r(���r(���r)���� addService���s���� zFirewallDConfigZone.addServicec�����������������C���sf���t�|t�}t�d|�j|��|�j�|��t|�����}||d�vrJt t j|��|d��|��|�� |��d�S�)Nz%s.removeService('%s')rw����r���r<���r ���r=���r���r���rG���rN���rR���r���r����NOT_ENABLEDre���r_���r����r(���r(���r)���� removeService���s���� z!FirewallDConfigZone.removeService�bc�����������������C���s*���t�|t�}t�d|�j|��||����d�v�S�)Nz%s.queryService('%s')rw����r���r<���r ���r=���r���rR���)r"���r����r?���r(���r(���r)����queryService���s���� z FirewallDConfigZone.queryServiceza(ss)c�����������������C���s���t��d|�j��|����d�S�)Nz %s.getPorts()����ri���ra���r(���r(���r)����getPorts���s����zFirewallDConfigZone.getPortsc�����������������C���s����g�}t�|t�D�](}t|t�r,|�t|���q|�|��q|}t�d|�jd�dd��|D�����|�j � |��t|�����}||d<�|��|��d�S�)Nz%s.setPorts('[%s]')ry���c�����������������s���s"���|�]}d�|d�|d�f�V��qdS��z('%s, '%s')r���r���Nr(�����.0�portr(���r(���r)���� <genexpr>��������z/FirewallDConfigZone.setPorts.<locals>.<genexpr>r����� r���rN���rZ���r���rO���r ���r=���r���r{���r���rG���rR���r_����r"���Zportsr?���Z_portsr����rP���r(���r(���r)����setPorts���s���� �zFirewallDConfigZone.setPortsc����������� ���������s����t�|t�}t���t���t�d|�j|����|�j�|��t|�����}tt ��fdd�|d���}|D�]&}t ||d��r\ttj d|��f���q\t|dd��|D���\}}|D�]} |d��t| d ���f��q�|D�]} |d��t| d ���f��q�|��|��d�S�) Nz%s.addPort('%s', '%s')c��������������������s���|�d���kS��Nr���r(����rE�����protocolr(���r)����<lambda>���r����z-FirewallDConfigZone.addPort.<locals>.<lambda>r����r����%s:%sc�����������������S���s���g�|�]\}}|�qS�r(���r(����r�����_port� _protocolr(���r(���r)���� <listcomp>���r����z/FirewallDConfigZone.addPort.<locals>.<listcomp>�-�r���r<���r ���r=���r���r���rG���rN���rR����filterr���r���r���r~���r���re���r���r���r_���� r"���r����r����r?���rP���Zexisting_port_idsZport_idZadded_rangesZremoved_ranges�ranger(���r����r)����addPort���s&���� � �zFirewallDConfigZone.addPortc����������� ���������s����t�|t�}t���t���t�d|�j|����|�j�|��t|�����}tt ��fdd�|d���}|D�]}t ||d��r\�q�q\ttj d|��f���t|dd��|D���\}}|D�]} |d��t| d ���f��q�|D�]} |d��t| d ���f��q�|��|��d�S�) Nz%s.removePort('%s', '%s')c��������������������s���|�d���kS�r����r(���r����r����r(���r)���r�������r����z0FirewallDConfigZone.removePort.<locals>.<lambda>r����r���r����c�����������������S���s���g�|�]\}}|�qS�r(���r(���r����r(���r(���r)���r������r����z2FirewallDConfigZone.removePort.<locals>.<listcomp>r�����r���r<���r ���r=���r���r���rG���rN���rR���r����r���r���r���r����r���re���r���r���r_���r����r(���r����r)���� removePort���s$���� �zFirewallDConfigZone.removePortc�����������������C���sX���t�|t�}t�|t�}t�d|�j||��|����d�D�] \}}t||�r2||kr2�dS�q2dS�)Nz%s.queryPort('%s', '%s')r����TF�r���r<���r ���r=���r���rR���r����r"���r����r����r?���r����r����r(���r(���r)���� queryPort ��s���� �zFirewallDConfigZone.queryPortc�����������������C���s���t��d|�j��|����d�S�)Nz%s.getProtocols()� ���ri���ra���r(���r(���r)����getProtocols��s����z FirewallDConfigZone.getProtocolsc�����������������C���sN���t�|t�}t�d|�jd�|���|�j�|��t|�����}||d<�|�� |��d�S�)Nz%s.setProtocols('[%s]')ry���r����rz���)r"���Z protocolsr?���rP���r(���r(���r)����setProtocols!��s���� �z FirewallDConfigZone.setProtocolsc�����������������C���sf���t�|t�}t�d|�j|��|�j�|��t|�����}||d�v�rJt t j|��|d��|��|�� |��d�S�)Nz%s.addProtocol('%s')r����r}����r"���r����r?���rP���r(���r(���r)����addProtocol-��s���� zFirewallDConfigZone.addProtocolc�����������������C���sf���t�|t�}t�d|�j|��|�j�|��t|�����}||d�vrJt t j|��|d��|��|�� |��d�S�)Nz%s.removeProtocol('%s')r����r����r����r(���r(���r)����removeProtocol:��s���� z"FirewallDConfigZone.removeProtocolc�����������������C���s*���t�|t�}t�d|�j|��||����d�v�S�)Nz%s.queryProtocol('%s')r����r����)r"���r����r?���r(���r(���r)���� queryProtocolG��s���� z!FirewallDConfigZone.queryProtocolc�����������������C���s���t��d|�j��|����d�S�)Nz%s.getSourcePorts()����ri���ra���r(���r(���r)����getSourcePortsQ��s����z"FirewallDConfigZone.getSourcePortsc�����������������C���s����g�}t�|t�D�](}t|t�r,|�t|���q|�|��q|}t�d|�jd�dd��|D�����|�j � |��t|�����}||d<�|��|��d�S�)Nz%s.setSourcePorts('[%s]')ry���c�����������������s���s"���|�]}d�|d�|d�f�V��qdS�r����r(���r����r(���r(���r)���r����e��r����z5FirewallDConfigZone.setSourcePorts.<locals>.<genexpr>r����r����r����r(���r(���r)����setSourcePortsX��s���� �z"FirewallDConfigZone.setSourcePortsc����������� ���������s����t�|t�}t���t���t�d|�j|����|�j�|��t|�����}tt ��fdd�|d���}|D�]&}t ||d��r\ttj d|��f���q\t|dd��|D���\}}|D�]} |d��t| d ���f��q�|D�]} |d��t| d ���f��q�|��|��d�S�) Nz%s.addSourcePort('%s', '%s')c��������������������s���|�d���kS�r����r(���r����r����r(���r)���r����u��r����z3FirewallDConfigZone.addSourcePort.<locals>.<lambda>r����r���r����c�����������������S���s���g�|�]\}}|�qS�r(���r(���r����r(���r(���r)���r����z��r����z5FirewallDConfigZone.addSourcePort.<locals>.<listcomp>r����r����r����r(���r����r)���� addSourcePortk��s&���� � �z!FirewallDConfigZone.addSourcePortc����������� ���������s����t�|t�}t���t���t�d|�j|����|�j�|��t|�����}tt ��fdd�|d���}|D�]}t ||d��r\�q�q\ttj d|��f���t|dd��|D���\}}|D�]} |d��t| d ���f��q�|D�]} |d��t| d ���f��q�|��|��d�S�) Nz%s.removeSourcePort('%s', '%s')c��������������������s���|�d���kS�r����r(���r����r����r(���r)���r�������r����z6FirewallDConfigZone.removeSourcePort.<locals>.<lambda>r����r���r����c�����������������S���s���g�|�]\}}|�qS�r(���r(���r����r(���r(���r)���r�������r����z8FirewallDConfigZone.removeSourcePort.<locals>.<listcomp>r����r����r����r(���r����r)����removeSourcePort���s$���� �z$FirewallDConfigZone.removeSourcePortc�����������������C���sX���t�|t�}t�|t�}t�d|�j||��|����d�D�] \}}t||�r2||kr2�dS�q2dS�)Nz%s.querySourcePort('%s', '%s')r����TFr����r����r(���r(���r)����querySourcePort���s���� �z#FirewallDConfigZone.querySourcePortc�����������������C���s���t��d|�j��|����d�S�)Nz%s.getIcmpBlocks()����ri���ra���r(���r(���r)���� getIcmpBlocks���s����z!FirewallDConfigZone.getIcmpBlocksc�����������������C���sN���t�|t�}t�d|�jd�|���|�j�|��t|�����}||d<�|�� |��d�S�)Nz%s.setIcmpBlocks('[%s]')ry���r����rz���)r"���Z icmptypesr?���rP���r(���r(���r)���� setIcmpBlocks���s���� �z!FirewallDConfigZone.setIcmpBlocksc�����������������C���sf���t�|t�}t�d|�j|��|�j�|��t|�����}||d�v�rJt t j|��|d��|��|�� |��d�S�)Nz%s.addIcmpBlock('%s')r����r}����r"����icmptyper?���rP���r(���r(���r)����addIcmpBlock���s���� z FirewallDConfigZone.addIcmpBlockc�����������������C���sf���t�|t�}t�d|�j|��|�j�|��t|�����}||d�vrJt t j|��|d��|��|�� |��d�S�)Nz%s.removeIcmpBlock('%s')r����r����r����r(���r(���r)����removeIcmpBlock���s���� z#FirewallDConfigZone.removeIcmpBlockc�����������������C���s*���t�|t�}t�d|�j|��||����d�v�S�)Nz%s.queryIcmpBlock('%s')r����r����)r"���r����r?���r(���r(���r)����queryIcmpBlock���s���� z"FirewallDConfigZone.queryIcmpBlockc�����������������C���s���t��d|�j��|����d�S�)Nz%s.getIcmpBlockInversion()����ri���ra���r(���r(���r)����getIcmpBlockInversion���s����z)FirewallDConfigZone.getIcmpBlockInversionc�����������������C���sH���t�|t�}t�d|�j|��|�j�|��t|�����}||d<�|�� |��d�S�)Nz%s.setIcmpBlockInversion('%s')r����� r����boolr ���r=���r���r���rG���rN���rR���r_���)r"����flagr?���rP���r(���r(���r)����setIcmpBlockInversion���s���� z)FirewallDConfigZone.setIcmpBlockInversionc�����������������C���sP���t��d|�j��|�j�|��t|�����}|d�r:ttj d��d|d<�|�� |��d�S�)Nz%s.addIcmpBlockInversion()r�����icmp-block-inversionT�r ���r=���r���r���rG���rN���rR���r���r���r~���r_���rU���r(���r(���r)����addIcmpBlockInversion���s����z)FirewallDConfigZone.addIcmpBlockInversionc�����������������C���sP���t��d|�j��|�j�|��t|�����}|d�s:ttj d��d|d<�|�� |��d�S�)Nz%s.removeIcmpBlockInversion()r����r����F�r ���r=���r���r���rG���rN���rR���r���r���r����r_���rU���r(���r(���r)����removeIcmpBlockInversion���s����z,FirewallDConfigZone.removeIcmpBlockInversionc�����������������C���s���t��d|�j��|����d�S�)Nz%s.queryIcmpBlockInversion()r����ri���ra���r(���r(���r)����queryIcmpBlockInversion��s����z+FirewallDConfigZone.queryIcmpBlockInversionc�����������������C���s���t��d|�j��|����d�S�)Nz%s.getMasquerade()����ri���ra���r(���r(���r)���� getMasquerade��s����z!FirewallDConfigZone.getMasqueradec�����������������C���sH���t�|t�}t�d|�j|��|�j�|��t|�����}||d<�|�� |��d�S�)Nz%s.setMasquerade('%s')r����r����)r"���� masquerader?���rP���r(���r(���r)���� setMasquerade��s���� z!FirewallDConfigZone.setMasqueradec�����������������C���sP���t��d|�j��|�j�|��t|�����}|d�r:ttj d��d|d<�|�� |��d�S�)Nz%s.addMasquerade()r����r����Tr����rU���r(���r(���r)���� addMasquerade"��s����z!FirewallDConfigZone.addMasqueradec�����������������C���sP���t��d|�j��|�j�|��t|�����}|d�s:ttj d��d|d<�|�� |��d�S�)Nz%s.removeMasquerade()r����r����Fr����rU���r(���r(���r)����removeMasquerade-��s����z$FirewallDConfigZone.removeMasqueradec�����������������C���s���t��d|�j��|����d�S�)Nz%s.queryMasquerade()r����ri���ra���r(���r(���r)����queryMasquerade8��s����z#FirewallDConfigZone.queryMasqueradeza(ssss)c�����������������C���s���t��d|�j��|����d�S�)Nz%s.getForwardPorts()� ���ri���ra���r(���r(���r)����getForwardPortsA��s����z#FirewallDConfigZone.getForwardPortsc�����������������C���s����g�}t�|t�D�](}t|t�r,|�t|���q|�|��q|}t�d|�jd�dd��|D�����|�j � |��t|�����}||d<�|��|��d�S�)Nz%s.setForwardPorts('[%s]')ry���c�����������������s���s.���|�]&}d�|d�|d�|d�|d�f�V��qdS�)z('%s, '%s', '%s', '%s')r���r���rp�������Nr(���r����r(���r(���r)���r����U��s�����z6FirewallDConfigZone.setForwardPorts.<locals>.<genexpr>r����r����r����r(���r(���r)����setForwardPortsH��s���� ��z#FirewallDConfigZone.setForwardPortsZssssc�����������������C���s����t�|t�}t�|t�}t�|t�}t�|t�}t�d|�j||||��|�j�|��||t|�t|�f}t|�����}||d�v�r�t t jd||||f���|d��|��|�� |��d�S�)Nz)%s.addForwardPort('%s', '%s', '%s', '%s')r�����%s:%s:%s:%sr}����r"���r����r�����toport�toaddrr?����fwp_idrP���r(���r(���r)����addForwardPort\��s$���� ���z"FirewallDConfigZone.addForwardPortc�����������������C���s����t�|t�}t�|t�}t�|t�}t�|t�}t�d|�j||||��|�j�|��||t|�t|�f}t|�����}||d�vr�t t jd||||f���|d��|��|�� |��d�S�)Nz,%s.removeForwardPort('%s', '%s', '%s', '%s')r����r����r����r����r(���r(���r)����removeForwardPortp��s$���� ���z%FirewallDConfigZone.removeForwardPortc�����������������C���sb���t�|t�}t�|t�}t�|t�}t�|t�}t�d|�j||||��||t|�t|�f}||����d�v�S�)Nz+%s.queryForwardPort('%s', '%s', '%s', '%s')r����r����)r"���r����r����r����r����r?���r����r(���r(���r)����queryForwardPort���s���� �z$FirewallDConfigZone.queryForwardPortc�����������������C���s���t��d|�j��|����d�S�)Nz%s.getInterfaces()� ���ri���ra���r(���r(���r)���� getInterfaces���s����z!FirewallDConfigZone.getInterfacesc�����������������C���sN���t�|t�}t�d|�jd�|���|�j�|��t|�����}||d<�|�� |��d�S�)Nz%s.setInterfaces('[%s]')ry���r����rz���)r"���rW���r?���rP���r(���r(���r)���� setInterfaces���s���� �z!FirewallDConfigZone.setInterfacesc�����������������C���st���t�|t�}t�d|�j|��|�j�|��t|�����}||d�v�rJt t j|��|d��|��|�� |��t|�jj|��d�S�)Nz%s.addInterface('%s')r����)r���r<���r ���r=���r���r���rG���rN���rR���r���r���r~���r���r_���r���r���r.����r"���� interfacer?���rP���r(���r(���r)����addInterface���s���� z FirewallDConfigZone.addInterfacec�����������������C���sp���t�|t�}t�d|�j|��|�j�|��t|�����}||d�vrJt t j|��|d��|��|�� |��td|��d�S�)Nz%s.removeInterface('%s')r������)r���r<���r ���r=���r���r���rG���rN���rR���r���r���r����re���r_���r���r����r(���r(���r)����removeInterface���s���� z#FirewallDConfigZone.removeInterfacec�����������������C���s*���t�|t�}t�d|�j|��||����d�v�S�)Nz%s.queryInterface('%s')r����r����)r"���r����r?���r(���r(���r)����queryInterface���s���� z"FirewallDConfigZone.queryInterfacec�����������������C���s���t��d|�j��|����d�S�)Nz%s.getSources()����ri���ra���r(���r(���r)���� getSources���s����zFirewallDConfigZone.getSourcesc�����������������C���sN���t�|t�}t�d|�jd�|���|�j�|��t|�����}||d<�|�� |��d�S�)Nz%s.setSources('[%s]')ry���r����rz���)r"���rX���r?���rP���r(���r(���r)���� setSources���s���� �zFirewallDConfigZone.setSourcesc�����������������C���sf���t�|t�}t�d|�j|��|�j�|��t|�����}||d�v�rJt t j|��|d��|��|�� |��d�S�)Nz%s.addSource('%s')r����r}����r"���r[���r?���rP���r(���r(���r)���� addSource���s���� zFirewallDConfigZone.addSourcec�����������������C���sf���t�|t�}t�d|�j|��|�j�|��t|�����}||d�vrJt t j|��|d��|��|�� |��d�S�)Nz%s.removeSource('%s')r����r����r����r(���r(���r)����removeSource���s���� z FirewallDConfigZone.removeSourcec�����������������C���s*���t�|t�}t�d|�j|��||����d�v�S�)Nz%s.querySource('%s')r����r����)r"���r[���r?���r(���r(���r)����querySource���s���� zFirewallDConfigZone.querySourcec�����������������C���s���t��d|�j��|����d�S�)Nz%s.getRichRules()����ri���ra���r(���r(���r)����getRichRules��s����z FirewallDConfigZone.getRichRulesc�����������������C���s\���t�|t�}t�d|�jd�|���|�j�|��t|�����}dd��|D��}||d<�|�� |��d�S�)Nz%s.setRichRules('[%s]')ry���c�����������������S���s���g�|�]}t�t|d����qS�)��rule_str)r<���r ���)r�����rr(���r(���r)���r������r����z4FirewallDConfigZone.setRichRules.<locals>.<listcomp>r����rz���)r"���Zrulesr?���rP���r(���r(���r)����setRichRules��s���� �z FirewallDConfigZone.setRichRulesc�����������������C���st���t�|t�}t�d|�j|��|�j�|��t|�����}tt |d��}||d�v�rXt tj|��|d�� |��|��|��d�S�)Nz%s.addRichRule('%s')r����r����)r���r<���r ���r=���r���r���rG���rN���rR���r ���r���r���r~���r���r_����r"����ruler?���rP���r����r(���r(���r)����addRichRule��s���� zFirewallDConfigZone.addRichRulec�����������������C���st���t�|t�}t�d|�j|��|�j�|��t|�����}tt |d��}||d�vrXt tj|��|d�� |��|��|��d�S�)Nz%s.removeRichRule('%s')r����r����)r���r<���r ���r=���r���r���rG���rN���rR���r ���r���r���r����re���r_���r����r(���r(���r)����removeRichRule)��s���� z"FirewallDConfigZone.removeRichRulec�����������������C���s8���t�|t�}t�d|�j|��tt|d��}||����d�v�S�)Nz%s.queryRichRule('%s')r����r����)r���r<���r ���r=���r���r ���rR���)r"���r����r?���r����r(���r(���r)���� queryRichRule7��s���� z!FirewallDConfigZone.queryRichRule)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)N)g�__name__� __module__�__qualname__�__doc__Z persistentr���r ���ZPK_ACTION_CONFIGZdefault_polkit_auth_requiredr���r���r ���r,���r-���r6���r���ZPROPERTIES_IFACEr@���rF���r���rH���r�����signalrI���ZPK_ACTION_INFOZINTROSPECTABLE_IFACErJ���r!���rR���rV���r\���r_���r`���rb���r^���re���rf���rh���rg���rj���rm���rn���ro���rq���rs���rt���ru���rx���r|���r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����r����� __classcell__r(���r(���r&���r)���r���0���s��� �� �� �� � �� �� �� �� �� � � ������ �� � � ������ �� � � ��� ��� �������� ����� � � ��� ���r���)"r ���Zdbus.serviceZfirewallr���Zfirewall.dbus_utilsr���r���r���Zfirewall.core.io.zoner���Zfirewall.core.fw_ifcfgr���Zfirewall.core.baser���Zfirewall.core.richr ���Zfirewall.core.loggerr ���Zfirewall.server.dbusr���Zfirewall.server.decoratorsr���r ���r���r���r���Zfirewall.errorsr���Zfirewall.functionsr���r���r���r���r���r(���r(���r(���r)����<module>���s���