+
    #fd                         R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHtH	t	 ^ RI
HtHtHtHtHtHt ^ RIt ! R R]P&                  P(                  4      tR# )z-backend_iptables.py: iptables backend for ufwN)UFWErrorUFWRule)warndebugmsgcmdcmd_pipe	_findpathc                      a  ] tR t^t o RtRR ltR tR tR tRR lt	R t
R	 tR
 tR tR tR tR tRR ltRR ltR tRR ltR tR tR tRtV tR# )UFWBackendIptableszInstance class for UFWBackendNc           	     $   R\         P                  P                  ,           R,           V n        W n        W0n        / p\        \         P                  P                  V4      p\        P                  P                  VR4      VR&   \        P                  P                  VR4      VR&   \        P                  P                  VR4      VR&   \        P                  P                  VR	4      VR
&   \        P                  P                  VR4      VR&   \        P                  P                  VR4      VR&   \        P                  P                  \        \         P                  P                  V4      R4      VR&   \         P                  P                  P                  V RWW#R7       R. R. R. R. /V n        R F  pRpVR8X  d)   V P!                  4       '       d
   Wv,          pM	VR8X  d   K4  R  F;  pR! F2  p	V: RV: RV	: 2p
V P                  V,          P#                  V
4       K4  	  K=  	  V P                  R,          P#                  VR,           4       V P                  R,          P#                  VR,           4       K  	  . R"OV n        RV n        R# )#z!UFWBackendIptables initializationz# z
_comment #zufw/user.rulesruleszufw/before.rulesbefore_ruleszufw/after.rulesafter_ruleszufw/user6.rulesrules6zufw/before6.rulesbefore6_ruleszufw/after6.rulesafter6_ruleszufw-initinitiptables)rootdirdatadirbeforeuseraftermisc6ufw-z	-logging-z-logging-denyz-logging-allowz[UFW LIMIT BLOCK]N)4r   )r   r   r   inputoutputforward)-mlimit--limitz3/minute-jLOG--log-prefix)r   commonprogramNamecomment_strr   r   r	   
config_dirospathjoin	state_dirbackend
UFWBackend__init__chainsuse_ipv6appendufw_user_limit_logufw_user_limit_log_text)selfdryrunr   r   filesr,   verchain_prefixloctargetchains   &&&&       6/usr/lib/python3/dist-packages/ufw/backend_iptables.pyr3   UFWBackendIptables.__init__    s   #**"8"88<Gszz44g>
j2BCg "Z9K Ln!ww||J8IJm'',,z3DEh!#j:M!No "Z9K Ln
 Yszz/C/CW%M%/1f 	''j&07 	( 	J  VR"fbIC Lcz==?? 'LCZ2<F2>VLEKK$++E2 = 3 KK&&|o'EFKK&&|6F'FG "#3 (;$    c                    \        R4      pV P                  R,          R8X  d   VR,          pV# V P                  R,          R8X  d   VR,          pV# V P                  R,          R8X  d   VR,          pV# VR	,          pV# )
zGet current policyzNew profiles:default_application_policyacceptz allowdropz denyrejectz rejectz skip)_defaults)r9   rstrs   & rA   get_default_application_policy1UFWBackendIptables.get_default_application_policyP   s    !==56(BHD  ]]78FBGOD  ]]78HDID  GODrC   c           	     h   V P                   '       Eg'   VR8w  d,   VR8w  d%   VR8w  d   \        R4      V,          p\        V4      hVR8w  d,   VR8w  d%   VR8w  d   \        R4      V,          p\        V4      hR	pVR8X  d   R
pM	VR8X  d   RpRpRpVR8X  d2    V P                  V P                  R,          RV,          R4       RpRpMhVR8X  d2    V P                  V P                  R,          RV,          R4       RpRpM0 V P                  V P                  R,          RV,          R4       RpRp\        P                  ! RT,           4      pT P                  R,          T P                  R,          3 F  p \        P                  P                  T4      p	T	R,          p
T	R,           Fi  pTP                  T4      '       d1   \        P                  P                  YP                  Yk4      4       KJ  \        P                  P                  Y4       Kk  	   \        P                  P                  T	4       K  	  \        R4      RVRV/,          pV\        R4      ,          pV#   \
         d    h i ; i  \
         d    h i ; i  \
         d    h i ; i  \
         d    h i ; i  \
         d    h i ; i)zSets default policy of firewallallowdenyrH   zUnsupported policy '%s'incomingoutgoingroutedz%Unsupported policy for direction '%s'INPUTOUTPUTFORWARD rJ   zDEFAULT_%s_POLICYz"ACCEPT"z	UFW BLOCKz	UFW ALLOWz"REJECT"z"DROP"r   r   tmporigz5Default %(direction)s policy changed to '%(policy)s'
	directionpolicyz*(be sure to update your rules accordingly))r:   rI   r   set_defaultr;   	Exceptionrecompiler   util
