Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional Ansible Scripts #2134

Merged
merged 51 commits into from Jul 24, 2017
Merged

Additional Ansible Scripts #2134

merged 51 commits into from Jul 24, 2017

Conversation

shawndwells
Copy link
Member

@shawndwells shawndwells commented Jul 6, 2017

Beginning:
*** rules of 'ospp-rhel7' profile missing a ansible fix script: 193 of 357 [45% complete]

After:
*** rules of 'ospp-rhel7' profile missing a ansible fix script: 171 of 357 [52% complete]

@mpreisler
Copy link
Member

@shawndwells I am 99% sure it's because that fix is getting pulled into RHEL5 and RHEL5 doesn't have the Value that that script is using.

dest: /etc/audit/auditd.conf
regexp: '.*flush.*'
line: flush = data
notify: reload auditd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will this work as is or do we need ansible handlers defined for this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mpreisler: shoot, you're right. I can take the notify out for now... how would we create handles?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's comment it or something so that we can grep for it when we implement handlers

@shawndwells
Copy link
Member Author

@mpreisler - Done! Thanks.

@mpreisler
Copy link
Member

mpreisler commented Jul 13, 2017

@shawndwells

$ sudo ansible-playbook --check ./ssg-rhel7-role-ospp-rhel7.yml 
 [WARNING]: provided hosts list is empty, only localhost is available

ERROR! Syntax Error while loading YAML.


The error appears to have been in '/home/mpreisle/d/scap-security-guide/build/roles/ssg-rhel7-role-ospp-rhel7.yml': line 2801, column 9, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

      #notify:
        - reload ssh
        ^ here
    - name: "Allow Only SSH Protocol 2"
      lineinfile:
        dest: /etc/ssh/sshd_config
        regexp: "^Protocol [0-9]"
        line: "Protocol 2"
        validate: sshd -t -f %s
2801->      #notify:
        - reload ssh

@@ -9,7 +9,8 @@
dest: /etc/ssh/sshd_config
regexp: "^Protocol [0-9]"
line: "Protocol 2"
notify:
validate: sshd -t -f %s
#notify:
- reload ssh
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be commented as well

@shawndwells
Copy link
Member Author

shawndwells commented Jul 14, 2017 via email

@mpreisler
Copy link
Member

Thx, the conflict is very minor, I will merge this manually.

@mpreisler
Copy link
Member

Can't merge this, still get issues:

ERROR! Syntax Error while loading YAML.


The error appears to have been in '/home/mpreisle/d/scap-security-guide/build/roles/ssg-rhel7-role-ospp-rhel7.yml': line 3118, column 17, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

        line="ClientAliveInterval 600"
        validate: sshd -t -f %s
                ^ here

There are a bunch of syntax errors. Is key=value allowed in your version of ansible, @shawndwells ? It isn't on the ansible shipping on Fedora. Probably also disallowed on RHEL.

@mpreisler
Copy link
Member

@shawndwells very briefly looked into this and the issue is that you are mixing 2 syntaxes together. They are both allowed but you can't mix them in one item.

@shawndwells
Copy link
Member Author

I'm getting an error on the playbooks:

 [WARNING]: provided hosts list is empty, only localhost is available

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

The error appears to have been in '/tmp/playbook.yml': line 1, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


- name: Read permission of GPG key directory
  ^ here

Which is from ensure_redhat_gpgkey_installed.yml:6:

# platform=multi_platform_rhel
# reboot = false
# strategy = restrict
# complexity = medium
# disruption = medium
- name: Read permission of GPG key directory
  stat:
    path: /etc/pki/rpm-gpg/
  register: gpg_key_directory_permission
  check_mode: no
  tags:
    @ANSIBLE_TAGS@

However there is another use of stat that follows the same format and appears fine in require_smb_client_signing.yml:7:

- name: Check if /etc/samba/smb.conf exists
  stat:
    path: /etc/samba/smb.conf
  register: st_smb
  tags:
    @ANSIBLE_TAGS@

I'm staring at these. Attempted to remove check_mode: no, and still get errors. Anyone have an idea on what I'm missing?

@mpreisler
Copy link
Member

@shawndwells did you uncomment the "hosts" line in the .yml? That really isn't intuitive but is required to make the playbook valid.

@mpreisler
Copy link
Member

@shawndwells I don't get syntax errors here.

$ ansible-playbook --version
ansible-playbook 2.3.1.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Jun 26 2017, 10:20:05) [GCC 7.1.1 20170622 (Red Hat 7.1.1-3)]

I would merge this if you didn't mention you get the stat error :-)

@mpreisler mpreisler self-assigned this Jul 24, 2017
@mpreisler
Copy link
Member

Merging this, we can improve it further with other PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants