403Webshell
Server IP : 23.254.227.96  /  Your IP : 216.73.216.7
Web Server : Apache/2.4.62 (Unix) OpenSSL/1.1.1k
System : Linux hwsrv-1277026.hostwindsdns.com 4.18.0-477.13.1.el8_8.x86_64 #1 SMP Tue May 30 14:53:41 EDT 2023 x86_64
User : viralblo ( 1001)
PHP Version : 8.1.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3.6/site-packages/cloudinit/config/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3.6/site-packages/cloudinit/config/__pycache__/cc_seed_random.cpython-36.pyc
3

��bj�@svdZddlZddlZddlmZddlmZddlmZm	Z	ddl
mZeZej
e�Zd
dd�Zdd	d
�Zdd�ZdS)a�
Seed Random
-----------
**Summary:** provide random seed data

Since all cloud instances started from the same image will produce very similar
data when they are first booted, as they are all starting with the same seed
for the kernel's entropy keyring. To avoid this, random seed data can be
provided to the instance either as a string or by specifying a command to run
to generate the data.

Configuration for this module is under the ``random_seed`` config key. The
``file`` key specifies the path to write the data to, defaulting to
``/dev/urandom``. Data can be passed in directly with ``data``, and may
optionally be specified in encoded form, with the encoding specified in
``encoding``.

If the cloud provides its own random seed data, it will be appended to ``data``
before it is written to ``file``.

.. note::
    when using a multiline value for ``data`` or specifying binary data, be
    sure to follow yaml syntax and use the ``|`` and ``!binary`` yaml format
    specifiers when appropriate

If the ``command`` key is specified, the given command will be executed.  This
will happen after ``file`` has been populated.  That command's environment will
contain the value of the ``file`` key as ``RANDOM_SEED_FILE``. If a command is
specified that cannot be run, no error will be reported unless
``command_required`` is set to true.

For example, to use ``pollinate`` to gather data from a
remote entropy server and write it to ``/dev/urandom``, the following could be
used::

    random_seed:
        file: /dev/urandom
        command: ["pollinate", "--server=http://local.polinate.server"]
        command_required: true

**Internal name:** ``cc_seed_random``

**Module frequency:** per instance

**Supported distros:** all

**Config keys**::

    random_seed:
        file: <file>
        data: <random string>
        encoding: <raw/base64/b64/gzip/gz>
        command: [<cmd name>, <arg1>, <arg2>...]
        command_required: <true/false>
�N)�BytesIO)�log)�subp�util)�PER_INSTANCEcCsf|sdS|s|j�d
kr$tj|�S|j�dkr:tj|�S|j�dkrVtj|ddd�Std	|��dS)
N��raw�base64�b64�gzip�gzF)�quiet�decodez Unknown random_seed encoding: %s)r)r	r
)rr)�lowerr�encode_textr	Z	b64decodeZdecomp_gzip�IOError)�data�encoding�r�$/usr/lib/python3.6/cc_seed_random.py�_decodeNs

rcCsr|r|rtd��n|s&tjd�dS|d}tj|�s^|rNtdj|d���ntjd|�dStj||dd�dS)	Nz"no command found but required=truezno command providedrz+command '{cmd}' not found but required=true)�cmdz'command '%s' not found for seed_commandF)�envZcapture)�
ValueError�LOG�debugrZwhich�format)�command�requiredrrrrr�handle_random_seed_command[s



rcCs|jdi�}|jdd�}|jdd�}t�}|rF|jt||jd�d��|jj}	|	rnd|	krn|jtj|	d��|j�}t	|�r�|j
d|t	|�|�tj||�|jd	d�}
|jd
d�}y$tj
j�}||d<t|
||d
�Wn6tk
�r}
z|jd|
|
�|
�WYdd}
~
XnXdS)NZrandom_seed�filez/dev/urandomrrr)rz0%s: adding %s bytes of random seed entropy to %srZcommand_requiredFZRANDOM_SEED_FILE)rrrz'handling random command [%s] failed: %s)�getr�writerZ
datasource�metadatarr�getvalue�lenrZappend_file�os�environ�copyrrZwarning)�nameZcfgZcloudrZ_argsZmycfgZ	seed_pathZ	seed_dataZseed_bufr#rZreqr�errr�handlens4
r+)N)N)�__doc__r	r&�iorZ	cloudinitrZloggingrrZcloudinit.settingsrZ	frequencyZ	getLogger�__name__rrrr+rrrr�<module>@s




Youez - 2016 - github.com/yon3zu
LinuXploit