+
    iL!  c                   s    ^ RI t ^ RIt^ RIt^ RIt^ RIHtHtHtHt ^ RI	H
t
 ^RIHtHtHtHt ^RIHtHt ^RIHtHt ]P,                  ! ]4      t ! R R]
P2                  4      t ! R	 R
]4      t ! R R]4      tR# )i    N)DictListOptionalTuple)ferny)
JsonObject	JsonValueget_strget_str_or_none)Peer	PeerError)RouterRoutingRulec                   s   a  ] tR t^t o ]P
                  ! R4      tV 3R lR ltV 3R lR ltV 3R lR lt	V 3R lt
R	tV tR
# )PasswordResponderz!Enter passphrase for key '(.*)': c                s0   < V ^8  d   QhRS[ S[,          /# )   password)r   strZformat__classdict__   "3/usr/lib/python3.14/site-packages/cockpit/remote.py__annotate__PasswordResponder.__annotate__   s     # ## #    c                s<    Wn         . V n        R V n        ^ V n        R # N)r   hostkeys_seenerror_messagepassword_attempts)selfr   s   &&r   __init__ZPasswordResponder.__init__   s     !!"r   c                s>   < V ^8  d   QhRS[ RS[ RS[ RS[ RS[ RS[/# )r   reasonhost	algorithmkeyfingerprintreturn)r   boolr   r   r   r   r   %   s9      s # # C ^a fj r   c                sJ   "   V P                   P                  WW4V34       R # 5i)F)r   Zappend)r   r   r   r    r!   r"   s   &&&&&&r   
do_hostkeyZPasswordResponder.do_hostkey%   s#     !!6"MNs   !#c          	      sB   < V ^8  d   QhRS[ RS[ RS[ RS[S[ ,          /# )r   messagesprompthintr#   )r   r   r   r   r   r   r   )   s.       c  RU r   c                sr  "   \         P                  R W24       \        P                  P	                  V4      pVe4   VP                  ^4      p\         P                  RV4       RV 2V n        R# V P                  f   Q hV P                  ^ 8X  g   Q hV ;P                  ^,          un        V P                  # 5i)zGot askpass(%s): %sNzCThis is a passphrase request for %s, but we don't do those.  Abort.zlocked identity: )	loggerdebugr   PASSPHRASE_REZ	fullmatchgroupr   r   r   )r   r&   r'   r(   ZmatchZpaths   &&&&  r   
do_askpassZPasswordResponder.do_askpass)   s     *D9!//99&A ;;q>DLL^`de#4TF!;D}}(((%%***!#}}s   B5B7c                s   < V ^8  d   Qh/ S[ S[,          ;R&   S[S[S[S[S[S[S[3,          ,          ;R&   S[ S[,          ;R&   S[;R&   # )r   r   r   r   r   )r   r   r   r   intr   r   r   r   r      sV      sm 
 c3S#5677  C=    r   )r   r   r   r   N)__name__
__module____qualname____firstlineno__reZcompiler+   r   r%   r-   __annotate_func____static_attributes____classdictcell__)r   s   @r   r   r      s9     JJCDM# #  )  r   r   c                   s   a a ] tR t^<t oRtV3R lR ltV3R lV 3R lltV3R lR ltV3R lR	 ltV3R
 lV 3R llt	V3R lt
RtVtV ;t# )SshPeerNc                   < V ^8  d   QhRR/# r   r#   N r   r   r   r   SshPeer.__annotate__C   s     E# E#D E#r   c           
     s  "   V P                   f   Q h\        P                  RV P                  V P                  V P
                  4       V P                  P                  R4      w  rpV'       d%   VP                  4       '       d   Tp\        V4      pMV P                  pR p\        V P                  4      pRR/pV P                  e   VP                  RR7       MVP                  RRR7        V P                   P                  W@P                  VV P
                  VVR	7      G R j  xL
  T P                   P?                  R.4      pT PA                  T. 4      G R j  xL
  R #  L<  \        \        P                  3 d4   p\        P                  R