open_filessearchwrite_to_filesubclose_files)r9   r[   rZ   err_msgr@   old_log_strnew_log_strpatffnsfdlinerK   s   &&&          rA   set_default_policy%UFWBackendIptables.set_default_policy^   s   {{{ Vv%5&H:L56&Aw''J&9
+BH$CD&(w''EJ& h&!KK $$TZZ
%;,?5,I,8:
 *)8#$$TZZ
%;,?5,I,8:
 *)$$TZZ
%;,?5,I,68
 *) **S;./Cjj/N1KL((--a0C ZKKDzz$''..r77;3MN..r8	 (HH((- M$ IJ	8V<>>??_ !  !  !  !  ! s<   +I$ +I4 +J 8JJ$$I14JJJ!$J1c                
   V P                   '       d.   R\        R4      ,           pVR\        R4      ,           ,          pV# V P                  4        . R+Op. p. pVR8X  d   VP                  R4       . R,Op. R-OpEMVR8X  d   R. F3  pVP                  RV,          4       VP                  RV,          4       K5  	  R/ F3  pVP                  RV,          4       VP                  RV,          4       K5  	  R0 F3  pVP                  R	V,          4       VP                  R	V,          4       K5  	  R1 F  pVP                  R
V,          4       K  	  EM-VR8X  d<   R2 F3  pVP                  RV,          4       VP                  RV,          4       K5  	  EMVR8X  d   R2 F3  pVP                  RV,          4       VP                  RV,          4       K5  	  V P                  R,          R,          '       d#   VP                  R4       VP                  R4       V P                  R,          R,          '       d#   VP                  R4       VP                  R4       EM%VR8X  d;   R2 F3  pVP                  RV,          4       VP                  RV,          4       K5  	  MVR8X  d   R2 F  pVP                  RV,          4       VP                  RV,          4       VP                  RV,          4       VP                  RV,          4       VP                  R V,          4       VP                  R!V,          4       K  	  VP                  R"4       VP                  R#4       VP                  R$4       VP                  R%4       R&V,          pV F  pR'V9   dN   VP                  R'4      w  rVR(V	,          ,          p\        V P                  .V,           VRV	.,           4      w  rM'\        V P                  .V,           V.,           4      w  rW+,          pVR8w  d
   VR),          pV
^ 8w  g   K  \        V4      h	  VR8X  g   V P                  4       '       d   VR*,          pV F  pR'V9   dN   VP                  R'4      w  rVR(V	,          ,          p\        V P                  .V,           VRV	.,           4      w  rM'\        V P                  .V,           V.,           4      w  rW+,          pVR8w  d
   VR),          pV
^ 8w  g   K  \        V4      h	  V# )3z'Show current running status of firewall> zChecking raw iptables
zChecking raw ip6tables
rawz-tbuiltinsz	filter:%sz	mangle:%szraw:%sznat:%sr   zufw-before-%szufw6-before-%sr   ufw-user-%sufw6-user-%sr$   r   zufw-user-limit-acceptufw-user-limitr   zufw6-user-limit-acceptufw6-user-limitr   zufw-after-%szufw6-after-%sloggingzufw-before-logging-%szufw6-before-logging-%szufw-user-logging-%szufw6-user-logging-%szufw-after-logging-%szufw6-after-logging-%szufw-logging-allowzufw-logging-denyzufw6-logging-allowzufw6-logging-denyzIPV4 (%s):
:z(%s) 
z

IPV6:
)-nz-vz-x-L)filternatmanglerr   )r}   r   rr   )rT   rV   rU   )
PREROUTINGrT   rV   rU   POSTROUTING)r   rU   )r   r   rU   )r    r"   r!   )r:   rI   initcapsr6   capssplitr   r   r   r5   	ip6tables)r9   
rules_typeoutargsitemsitems6cbitrcrX   s   &&          rA   get_running_raw"UFWBackendIptables.get_running_raw   s)   ;;;455C4!6777CJ 	'KK6E0F:%3[1_-kAo. 4%[1_-kAo.% .X\*hl+ . =X\* =8#3_q01.23 4 6!3]Q./nq01 4 yy!#&&45-.yy!#&&67/07"3^a/0o12 4 9$34q896:;2Q674q893a7859: 4 LL,-LL+,MM./MM-.
+Aaxw!}$$ 6!T1 EF	S$ 6! <=	JCU"tQwsm#  $--//= C!8WWS\FQ7a=(C #T]]Od$:aq\$I JIR #T^^$4t$;qc$A BIR
&4KC7"3-'  
rC   c           
        RpV P                   '       dD   R\        R4      ,           pV P                  4       '       d   VR\        R4      ,           ,          pV# \        R4      pR6 F  p\        V P                  RR	V,          R
.4      w  rcV^8X  d   \        R4      u # V^ 8w  d   \        VRV,          ,           4      hV P                  4       '       g   Kq  \        V P                  RRV,          R
.4      w  rgV^ 8w  g   K  \        VR,           4      h	  RpRp	Rp
V P                  V P                  ,           p^p/ pV EFm  pRp/ pRpRpV'       gU   VP                  R8w  g   VP                  R8w  d3   RpVP                  4       pVV9   d   \        RV,          4       Kc  RVV&   R7 EF  pRVV&   RpRpVR8X  db   VP                  pV'       gA   VP                  R8w  d0   VP                  pVP                  '       d   VR8X  d
   VR,          pMmVP                  pM`VP                   pV'       gA   VP                  R8w  d0   VP                  pVP                  '       d   VR8X  d
   VR,          pMVP"                  pVR8w  d   VR8w  d   VVV&   VR8w  Ed{   VV,          R8X  d   VVV&   MVV;;,          RV,           ,          uu&   V'       d8   VP$                  R8w  d'   VV;;,          RVP$                  ,           ,          uu&   V'       Ed   VR8X  d{   VP                  R8w  dj   VV;;,          RVP                  ,          ,          uu&   VP                  '       d   VR8X  d   VV;;,          R,          uu&   VV;;,          R,          uu&   VR8X  d{   VP                  R8w  dj   VV;;,          RVP                  ,          ,          uu&   VP                  '       d   VR8X  d   VV;;,          R,          uu&   VV;;,          R,          uu&   VR8X  Ed   VR8X  g   VR8X  d   RVV&   V'       dn   VP$                  R8w  d]   VP                  VP                   8X  dB   VP                  VP"                  8X  d'   VV;;,          RVP$                  ,           ,          uu&   VR8X  d   VV;;,          R,          uu&   MV'       dS   VP$                  R8w  dB   VP                  VP"                  8X  d'   VV;;,          RVP$                  ,           ,          uu&   MWVP                  '       dF   VP                   R8X  d5   VP                  R8X  d$   RVV,          9  d   VV;;,          R,          uu&   VP&                  '       d   VR8X  d8   VP(                  R8w  d'   VV;;,          RVP(                  ,          ,          uu&   VR8X  d>   VP*                  R8w  d*   VV;;,          RVP*                  ,          ,          uu&   EKZ  EK]  EK`  VR8X  d8   VP(                  R8w  d'   VV;;,          RVP(                  ,          ,          uu&   VR8X  g   EK  VP*                  R8w  g   EK  VV;;,          RVP*                  ,          ,          uu&   EK  	  . pRpVP,                  '       g    VP.                  P1                  4       R8X  d   VP,                  '       d*   VP3                  VP,                  P1                  4       4       V'       d-   VP.                  R8X  d   VP3                  VP.                  4       \5        V4      ^ 8  d   RR P7                  V4      ,          pV'       d   VR!V,          ,          pVP.                  P9                  4       pVP&                  '       d   R"pVP.                  R#8X  d%   VP&                  '       g   V'       g   V'       g   RpRpVP:                  R8w  d   R$VP=                  4       ,          pVVR,          :R% RRP7                  VP>                  P9                  4       V.4      :R& VR,          :R% V: V: R'2,          pV'       d
   W,          pM=VP&                  '       d
   W,          p
M"VP.                  R8X  d
   W,          p	MW,          pV^,          pEKp  	  VR8w  g   V	R8w  g	   V
R8w  Ed   R(pV'       d
   VR),          p\        R*4      p\        R+4      p\        R,4      pR-pVVVV3,          pV'       d
   VR),          pVVR.\5        V4      ,          R.\5        V4      ,          R.\5        V4      ,          3,          ,          pVV,          pVR8w  d
   VV,          pVR8w  d   V	R8w  d   V\        R'4      ,          pV	R8w  d
   VV	,          pVR8w  d   V
R8w  d   V\        R'4      ,          pV
R8w  d
   VV
,          pTpV'       d   V PA                  4       w  p p!\        R84      R#V PC                  4       RV PC                  R4      R/V PC                  RR4      /,          p"V PE                  4       p#\        R04      R1V!R2V"R3V#R4V/,          # \        R54      V,          # )9zShow ufw managed rulesrW   rq   zChecking iptables
zChecking ip6tables
problem runningr!   r"   r|   rt   r{   zStatus: inactivez iptables: %s
ru   
 ip6tablesTFzSkipping found tuple '%s'dstsrcz::/0 (v6)z	0.0.0.0/0any /z (%s)Anywherez on %sr   z (%s)z, z[%2d] FWDinz # %s2612rz   z

z     ToFromActionz%-26s %-12s%s
r   rS   z0Status: active
%(log)s
%(pol)s
%(app)s%(status)slogpolappstatuszStatus: active%sr   )r   r   zCDefault: %(in)s (incoming), %(out)s (outgoing), %(routed)s (routed))#r:   rI   r5   r   r   r   r   r   r   dappsappget_app_tupler   r   v6dportr   sportprotocolr"   interface_ininterface_outlogtyperZ   lowerr6   lenr/   uppercommentget_commentactionget_loglevel_get_default_policyrL   )$r9   verbose
show_countr   rf   rZ   r   out6sstr_outstr_rter   count	app_rulesrtmp_strlocationtupl
show_protor>   portrX   attribs
attrib_strdir_strr+   full_strstr_tostr_from
str_actionrules_header_fmtrules_headerlevellogging_str
policy_strapp_policy_strs$   &&&                                 rA   
get_statusUFWBackendIptables.get_status  s:   ;;;011C}}ta 6777J%&7IT]]D)Y7? @IRQw+,,qw):c)BBCC}} $..$!/9!=t"E F
7"7\#9:: 8 

