lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20170722003310.GG4211@magnolia>
Date:   Fri, 21 Jul 2017 17:33:10 -0700
From:   "Darrick J. Wong" <darrick.wong@...cle.com>
To:     "Theodore Ts'o" <tytso@....edu>
Cc:     linux-ext4 <linux-ext4@...r.kernel.org>
Subject: [RFC 3/3] systemd integration scripts

Here's the systemd stuff.  I haven't bothered to supply a cronjob,
since it's trivial to create a cron.weekly entry that runs
/sbin/online-fsck-all.

--D

/lib/systemd/system/online-fsck-all.service:

[Unit]
Description=Scrub Filesystem Metadata
ConditionACPower=true
 
[Service]
Type=oneshot
Environment=SERVICE_MODE=1
ExecStart=/sbin/online-fsck-all

/lib/systemd/system/online-fsck-all.timer:

[Unit]
Description=Scrub Filesystem Metadata Periodically

[Timer]
# Run on Sunday at 3:30am, to avoid running afoul of DST changes
OnCalendar=Sun *-*-* 03:30:00
RandomizedDelaySec=60
Persistent=true

[Install]
WantedBy=timers.target

/lib/systemd/system/online-fsck-fail@...rvice:

[Unit]
Description=Scrub Filesystem Metadata Failure Reporting for %I

[Service]
Type=oneshot
Environment=EMAIL_ADDR=root@...alhost
ExecStart=/usr/lib/online-fsck/online-scrub-fail "${EMAIL_ADDR}" %I
User=mail
Group=mail
SupplementaryGroups=systemd-journal

/lib/systemd/system/online-fsck@...rvice:

[Unit]
Description=Scrub Filesystem Metadata for %I
OnFailure=online-fsck-fail@...service

[Service]
Type=oneshot
WorkingDirectory=/
PrivateNetwork=true
ProtectSystem=true
ProtectHome=read-only
PrivateTmp=yes
AmbientCapabilities=CAP_SYS_ADMIN CAP_SYS_RAWIO
NoNewPrivileges=yes
User=root
IOSchedulingClass=idle
CPUSchedulingPolicy=idle
Environment=SERVICE_MODE=1
ExecStart=/sbin/online-fsck -t %I

/usr/lib/online-fsck/online-scrub-fail:

#!/bin/bash

# Email logs of failed online-fsck unit runs

mailer=/usr/sbin/sendmail
recipient="$1"
test -z "${recipient}" && exit 0
dev="$2"
test -z "${dev}" && exit 0
hostname="$(hostname -f 2>/dev/null)"
test -z "${hostname}" && hostname="${HOSTNAME}"
if [ ! -x "${mailer}" ]; then
	echo "${mailer}: Mailer program not found."
	exit 1
fi

(cat << ENDL
To: $1
From: <online-fsck@...ostname}>
Subject: online-fsck failure on ${dev}

So sorry, the automatic online-fsck of ${dev} on ${hostname} failed.

A log of what happened follows:
ENDL
systemctl status --full --lines 4294967295 "online-fsck@...ev}") | "${mailer}" -t -i

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