+
    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                s,  "   \         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                  ^,          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   BB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  "   \         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)z1Starting ssh session user=%s, host=%s, private=%sZ:NZ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)!r)   r*   userr   private
rpartitionZisdigitr.   r   r   ZupdatesessionZconnectZOSErrorsocketZgaierrorr
   r   r   ZSshHostKeyErrorr   Z
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   A2M!5A)M!7E EE 1M!MM!E M0.FM5M6A.I/%A
I//MMA?L
LM(M)-MMM!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   rI   ZSshPeer.do_kill   s.    99JJL\GOD1 r   c                s$   < V ^8  d   QhRS[ RR/# )r   r?   r#   NrF   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commandrK   ZresponseN)r   Z
startswithZwrite_controlr   )r   r?   rK   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   r@   r=   rA   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)rH   r   r   r@   r   r   rA   r   SessionrC   r   Zstart_in_background)	r   rN   r   r@   r=   rA   Zinit_superuserrP   rJ   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   rC   r   r@   r   rA   )r   r   rQ   r   r$   r   r   r   r   r;   <   sQ     emm$+ 
I  3-  sm	 
 M r   )r   r   rA   rC   r@   )r/   r0   r1   r2   rC   rE   rI   rL   rM   r   r4   r5   r6   __classcell__rJ   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   )rH   r   remotes)r   rN   rJ   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 \        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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,          # )r   Nr@   Z@rC   rA   Zchannelz!Request for channel %s is remote.zkey=%szC%s is not among the existing remotes %s.  Opening a new connection.)rA   c                  s:   < SP                   P                  S 4      # r   )rV   Z__delitem__)r!   r   s   r   Z<lambda>Z,HostRoutingRule.apply_rule.<locals>.<lambda>   s    4<<+C+CC+Hr   )r   rN   rO   getpassZgetuserrB   r)   r*   rV   r7   Zadd_done_callback)	r   r=   r   r@   Zuser_from_hostZ_Znoncepeerr!   s	   f&      @r   
apply_ruleZHostRoutingRule.apply_rule   s/    w(=(=>4;;(((w- 7??$$D#'??3#7 NAq!))TD7It,	9GY/EE %8'BXs#dll"LL^`ceieqeqr4;;GRVEVWD""#HI $DLL||C  r   c                r8   r9   r:   r   r   r   r   rW      s      $ r   c                sz    \        V P                  P                  4       4       F  pVP                  4        K  	  R # r   )ZsetrV   ZvaluesrG   )r   rY   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   rV   )r    r   r   r   r	   r   r   r   r   rW      s.     %Xc]HSM9:D@AA r   )rV   )r/   r0   r1   r2   r   rZ   r[   r4   r5   r6   rR   rS   rT   r   rU   rU      s'     &! &!P _  r   rU   )rX   Zloggingr3   rD   Ztypingr    r   r   r   Zcockpit._vendorr   Zjsonutilr   r   r   r   rY   r	   r
   rN   r   r   Z	getLoggerr/   r)   ZAskpassHandlerr   r7   rU   r:   r   r   <module>r\      sh      	  . . ! E E ! '			8	$$,, $NmFd mF`1k 1r   