<commit_before>---

- name: Logcheck additional configuration - ntpd ignore
  copy:
    src=ntpd dest=/etc/logcheck/ignore.d.server/ntpd mode=644

- name: Logcheck additional configuration - ignore rules
  copy:
    src=logcheck-local-ignores dest=/etc/logcheck/ignore.d.server/local-rules mode=644

- name: Logcheck replace rules
  template: src=logcheck.replace.j2 dest=/etc/logcheck/logcheck.replace mode=0644 validate='sed -f %s /var/log/syslog'

- name: Review Logcheck configuration
  replace:
## Error: Config file /tmp/tmp32Yy_d unreadable or does not exists
#    dest='/etc/logcheck/logcheck.conf' regexp="{{ item.regexp }}" replace="{{ item.replace }}" validate='sudo -u logcheck logcheck -t -d -o -c %s'
    dest='/etc/logcheck/logcheck.conf' regexp="{{ item.regexp }}" replace="{{ item.replace }}"
  with_items:
    - { regexp: '^#SORTUNIQ=0', replace: 'SORTUNIQ=1' }
    - { regexp: '^#SYSLOGSUMMARY=0', replace: 'SYSLOGSUMMARY=1' }

- name: Add log files for logcheck to check
  lineinfile: dest=/etc/logcheck/logcheck.logfiles line={{ item }} backup=yes
  with_items: "{{ harden_logcheck_extra_logfiles }}"


- name: check if logcheck patched
  stat: path=/usr/sbin/.logcheck-ansible-harden-patch
  register: lpatch<commit_msg>travis/docker/debian9: workaround for inexistent /var/log/syslog<commit_after>---

- name: Logcheck additional configuration - ntpd ignore
  copy:
    src=ntpd dest=/etc/logcheck/ignore.d.server/ntpd mode=644

- name: Logcheck additional configuration - ignore rules
  copy:
    src=logcheck-local-ignores dest=/etc/logcheck/ignore.d.server/local-rules mode=644

- name: Debian-docker | ensure /var/log/syslog file exists for following validate
  file:
    dest: /var/log/syslog
    state: touch
  when: (ansible_virtualization_type is defined and ansible_virtualization_type == "docker") and ansible_distribution == "Debian" and ansible_distribution_major_version|int >= 9

- name: Logcheck replace rules
  template: src=logcheck.replace.j2 dest=/etc/logcheck/logcheck.replace mode=0644 validate='sed -f %s /var/log/syslog'

- name: Review Logcheck configuration
  replace:
## Error: Config file /tmp/tmp32Yy_d unreadable or does not exists
#    dest='/etc/logcheck/logcheck.conf' regexp="{{ item.regexp }}" replace="{{ item.replace }}" validate='sudo -u logcheck logcheck -t -d -o -c %s'
    dest='/etc/logcheck/logcheck.conf' regexp="{{ item.regexp }}" replace="{{ item.replace }}"
  with_items:
    - { regexp: '^#SORTUNIQ=0', replace: 'SORTUNIQ=1' }
    - { regexp: '^#SYSLOGSUMMARY=0', replace: 'SYSLOGSUMMARY=1' }

- name: Add log files for logcheck to check
  lineinfile: dest=/etc/logcheck/logcheck.logfiles line={{ item }} backup=yes
  with_items: "{{ harden_logcheck_extra_logfiles }}"


- name: check if logcheck patched
  stat: path=/usr/sbin/.logcheck-ansible-harden-patch
  register: lpatch
{'fraction_non_alphanumeric': 0.13874253600280997, 'fraction_numerical': 0.012644889357218124, 'mean_word_length': 4.303538175046555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '208970', 'n_tokens_mistral': 1011, 'n_tokens_neox': 964, 'n_words': 228}