Scroll to navigation

clone-master-clean-up(1) Clean-Up For Cloning Preparation clone-master-clean-up(1)

NAME

clone-master-clean-up - Clean up a system for cloning preparation.

OPTIONS

The program does not accept command line options.

DESCRIPTION

Clean up a system and delete all usage history to prepare it for being cloned.

How to properly clean up a system to create a golden image is highly dependent on installed software, machine configuration, and how the image is supposed to be used.

1. A golden image for fast and easy way to deploy a freshly installed base operating system (a so-called plain vanilla image).

2. A golden image that is used during the life cycle management of a system or solution landscape.

Life-cycle management images normally include custom additions beyond the base operating system which are needed on all rolled-out systems. This can include additional software, e.g. for backup, hardware support, or monitoring, and system configuration, e.g. the creation of additional local users and changes to configuration files such as 'sudoers' or 'pam'.
Additionally, with the use case of a life cycle management image, there will be a very intensive test cycle of newly installed software and configuration before the golden image is created and rolled out. Such testing can lead a lot of additional log files and temporary data.

This means that the parts of the operating system which need to be cleaned up are different depending on the use case and that it can be counterproductive to remove some special files or directories.

For the use case of creating an clean operating system base installation, the standard scope of 'clone-master-clean-up' is generally sufficient. To allow customization for this use case, use the configuration file /etc/sysconfig/clone-master-clean-up.
Here, you can configure the following behavior:

/etc/sudoers is restored to original, and only root is allowed to run sudo.
default: no
clean up user ids >= 1000
default: no
clean up all zypper repositories
default: no
remove btrfs snapshots of root filesystem
default: yes
(If the system is running on EC2) Allow ec2-user to run sudo password-less.
default: no

For the use case of a life cycle management image, it's impossible to write a standard script which will fit all requirements. To enable this use case, clone-master-clean-up allows including a drop-in file containing paths to files and directories that are deleted in addition to doing the standard clean-ups.

For more information and examples, see /usr/share/clone-master-clean-up/custom_remove.template. Please copy the template file /usr/share/clone-master-clean-up/custom_remove.template to /etc/clone-master-clean-up/custom_remove and un-comment the parts you need or add additional parts which will fit your needs.

If the file '/etc/clone-master-clean-up/custom_remove' exists, all included files and directories will be picked up line by line and additionally removed from the golden image.

CLEANED UP ITEMS

The program asks for confirmation before proceeding with cleanup. If you proceed by typing "YES" and enter, the following locations/items will be cleaned up (or deleted):

SUSE registration, all software repositories.
SSH host keys, root user SSH keys, root user authorized keys, root user shell history.
User mails and user cron jobs.
Temporary files under /tmp and /var/tmp.
Log files and archived log files under /var/log.
Auto-generated HANA firewall configuration script.
System random seeds.
Systemd journal.
machine ID.
Salt client ID.
osad authentication configuration file and the system ID.
Domain and host names.
/etc/hostname, /etc/hosts, /etc/resolv.conf are restored to original.
Persistent network interfaces (auto-generated 70-persistent-net.rules).
YaST Firstboot is enabled if there is a firstboot.xml.
Give root user a new password, optionally.
Zypper anonymous ID
Clean up postfix
Swap the uuid strings with dev strings in /etc/fstab
Clean up network files (except interfaces using dhcp boot protocol)
Clean up collectd
Clean up /root
Clean up cache, crash and coredump

FILES

/etc/sysconfig/clone-master-clean-up

Defines the behavior of clone-master-clean-up.

/usr/share/clone-master-clean-up/custom_remove.template

Template for a vendor/customer-specific drop-in file. Defines additional files and directories to clean up.

/etc/clone-master-clean-up/custom_remove

´Operation-ready´ copy of the template file. If this file exists, clone-master-clean-up will remove files and directories that are listed in it.

AUTHOR

Howard Guo <hguo@suse.com>, Angela Briel <abriel@suse.com>

September 2022