Git Product home page Git Product logo

ubuntu1604-cis's Introduction

  • ๐Ÿ‘‹ Hi, Iโ€™m @florianutz
  • ๐Ÿ‘€ Iโ€™m interested in automation and secure operation

ubuntu1604-cis's People

Contributors

caglarsayin avatar dependabot[bot] avatar florianutz avatar isaacbentley avatar j00k avatar jalev avatar smiller171 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ubuntu1604-cis's Issues

Why can't these fail?

I can't find any tasks checking the registered vars, and yet these tasks are set to never fail. As far as I can tell these are scored rules that are being allowed to pass unchecked.

- name: "SCORED | 1.1.5 | PATCH | Ensure separate partition exists for /var"
shell: mount | grep "on /var "
register: var_mounted
changed_when: false
failed_when: false
when:
- ubuntu1604cis_rule_1_1_5
tags:
- level2
- scored
- patch
- rule_1.1.5
- skip_ansible_lint
- name: "SCORED | 1.1.6 | PATCH | Ensure separate partition exists for /var/tmp"
shell: mount | grep "on /var/tmp "
register: var_tmp_mounted
changed_when: false
failed_when: false
when:
- ubuntu1604cis_rule_1_1_6
tags:
- level2
- scored
- patch
- rule_1.1.6
- skip_ansible_lint

- name: "SCORED | 1.1.10 | PATCH | Ensure separate partition exists for /var/log"
shell: mount | grep "on /var/log "
register: var_log_mounted
changed_when: false
failed_when: false
when:
- ubuntu1604cis_rule_1_1_10
tags:
- level2
- scored
- patch
- rule_1.1.10
- skip_ansible_lint
- name: "SCORED | 1.1.11 | PATCH | Ensure separate partition exists for /var/log/audit"
shell: mount | grep "on /var/log/audit "
register: var_log_audit_mounted
changed_when: false
failed_when: false
when:
- ubuntu1604cis_rule_1_1_11
tags:
- level2
- scored
- patch
- rule_1.1.11
- skip_ansible_lint
- name: "SCORED | 1.1.12 | PATCH | Ensure separate partition exists for /home"
shell: mount | grep "on /home "
register: home_mounted
changed_when: false
failed_when: false
when:
- ubuntu1604cis_rule_1_1_12
tags:
- level2
- scored
- patch
- rule_1.1.12
- skip_ansible_lint

tasks/main.yml has type section issues

root@server-ubuntu-1604:~# ansible-playbook --version
ansible-playbook 2.0.0.2
root@log-server-ubuntu-1604:~# ansible-playbook --check /etc/ansible/roles/florianutz.ubuntu1604-cis/tasks/main.yml
 [WARNING]: provided hosts list is empty, only localhost is available

ERROR! 'fail' is not a valid attribute for a Play

The error appears to have been in '/etc/ansible/roles/florianutz.ubuntu1604-cis/tasks/main.yml': line 3, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

# tasks file for Ubuntu1604-CIS
- name: Check OS version and family
  ^ here

root@log-server-ubuntu-1604:~# ansible-playbook site.yml
 [WARNING]: provided hosts list is empty, only localhost is available

ERROR! The handlers/main.yml file for role 'florianutz.ubuntu1604-cis' must contain a list of tasks

The error appears to have been in '/etc/ansible/roles/florianutz.ubuntu1604-cis/tasks/main.yml': line 3, column 1, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

# tasks file for Ubuntu1604-CIS
- name: Check OS version and family
^ here

I was able to successfully run this on a machine the other day and on another system with the same configuration it's not failing. I doubt this is an issue with the file, as I have been able to get this to run, but I haven't the foggiest idea why it would suddenly be failing like this. Any ideas?

Vaildate SSH config file after changes

When running the section5 SSH tasks, the sshd configuration file is not validated. The ssh daemon may not be restarted, because not all tasks contain the notify statement and the error remains silently in the configuration file.

This can cause, that sshd configuration file is misconfigured and ssh daemon will not start after system restart.

This is major issue, since the administrator has to log into the machine via single user mode, serial console or another type of alternative access to fix the misconfigured file. This happened to me today on GCP platform, where the end of the SSH file is by default configured properly, but if another line is added to it, it breaks the syntax.

Example of valid ending of SSH config file:

