diff --git a/providers/ec2/tasks/cleanup.py b/common/tasks/cleanup.py similarity index 100% rename from providers/ec2/tasks/cleanup.py rename to common/tasks/cleanup.py diff --git a/providers/ec2/__init__.py b/providers/ec2/__init__.py index 5bd1c27..10c746f 100644 --- a/providers/ec2/__init__.py +++ b/providers/ec2/__init__.py @@ -15,7 +15,7 @@ from common.tasks import boot as common_boot from tasks import security from tasks import network from tasks import initd -from tasks import cleanup +from common.tasks import cleanup def initialize(): diff --git a/providers/raw/__init__.py b/providers/raw/__init__.py index c8ebc31..dacdaca 100644 --- a/providers/raw/__init__.py +++ b/providers/raw/__init__.py @@ -11,7 +11,7 @@ from common.tasks import boot as common_boot from tasks import security from tasks import network from tasks import initd -from tasks import cleanup +from common.tasks import cleanup def initialize(): diff --git a/providers/raw/tasks/cleanup.py b/providers/raw/tasks/cleanup.py deleted file mode 100644 index 7b793a4..0000000 --- a/providers/raw/tasks/cleanup.py +++ /dev/null @@ -1,43 +0,0 @@ -from base import Task -from common import phases -import os - - -class ClearMOTD(Task): - description = 'Clearing the MOTD' - phase = phases.system_cleaning - - def run(self, info): - with open('/var/run/motd', 'w'): - pass - - -class ShredHostkeys(Task): - description = 'Securely deleting ssh hostkeys' - phase = phases.system_cleaning - - def run(self, info): - ssh_hostkeys = ['ssh_host_dsa_key', - 'ssh_host_rsa_key'] - if info.manifest.system['release'] != 'squeeze': - ssh_hostkeys.append('ssh_host_ecdsa_key') - - private = [os.path.join(info.root, 'etc/ssh', name) for name in ssh_hostkeys] - public = [path + '.pub' for path in private] - - from common.tools import log_check_call - log_check_call(['/usr/bin/shred', '--remove'] + private + public) - - -class CleanTMP(Task): - description = 'Removing temporary files' - phase = phases.system_cleaning - - def run(self, info): - tmp = os.path.join(info.root, 'tmp') - for tmp_file in [os.path.join(tmp, f) for f in os.listdir(tmp)]: - os.remove(tmp_file) - - log = os.path.join(info.root, 'var/log/') - os.remove(os.path.join(log, 'bootstrap.log')) - os.remove(os.path.join(log, 'dpkg.log'))