404

[ Avaa Bypassed ]




Upload:

Command:

elspacio@3.133.143.118: ~ $
3

�~�f9L�@s�ddlZddlZddlZddlZddlZddlZddlmZmZddl	m
Z
mZddlm
Z
mZmZmZddlmZddlmZdZdZd	Zd
ZdZeje�ZGdd
�d
�ZGdd�dej�Zddd�Zddd�Z dd�Z!ddd�Z"ddd�Z#dS)�N)�List�Optional)�subp�util)�is_ipv6_address�is_ipv6_network�renderer�subnet_is_ipv6)�NetworkState)�available_nm_ifcfg_rhz/etc/NetworkManagerz/usr/lib/NetworkManagerz'/etc/NetworkManager/NetworkManager.confz/etc/sysconfig/network-scriptsz�# This is generated by cloud-init. Do not edit.
#
[.config]
  enable=nm-version-min:1.40
[connection.30-cloud-init-ip6-addr-gen-mode]
  # Select EUI64 to be used if the profile does not specify it.
  ipv6.addr-gen-mode=0

c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
edd�dd�Zeedd�dd�Zdd�Zdd �Zed!d"��Zd#d$�Zd%d&�ZdS)'�NMConnectionz/Represents a NetworkManager connection profile.cCsRtjd�}tj�|_t|j_d|��ttj||��dd�|jd<ddi|jd<d	S)
z�
        Initializes the connection with some very basic properties,
        notably the UUID so that the connection can be referred to.
        z$a3924cb8-09e0-43e9-890b-77972a800108zcloud-init Z120)�id�uuidzautoconnect-priority�
connectionz%org.freedesktop.NetworkManager.originz
cloud-init�userN)rZUUID�configparserZConfigParser�config�strZoptionxformZuuid5)�self�con_idZ
CI_NM_UUID�r�%/usr/lib/python3.6/network_manager.py�__init__.s

zNMConnection.__init__cCs6|jj|�si|j|<|jj||�s2||j||<dS)z_
        Sets a property unless it's already set, ensuring the section
        exists.
        N)r�has_section�
has_option)r�section�option�valuerrr�_set_defaultFs
zNMConnection._set_defaultcCs|jj|�o|jj||�S)zf
        Checks if a config option is set. Returns True if it is,
        else returns False.
        )rrr)rrrrrr�_config_option_is_setQsz"NMConnection._config_option_is_setcCs"|j||�r|j||SdSdS)z]
        Returns the value of a config option if its set,
        else returns None.
        N)rr)rrrrrr�_get_config_optionZszNMConnection._get_config_optioncCs|j||�r||j||<dS)z�
        Overrides the value of a config option if its already set.
        Else, if the config option is not set, it does nothing.
        N)rr)rrrrrrr�_change_set_config_optiondsz&NMConnection._change_set_config_optioncCsVx4d
D],}|j|d�dkrdS|j|d�dkrdSqWxdD]}|j|dd	�q<WdS)
zt
        If for both ipv4 and ipv6, 'may-fail' is set to be False,
        set it to True for both of them.
        �ipv4�ipv6zmay-fail�falseN�method�dhcp�auto�true)r"r#)r&r')r"r#)r r!)r�familyrrr�$_set_mayfail_true_if_both_false_dhcpls


z1NMConnection._set_mayfail_true_if_both_false_dhcpcCs�ddddddddd�}|j|dd�y||}Wn&tk
rVd}d|j|d<YnX|j|ddkrnd	S|j|ddkr�|dkr�d	S|dkr�|jd
dd�||j|d<|j|dd�d	S)z}
        Ensures there's appropriate [ipv4]/[ipv6] for given family
        appropriate for given configuration type
        Zmanualr'r&)ZstaticZstatic6Zdhcp6�
