+
    iF)                     2  a  R t&0 t R t^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	H
t
HtHt ^ RIHt ^ RIHt ^ RIHt ^ RIHtHtHt ^ RIHt ^ R	IHt ^ R
IHt RRR].R]R. /t] ^ k ]P<                  ! ]4      t R R lt!R R lt"R R lt#R R lt$RR lt%R# )zFSet Passwords: Set user passwords and enable/disable SSH password authN)List)features	lifecyclesubputil)Cloud)Config)
MetaSchema)ALL_DISTROSDistroug_util)log_util)PER_INSTANCE)update_ssh_configidcc_set_passwordsdistros	frequencyactivate_by_schema_keysc                <    V ^8  d   QhR\         R\        R\         /# )   
users_listpw_typereturn)liststr)formats   "C/usr/lib/python3/dist-packages/cloudinit/config/cc_set_passwords.py__annotate__r   #   s!     
 
$ 
 
 
    c                    V '       g   . # V  Uu. uF7  pVP                  RR4      V8X  g   K  VR,          VP                  RR4      3NK9  	  up# u upi )zDeither password or type: RANDOM is required, user is always requiredtypehashnamepasswordRANDOM)get)r   r   items   && r   get_users_by_typer(   #   sa      	
 #
"xx'72 ;T&\488J9:"

s
   AAc                <    V ^8  d   QhR\         R\        R\        /# )r   distroservice
extra_args)r   r   )r   s   "r   r   r   0   s!     	
 	
 	
 	
3 	
r   c                      V P                   ! R V.VO5!   \        P                  R4       R#   \        P                   d"   p\        P                  RT4        Rp?R# Rp?ii ; i)restartzRestarted the SSH daemon.zm'ssh_pwauth' configuration may not be applied. Cloud-init was unable to restart SSH daemon due to error: '%s'N)manage_serviceLOGdebugr   ProcessExecutionErrorwarning)r*   r+   r,   es   &&* r   _restart_ssh_daemonr5   0   sX    
i>:>		-.%% 
>	
 	

s   *. A$AA$c                $    V ^8  d   QhR\         /# )r   r*   )r   )r   s   "r   r   r   <   s     ?- ?-v ?-r   c                   VP                  RR4      pRp\        V \        4      '       d   \        P                  ! RRRR7       \
        P                  ! V 4      '       d   RpMn\
        P                  ! V 4      '       d   R	pMOR
V R2pV e   V P                  4       R8X  d   \        P                  RWP4       R# \        P                  RWP4       R# \        W4/4      pV'       g   \        P                  RV4       R# VP                  4       '       dZ   \        P                  ! RRRRRV.4      P                  P!                  4       pVP                  4       R9   d   \#        WR4       R# R# \#        W4       R# )zApply sshd PasswordAuthentication changes.

@param pw_auth: config setting from 'pw_auth'.
                Best given as True, False, or "unchanged".
@param distro: an instance of the distro class for the target distribution

