~junaidali/charms/trusty/plumgrid-gateway/pg-restart

« back to all changes in this revision

Viewing changes to hooks/charmhelpers/contrib/hardening/host/checks/apt.py

  • Committer: Junaid Ali
  • Date: 2016-05-01 02:22:48 UTC
  • Revision ID: junaidali@plumgrid.com-20160501022248-ro6fhd2jowxejn2w
update sleep time in restart_pg, changes for make sync

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2016 Canonical Limited.
2
 
#
3
 
# This file is part of charm-helpers.
4
 
#
5
 
# charm-helpers is free software: you can redistribute it and/or modify
6
 
# it under the terms of the GNU Lesser General Public License version 3 as
7
 
# published by the Free Software Foundation.
8
 
#
9
 
# charm-helpers is distributed in the hope that it will be useful,
10
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 
# GNU Lesser General Public License for more details.
13
 
#
14
 
# You should have received a copy of the GNU Lesser General Public License
15
 
# along with charm-helpers.  If not, see <http://www.gnu.org/licenses/>.
16
 
 
17
 
from charmhelpers.contrib.hardening.utils import get_settings
18
 
from charmhelpers.contrib.hardening.audits.apt import (
19
 
    AptConfig,
20
 
    RestrictedPackages,
21
 
)
22
 
 
23
 
 
24
 
def get_audits():
25
 
    """Get OS hardening apt audits.
26
 
 
27
 
    :returns:  dictionary of audits
28
 
    """
29
 
    audits = [AptConfig([{'key': 'APT::Get::AllowUnauthenticated',
30
 
                          'expected': 'false'}])]
31
 
 
32
 
    settings = get_settings('os')
33
 
    clean_packages = settings['security']['packages_clean']
34
 
    if clean_packages:
35
 
        security_packages = settings['security']['packages_list']
36
 
        if security_packages:
37
 
            audits.append(RestrictedPackages(security_packages))
38
 
 
39
 
    return audits