ipv6_slaaczipv6_dhcpv6-statelesszipv6_dhcpv6-statefulZdhcp4r&r%Zdisabledr(zmay-failN�ipv6_dhcpv6-stateful�ipv6_dhcpv6-statelessr+r"r$)r,r-r+)r�KeyErrorr)rr)Zsubnet_typeZ
method_mapr%rrr�_set_ip_method�s2zNMConnection._set_ip_methodcCsX|jj|�si|j|<x<tjd�D].}|�|��}|jj||�s"||j||<Pq"WdS)z�
        Adds a numbered property, such as address<n> or route<n>, ensuring
        the appropriate value gets used for <n>.
        �N)rr�	itertools�countr)rrZ
key_prefixr�index�keyrrr�
_add_numbered�s
zNMConnection._add_numberedcCs*|ddt|d�}|j|d|�dS)z5
        Adds an ipv[46]address<n> property.
        �address�/�prefixN)rr5)rr)�subnetrrrr�_add_address�szNMConnection._add_addresscCsVt|d�rdnd}|ddt|d�}d|krD|d|d}|j|d|�d	S)
z!Adds a ipv[46].route<n> property.�gatewayr#r"Znetworkr7r8�,�routeN)rrr5)rr=r)rrrr�
_add_route�s
zNMConnection._add_routeN)�dns�returncCsNt|�rdnd}|jj|�rJ|j|dd�|j|d|d|j|d<dS)zF
        Extends the ipv[46].dns property with a name server.
        r#r"r?��;N)rrrr)rr?r)rrr�_add_nameserver�szNMConnection._add_nameserver)�
dns_searchr@cCsRxLdD]D}|jj|�r|j|dd�|j|ddj|�d|j|d<qWdS)zM
        Extends the ipv[46].dns-search property with a name server.
        r"r#z
dns-searchrArBN)r"r#)rrr�join)rrDr)rrr�_add_dns_search�s
zNMConnection._add_dns_searchcCs|jddS)z-
        Returns the connection UUID
        rr)r)rrrr�con_uuid�szNMConnection.con_uuidcCs|jjdd�S)zN
        Can this be serialized into a meaningful connection profile?
        r�type)rr)rrrr�valid�szNMConnection.validcCs|jdd�j�S)z)
        Sanitize a MAC address.
        �-�:)�replace�upper)Zaddrrrr�mac_addr�szNMConnection.mac_addrc
stddddddd�}||d}|dkr*dSd	|kr8d}nd}||jd
d<|dk	r|||jd
d<|j||d�|jd
d
<i|j|<dddddddddd�	ddd�ddiiid�}|d}d}	g�g�x�|dD]�}
t|
�r�d nd!}|j||
d�d"|
k�r|j||
�d#|
k�r(|
d#|j|d#<x|
d$D]}|j|��q2Wd%|
k�r^�j|
d%�d&|
k�rv�j|
d&�|d!kr�d|
kr�|
d}	q�Wd'|k�r؈�fd(d)�|d'd*D�7���fd+d)�|d'd,D�7���r�|j�r�|j���r|j�r|j�x�D]}
|j	|
��q
W��r.|j
��|j�|	dk�rD|}	|	|k�sbtj
d-|d.||	�x~||j�D]n\}}||k�r��qp||dk�r��qpt||t��r�||�r�d/nd0|j||<nt||�|j||<�qpW|dk�rN|d1d2k�rtd3�|jdd4<|	dk	�r(t|	�|jdd<|d5dk	�rN|j|d5�|jdd6<|dk�rzd7|k�rz|j|d7�|jdd8<|dk�r�x<|d9D]0}|j|�}|jd
dd�|jd
d
|j���q�W|d5dk	�r�|j|d5�|jdd6<|dk�rB|	dk	�rBd:|jdd;<t|	�|jdd<|d5dk	�rB|j|d5�|jdd6<|dk�s^|jj|d6��rp|d.|jd
d<<dS)=z�
        Integrate information from network state interface information
        into the connection. Most of the work is done here.
        �ethernet�vlan�bond�bridge�
infinibandN)ZphysicalrPrQrRrSZloopbackrHzbond-masterrz
slave-typez-masterZmasterz	bond-modeZbond_miimonzbond-xmit-hash-policyzbond-num-grat-arpzbond-downdelayzbond-updelayzbond-fail-over-maczbond-primary-reselectzbond-primary)	�modeZmiimonZxmit_hash_policyZnum_grat_arpZ	downdelayZupdelayZ
fail_over_macZprimary_reselectZprimaryZ
bridge_stpZbridge_bridgeprio)ZstpZpriorityr
Zvlan_id)rQrRrPrOrSZmtuZsubnetsr#r"r6r;Zroutes�dns_nameserversrDr?csg|]}|�kr|�qSrr)�.0r?)�found_nameserversrr�
<listcomp>Osz1NMConnection.render_interface.<locals>.<listcomp>Znameserverscsg|]}|�kr|�qSrr)rV�search)�found_dns_searchrrrXTsrYzZNetwork config: ignoring %s device-level mtu:%s because ipv4 subnet-level mtu:%s provided.�namer(r$Z	wakeonlanT�@zwake-on-lanZmac_addresszmac-addresszvlan-raw-device�parentZbridge_portsZdatagramztransport-modezinterface-name)r�con_refr	r/r:r>�extendrUZdns_searchdomainsrCrFr*�LOGZwarning�items�
isinstance�boolrrN�get_connrrGr)r�iface�
network_staterZ	_type_mapZif_typeZ
slave_typeZ	_prop_mapZ
device_mtuZipv4_mtur9r)r=Z
nameserverZnm_propr4Zportr)rZrWr�render_interface�s�
















zNMConnection.render_interfacecCs(tj�}|jj|dd�d}||j�S)z
        Stringify.
        F)Zspace_around_delimitersz2# Generated by cloud-init. Changes will be lost.

)�io�StringIOr�write�getvalue)rZbuf�headerrrr�dump�szNMConnection.dump)�__name__�
__module__�__qualname__�__doc__rrrr r!r*r/r5r:r>rrCrrFrGrI�staticmethodrNrgrmrrrrr+s&	
-

	
5rc@sBeZdZdZddd�Zdd�Zdd�Zd
eee	dd	�d
d�Z
dS)�Rendererz?Renders network information in a NetworkManager keyfile format.NcCsi|_||_dS)N)�connectionsr)rrrrrr�szRenderer.__init__cCs
|j|S)N)rt)rrrrrrd�szRenderer.get_conncCs ||jkr|j|j�S|SdS)N)rtrG)rrrrrr^�s
zRenderer.con_ref)rf�	templatesr@cCs�x&|j�D]}t|d�|j|d<q
Wx,|j�D] }|j|d}|j|||�q2Wx<|jj�D].\}}|j�stqbt||�}tj||j	�d�qbWtjt
|�td�dS)Nr[i�)Ziter_interfacesrrtrgrarI�nm_conn_filenamerZ
write_filerm�cloud_init_nm_conf_filename�NM_IPV6_ADDR_GEN_CONF)rrfru�targetreZconnrr[rrr�render_network_state�s	
zRenderer.render_network_state)N)NN)rnrorprqrrdr^r
r�dictrzrrrrrs�s


rscCs&tj|t�}d|�d�}|�d|��S)Nzcloud-init-z
.nmconnectionz/system-connections/)r�target_path�
NM_RUN_DIR)rry�target_con_dir�con_filerrrrv�srvcCs$tj|t�}d|��}|�d|��S)Nzifcfg-r7)rr|�IFCFG_CFG_FILE)�devnameryr~rrrr�sysconfig_conn_filename�s
r�cCs8t|�}tjj|�r$t�r$t|�}tjj|�r4|SdS)a�
    This function returns the name of the interface config file.
    It first checks for presence of network manager connection file.
    If absent and ifcfg-rh plugin for network manager is available,
    it returns the name of the ifcfg file if it is present. If the
    plugin is not present or the plugin is present but ifcfg file is
    not, it returns None.
    This function is called from NetworkManagerActivator class in
    activators.py.
    N)rv�os�path�isfilerr�)r�Z	conn_filerrr�
conn_filename�sr�cCstj|t�}d}|�d|��S)Nz$30-cloud-init-ip6-addr-gen-mode.confz/conf.d/)rr|r})ryr~Z	conf_filerrrrw	srwcCszddlm}tjjtj|td��}tjd|d�}d}|�rjytjddd	g�Wntj	k
rhd
}YnX|oxt
|�ox|S)Nr)�uses_systemd)r�Znmcli)ryTZ	systemctlz
is-enabledzNetworkManager.serviceF)Zcloudinit.distrosr�r�r�r�rr|�NM_CFG_FILEZwhichZProcessExecutionErrorrc)ryr�Zconfig_presentZ
nmcli_presentZservice_activerrr�	availables
r�)N)N)N)N)$rrhr1Zloggingr�rZtypingrrZ	cloudinitrrZ
cloudinit.netrrrr	Zcloudinit.net.network_stater
Zcloudinit.net.sysconfigrr}Z
NM_LIB_DIRr�r�rxZ	getLoggerrnr`rrsrvr�r�rwr�rrrr�<module>	s4	
0




Filemanager

Name Type Size Permission Actions
__init__.cpython-36.opt-1.pyc File 33.43 KB 0644
__init__.cpython-36.pyc File 33.43 KB 0644
activators.cpython-36.opt-1.pyc File 9.52 KB 0644
activators.cpython-36.pyc File 9.52 KB 0644
bsd.cpython-36.opt-1.pyc File 5.74 KB 0644
bsd.cpython-36.pyc File 5.74 KB 0644
cmdline.cpython-36.opt-1.pyc File 7.2 KB 0644
cmdline.cpython-36.pyc File 7.2 KB 0644
dhcp.cpython-36.opt-1.pyc File 15.98 KB 0644
dhcp.cpython-36.pyc File 15.98 KB 0644
eni.cpython-36.opt-1.pyc File 12.89 KB 0644
eni.cpython-36.pyc File 12.89 KB 0644
ephemeral.cpython-36.opt-1.pyc File 10.51 KB 0644
ephemeral.cpython-36.pyc File 10.51 KB 0644
freebsd.cpython-36.opt-1.pyc File 2.54 KB 0644
freebsd.cpython-36.pyc File 2.54 KB 0644
netbsd.cpython-36.opt-1.pyc File 1.69 KB 0644
netbsd.cpython-36.pyc File 1.69 KB 0644
netplan.cpython-36.opt-1.pyc File 11.91 KB 0644
netplan.cpython-36.pyc File 11.91 KB 0644
network_manager.cpython-36.opt-1.pyc File 12.83 KB 0644
network_manager.cpython-36.pyc File 12.83 KB 0644
network_state.cpython-36.opt-1.pyc File 27.57 KB 0644
network_state.cpython-36.pyc File 27.57 KB 0644
networkd.cpython-36.opt-1.pyc File 8.21 KB 0644
networkd.cpython-36.pyc File 8.21 KB 0644
openbsd.cpython-36.opt-1.pyc File 2.18 KB 0644
openbsd.cpython-36.pyc File 2.18 KB 0644
renderer.cpython-36.opt-1.pyc File 1.82 KB 0644
renderer.cpython-36.pyc File 1.82 KB 0644
renderers.cpython-36.opt-1.pyc File 1.53 KB 0644
renderers.cpython-36.pyc File 1.53 KB 0644
sysconfig.cpython-36.opt-1.pyc File 23.07 KB 0644
sysconfig.cpython-36.pyc File 23.07 KB 0644
udev.cpython-36.opt-1.pyc File 1.22 KB 0644
udev.cpython-36.pyc File 1.31 KB 0644