YH4       \!        RR\#        T4      R7      ThR p?i\$        P&                   d   pTP(                  '       d'   TP(                  ^ ,          w  rrpRT RT
 RT 2RT/pM/ p\+        T\$        P,                  4      '       d   RpMT P
                  '       d   RpMRp\        P                  R\/        T4      YP
                  TP(                  Y4       \!        YT/ R7      ThR p?i\$        P0                   d   p\        P                  RYH4       \2        P5                  TP6                  R4      pRT9   d+   T P                  e   TP8                  ^ 8X  d   RTR&   MRTR&   \!        RTP:                  ;'       g    RTR7      ThR p?i\$        P<                   d3   p\        P                  RYH4       \!        R\#        T4      R7      ThR p?ii ; i EL5i)Nz1Starting ssh session user=%s, host=%s, private=%sZ:ZStrictHostKeyCheckingZyesZ1)ZNumberOfPasswordPromptsZno)ZPasswordAuthenticationZKbdInteractiveAuthentication)Z
login_nameportZhandle_host_keyoptionsZinteraction_responderz connecting to host %s failed: %szno-host)errormessagezhost-keyZ zhost-fingerprintzinvalid-hostkeyzunknown-hostkeyzunknown-hostzPSshPeer got a %s %s; private %s, seen hostkeys %r; raising %s with extra args %r)r>   Zauth_method_resultsz$authentication to host %s failed: %sznot-providedr   z	not-triedZdeniedzauthentication-failedz)unknown failure connecting to host %s: %szinternal-error)r?   zcockpit-bridge)!sessionr)   r*   userr   private
rpartitionZisdigitr.   r   r   ZupdateZconnectZOSErrorsocketZgaierrorr
   r   r   ZSshHostKeyErrorr   
