-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
[Unit] | ||
Description=Squid log rotation service | ||
After=network-online.target | ||
|
||
[Service] | ||
Type=oneshot | ||
ExecStart=/usr/sbin/squid -k rotate | ||
|
||
# Hardening | ||
CapabilityBoundingSet=CAP_SETUID CAP_SETGID CAP_DAC_READ_SEARCH CAP_DAC_OVERRIDE | ||
LockPersonality=true | ||
MemoryDenyWriteExecute=true | ||
PrivateDevices=true | ||
PrivateNetwork=true | ||
PrivateTmp=true | ||
ProcSubset=pid | ||
ProtectClock=true | ||
ProtectControlGroups=true | ||
ProtectHome=true | ||
ProtectHostname=true | ||
ProtectKernelLogs=true | ||
ProtectKernelModules=true | ||
ProtectKernelTunables=true | ||
ProtectProc=invisible | ||
ProtectSystem=full | ||
RestrictAddressFamilies= | ||
RestrictNamespaces=true | ||
RestrictRealtime=true | ||
RestrictSUIDSGID=true | ||
SystemCallArchitectures=native | ||
SystemCallErrorNumber=EPERM | ||
SystemCallFilter=@system-service | ||
SystemCallFilter=~@resources | ||
UMask=0077 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[Unit] | ||
Description=Squid log rotation timer | ||
|
||
[Timer] | ||
OnBootSec=1min | ||
OnUnitInactiveSec=4h | ||
RandomizedDelaySec=5m | ||
AccuracySec=1m | ||
|
||
[Install] | ||
WantedBy=timers.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
|
||
- name: Ensure Systemd Netdata service is restarted | ||
ansible.builtin.systemd: | ||
name: netdata | ||
state: restarted | ||
changed_when: false | ||
listen: netdata_restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
--- | ||
- name: Retrieve Netdata public unique ID | ||
ansible.builtin.slurp: | ||
src: /var/lib/netdata/registry/netdata.public.unique.id | ||
register: _netdata_public_id | ||
|
||
- name: Ensure Netdata configuration directory is present | ||
ansible.builtin.file: | ||
path: /etc/netdata/go.d | ||
state: directory | ||
mode: '0755' | ||
|
||
- name: Ensure Netdata collectors are configured | ||
ansible.builtin.template: | ||
src: "netdata_{{ item }}.conf.j2" | ||
dest: "/etc/netdata/go.d/{{ item }}.conf" | ||
mode: '0644' | ||
notify: netdata_restarted | ||
with_items: | ||
- squid | ||
- squidlog | ||
|
||
- name: Ensure Squid log rotation service units are present | ||
ansible.builtin.copy: | ||
src: "{{ item }}" | ||
dest: "/etc/systemd/system/{{ item }}" | ||
with_items: | ||
- squid_logrotate.service | ||
- squid_logrotate.timer | ||
|
||
- name: Ensure Squid log rotation service is started and enabled at boot | ||
ansible.builtin.systemd: | ||
name: squid_logrotate.timer | ||
state: started | ||
enabled: true | ||
daemon_reload: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
jobs: | ||
- name: local | ||
url: http://[::1]:{{ squid_http_port }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
jobs: | ||
- name: local | ||
path: /var/run/squid/{{ _netdata_public_id.content | b64decode }}_access.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters