| Server IP : 172.67.201.108 / Your IP : 216.73.216.55 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.7 System : Linux ip-172-31-69-123.ec2.internal 6.1.177-224.371.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Mon Jul 27 20:28:29 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /lib/python3.9/site-packages/cfnbootstrap/__pycache__/ |
Upload File : |
a
��Rj� � @ s� d Z ddlZddlZddlZddlZddlmZmZ ddlm Z e�
d�ZdZe
d�dd �Zdee
dd
�dd�Zedd
�dd�Zdeee
ed�dd�Zedkr�e�e� � dS )a^
Override CA uninstaller.
Reads the install-marker JSON (or partial-marker recovery file) written by
:mod:`cfnbootstrap._ca_install_win`, calls ``certutil -delstore`` for each
recorded entry, and removes the marker file.
Public surface:
uninstall_all(marker_path=None)
main(argv=None) -- script entrypoint used by bin/cfn-ca-uninstall
Idempotent: no-op when no marker is present. Best-effort: a missing cert in
the Windows store is logged and continued, not raised. We NEVER remove a
cert that is not listed in our marker (or partial-marker) -- that protects
operator-installed CAs.
� N)�List�Optional)�CaOverrideError�cfn.initz[CaOverrideInstall])�returnc C s t j�d�} | r| S t j�d�S )zAResolve the install-marker path, honouring the test seam env var.ZCFN_CA_OVERRIDE_MARKER_PATHz/${SystemDrive}\cfn\state\ca-install-marker.json)�os�environ�get�path�
expandvars)�override� r
�>/usr/lib/python3.9/site-packages/cfnbootstrap/_ca_uninstall.py�_default_marker_path- s r )�marker_pathr c C sB | du rt � } tjdkr(t�dt� dS ddlm} |�| � dS )a� Uninstall every override CA recorded in the marker.
Args:
marker_path: Override the default marker path. When ``None``, the
default is resolved from ``CFN_CA_OVERRIDE_MARKER_PATH`` or
``%SystemDrive%\cfn\state\ca-install-marker.json``.
Raises:
CaOverrideError: on hard failures (certutil missing, certutil call
failures that are not "cert not in store"). cfn-ca-uninstall's
``main()`` translates these to a non-zero exit code.
N�ntz�%s cfn-ca-uninstall is a no-op on non-Windows hosts; the override PEM file itself is the install marker on Linux. Remove the PEM to disable.r )�_ca_install_win) r r �name�log�info�_LOG_PREFIXZcfnbootstrapr Zuninstall_all_from_marker)r r r
r
r �
uninstall_all5 s
�r )�quietr c C sb | r
t jnt j}t �� }|jsDt �tj�}|�t � d�� |�
|� |�|� t �d��|� dS )zMinimal logging config used by the CLI entrypoint.
Mirrors the lightweight pattern used by the other bin/cfn-* tools.
z'%(asctime)s [%(levelname)s] %(message)sr N)�loggingZWARNING�INFO� getLogger�handlersZ
StreamHandler�sys�stderrZsetFormatterZ FormatterZ
addHandlerZsetLevel)r �level�rootZhandlerr
r
r �_configure_loggingW s �
r! )�argvr c
C s� t jddd�}|jdddd� |jdd d
dd� |�| �}t|j� zt|jd
� W n� ty� } z2t j
�|jd � t j
�d|j
� W Y d}~dS d}~0 ty� } z*t j
�dtt|�j|f � W Y d}~dS d}~0 0 dS )z�CLI entrypoint for ``cfn-ca-uninstall``.
Returns:
``0`` on success, non-zero on hard failure. A clear human-readable
diagnostic is printed to stderr on failure.
zcfn-ca-uninstallz�Uninstall override CA(s) previously installed by cfn-bootstrap. Reads the install-marker JSON, calls certutil -delstore for each recorded entry, and removes the marker file. Idempotent.)�prog�descriptionz
--marker-pathNz�Override the install-marker path. Defaults to CFN_CA_OVERRIDE_MARKER_PATH env var or %%SystemDrive%%\cfn\state\ca-install-marker.json.)�default�helpz--quietz-q�
store_truez1Suppress INFO logging; only WARNING+ are emitted.)�actionr&