Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Common cleanup script (one-sysprep) #127

Closed
kvaps opened this issue Nov 21, 2018 · 3 comments
Closed

Common cleanup script (one-sysprep) #127

kvaps opened this issue Nov 21, 2018 · 3 comments

Comments

@kvaps
Copy link
Contributor

kvaps commented Nov 21, 2018

I think it would be nice to provide single cleanup script, for remove all sensitive information from the images after preparation.

I leave there a few examples that can go in there.

Linux

Clean package cache:

# Ubuntu / Debian
apt-get clean all

# Centos
yum clean all

# Alpine
rm -rf /var/cache/apk/*

# openSUSE
zypper clean --all

Remove root password

passwd -d root

Remove network configuration

# Ubuntu / Debian
# TODO

# Centos
# TODO

# Alpine
# TODO

# openSUSE
rm -f /etc/sysconfig/network/ifcfg-eth*
rm -f /etc/sysconfig/network/routes
sed -i '/^NETCONFIG_DNS_STATIC_SERVERS=/ s/=.*$/=""/' /etc/sysconfig/network/config
sed -i '/^NETCONFIG_DNS_STATIC_SEARCHLIST=/ s/=.*$/=""/' /etc/sysconfig/network/config
sed -i '/^ *[^#]/d' /etc/resolv.conf

Remove DNS configuration

sed -i '/^ *[^#]/d' /etc/resolv.conf

Clear bash/ash history:

rm -f ~/.*_history

Remove host ssh keys:

rm -f /mnt/etc/ssh/ssh_host_* 

Something else?

Windows

Clean opennebula-contextulization logs:

rm -force C:\.opennebula-context.out
  • Run sysprep - it's already cleaning everything well
@kvaps kvaps changed the title Conside common cleanup procedure Conside common cleanup script Nov 21, 2018
@vholer vholer added this to the v5.12.0 milestone Sep 5, 2019
@openmilanese
Copy link

Do not forget /etc/machine-id. Some OS uses the contents of /etc/machine-id to determine the DHCP unique identifier (duid) that is used for DHCP requests.

@vholer vholer changed the title Conside common cleanup script Common cleanup script (one-sysprep) Feb 17, 2020
@vholer
Copy link
Contributor

vholer commented Feb 17, 2020

Extending the use-case:

For inspiration, we can follow the naming and implementation of some operations of virt-sysprep (see virt-sysprep --list-operations).

@ospalax ospalax self-assigned this Jun 24, 2020
ospalax pushed a commit to ospalax/addon-context-linux that referenced this issue Jun 24, 2020
ospalax pushed a commit to ospalax/addon-context-linux that referenced this issue Jun 25, 2020
ospalax pushed a commit to ospalax/addon-context-linux that referenced this issue Jun 26, 2020
ospalax pushed a commit to ospalax/addon-context-linux that referenced this issue Jun 26, 2020
ospalax pushed a commit to ospalax/addon-context-linux that referenced this issue Jun 26, 2020
ospalax pushed a commit to ospalax/addon-context-linux that referenced this issue Jun 26, 2020
ospalax pushed a commit to ospalax/addon-context-linux that referenced this issue Jun 29, 2020
ospalax pushed a commit to ospalax/addon-context-linux that referenced this issue Jun 29, 2020
ospalax pushed a commit to ospalax/addon-context-linux that referenced this issue Jun 29, 2020
ospalax pushed a commit to ospalax/addon-context-linux that referenced this issue Jun 29, 2020
ospalax pushed a commit to ospalax/addon-context-linux that referenced this issue Jun 29, 2020
ospalax pushed a commit to ospalax/addon-context-linux that referenced this issue Jun 30, 2020
ospalax pushed a commit to ospalax/addon-context-linux that referenced this issue Jun 30, 2020
ospalax pushed a commit to ospalax/addon-context-linux that referenced this issue Jun 30, 2020
vholer pushed a commit that referenced this issue Jun 30, 2020
@vholer vholer modified the milestones: v5.12.0, v5.14.0 Jun 30, 2020
@ospalax
Copy link

ospalax commented Jun 30, 2020

Hi @kvaps

it was implemented in onesysprep tool in the master - can you check it out #214?

The tool is in: src/usr/sbin/onesysprep

Thanks

@ospalax ospalax closed this as completed Jun 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants