HEX
Server: Apache
System: Linux zacp120.webway.host 4.18.0-553.50.1.lve.el8.x86_64 #1 SMP Thu Apr 17 19:10:24 UTC 2025 x86_64
User: govancoz (1003)
PHP: 8.3.26
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: //lib/python3.6/site-packages/cloudinit/config/__pycache__/cc_phone_home.cpython-36.pyc
3

\�me��	@s�UdZddlZddlmZddlmZmZmZddlm	Z	ddl
mZddlm
Z
mZddlmZdd	lmZeZd
ddd
dddgZdZdddeegeed�ed�gdgd�Ze
ee�Zeje�Zeee	edd�dd�ZdS)zPhone Home: Post data to url�N)�dedent)�	templater�
url_helper�util)�Cloud)�Config)�
MetaSchema�get_meta_doc)�ALL_DISTROS)�PER_INSTANCE�pub_key_dsa�pub_key_rsa�
pub_key_ecdsa�pub_key_ed25519�instance_id�hostname�fqdnajThis module can be used to post data to a remote host after boot is complete.
If the post url contains the string ``$INSTANCE_ID`` it will be replaced with
the id of the current instance. Either all data can be posted or a list of
keys to post. Available keys are:

    - ``pub_key_dsa``
    - ``pub_key_rsa``
    - ``pub_key_ecdsa``
    - ``pub_key_ed25519``
    - ``instance_id``
    - ``hostname``
    - ``fdqn``

Data is sent as ``x-www-form-urlencoded`` arguments.

**Example HTTP POST**:

.. code-block:: http

    POST / HTTP/1.1
    Content-Length: 1337
    User-Agent: Cloud-Init/21.4
    Accept-Encoding: gzip, deflate
    Accept: */*
    Content-Type: application/x-www-form-urlencoded

    pub_key_dsa=dsa_contents&pub_key_rsa=rsa_contents&pub_key_ecdsa=ecdsa_contents&pub_key_ed25519=ed25519_contents&instance_id=i-87018aed&hostname=myhost&fqdn=myhost.internal
Z
cc_phone_homez
Phone HomezPost data to urlzt            phone_home:
                url: http://example.com/$INSTANCE_ID/
                post: all
            as            phone_home:
                url: http://example.com/$INSTANCE_ID/
                post:
                    - pub_key_dsa
                    - pub_key_rsa
                    - pub_key_ecdsa
                    - pub_key_ed25519
                    - instance_id
                    - hostname
                    - fqdn
                tries: 5
            �
phone_home)�id�name�title�descriptionZdistros�	frequencyZexamplesZactivate_by_schema_keys)r�cfg�cloud�args�returncCst|�dkrtj|d�}n d|kr4tjd|�dS|d}d|krTtjd|�dS|d}|jdd�}|jd�}yt|�}Wn*tt	fk
r�d	}tj
td
|�YnX|dkr�t}|j�|j
�j|j
dd�jd
�}ddddd�}	xL|	j�D]@\}
}ytj|�||
<Wq�tk
�r,tj
td|�Yq�Xq�Wi}x:|D]2}
|
|k�rX||
||
<nd||
<tjd|
��q<Wi}x6|j�D]*\}
}|dk�r�d||
<nt|�||
<�q�Wd|di}tj||�}y$tj|||ddtj|j�d�Wn&tk
�rtj
td||�YnXdS)Nrrz=Skipping module named %s, no 'phone_home' configuration found�urlzFSkipping module named %s, no 'url' found in 'phone_home' configurationZpost�all�tries�
z?Configuration entry 'tries' is not an integer, using %s insteadT)r)rrrz/etc/ssh/ssh_host_dsa_key.pubz/etc/ssh/ssh_host_rsa_key.pubz/etc/ssh/ssh_host_ecdsa_key.pubz!/etc/ssh/ssh_host_ed25519_key.pub)rr
rrz1%s: failed to open, can not phone home that data!z=Requested key %s from 'post' configuration list not availablezN/AZINSTANCE_IDr��)�dataZretriesZsec_betweenZssl_detailsz0Failed to post phone home data to %s in %s tries)�lenrZ	read_conf�LOG�debugZwarning�get�int�
ValueError�	TypeErrorZlogexc�
POST_LIST_ALLZget_instance_idZget_hostnamer�itemsZ	load_file�	Exception�strrZ
render_stringrZread_file_or_urlZfetch_ssl_details�paths)rrrrZph_cfgrZ	post_listrZall_keysZpubkeys�n�pathZsubmit_keys�kZreal_submit_keys�vZ
url_params�r4�#/usr/lib/python3.6/cc_phone_home.py�handleos�




r6)�__doc__Zlogging�textwraprZ	cloudinitrrrZcloudinit.cloudrZcloudinit.configrZcloudinit.config.schemarr	Zcloudinit.distrosr
Zcloudinit.settingsrrr+ZMODULE_DESCRIPTION�metaZ	getLogger�__name__r%r.�listr6r4r4r4r5�<module>	s>