Revision f8119e65 image_creator/os_type/unix.py

b/image_creator/os_type/unix.py
8 8

  
9 9
class Unix(OSBase):
10 10

  
11
    sensitive_userdata = ['.bash_history']
11
    sensitive_userdata = [
12
        '.bash_history',
13
        '.gnupg',
14
        '.ssh',
15
        '.mozilla',
16
        '.thunderbird'
17
    ]
12 18

  
13 19
    def get_metadata(self):
14 20
        meta = super(Unix, self).get_metadata()
......
33 39
        return users
34 40

  
35 41
    def data_cleanup(self):
36
        self.cleanup_userdata()
37
        self.cleanup_tmp()
38
        self.cleanup_log()
39
        self.cleanup_mail()
40
        self.cleanup_cache()
41

  
42
    def cleanup_cache(self):
42
        self.data_cleanup_userdata()
43
        self.data_cleanup_tmp()
44
        self.data_cleanup_log()
45
        self.data_cleanup_mail()
46
        self.data_cleanup_cache()
47

  
48
    def data_cleanup_cache(self):
49
        """Remove all regular files under /var/cache"""
43 50
        self.foreach_file('/var/cache', self.g.rm, ftype='r')
44 51

  
45
    def cleanup_tmp(self):
52
    def data_cleanup_tmp(self):
53
        """Remove all files under /tmp and /var/tmp"""
46 54
        self.foreach_file('/tmp', self.g.rm_rf, maxdepth=1)
47 55
        self.foreach_file('/var/tmp', self.g.rm_rf, maxdepth=1)
48 56

  
49
    def cleanup_log(self):
57
    def data_cleanup_log(self):
58
        """Empty all files under /var/log"""
50 59
        self.foreach_file('/var/log', self.g.truncate, ftype='r')
51 60

  
52
    def cleanup_mail(self):
53
        self.foreach_file('var/spool/mail', self.g.rm_rf, maxdepth=1)
54
        self.foreach_file('var/mail', self.g.rm_rf, maxdepth=1)
61
    def data_cleanup_mail(self):
62
        """Remove all files under /var/mail and /var/spool/mail"""
63
        self.foreach_file('/var/spool/mail', self.g.rm_rf, maxdepth=1)
64
        self.foreach_file('/var/mail', self.g.rm_rf, maxdepth=1)
55 65

  
56
    def cleanup_userdata(self):
66
    def data_cleanup_userdata(self):
67
        """Delete sensitive userdata"""
57 68
        homedirs = ['/root'] + self.ls('/home/')
58 69

  
59 70
        for homedir in homedirs:

Also available in: Unified diff