Linux ns1.utparral.edu.mx 6.8.0-79-generic #79~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 15 16:54:53 UTC 2 x86_64
Apache/2.4.58 (Unix) OpenSSL/1.1.1w PHP/8.2.12 mod_perl/2.0.12 Perl/v5.34.1
: 10.10.1.9 | : 10.10.1.254
Cant Read [ /etc/named.conf ]
daemon
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
README
+ Create Folder
+ Create File
/
usr /
lib /
ubuntu-advantage /
[ HOME SHELL ]
Name
Size
Permission
Action
add_esm_snapshot_auth.py
1.88
KB
-rw-r--r--
apt-esm-json-hook
50.32
KB
-rwxr-xr-x
apt_news.py
565
B
-rw-r--r--
auto_attach.py
3.68
KB
-rw-r--r--
cloud-id-shim.sh
500
B
-rwxr-xr-x
convert_list_to_deb822.py
2.37
KB
-rw-r--r--
daemon.py
2.49
KB
-rw-r--r--
esm_cache.py
491
B
-rwxr-xr-x
migrate_user_config.py
5.37
KB
-rw-r--r--
patch_status_json.py
2.47
KB
-rwxr-xr-x
postinst-migrations.sh
3.53
KB
-rwxr-xr-x
reboot_cmds.py
4.9
KB
-rw-r--r--
timer.py
5.98
KB
-rw-r--r--
upgrade_lts_contract.py
621
B
-rwxr-xr-x
Delete
Unzip
Zip
${this.title}
Close
Code Editor : auto_attach.py
#!/usr/bin/env python3 """ Perform auto-attach operation On Ubuntu Pro machines, we try to perform an auto-attach operation on first boot. This happens through a systemd unit that executes this script on every boot. However, if we detect that cloud-init has user data related to ua, we don't run auto-attach here, since cloud-init will drive this operation on their side. """ import logging import sys from uaclient import exceptions, http, log, messages, system from uaclient.api.exceptions import ( AlreadyAttachedError, AutoAttachDisabledError, EntitlementsNotEnabledError, ) from uaclient.api.u.pro.attach.auto.full_auto_attach.v1 import ( FullAutoAttachOptions, full_auto_attach, ) from uaclient.clouds.aws import AWSAutoAttachInstance from uaclient.clouds.identity import cloud_instance_factory from uaclient.config import UAConfig from uaclient.daemon import AUTO_ATTACH_STATUS_MOTD_FILE, retry_auto_attach from uaclient.files import state_files LOG = logging.getLogger("ubuntupro.lib.auto_attach") # All known cloud-config keys which provide ubuntu pro configuration directives CLOUD_INIT_UA_KEYS = set( ["ubuntu-advantage", "ubuntu_advantage", "ubuntu_pro"] ) try: import cloudinit.stages as ci_stages # type: ignore except ImportError: pass def get_cloudinit_init_stage(): if "cloudinit.stages" in sys.modules: return ci_stages.Init() return None def check_cloudinit_userdata_for_ua_info(): init = get_cloudinit_init_stage() # if init is None, this means we were not able to import the cloud-init # module. if init is None: return False if init.cfg and CLOUD_INIT_UA_KEYS.intersection(init.cfg): return True return False def main(cfg: UAConfig): if check_cloudinit_userdata_for_ua_info(): LOG.info("cloud-init userdata has ubuntu-advantage key.") LOG.info( "Skipping auto-attach and deferring to cloud-init " "to setup and configure auto-attach" ) return try: cloud = cloud_instance_factory() except exceptions.CloudFactoryError as e: LOG.debug("Error loading the cloud: %s", e) else: if isinstance(cloud, AWSAutoAttachInstance): if not cloud.is_likely_pro: LOG.info( "Skipping auto-attach. Reason: No billingProduct nor" " marketplaceProductCode on AWS." ) return else: LOG.info("Auto-attaching: product code found on AWS.") system.write_file( AUTO_ATTACH_STATUS_MOTD_FILE, messages.AUTO_ATTACH_RUNNING ) try: full_auto_attach(FullAutoAttachOptions()) except AlreadyAttachedError as e: LOG.info(e.msg) except AutoAttachDisabledError: LOG.debug("Skipping auto-attach. Config disable_auto_attach is set.") except EntitlementsNotEnabledError as e: LOG.warning(e.msg) except Exception as e: LOG.error(e) system.ensure_file_absent(AUTO_ATTACH_STATUS_MOTD_FILE) LOG.info("creating flag file to trigger retries") system.create_file(retry_auto_attach.FLAG_FILE_PATH) failure_reason = ( retry_auto_attach.full_auto_attach_exception_to_failure_reason(e) ) state_files.retry_auto_attach_state_file.write( state_files.RetryAutoAttachState( interval_index=0, failure_reason=failure_reason ) ) return 1 system.ensure_file_absent(AUTO_ATTACH_STATUS_MOTD_FILE) return 0 if __name__ == "__main__": log.setup_journald_logging() cfg = UAConfig() http.configure_web_proxy(cfg.http_proxy, cfg.https_proxy) sys.exit(main(cfg))
Close