T[[(	AGHDJ"""
(9$5>?&*IdO' "%<%%C"qvv| vv444C6M GOD ww%%C"qvv| vv444C6M GOD ww+%#-$'HSM5=}*(, t3!ajjE&9 qzz)99w%<AFFbL$SMVqvv->>M tttv ( 8$SMS0M%<AFFbL$SMVqvv->>M tttv ( 8$SMS0M5=k)SF](2 &!***=55AEE>agg.@$SMS1::-==M&=$SMW4M &!***=77agg-$SMS1::-==MTTTaeevo!%%6/hsm3 SMW,M 999e|"(< Q^^)DDe|2(= Q__)EE )>| e|"(< Q^^)DDe|2(= Q__)EEq (t GJyyyAKK--/58999NN199??#45!++"6NN1;;/w<!#!(DIIg,>!?J 8u--kk'')Gyyy{{d"1999:KyyB%78E??03!((..:J:A:C 1D080;	= =G 999&G[[E)&GLAQJEi l 7gmw"}HG#tWFyH8J0+vz8.LLL', 3v;. 3z?2 3x=022 2L
 $HBwABw7b=AdG#"}G#Bw7b=AdG#"}G#A#'#4#4#6 UK 1 2  $T%=%=%?$d&>&>x&H')A)A)BF*HIJJ "@@BNJKk5*nh;< < '(A..rC   c                   V P                   '       d   \        R\        R4      ,           4       R# . pVP                  V P                  R,          4       V P
                  eg   V P                  eY   VP                  R4       VP                  V P
                  4       VP                  R4       VP                  V P                  4       VP                  R4       \        V4      w  r#V^ 8w  d   \        RV,          4      p\        V4      hR# )	zStop the firewallrq   running ufw-initr   N	--rootdir	--datadirz
force-stopproblem running ufw-init
%s)	r:   r   rI   r6   r;   r   r   r   r   r9   r   r   r   rf   s   &    rA   stop_firewall UFWBackendIptables.stop_firewall  s    ;;;q+,,-DKK

6*+||'DLL,DK(DLL)K(DLL)KK%D	IRQw:S@Aw'' rC   c                   V P                   '       d   \        R\        R4      ,           4       R# . pVP                  V P                  R,          4       V P
                  eg   V P                  eY   VP                  R4       VP                  V P
                  4       VP                  R4       VP                  V P                  4       VP                  R4       \        V4      w  r#V^ 8w  d   \        RV,          4      p\        V4      hR	V P                  9  g:   V P                  R	,          \        V P                  P                  4       4      9  d    V P                  R
4       R#  V P                  V P                  R	,          4       R#   \         d    \        R4      p\        T4      hi ; i  \         d    \        R4      p\        T4      hi ; i)zStart the firewallrq   r   r   Nr   r   startr   loglevellowzCould not set LOGLEVELzCould not load logging rules)r:   r   rI   r6   r;   r   r   r   r   rJ   list	loglevelskeysset_loglevelr]   update_loggingr   s   &    rA   start_firewall!UFWBackendIptables.start_firewall  sg   ;;;q+,,-DKK

6*+||'DLL,DK(DLL)K(DLL)KK D	IRQw:S@Aw''.}}Z(T^^5H5H5J0KK,%%e,
,''j(AB ! , 89G"7++, ! , >?G"7++,s   F )"F2 "F/2"Gc                   V P                   '       d   R# V P                  4        RpV P                  pV'       d   RpV P                  pR F  pVR8X  g   VR8X  dU   V'       d#   V P                  R,          R,          '       g   K;  V'       g#   V P                  R,          R,          '       g   Ke  \        VRR	VR
,           V,           .4      w  rVV^ 8w  g   K  \        R4        R# 	  R# )zCheck if all chains existFr   ufw6r$   limit-acceptr   r   r{   r|   -user-z_need_reload: forcing reloadT)r    r!   r"   r$   r   )r:   r   r   r   r   r   r   )r9   r   prefixexer@   r   r   s   &&     rA   _need_reloadUFWBackendIptables._need_reload  s    ;;; 	mmF..CNE5N#:dii055DIIg$6s$;$;S$fx.?%.GHIIRQw45 O rC   c                   \        R4      pV P                  '       d1   \        R4       V P                  4       '       d   \        R4       R# R# V P	                  4       '       d    V P
                  R,           F+  pV P                  VRV.4       V P                  VRV.4       K-  	  \        RT P                  R,          .T P                  R	.4      w  r4T^ 8w  d   \        TR
,           4      hT P                  4       '       dI   \        RT P                  R,          .T P                  R	.4      w  r4T^ 8w  d   \        TR,           4      hR# R# R#   \         d    \        T4      hi ; i)zReload firewall rules filer   z> | iptables-restorez> | ip6tables-restorer   -F-Zcatr   r{   z	 iptablesr   r   N)rI   r:   r   r5   
is_enabledr4   
_chain_cmdr]   r   r   r;   iptables_restoreip6tables_restore)r9   rf   r   r   r   s   &    rA   _reload_user_rules%UFWBackendIptables._reload_user_rules:  s@   %&;;;&'}}+, __(V,,AOOAay1OOAay1 - !%G)<!="&"7"7!>@IRQww455}}$eTZZ-A%B&*&<&<d%CE	7"7\#9::     (w''(s   %AE E&c                z   . p\         P                  ! R4      p\         P                  ! R4      p\         P                  ! R4      pVP                  V4      '       d   VP                  V4      '       d   VP                  V4      '       d3   VP                  VP	                  RVP	                  RV4      4      4       M!VP                  VP	                  RV4      4       VP                  VP	                  RV4      4       M3VP                  VP	                  RV4      4       MVP                  V4       \         P                  ! R4      p\         P                  ! R	4      p	\         P                  ! R
4      p
Rp\        V4       EFx  w  rVP                  V4      '       g   K  VP	                  RV4      P                  4       pVP                  4       R8X  d   RpMVP                  4       R8X  d   RpMRpV: RV: R2pV	P                  V4      '       g
   RV,           pVP	                  RV4      WL&   VP                  WP	                  RV,           R,           V,           V4      4       VP                  WP	                  RV,           R,           V,           VP	                  RV4      4      4       VP                  WP	                  RV,           R,           V,           VP	                  RV,           V4      4      4       EK{  	  \         P                  ! R4      p\        V4       F  w  rVP                  V4      '       g   K  VP	                  RV4      pVP	                  R V,           R,           V4      pVP	                  RV,           R,           V4      pVWL&   VP                  VV4       VP                  VV4       K  	  V# )!z5Return list of iptables rules appropriate for sendingz-p all zport z-j (REJECT(_log(-all)?)?)z-p tcp z-j \1 --reject-with tcp-resetz-p udp rW   z(.*)-j ([A-Z]+)_log(-all)?(.*)z-j [A-Z]+_log-allz(-A|-D) ([a-zA-Z0-9\-]+)z'-m limit --limit 3/min --limit-burst 10\2rF   ALLOWr$   LIMITBLOCKz -j LOG --log-prefix "[UFW ] "z-m conntrack --ctstate NEW z	\1-j \2\4z\1-j z-user-logging-z\1 z\1-j RETURN\1z	 -j LIMITz+ -m conntrack --ctstate NEW -m recent --setz -j z-user-limitz-user-limit-acceptzL -m conntrack --ctstate NEW -m recent --update --seconds 30 --hitcount 6 -j )	r^   r_   rb   r6   rd   	enumeratestripr   insert)r9   fruler   suffixsnippets	pat_protopat_port
pat_rejectpat_log
pat_logall	pat_chain
limit_argsr   r   r[   lstr	pat_limittmp1tmp2tmp3s   &&&&                rA   _get_rules_from_formatted,UFWBackendIptables._get_rules_from_formattedV  s#    JJz*	::h'ZZ <=
E""u%%$$U++OOIMM)"'G%  ! OOIMM)U$CD	i ?@	b% 89OOE" **>?ZZ 45
JJ:;	>
h'DA~~a   UA.446<<>X-$F\\^w.$F$F?I!((++84?D%kk,:;;x&/@/?0@BH0IJK$M N==&1A2BDJ2K18^1224$5 6 ==&1A2BDJ2K18UT\11M$O P+ (4 JJ|,	h'DA"" }}%R%&( }} &,.4&57D&EFGI !}}Vf_7K%KQO"4(4( ( rC   c                   . pV P                  WV4      p\        P                  ! R4      p\        V4       F  w  rxVP	                  VP                  RV4      P                  4       4       VP                  V4      '       g   KM  WG,          P	                  R4       WG,          P	                  VP                  RV4      P                  RR4      4       WG;;,          VP                  RV4      P                  4       ,          uu&   K  	  V# )zLReturn list of iptables rules appropriate for sending as arguments
to cmd()
z(.*) --log-prefix (".* ")(.*)r  r(   r   "rW   z\3)	r  r^   r_   r  r6   rd   r   matchreplace)	r9   r  r   r  r  str_snippetsri   r   r   s	   &&&&     rA   _get_lists_from_formatted,UFWBackendIptables._get_lists_from_formatted  s     55eVL jj9:l+DAOOCGGE1-3356yy||"">2""3775!#4#<#<S"#EFswwua06688 , rC   c                
   V P                   R,          .pV P                  4       '       d#   VP                  V P                   R,          4       V EF  p \        P                  P                  V4      p\        P                  ! R4      p\        P                  ! R4      p\        P                  ! R4      pT EF#  pTp	Rp
RT9   d$   TP                  R4      w  rTP                  4       p
TP                  T	4      '       g   KK  TP                  RT	4      p\        P                  ! R	TP                  4       4      p\        T4      ^8  g   \        T4      ^	8  d    \        R
4      T,          p\!        T4       K  RpRpRp\        T4      ^8X  g   \        T4      ^	8X  Ed   \        R4      T,          pTR,          P                  R4      ^ ,          pRTR,          9   Ed@   RTR,          9   d   TP#                  TR,          4      '       d   TP#                  TR,          4      '       dl   TR,          P                  R4      ^ ,          P%                  R4      ^,          pTR,          P                  R4      ^,          P%                  R4      ^,          pMTR,          P'                  R4      '       d!   TR,          P%                  R4      ^,          pMLTR,          P'                  R4      '       d!   TR,          P%                  R4      ^,          pM\!        T4       EKg   T^ ,          pRpRT9   d   RpTP                  R4      ^,          p\        T4      ^8  d8   \)        TT^,          T^,          T^,          T^,          T^,          TTT
4	      pM\)        TT^,          T^,          T^,          T^,          T^,          TTT
4	      p\        P                  ! R4      pT^,          R8w  d   TP                  RT^,          4      Tn        T^,          R8w  d   TP                  RT^,          4      Tn        TR8w  d   TP/                  RT4       TR8w  d   TP/                  RT4       Y P                   R,          8X  d0   TP1                  R4       T P2                  P                  T4       EK  TP1                  R4       T P4                  P                  T4       EK&  	  TP7                  4        EK  	  R#   \         d    \        R4      T,          p\        T4      hi ; i  \         d#    \        R4      T,          p\!        T4        EK  i ; i)z$Read in rules that were added by ufwr   r   zCouldn't open '%s' for readingz^### tuple ###\s*zin_\w+zout_\w+rW   z	 comment=z\s+z)Skipping malformed tuple (bad length): %sr   z$Skipping malformed tuple (iface): %srI   !in_out_Fry   T%20r   r   r   zSkipping malformed tuple: %sN)r;   r5   r6   r   r`   open_file_readr]   rI   r   r^   r_   r   r  r  rd   r   r   rb   	partition
startswithr   r   r   set_interfaceset_v6r   r   close)r9   rfnsrj   rY   rf   	pat_tuplepat_iface_inpat_iface_out	orig_linerm   r   hexr   rX   wmsgdtyper   r   r   r"   rule	pat_spacewarn_msgs   &                      rA   _read_rulesUFWBackendIptables._read_rules  sI   

7#$==??KK

8,-A(xx..q1
 

#78I::i0LJJz2M!	 )+ ) =ID!iikG??4(($==T2D((64::<8C3x!|s3x!| !LM$( *T
  !%')(*s8q=CHM#$%K#L(,$.D$'GMM#$6q$9E"c"g~#&#b'>#/#6#6s2w#?#?#0#7#7B#@#@ ),Bc(:1(=(G(G(LQ(O %1 ),Bc(:1(=(G(G(LQ(O %2%(W%7%7%>%>36r73D3DS3I!3LL%(W%7%7%?%?47G4E4Ec4J14MM$(J$,%%(VF&+G"f}*.)/c):1)="3x!|'.vs1vs1vs1v/21vs1vug/6(8 (/vs1vs1vs1v/21vs1vug/6(8 -/JJu,=	#&q6S=09c3q60JDI#&q6S=09c3q60JDI+r1 $ 2 24 F,2 $ 2 25- H 

8 44 KK- KK..t4 KK. JJ--d3c "f JJL{   (<=Cw''(\  ( %'()G'H)-(/H N$	%s   S6E	T"6)T"(UUc                   V P                   R,          pV'       d   V P                   R,          p\        P                  ! V\        P                  4      '       g   \	        RV,          4      p\        V4      h \        P                  P                  V4      pT P                  4        RpT P                  pT'       d   RpT P                  pT P                  '       d    \        P                  P!                  4       pM	TR,          p\        P                  P#                  TR4       \        P                  P#                  TRT,           R	,           4       \        P                  P#                  TRT,           R
,           4       \        P                  P#                  TRT,           R,           4       \        P                  P#                  TRT,           R,           4       \        P                  P#                  TRT,           R,           4       \        P                  P#                  TRT,           R,           4       \        P                  P#                  TRT,           R,           4       \        P                  P#                  TRT,           R,           4       \        P                  P#                  TRT,           R,           4       \        P                  P#                  TRT,           R,           4       \        P                  P#                  TRT,           R,           4       \        P                  P#                  TRT,           R,           4       \        P                  P#                  TRT,           R,           4       \        P                  P#                  TRT,           R,           4       TR8X  d!   T P$                  R,          R,          '       g(   TR8X  d}   T P$                  R,          R,          '       d]   \        P                  P#                  TRT,           R,           4       \        P                  P#                  TRT,           R,           4       \        P                  P#                  TR4       T EF  pTP&                  p	TP(                  '       d   RTP&                  ,           p	TP*                  R8w  d   T	RTP*                  ,           ,          p	Rp
TP,                  R8X  d   TP.                  R8X  d   TP0                  p
MTP,                  R8w  d1   TP.                  R8w  d    R TP,                  : R!TP.                  : 2p
MXTP,                  R8w  d%   YP0                  : RTP,                  : 2,          p
M#YP0                  : RTP.                  : 2,          p
TP2                  R8X  d   TP4                  R8X  d   R"T	: R#TP6                  : R#TP8                  : R#TP:                  : R#TP<                  : R#TP>                  : R#T
: 2pTP@                  R8w  d   TR$TP@                  ,          ,          p\        P                  P#                  Y{R%,           4       EM\B        PD                  ! R#4      pR&pTP2                  '       d   TPG                  R'TP2                  4      pR&pTP4                  '       d   TPG                  R'TP4                  4      pR"T	: R#TP6                  : R#TP8                  : R#TP:                  : R#TP<                  : R#TP>                  : R#T: R#T: R#T
: 2pTP@                  R8w  d   TR$TP@                  ,          ,          p\        P                  P#                  Y{R%,           4       R(pTP(                  '       d   R)pMTP0                  R*8X  d   R+pT: R,T: 2pR-T: R#TPI                  4       : R%2pT PK                  TTT4       F#  p\        P                  P#                  TT4       K%  	  EK  	  \        P                  P#                  TR.4       \        P                  P#                  TR/4        T PM                  T PN                  R0,          4      pT F  w  ppp\Q        T4      ^ 8  d   T^ ,          R18X  d   K'  TPS                  TR&,           4      '       g   KG  \        P                  P#                  TR#PU                  T4      PW                  R2R34      PW                  R4R54      R%,           4       K  	  \        P                  P#                  TR64       TR8X  d!   T P$                  R,          R,          '       g*   TR8X  EdC   T P$                  R,          R,          '       Ed"   \        P                  P#                  TR74       T PN                  R0,          R88w  dn   \        P                  P#                  TR-T,           R9,           R#PU                  T PX                  4      ,           R:,           T PZ                  ,           R;,           4       \        P                  P#                  TR-T,           R<,           4       \        P                  P#                  TR-T,           R=,           4       \        P                  P#                  TR>4       \        P                  P#                  TR?4        T P                  '       d#   \        P                  P]                  TR@4       RA# \        P                  P]                  T4       RA#   \         d    h i ; i  \         d    h i ; i  \         d    h i ; i)Bz.Write out new rules to file to user chain filer   r   z'%s' is not writabler   r   rX   z*filter
ry   z-user-input - [0:0]
z-user-output - [0:0]
z-user-forward - [0:0]
z-before-logging-input - [0:0]
z-before-logging-output - [0:0]
z -before-logging-forward - [0:0]
z-user-logging-input - [0:0]
z-user-logging-output - [0:0]
z-user-logging-forward - [0:0]
z-after-logging-input - [0:0]
z-after-logging-output - [0:0]
z-after-logging-forward - [0:0]
z-logging-deny - [0:0]
z-logging-allow - [0:0]
r$   r   r   z-user-limit - [0:0]
z-user-limit-accept - [0:0]
z### RULES ###
zroute:rW   rI   r   z!out_z
### tuple ### r   z comment=%srz   r   r"  r    r"   r   r!   r   z-A z
### END RULES ###
z
### LOGGING ###
r   -D[z"[z] r  z### END LOGGING ###
z
### RATE LIMITING ###
offz-user-limit z "z "
z-user-limit -j REJECT
z-user-limit-accept -j ACCEPT
z### END RATE LIMITING ###
zCOMMIT
FN)/r;   r-   accessW_OKrI   r   r   r`   ra   r]   r   r   r   r:   sysstdoutfilenorc   r   r   r"   r   r   r   rZ   r   r   r   r   r   r   r   r   r^   r_   rd   format_ruler  _get_logging_rulesrJ   r   r&  r/   r  r7   r8   re   )r9   r   
rules_filerf   rk   r=   r   rl   r   r   ifaceststrr3  r   r   chain_suffixr@   rule_strr   lrules_tr   qs   &&                    rA   _write_rulesUFWBackendIptables._write_rules  s^   ZZ(
H-J yyRWW--.*=>G7##	((%%j1C
 	

!LKKE;;;""$BUB 	r;/r3#58O#OPr3#5)A$B 	Cr3#5)B$C 	D 	r3#5)J$K 	Lr3#5)K$L 	Mr3#5)L$M 	Nr3#5)H$I 	Jr3#5)I$J 	Kr3#5)J$K 	Lr3#5)I$J 	Kr3#5)J$K 	Lr3#5)K$L 	Mr3#5)B$C 	Dr3#5)C$D 	E E!dii&8&=&=F"tyy'9#'>'>HH""2s\'9-D(E FHH""2s\'9-K(L M 	r#45 AXXFyyy!AHH,yyB#		/)F~~#2(=2%!//R*?+,>>1??K>>R'annEEFaooFFFvv|"ajj!''155!''155 99?MAII55D&&r$;7JJsO	666$==7D666$==7D

AGGQUUAGGQUUdF, 99?MAII55D&&r$;7"Lyyy(%'$0,?E',ammo>H33Hl4@B&&r1-Bc l 	r#:; 	r#89	..t}}Z/HIH  GAq!1vzaddl||L3.//&&rHHQK''T2::4G	   	r#:; E!dii&8&=&=F"tyy'9#'>'>HH""2'BC}}Z(E1&&r5%,&(6,7$"9"9:,; , "&!=!=,> AH,H I HH""2u|';2(3 4HH""2u|';9(: ;HH""2'DEr:.	{{{$$S%0$$S)o  		n  		B  		s0   8l "l+ l;  l; :l; l(+l8;mc                   V P                  4        RpVP                  '       d{   V P                  4       '       g   \        R4      p\	        V4      hVP
                  R8X  d=   V P                  R,          R,          '       g   \        R4      VP
                  ,          # MMVP
                  R8X  d=   V P                  R,          R,          '       g   \        R4      VP
                  ,          # VP                  '       d9   VP                  R8w  d(   VP                  R	8w  d   \        R
4      p\	        V4      h. pRpRpV P                  pVP                  p	VP                  '       dK   V P                  R8  d.   VP                  R8w  g   VP                  R8w  d   \        R4      # V P                  pV	^ 8  g   V	\        V4      8  d   \        R4      V	,          p\	        V4      hV	^ 8  d)   VP                   '       d   \        R4      p\	        V4      h VP#                  4        ^p
Rp^ pR/pT EF  p TP#                  4        TP&                  TP(                  TP                  TP                  3pY8X  ds   T^,          R8X  d   T^,          R8X  d   T
^8  g#   T^,          R8X  d   T^,          R8X  g   Y8w  d%   RpTP+                  TP-                  4       4       R/pM	T	^,          p	TpT
^,          p
\.        P0                  ! Y4      pT^8  d
   T^,          pT^ 8X  dJ   T'       gB   T'       g:   RpTP                   '       g#   TP+                  TP-                  4       4       EK9  EK<  TR08X  d)   TP                   '       d   TP2                  R8X  d   RpEKk  T^ 8  dA   TP                   '       g/   T'       g'   RpRpTP+                  TP-                  4       4       EK  TP+                  T4       EK  	  T'       d1   T^ 8  d)   \        R4      pTP                  '       d
   TR,          pT# MT'       g2   TP                   '       g    TP+                  TP-                  4       4       T'       gM   TP                   '       d;   T P4                  '       g)   \        R4      pTP                  '       d
   TR,          pT# T'       dC   TP                   '       g1   T'       g)   \        R4      pTP                  '       d
   TR,          pT# TP                  '       d   YPn        MYPn	         T P7                  TP                  4       \        R4      pTP                  '       d   \        R4      pT P9                  4       '       Ed   T P4                  '       Eg   RpT'       g*   T P;                  TP                  4      '       g	   T'       dx   RpT'       d   T\        R4      ,          pMT\        R4      ,          pTP                  '       d
   TR,          pT'       d    T P=                  4        MT\        R4      ,          pMT'       dj   TP                   '       dX   Rp\        R4      pTP                  '       d
   TR,          pT'       d    T P=                  4        RpMBT\        R4      ,          pM/T'       g(   T'       g    TP                   '       g   Rp\        R4      pTR8w  Ed   T P>                  pRpTP                  '       d   T P@                  pR pTR,          pR!pTPB                  '       d   R"pMTPD                  R#8X  d   R$pT: R%T: 2p\        R&4      p\G        TR'TR(.4      w  ppT^ 8w  d   \	        T4      hT: R)T: R)TPI                  4       : 2p\J        PL                  ! R*4      pT PO                  TTT4       F  p\G        T.T,           4      w  ppT^ 8w  d&   \Q        T\R        PT                  4       \	        T4       TR8X  g   KN  TPW                  R)PY                  T4      4      '       g   Kv  TP[                  R+R)PY                  T4      4      p\G        TRTR,R-.4      w  ppT^ 8w  g   K  \]        R.T,          4       K  	  T#   \$         d    h i ; i  \$         d    h i ; i  \         d    h \$         d    \        R4      p\	        T4        ELi ; i  \$         d    h i ; i  \$         d    h i ; i)1a(  Updates firewall with rule by:
* appending the rule to the chain if new rule and firewall enabled
* deleting the rule from the chain if found and firewall enabled
* inserting the rule if possible and firewall enabled
* updating user rules file
* reloading the user rules file if rule is modified
rW   z)Adding IPv6 rule failed: IPv6 not enabledr$   r   z#Skipping unsupported IPv6 '%s' ruler   z#Skipping unsupported IPv4 '%s' ruleudptcpz/Must specify 'tcp' or 'udp' with multiple portsFz1.4z:Skipping IPv6 application rule. Need at least iptables 1.4zInvalid position '%d'z Cannot specify insert and deleteTz Skipping inserting existing ruler   z"Could not delete non-existent rulezSkipping adding existing rulezCouldn't update rules filezRules updatedzRules updated (v6)zRule insertedzRule updatedz (skipped reloading firewall)r8  zRule deleted-Az
Rule addedr   r   r    r"   r   r!   r   !Could not update running firewallr|   r{   r   z(-A +)(ufw6?-user-[a-z\-]+)(.*)r   r&   RETURNzFAILOK: -D %s -j RETURN)rW   rW   rW   rW   )/r   r   r5   rI   r   r   r   multir   r   positioniptables_versionr   r   r   r   remove	normalizer]   r   r   r6   dup_ruler   r  r   r:   rI  r   r   r   r   r   r"   rZ   r   r@  r^   r_   r  r   r=  stderrrb   r/   rd   r   )r9   r2  allow_reloadrK   rf   newrulesfoundmodifiedr   rS  r   insertedmatcheslastr   currentretflagr   r=   rE  r@   r   r   rF  r  r   r   s   &&&                         rA   set_ruleUFWBackendIptables.set_rule  s    	777==??GHw''{{g%dii.@.E.E>?4;;OO{{g%dii.@.E.E>?4;;OO:::$--50T]]e5KIJG7##

==777$$u,$))r/26))r/UVVKKE a<8c%j0/0H=G7##a<DKKK:;G7##	NN A uuaeeQVVQVV4G  GrMd1gm	AJ"$r)9?#HOODMMO4+DMHDQJE--(CQw1axh {{{OODMMO4 #t{{{t||r/AqX 0"Y \ {;<777GOD	  0 T[[[=>777GODt{{{889777GOD777"K!J	dgg& !777)*D ??T[[[D4,,TWW55Ao..DAn--D777GOD//1 A=>>D4;;;( 777GOD//1 DA=>>D8DKKKrzmm$777..C#)LGOD&<<<#,L^^u,#+L(4lC ?@dE4 89	S7"7++)-ud6F6F6HI**%GH778D8DFA !$SEAIIRQwC, ) t|sxx{(C(C#KKsxx{;$'dAtX(F$G	S7!";q"ABF [  		  T  	 	45GW	2 %   % sH   b 3b%b, c c/ bb),cccc,/c<c                v   . p. pV'       d   V P                   pMV P                  pVP                  4       pVP                  V4       VP	                  4        VP                  4       pV FL  pVP                  4       pVP	                  4        VP                  4       p	W8X  g   K;  VP                  V4       KN  	  V# )z@Return a list of UFWRules from the system based on template rule)r   r   rW  r(  rV  r   r6   )
r9   templater   r   r   normr   r   rX   	tmp_tuples
   &&&       rA   get_app_rules_from_system,UFWBackendIptables.get_app_rules_from_system  s    	KKEJJE  "B!!#A**,CMMO))+I   %  rC   c                   V P                   pVP                  R4      '       d   V P                  p\        V.V,           4      w  rVV^ 8w  d:   \	        RV,          4      pV'       d   \        RV,           4       R# \        V4      hR# )zPerform command on chainr   zCould not perform '%s'zFAILOK: N)r   r&  r   r   rI   r   r   )r9   r@   r   fail_okr   r   r   rf   s   &&&&    rA   r   UFWBackendIptables._chain_cmd  sn    mmF##..C%	70D9:Gj7*+w'' rC   c                   V P                   '       d   R# V P                  4        . p V P                  V4      p T P	                  RR7       T P	                  RR7       T P                  4       '       g   R# \        R4      pT P                  R,          T P                  R,          ,           T P                  R	,          ,           T P                  R
,          ,            F  p T P                  TRTR.4       K  	   T P                  R,          T P                  R	,          ,           T P                  R
,          ,            F+  pT P                  TRT.4       T P                  TRT.4       K-  	  T Fu  w  rEpRp\        T4      ^ 8  d   T^ ,          R8X  d   Rp TR8X  d4   \        T4      ^8  d$   T P                  TR.TR,          ,           RR7       T P                  YET4       Kw  	  R F  pT P                  R,          R,          '       d   TR8X  g,   T P                  R,          R,          '       g   KL  TR8X  g   KU  T P                  TRT.T P                  ,           T P                  R,           .,           RR7       T P                  R,          R8w  g   K  T P                  TRT.T P                  ,           T P                  R,           .,           RR7       K  	  R#   \         d    h i ; i  \
         d    h \         d    \        R4      p\        T4        ELi ; i  \         d    \        T4      hi ; i  \         d    \        T4      hi ; i  \         d    \        T4      hi ; i)z#Update loglevel of running firewallNF)r   Tz&Couldn't update rules file for loggingrO  r   r   r   r   r|   r{   r   r   r8  delete_first:   NN)rl  rv   rw   r$   r   r   r   r   r:  -I)rv   rw   )r:   r   rA  r]   rI  r   rI   r   r4   r   r   r   r7   r8   rJ   )	r9   r   rules_trf   r   r   rH  rl  r@   s	   &&       rA   r   !UFWBackendIptables.update_logging  s   ;;; 		--e4G
	'&    78X&V)<<;;w "&++f"56 6A(D!T?36	$[[*T[[-AA{{6"# #D!9-D!9-# GA!G1vzaddl(&3q6A:OOAv"~tODg.  ;E		'"3''E5E,E		'"3''E5F,Fe} $ 7 7(8!%!=!=!C D(E )-   . ==,5OOED%=$($;$;,<%)%A%AC%G$H,I -1 $ 2 ;e  		  	 	@AGW	  (w''(  	$7##	$  (w''(sH   K $K.  L!:A2L; AMK+.LLL!L8;MM,c                   . pV\        V P                  P                  4       4      9  d   \        R4      V,          p\	        V4      hVR8X  d5   V P
                  R,           F  pVP                  VRVRR.R.4       K  	  V# V P
                  R,           F  pVP                  VRVRR.R	.4       K  	  . ROpV P                  V,          V P                  R,          8  Ed   . pV P                  V,          V P                  R,          8  d   TpV P
                  R,           F  pR  F  pVP                  V4      '       g   K  V P                  V4      R8X  g   V P                  V4      R8X  d&   RpVP                  VRVRRRV.V,           R	.4       Km  V P                  V,          V P                  R,          8  g   K  RpVP                  VRVRRRV.V,           R	.4       K  	  K  	  . pV P                  V,          V P                  R,          8  d   TpV P
                  R,           F  pVP                  R4      '       d   RpMVP                  R4      '       du   RpV P                  V,          V P                  R,          8  d%   VP                  VRVR
RRRRR.V,           R	.4       M%VP                  VRVR
RRRRRRR.
V,           R	.4       VP                  VRVRRRX.V,           R	.4       K  	  V P                  V,          V P                  R,          8  d   . pV P                  V,          V P                  R,          8  d   TpV P                  V,          V P                  R,          8  d   . R!OV,           pRpV P
                  R,           F$  pVP                  VRVRRRV.V,           R	.4       K&  	  V# )"z%Get rules for specified logging levelzInvalid log level '%s'r:  r   rq  r&   rP  ro  r8  rW   r#   r   highr   rH   rP   z[UFW BLOCK] rN  r'   r(   mediumz[UFW ALLOW] r   rO   	conntrack	--ctstateINVALIDz[UFW AUDIT INVALID] fullz[UFW AUDIT] r   )r#   r$   r%   z3/minz--limit-burst10r   )r#   rw  rx  NEW)	r   r   r   rI   r   r4   r6   endswithr   )	r9   r   rr  rf   r   r  largsr   r   s	   &&       rA   rA  %UFWBackendIptables._get_logging_rules  s   T^^0023301U;G7##E> [[((D!T8#<nMN )N [[((D!T8#<bAB ) P
 >>% DNN5$99E~~e$t~~f'=="[[))7Azz!}}33A6(B33A6&@%3F#NNAau0>0H050679,; < "^^E2dnnX6NN%3F#NNAau0>0H050679,; < 8 *  E~~e$t~~f'=="[[((::g&&+FZZ''+F~~e,t~~h/GGD!T;,7,0(,<>C,DEG(I J  D!T;,7,0%,:,B	,D
 ).,.
 02(3 4 D!T5$2F$<>C$DEG I J# )* >>% DNN8$<<E ~~e$t~~f'==" ~~e$t~~f'==?*L#F[[**D!T5$2F$<>C$DEG I J + rC   c           
        Rp\        \        P                  P                  V P                  4      p. pV P
                   F  pV P
                  V,          P                  R4      '       g   K-  VP                  V P
                  V,          4       \        P                  P                  VR\        P                  P                  V P
                  V,          4      4      p\        P                  P                  V4      '       d   K  \        R4      V,          p\        V4      h	  \        P                   ! R4      pV FN  pV: RV: 2p\        P                  P#                  V4      '       g   K3  \        R4      V,          p\        V4      h	  V F\  pV: RV: 2pV\        R4      R	\        P                  P                  V4      R
V/,          ,          p\        P$                  ! WE4       K^  	  V EF2  pV: RV: 2p\&        P(                  ! \        P                  P                  VR\        P                  P                  V4      4      \        P                  P+                  V4      4       \&        P,                  ! W4        \        P.                  ! V4      p	V	\.        P0                  ,          p
T
\.        P6                  ,          '       d   T\        R4      T,          ,          pK  T
\.        P8                  ,          '       g   EK  T\        R4      T,          ,          pEK5  	  V#   \2         d#    \        R4      T,          p\5        T4        EKe  i ; i)zReset the firewallrW   z.rulesr   zCould not find '%s'. Abortingz%Y%m%d_%H%M%S.z'%s' already exists. Abortingz"Backing up '%(old)s' to '%(new)s'
oldnewzCouldn't stat '%s'zWARN: '%s' is world writablezWARN: '%s' is world readable)r	   r   r)   	share_dirr   r;   r}  r6   r-   r.   r/   basenameisfilerI   r   timestrftimeexistsrenameshutilcopydirnamecopymodestatST_MODEr]   r   S_IWOTHS_IROTH)r9   resr  allfilesr   fnrf   extr  statinfomoder4  s   &           rA   resetUFWBackendIptables.reseth  sk   cjj22DLLA	A::a=))(33OODJJqM*i gg..tzz!}=?B77>>"%%;<Cw''  mmO, As#Bww~~b!!;<Cw''	  As#B1:;RWW--a0%<> >CIIa	  A$CKKY
%'WW%5%5a%8:*, OOC#771:- dll""q78A>>$$q78A>>% ( 
  12a8Xs   -L**(MM)r4   r+   r   r   r   r   r7   r8   )NN)FF)F)T)__name__
__module____qualname____firstlineno____doc__r3   rL   rn   r   r   r   r   r   r   r  r  r5  rI  rc  ri  r   r   rA  r  __static_attributes____classdictcell__)__classdict__s   @rA   r   r      s     '.;`IV[zc/J($,B8;8BH$cJgRcJ0(H2TXt8 8rC   r   )r  r-   r^   r  r  r=  r  
ufw.commonr   r   ufw.utilr   r   r   r   r   r	   ufw.backendr   r1   r2   r    rC   rA   <module>r     s@    3" 
 	   
  ( ? ? B// BrC   