@return: Nonessh_svcnamesshPasswordAuthenticationz-Using a string value for the 'ssh_pwauth' key22.2z&Use a boolean value with 'ssh_pwauth'.
deprecateddeprecated_versionextra_messageyesnozLeaving SSH config 'z' unchanged.N	unchangedz%s ssh_pwauth=%sz$%s Unrecognized value: ssh_pwauth=%sz/No need to restart SSH service, %s not updated.	systemctlshowz
--propertyActiveStatez--valuez--job-mode=ignore-dependencies)active
activating	reloading)
get_option
isinstancer   r   	deprecater   is_trueis_falselowerr0   r1   r3   r   uses_systemdr   stdoutstripr5   )pw_authr*   r+   cfg_namecfg_valbmsgupdatedstates   &&      r   handle_ssh_pwauthrX   <   sH    u5G'H'3F%B	

 ||G	w		%hZ|<?gmmo<II($8 	 KK>N 34G		CXN			
 & 	 ;;=AA  !A B" 	F,r   c          
      L    V ^8  d   QhR\         R\        R\        R\        RR/# )r   r#   cfgcloudargsr   N)r   r   r   r   )r   s   "r   r   r   ~   s6     E E E6 E% Et E Er   c                 b   VP                   pV'       d*   V^ ,          pRV9   d   RVR,          9   d   VR,          R M\        P                  ! VRR4      pRp. p. pRV9   Ed   VR,          p	\        P                  ! V	R. R7      pRV	9   d   V	R,          '       d   \        P
                  ! RR	R
R7       \        V	R,          \        4      '       d/   \        P                  R4       \        P                  ! V	RV4      pM]\        P
                  ! RRRR7       \        P                  R4       \        P                  ! V	R4      p
V
'       d   V
P                  4       p\        P                  ! V	RV4      pV'       gi   V'       ga   V'       dY   \        P                  ! W4      w  r\        P                  ! V4      w  rV'       d   V: RV: 2.pM\        P                  R4       . pV'       g
   V'       Ed   \!        VR4      pV UUu. uF  w  ppVNK
  	  ppp\!        VR4      pV UUu. uF  w  ppVNK
  	  ppp. p\!        VR4       FI  w  pp\#        4       pVP%                  V4       VP%                  W34       VP%                  V RV 24       KK  	  \&        P(                  ! R4      pV F  pVP+                  R^4      w  ppVP-                  V4      e.   RV9  d'   VP%                  VV34       VP%                  V4       KX  VR8X  g   VR8X  d#   \#        4       pVP%                  V: RV: 24       VP%                  VV34       VP%                  V4       K  	  V'       d+    \        P                  RV4       VP/                  VRR7       V'       d+    \        P                  RV4       VP/                  VRR7       \5        V4      '       d4   RR P7                  V4      3p\8        P:                  ! R!V,          RRR"7       V'       dn   Tp\<        P>                  '       d
   VV,          p. pV F&  p VPA                  V4       VP%                  V4       K(  	  V'       d   \        P                  R$V4       \C        VPE                  R%4      V4       \5        V4      '       d)   \        P                  R&\5        V4      4       VR',          hR# u uppi u uppi   \0         d9   pTP%                  T4       \        P2                  ! \        RT4        Rp?ELRp?ii ; i  \0         d9   pTP%                  T4       \        P2                  ! \        RT4        Rp?ELRp?ii ; i  \0         d:   pTP%                  T4       \        P2                  ! \        R#T4        Rp?EKu  Rp?ii ; i)(    chpasswdr   r$   NTusers)defaultzConfig key 'lists'z22.3zUse 'users' instead.r<   z$Handling input for chpasswd as list.zThe chpasswd multiline stringr;   zUse string type instead.z0Handling input for chpasswd as multiline string.expire:z2No default or defined user to change password for.textr"   r%   z\$(1|2a|2y|5|6)(\$.+){2}RzChanging password for %s:F)hashedz,Failed to set passwords with chpasswd for %szSetting hashed password for %s:z3Failed to set hashed passwords with chpasswd for %sz%Set the following 'random' passwords

z%s
%s
)stderrfallback_to_stdoutzFailed to set 'expire' for %szExpired passwords for: %s users
ssh_pwauthz+%s errors occurred, re-raising the last one)#r*   r   get_cfg_option_strget_cfg_option_listr   rK   rJ   r   r0   r1   
splitlinesget_cfg_option_boolr   normalize_users_groupsextract_defaultr3   r(   rand_user_passwordappendrecompilesplitmatchr_   	Exceptionlogexclenjoinr   	multi_logr   EXPIRE_APPLIES_TO_HASHED_USERSexpire_passwdrX   r&   )r#   rZ   r[   r\   r*   r$   rb   plistr   chfg	multiliner`   _groupsuser_user_configerrorsplist_in_hashed_plist_inhashed_usersrandlistproglineupr4   blurbusers_to_expireexpired_userss   &&&&                         r   handler   ~   s   \\F73z?!:J'**3
DAFEJS:--dGRH
T>d6ll/#)4
 $v,--		@A00vuE##>'-"<
 		LM 33D&A	%002E))$&A%X"99#F&66u= $h/0EKKLMF

 %Z8%-.X'$X.+J?,;<OqO<(X>GD!)+HLLOOT,-OOtfAhZ01	 ? zz56D::c1%DAqzz!}(S\&&1v.##A& 8qH}*,AOOq!$45A'Q  		5u=7 			;\J= x==8		(#E U"5U #O666</M$I((+!((+ % 		;]Kcggl+V4
6{{		?VMRj ] /<@  a G   a I  4 ! IMM!$KK%DaHHIsT   	S+S()S )T$ 8"U*T!)-TT!$U'/-U""U'*V.5-V))V.c           
         V ^8  d   \        R4      h\        P                  ! \        P                  4      \        P                  ! \        P
                  4      \        P                  ! \        P                  4      \        P                  ! \        P                  4      .pVP                  \        \        P                  ! V \        V4      ,
          \        P                  \        P
                  ,           \        P                  ,           \        P                  ,           R7      4      4       \        P                  ! V4       RP                  V4      # )   z.Password length must be at least 4 characters.)select_from )
ValueErrorrandomchoicestringdigitsascii_lowercaseascii_uppercasepunctuationextendr   r   rand_strrz   shuffler{   )pwlenres_rand_lists   & r   rr   rr     s    qyIJJ 	fmm$f,,-f,,-f(()	M MMM**"MM(()(() $$%	

 NN=!77=!!r   c                @    V ^8  d   Qh/ ^ \         9   d
   \        ;R&   # )r   meta)__conditional_annotations__r	   )r   s   "r   r   r      s     L L" j # Mr   )   )'r   __doc__loggingr   rt   r   typingr   	cloudinitr   r   r   r   cloudinit.cloudr   cloudinit.configr   cloudinit.config.schemar	   cloudinit.distrosr
   r   r   cloudinit.logr   cloudinit.settingsr   cloudinit.ssh_utilr   r   	getLogger__name__r0   r(   r5   rX   r   rr   r   )r   s   @r   <module>r      s    M   	   5 5 ! # . : : " + 0 	
}r	  !
	
?-DEP"r   