isinstanceZSshChangedHostKeyErrorZtypeZSshAuthenticationErrorZdictZfromkeysZmethodsr   r   ZSshErrorZwrap_subprocess_argsZspawn)r   ZbasenameZcolonZportstrr   r<   Z	responderr=   ZexcZ_reasonr    r!   r"   Z
error_argsr>   ZresultsZargss   &                r   do_connect_transportZSshPeer.do_connect_transportC   s     ||'''H$))UYU^U^`d`l`lm#'99#7#7#< W__&&Dw<D99DD%dmm4	*E2==$NN3N7NN$UYNZ.	I,,&&t		7;||W=F ' H H H^ ||002B1CDjjr"""aH ) 	SLL;TGIYCIsR$$ 	]&&& >G=T=TUV=W:y{(TF!I;au*EGY[fg

#u;;<<)) 'LLkcCy7N7NPUcEUPRSY\\++ 	BLL?KmmCKK@GW$)B..!3*5GJ'*2GJ'3"+"9"9"T"T=T079>AB ~~ 	ILLDdP,c#h?SH	I
 	#s   BM1A)M1/7E% &E#'E% +1M1M.M1#E% %M+ .F..M+M+A.I?5A
I??M+M+A?L!
L!!M+8M+9-M&&M++M1c                s,   < V ^8  d   QhRRRRRS[ RR/# )r   r   z
str | Noner,   r?   r#   Nr   r   r   r   r   r;      s*     2 2L 2 2
 2W[ 2r   c                sx   < WP                   8X  d   V P                  4        R # Vf   \        SV `  WV4       R # R # r   )r   closesuperdo_kill)r   r   r,   r?   	__class__s   &&&&r   rJ   ZSshPeer.do_kill   s.    99JJL\GOD1 r   c                s$   < V ^8  d   QhRS[ RR/# )r   r?   r#   NrG   r   r   r   r   r;      s     ! !J !4 !r   c                s    \        VR 4      P                  R4      '       d=   \        VR4      pT P                  RY P                  ;'       g    RR7       RV n        R# R# )Z	challengezplain1:cookieZ	authorizeZ )ZcommandrL   ZresponseN)r   Z
startswithZwrite_controlr   )r   r?   rL   s   && r   do_authorizeZSshPeer.do_authorize   sR    7K(33I>>Wh/F{6MML_L_]_` DM ?r   c                r8   r9   r:   r   r   r   r   r;      s       r   c                s    R V n         R # r   )r   )r   s   &r   do_superuser_init_doneZSshPeer.do_superuser_init_done   s	    r   c                sL   < V ^8  d   QhRS[ RS[RS[S[,          RS[RS[RR/# )r   routerr   rA   r=   rB   r#   N)r   r   r   r   r$   r   r   r   r   r;      sF     F Fv FS F FPZ Fhl Fqu Fr   c               s   < \         SV `  V4       W n        W0n        \	        VR R4      V n        WPn        \        P                  ! 4       V n	        \        VRR4      pVR9   d   RpMRV/pV P                  W'R7       R# )r   Nzinit-superuserFZid)	init_host	superuser)NZnone)rI   r   r   rA   r   r   rB   r   Sessionr@   r   Zstart_in_background)	r   rO   r   rA   r=   rB   Zinit_superuserrQ   rK   s	   &&&&&$  r   r   ZSshPeer.__init__   su     		T:}} )2BDI^+I~.I  4 Er   c                s   < V ^8  d   Qh/ S[ S[P                  ,          ;R&   S[;R&   S[ S[,          ;R&   S[ S[,          ;R&   S[;R&   # )r   r@   r   rA   r   rB   )r   r   rR   r   r$   r   r   r   r   r;   <   sQ     emm$+ 
I  3-  sm	 
 M r   )r   r   rB   r@   rA   )r/   r0   r1   r2   r@   rF   rJ   rM   rN   r   r4   r5   r6   __classcell__rK   r      @@r   r7   r7   <   sI     '+GE# E#N2 2! ! F F{  r   r7   c                   sb   a a ] tR t^t oV 3R ltV3R lR ltV3R lR ltV3R ltRtVt	V ;t
# )HostRoutingRulec                s4   < \         SV `  V4       / V n        R # r   )rI   r   remotes)r   rO   rK   s   &&r   r   ZHostRoutingRule.__init__   s     r   c                s6   < V ^8  d   QhRS[ RS[S[,          /# )r   r=   r#   )r   r   r	   r   r   r   r   HostRoutingRule.__annotate__   s     &! &!* &!$ &!r   c                s  a a S P                   f   Q hS P                   P                  f   Q h\        VRS P                   P                  4      pVS P                   P                  8X  d   R # \        VRR 4      pV\        P                  ! 4       8X  d   R pV'       g"   VP                  R4      w  p pT;'       g    R p\        VRR 4      R8X  d   \        VR4      pMR p\        V\        4      '       g   Q hVe   \        V\        4      '       g   Q hVe   \        V\        4      '       g   Q hW#V3o\        P                  RV4       \        P                  RS4       SS P                  9  da   \        P                  R	SS P                  4       \        S P                   W#WR JR
7      pVP                  VV 3R l4       VS P                  S&   S P                  S,          # )Nr   rA   Z@r@   rB   Zchannelz!Request for channel %s is remote.zkey=%szC%s is not among the existing remotes %s.  Opening a new connection.)rB   c                  s:   < SP                   P                  S 4      # r   )rW   Z__delitem__)r!   r   s   r   Z<lambda>Z,HostRoutingRule.apply_rule.<locals>.<lambda>   s    4<<+C+CC+Hr   )rO   rP   r   getpassZgetuserrC   rE   r   r)   r*   rW   r7   Zadd_done_callback)	r   r=   r   rA   Zuser_from_hostZ_Znoncepeerr!   s	   f&      @r   
apply_ruleZHostRoutingRule.apply_rule   s   {{&&&{{$$000w(=(=>4;;(((w- 7??$$D#'??3#7 NAq!))TD7It,	9GY/EE$$$$$|z$4444}
5# 6 666%8'BXs#dll"LL^`ceieqeqr4;;GRVEVWD""#HI $DLL||C  r   c                r8   r9   r:   r   r   r   r   rX      s      $ r   c                sz    \        V P                  P                  4       4       F  pVP                  4        K  	  R # r   )ZsetrW   ZvaluesrH   )r   rZ   s   & r   shutdownZHostRoutingRule.shutdown   s'    ++-.DJJL /r   c                sv   < V ^8  d   Qh/ S[ S[S[S[S[,          S[S[,          3,          S[3,          ;R&   # )r   rW   )r    r   r   r   r	   r   r   r   r   rX      s.     %Xc]HSM9:D@AA r   )rW   )r/   r0   r1   r2   r   r[   r\   r4   r5   r6   rS   rT   rU   r   rV   rV      s'     &! &!P _  r   rV   )rY   Zloggingr3   rD   Ztypingr    r   r   r   Zcockpit._vendorr   Zjsonutilr   r   r   r   rZ   r	   r
   rO   r   r   Z	getLoggerr/   r)   ZAskpassHandlerr   r7   rV   r:   r   r   <module>r]      sh      	  . . ! E E ! '			8	$$,, $NmFd mF`1k 1r   