# Create chrooted directory
Match Group scponly
    ChrootDirectory %h
    passwordAuthentication yes
    ForceCommand internal-sftp
    AllowTcpForwarding no
    X11Forwarding no

By adding for example line PermitUserEnvironment no, the Match block is not closed with Match all statement and the configuration file is invalid.

# Create chrooted directory
Match Group scponly
    ChrootDirectory %h
    passwordAuthentication yes
    ForceCommand internal-sftp
    AllowTcpForwarding no
PermitUserEnvironment no

Error when running sshd -t:

/etc/ssh/sshd_config line 69: Directive 'PermitUserEnvironment' is not allowed within a Match block.

As remediation I propose:

  • There should be SSH validation run sshd -t after tasks or in handler
  • If the validation is run on handler, all tasks, that alter sshd config file should notify for daemon restart.

Use version tags in Galaxy

Currently you have version tags in GitHub, but those versions are not reflected in Ansible Galaxy. It would be very helpful for me if you would set up Galaxy to use those version tags.

Link to CIS Guide doesn't work.

The link to the CIS guide doesn't work anymore.

On their current version of this it, the ubuntu 16 guide is hidden behind an email registration here: https://www.cisecurity.org/benchmark/ubuntu_linux/

The page is branded for Ubuntu 18, and has a back link for Ubuntu 14, but if you register, you get an email with a link to a download archive where Ubuntu the Ubuntu 16 PDF is available.

Requirement.yml is missing

HI Florian ,

  1. ansible-galaxy install -p roles -r requirements.yml in this command requirement.yml is missing .

  2. ERROR! 'register' is not a valid attribute for a Play

The error appears to have been in '/etc/ansible/Sango/Ubuntu1604-CIS/tasks/prelim.yml': line 2, column 3, but may
be elsewhere in the file depending on the exact syntax problem.


The offending line appears to be:


  • name: PRELIM | List users accounts
    ^ here

I am geeting this issue , can you please help me here .

Undefined variable grub_cfg & grub2-mkconfig doesn't exist

I get this error:

RUNNING HANDLER [Ubuntu1604-CIS : generate new grub config] **************************************************************************************************
fatal: [localhost]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'grub_cfg' is undefined\n\nThe error appears to have been in '/root/smtt/ansible/Ubuntu1604-CIS/handlers/main.yml': line 29, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n- name: generate new grub config\n ^ here\n"}

Also, the command grub2-mkconfig should be renamed to grub-mkconfig:

$ grub2-mkconfig
No command 'grub2-mkconfig' found, did you mean:
Command 'grub-mkconfig' from package 'grub-common' (main)
grub2-mkconfig: command not found

Section 1.1.1 does not match CIS Guide

In the playbook task 1.1.1.6 is handling disabling squashfs, in the guide it handles udf, and squashfs is never disabled.

Similarly 1.1.1.8 removes FAT, which is again, not addressed in the CIS guide.

ubuntu1604cis_aide_cron

default value for ubuntu1604cis_aide_cron[aide_job] contains a wrong value
there must be /usr/bin/aide --check instead of /usr/sbin/aide --check

Changing password fails

the password fails the dictionary check - error loading dictionary

ensure that cracklib-runtime is installed

6.2.6 Leaves empty secure path, breaks playbook

When running against a Ubuntu 16.04.4 machine that was upgraded from a clean 16.04.3 installation, 6.2.6 doesn't update secure path with anything. The resulting /etc/sudoers file results in this on line 11:

Defaults        secure_path=""

At this point, Ansible is unable to continue and the connection is broken.

NTP configuration fails (chronyd)

This list syntax produce wrong output to the chrony.conf file (possible other files, that are using FOR loop). To be more precise it loops through the addresses as each letter is a separate string and this results a new row for each of them.
E.g.
server 0 minpoll 8
server . minpoll 8
server p minpoll 8
server o minpoll 8
...
etc.
This seems to occur after this commit.

Idempotence test failed

ERROR: Idempotence test failed because of the following tasks:

  • [instance] => Ubuntu1604-CIS : SCORED | 1.1.1.4 | PATCH | Ensure mounting of hfs filesystems is disabled
  • [instance] => Ubuntu1604-CIS : SCORED | 1.1.1.5 | PATCH | Ensure mounting of hfsplus filesystems is disabled
  • [instance] => Ubuntu1604-CIS : NOTSCORED | 4.3 | PATCH | Ensure logrotate.conf exists

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.