This week's book giveaway is in the Java in General forum.
We're giving away four copies of Helidon Revealed: A Practical Guide to Oracle’s Microservices Framework and have Michael Redlich on-line!
See this thread for details.

Tina Jo

Greenhorn
+ Follow
since Feb 24, 2023
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Tina Jo

I'm working on an Ansible playbook to set permissions for initialization files in user home directories to meet STIG requirements. However, I'm running into an issue with the 'Correct file permissions' task, where I get the following error:

fatal: [SERVER_NAME]: FAILED! => { "msg": "The conditional check 'init_files.results | map(attribute='files') | flatten | length > 0' failed. The error was: Could not load \"length\": 'length'\n line 0\n\nThe error appears to be in '/home/path/to/playbook/tasks/playbook name.yml': line 21, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Correct file permissions\n ^ here\n" }  

Here's the snippet of the playbook causing the issue:

- name: Set permissions for initialization files in user home directories

find:  

paths: "/home/{{ item }}"

patterns: ".*"  

file_type: file  

hidden: yes  

register: init_files  

loop: "{{ users.stdout_lines }}"  

- name: Correct file permissions

file:

path: "{{ item.path }}"

mode: '0740'  

loop: "{{ init_files.results | map(attribute='files') | flatten }}"  

when: init_files.results | map(attribute='files') | flatten | length > 0  

The task before 'Correct file permissions' is supposed to find all hidden files within the user's home directory and register the results. I expected to loop over these results to correct file permissions but it seems like the init_files variable is not structured as anticipated. I've attempted to debug with a var output, but the issue persists.

Can someone help me understand why the init_files variable isn't structured with a files attribute as the find module documentation suggests, or point out what I might be doing wrong?

   Here is what I have tried: Checked for invisible characters or issues with line endings using :set list in vi.

   Ensured that the indentation is consistent throughout the playbook.

   Replaced select('length') | list | length with flatten | length in the when conditional.

   Verified the Ansible and Jinja2 documentation for the correct syntax and usage of filters and conditionals.

Stig: Check Text: Verify that all local initialization files have a mode of "0740" or less permissive with the following command:

Note: The example will be for the "smithj" user, who has a home directory of "/home/smithj".

$ sudo ls -al /home/smithj/.[^.]* | more

-rw-------. 1 smithj users 2984 Apr 27 19:02 .bash_history

-rw-r--r--. 1 smithj users 18 Aug 21 2019 .bash_logout

-rw-r--r--. 1 smithj users 193 Aug 21 2019 .bash_profile

If any local initialization files have a mode more permissive than "0740", this is a finding.

Any help or resources for troubleshooting this playbook would be greatly appreciated.
1 year ago
I'm working on an Ansible playbook to set permissions for initialization files in user home directories to meet STIG requirements. However, I'm running into an issue with the 'Correct file permissions' task, where I get the following error:

fatal: [SERVER_NAME]: FAILED! => { "msg": "The conditional check 'init_files.results | map(attribute='files') | flatten | length > 0' failed. The error was: Could not load \"length\": 'length'\n line 0\n\nThe error appears to be in '/home/path/to/playbook/tasks/playbook name.yml': line 21, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n - name: Correct file permissions\n ^ here\n" }

Here's the snippet of the playbook causing the issue:



The task before 'Correct file permissions' is supposed to find all hidden files within the user's home directory and register the results. I expected to loop over these results to correct file permissions but it seems like the init_files variable is not structured as anticipated. I've attempted to debug with a var output, but the issue persists.

Can someone help me understand why the init_files variable isn't structured with a files attribute as the find module documentation suggests, or point out what I might be doing wrong?

  • Here is what I have tried: Checked for invisible characters or issues with line endings using :set list in vi.
  • Ensured that the indentation is consistent throughout the playbook.
  • Replaced select('length') | list | length with flatten | length in the when conditional.
  • Verified the Ansible and Jinja2 documentation for the correct syntax and usage of filters and conditionals.


  • The Stig: Check Text: Verify that all local initialization files have a mode of "0740" or less permissive with the following command:

    Note: The example will be for the "smithj" user, who has a home directory of "/home/smithj".



    If any local initialization files have a mode more permissive than "0740", this is a finding.

    Any help or resources for troubleshooting this playbook would be greatly appreciated.

    ansible, yaml, ansible-playbook, stig-compliance
    1 year ago
    .I was not getting alerts from check_mk when my servers needed attention. I then tried the mail command from the server designed to be the checkmk server. The mail command did not return any error and I used mailq command and saw that no messages were in q. However, When I checked my work email (which uses Microsoft Outlook) there was No email there. One of my colleagues suggested that the issue is how the sender appears and that it is seen as spam before it gets to my inbox. It used to appear like this <root@fullyqualifieddomainnameofserver> (ONE email of the 25 I sent came through) so I created this script #!/bin/bash
    # Input parametersFROM="$1"SUBJECT="$2"
    # Send email/usr/sbin/sendmail.sendmail -f "$FROM" "$TO" <<EOFFrom: $FROMSubject: $SUBJECTTo: "workemail"BODY:"test content"SMTPPORT:25EOF
    I have been changing the From variable; however, I am still NOT Receiving any emails. Does anyone know why?
    1 year ago
    I'm in the process of configuring alerts for Checkmk, specifically regarding email notifications. How can I ensure that the setup for sending emails from my Checkmk server is correctly established? I've read that for supported Linux distributions, it involves installing an SMTP server service. Could you provide guidance on how to verify or set up this SMTP server service for email notifications?
    1 year ago
    Hello I am trying to send a alert from checkmk to my servers. How do I
    1. ensure my checkmk is able to send email alerts and
    2. send a fake alert that will be sent to the email I have specified on checkmk.
    1 year ago
    I have made the following changes to /network-scripts/ifcfg-enp0s3 file in order to try and get a static IP address (added ip i want ending in .49, added gateway, Prefix and Subnet mask (

    1: https://i.stack.imgur.com/Qamcp.png image of file included)

    But i get this error message when I attempt to restart network (image of error included) enter image description here


    When I check Jornalctl -xe I get this (image included)


    Possible solution i found: “If you are using NetworkManager there will be more items that you would need to configure like: GATEWAY, DOMAIN, DNS1, DNS2, etc. If you are not using NetworkManager, you will need to configure the gateway address in the /etc/sysconfig/network file, and the DNS resolvers (if required) in the /etc/resolv.conf file I added DNS="8/8/8/8".” But I do not know how to configure DNS, Domain etc.
    1 year ago
    So yes my system uses nmtuli. I am not sure what you mean by a hammer?
    1 year ago
    Can I ask how do I know if I am using network manager and I am using centos 7.
    1 year ago
    I have made the following edits to /etc/sysconfig/network-scripts/ifcfg-eth3 file and Now ping command is not working and I cannot login with ssh. My goal was to assign a static IP address that will not change what am I doing wrong? BOOTPROTO I changed from DHCP to static and I put IPADDR=192.168.0.49 at the bottom. What did i do wrong what is missing?
    1 year ago