aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Kaspar [Dee'Kej] <dkaspar@redhat.com>2017-11-08 12:51:05 +0100
committerDee'Kej <deekej@linuxmail.org>2017-11-08 12:53:37 +0100
commit7fa374712f6da22f97bce84fff2e4cd535e9ef8d (patch)
treea634262d79c3da4f45003483342f67f29228d6d2
parentad115e06a5d2a654c16281690bd870731fbb11d2 (diff)
downloadinitscripts-7fa374712f6da22f97bce84fff2e4cd535e9ef8d.tar
initscripts-7fa374712f6da22f97bce84fff2e4cd535e9ef8d.tar.gz
initscripts-7fa374712f6da22f97bce84fff2e4cd535e9ef8d.tar.bz2
initscripts-7fa374712f6da22f97bce84fff2e4cd535e9ef8d.tar.xz
initscripts-7fa374712f6da22f97bce84fff2e4cd535e9ef8d.zip
9.789.78
-rw-r--r--initscripts.spec17
1 files changed, 16 insertions, 1 deletions
diff --git a/initscripts.spec b/initscripts.spec
index 83d19d11..dcc4fea8 100644
--- a/initscripts.spec
+++ b/initscripts.spec
@@ -1,6 +1,6 @@
Summary: Scripts to bring up network interfaces and legacy utilities
Name: initscripts
-Version: 9.77
+Version: 9.78
License: GPLv2
Group: System Environment/Base
Release: 1%{?dist}
@@ -159,6 +159,21 @@ fi
%dir %{_libexecdir}/initscripts/legacy-actions
%changelog
+* Wed Nov 08 2017 David Kaspar [Dee'Kej] <dkaspar@redhat.com> - 9.78-1
+- specfile: drop dependancy on /etc/system-release
+- ifup-post: always update nameserver & search entries in /etc/resolv.conf
+- network-scripts: forward DBus calls to /dev/null
+- Spelling fixes
+- Tell git to ignore *.o
+- Use grep -E instead of deprecated egrep
+- Avoid some unnecessary stat calls
+- systemd/system: symlinks for fedora-* services removed
+- network-scripts: firewall-cmd replaced with DBus calls
+- 'debugmode' subpackage dropped completely
+- sysconfig/init* files dropped
+- sysctl.conf.s390 dropped
+- usleep: change the error message to print the full replacement commandline
+
* Tue Aug 15 2017 David Kaspar [Dee'Kej] <dkaspar@redhat.com> - 9.77-1
- specfile: Fix failing build for s390* architecture
- Drop no longer supported SPARC architecture
> 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189
package security::msec;

use strict;
use MDK::Common::File;
use MDK::Common;


#-------------------------------------------------------------
# msec options managment methods


#-------------------------------------------------------------
# option defaults

sub load_defaults {
    my ($msec, $category) = @_;
    my $separator = $msec->{$category}{def_separator};
    map { 
        my ($opt, $val) = split /$separator/;
        chop $val;
        if_($opt ne 'set_security_conf', $opt => $val);
    } cat_($msec->{$category}{defaults_file}), if_($category eq "checks", 'MAIL_USER');
}


# get_XXX_default(function) -
#   return the default of the function|check passed in argument.

sub get_check_default {
    my ($msec, $check) = @_;
    $msec->{checks}{default}{$check};
}

sub get_function_default {
    my ($msec, $function) = @_;
    $msec->{functions}{default}{$function};
}



#-------------------------------------------------------------
# option values

sub load_values {
    my ($msec, $category) = @_;
    my $separator = $msec->{$category}{val_separator};
    map {
        my ($opt, $val) = split /$separator/;
        chop $val;
        $val =~ s/[()]//g;
        chop $opt if $separator eq '\(';  # $opt =~ s/ //g if $separator eq '\(';
        if_($val, $opt => $val);
    } cat_($msec->{$category}{values_file});
}


# get_XXX_value(check|function) -
#   return the value of the function|check passed in argument.
#   If no value is set, return "default".

sub get_function_value {
    my ($msec, $function) = @_;
    $msec->{functions}{value}{$function} || "default";
}

sub get_check_value {
    my ($msec, $check) = @_;
    $msec->{checks}{value}{$check} || "default";
}



#-------------------------------------------------------------
# get list of check|functions

# list_(functions|checks) -
#   return a list of functions|checks handled by level.local|security.conf

sub raw_checks_list {
    my ($msec) = @_;
    keys %{$msec->{checks}{default}};
}

sub list_checks {
    my ($msec) = @_;
    grep { !member($_, qw(MAIL_WARN MAIL_USER)) } $msec->raw_checks_list;
}

sub list_functions {
    my ($msec, $category) = @_;

    ## TODO handle 3 last functions here so they can be removed from this list
    my @ignore_list = qw(indirect commit_changes closelog error initlog log set_secure_level
					set_security_conf set_server_level print_changes get_translation create_server_link);

    my %options = (
	    'network' => [qw(accept_bogus_error_responses accept_broadcasted_icmp_echo accept_icmp_echo
					enable_dns_spoofing_protection enable_ip_spoofing_protection
					enable_log_strange_packets enable_promisc_check no_password_aging_for)],
	    'system' =>  [qw(allow_autologin allow_issues allow_reboot allow_remote_root_login
                         allow_root_login allow_user_list allow_x_connections allow_xserver_to_listen
                         authorize_services enable_at_crontab enable_console_log
                         enable_msec_cron enable_pam_wheel_for_su enable_password enable_security_check
                         enable_sulogin password_aging password_history password_length set_root_umask
                         set_shell_history_size set_shell_timeout set_user_umask)]);

    # get all function names; filter out those which are in the ignore
    # list, return what lefts.
    grep { !member($_, @ignore_list) && member($_, @{$options{$category}}) } keys %{$msec->{functions}{default}};
}


#-------------------------------------------------------------
# set back checks|functions values

sub set_function {
    my ($msec, $function, $value) = @_;
    $msec->{functions}{value}{$function} = $value;
}

sub set_check {
    my ($msec, $check, $value) = @_;
    $msec->{checks}{value}{$check} = $value;
}


#-------------------------------------------------------------
# apply configuration

# config_(check|function)(check|function, value) -
#   Apply the configuration to 'prefix'/etc/security/msec/security.conf||/etc/security/msec/level.local

sub apply_functions {
    my ($msec) = @_;
    my @list = sort($msec->list_functions('system'), $msec->list_functions('network'));
    substInFile {
        foreach my $function (@list) { s/^$function.*\n// }
        if (eof) {
            $_ .= join("\n", if_(!$_, ''), (map { 
                my $value = $msec->get_function_value($_);
                if_($value ne 'default', "$_ ($value)");
            } @list), "");
        }
    } $msec->{functions}{values_file};
}

sub apply_checks {
    my ($msec) = @_;
    my @list =  sort $msec->raw_checks_list;
    substInFile {
        foreach my $check (@list) { s/^$check.*\n// }
        if (eof) {
            print "\n", join("\n", map { 
                my $value = $msec->get_check_value($_);
                if_($value ne 'default', $_ . '=' . $value);
            } @list), "\n";
        }
    } $msec->{checks}{values_file};
}

sub reload {
    my ($msec) = @_;
    my $num_level = 0;
    require security::level;
    $num_level ||= security::level::get();
    $msec->{functions}{defaults_file} = "$::prefix/usr/share/msec/level.".$num_level;
    $msec->{functions}{default} = { $msec->load_defaults('functions') };
}

sub new { 
    my $type = shift;
    my $msec = bless {}, $type;

    $msec->{functions}{values_file}   = "$::prefix/etc/security/msec/level.local";
    $msec->{checks}{values_file}      = "$::prefix/etc/security/msec/security.conf";
    $msec->{checks}{defaults_file}    = "$::prefix/var/lib/msec/security.conf";
    $msec->{checks}{val_separator}    = '=';
    $msec->{functions}{val_separator} = '\(';
    $msec->{checks}{def_separator}    = '=';
    $msec->{functions}{def_separator} = ' ';
    $msec->reload;

    $msec->{checks}{default}    = { $msec->load_defaults('checks') };
    $msec->{functions}{value}   = { $msec->load_values('functions') };
    $msec->{checks}{value}      = { $msec->load_values('checks') };
    $msec;
}

1;