Commit Graph

76 Commits

Author SHA1 Message Date
Conrad Meyer
fd1efedc79 Add extremely useful calendar(1) application to FreeBSD
It does extremely useful things like execute sendmail and spew dubiously
accurate factoids.

From the feedback, it seems like it is an essential utility in a modern unix
and not at all a useless bikeshed.  How do those Linux people live without it?
Reverts r358561.
2020-03-03 00:20:08 +00:00
Conrad Meyer
3c565de33f Fix typo in r278616
FreeBSD isn't an encyclopedia.
2020-03-02 23:37:47 +00:00
Kyle Evans
e9104c3142 backup-passwd: mask out all passwords in the diff
The previous expression borked if a username had a plus or hyphen in it.
This is needlessly restrictive- at leSt a hyphen in the middle is valid.
Instead of playing this game, let's just assume the username can't contain a
colon and mask out the second field.

Submitted by:	sigsys gmail com
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D23548
2020-02-11 06:12:02 +00:00
Kristof Provost
d8ffc21c5c Fix pfdenied not returning any results
When _a is empty we end up with an invalid invocation of pfctl, and no output.
We must add quotes to make it clear to pfctl that we're passing an empty anchor
name.

PR:		224415
Submitted by:	sigsys AT gmail.com
MFC after:	2 weeks
2020-01-16 22:08:05 +00:00
Alan Somers
9809df467b periodic: replace "tty" with "test -t 0"
Apparently using tty for this purpose has been deprecated since 4.4 Lite.

Reviewed by:	cy
MFC after:	1 month
Differential Revision:	https://reviews.freebsd.org/D21318
2019-08-19 01:14:11 +00:00
Alan Somers
a9ff79e3bb periodic: fix anticongestion for scripts run after security
Revision 316342, which introduced the anticongestion feature, failed to
consider that the periodic scripts are executed by a recursive invocation of
periodic.  The recursive invocation wrongly cleaned up a temporary file that
should've been cleaned up only by the original invocation.  The result is
that if the first script that requests an anticongestion sleep runs after
the security scripts, the sleep won't happen.

Fix this bug by delaying cleanup until the end of the original invocation.

PR:		236564
Submitted by:	Yasuhiro KIMURA <yasu@utahime.org>
Reviewed by:	imp
MFC after:	1 month
2019-08-18 17:12:06 +00:00
Ian Lepore
545151d107 Eliminate spurious periodic.daily error message for rotating accounting log.
In 2011, r218961 removed local code for rotating logs in favor of using the
rotate_log command in etc/rc.d/accounting.  If the accounting service is
activated then subsequently de-activated in rc.conf but still remains active
in periodic.conf, then you get an error message every day in the periodic
jobs about being unable to rotate the logs.

With this change to use "onerotate_log", the log rotation will happen the
first time periodic daily runs after accounting was disabled but periodic
accounting was left enabled.  After that happens once, the /var/account/acct
will no longer exist, which results in a different path through the periodic
code and no more error messages will appear (unless daily_show_badconfig is
set, in which case the admin will be told that periodic security processing
is enabled but the accounting file is not present).

This is only a partial fix for the problems reported in PR 202203.

PR:		202203
2019-07-07 17:15:45 +00:00
Eugene Grosbein
3398cc6839 periodic/weekly/340.noid: do not use sysrc(8) that depends
on bsdinstall(8) and may be non-functional
for system built WITHOUT_BSDINSTALL. (*)

Also, add a check for jails sharing whole tree with host (path=/)
and do not skip it.

Reported by:	Andre.Albsmeier@siemens.com (*)
MFC after:	1 week
2018-12-15 23:20:08 +00:00
Eric van Gyzen
cf44d7bd57 Fix daily mailq script for Postfix and daily_show_success="NO"
Exit with a zero status when Postfix reports "Mail queue is empty" so this
section won't appear in the report at all when daily_show_success="NO".

MFC after:	2 weeks
Sponsored by:	Dell EMC Isilon
2018-11-11 00:39:20 +00:00
Eugene Grosbein
bcfc8c2779 weekly/340.noid: suppress warning on non-existent jail.conf
MFC after:	1 month
2018-11-10 17:49:19 +00:00
Eugene Grosbein
f984e1f8e3 Sigh... Fix another breakage after r340322: spell "sysrc" correctly.
MFC after:	1 month
2018-11-10 14:35:12 +00:00
Eugene Grosbein
2f45576d88 Fix breakage after r340322: add missing "-n" to invocation of sysrc.
MFH:		1 month
2018-11-10 14:25:37 +00:00
Eugene Grosbein
ab478b0185 Prevent periodic/etc/weekly/340.noid from descending into root directories
of jails. Jails have their own user/group databases and this script
can produce multiple false warnings, not to mention significant extra
load in case of large jailed subtrees. Leave this check for jailed
invocations of the same script.

MFC after:	1 month
2018-11-10 14:21:26 +00:00
Brad Davis
412e58bf47 Move defaults/periodic.conf back to a config file.
Ths prevents etcupdate and mergemaster from deleting it for now.

Approved by:	re (rgrimes), will (mentor)
Differential Revision:	https://reviews.freebsd.org/D16975
2018-09-02 15:53:56 +00:00
Brad Davis
81ea85a884 Move all periodic related config and scripts to usr.sbin/periodic/
This makes pkgbase easier by tagging these as CONFS so they are properly
tagged as config files.

Approved by:	will (mentor)
Sponsored by:	Essen Hackathon
Differential Revision:	https://reviews.freebsd.org/D16553
2018-08-11 17:11:08 +00:00
Alan Somers
8394104312 periodic: fix exit status for nonexistent arguments
When called with an absolute pathname, periodic should attempt to execute
every script in that directory. If the directory does not exist, it should
print an error and exit 1. Due to a copy/paste mistake in r231568, it exits
0 in that case.

Reported by:	devel/hs-ShellCheck
MFC after:	3 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D13070
2017-11-20 23:51:51 +00:00
Enji Cooper
84c8bb4fbc periodic(8): delete trailing whitespace
MFC after:	1 month
2017-06-20 06:20:09 +00:00
Alan Somers
86571b9c01 Consolidate random sleeps in periodic scripts
Multiple periodic scripts sleep for a random amount of time in order to
mitigate the thundering herd problem. This is bad, because the sum of
multiple uniformly distributed random variables approaches a normal
distribution, so the problem isn't mitigated as effectively as it would be
with a single sleep.

This change creates a single configurable anticongestion sleep. periodic
will only sleep if at least one script requires it, and it will never sleep
more than once per invocation. It also won't sleep if periodic was run
interactively, fixing an unrelated longstanding bug.

PR:		217055
PR:		210188
Reviewed by:	cy
MFC after:	3 weeks
Differential Revision:	https://reviews.freebsd.org/D10211
2017-04-01 04:42:35 +00:00
Alan Somers
c5b5b50ded Better document security_show_{success,info,badconfig} in /etc/periodic.conf
periodic(8) already handles the security_show_{success,info,badconfig}
variables correctly. However, those variables aren't explicitly set in
/etc/defaults/periodic.conf or anywhere else, which suggests to the user
that they shouldn't be used.

etc/defaults/periodic.conf
	Explicitly set defaults for security_show_{success,info,badconfig}

usr.sbin/periodic/periodic.sh
	Update usage string

usr.sbin/periodic/periodic.8
	Minor man page updates

One thing I'm _not_ doing is recommending setting security_output to
/var/log/security.log or adding that file to /etc/newsyslog.conf, because
periodic(8) would create it with default permissions, usually 644, and
that's probably a bad idea.

Reviewed by:	brd
MFC after:	4 weeks
Sponsored by:	Spectra Logic Corp
Differential Revision:	https://reviews.freebsd.org/D6477
2016-05-21 02:14:11 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Baptiste Daroussin
01c2b8ac0d use .Mt to mark up email addresses consistently (part2)
PR:		191174
Submitted by:	Franco Fichtner  <franco@lastsummer.de>
2014-06-20 09:57:27 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Jeremie Le Hen
94582faa19 Include the calling context in the mail subject, if any.
More concretely, periodic security scripts defaults to being
called from daily ones -- daily context -- so the mail subject
will now be "${HOST} daily security run output" instead of
"{HOST} security run output".

If you switch the period of some security checks to weekly, you
will receive another email "${HOST} weekly security run output".
2013-09-03 13:40:24 +00:00
Jeremie Le Hen
195cf868e2 Export a PERIODIC environment variable from periodic(8). This will
allow periodic security scripts to know if they have been called in
a daily or a weekly context.
2013-08-25 08:56:09 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
Brooks Davis
df01f319c7 Prevent periodic scripts that run longer than the expected period from
starting up before the previous script finishes.  This prevents an
infinite number of them from piling up and slowing a system down.

Since all the refactoring to make this happen required churning the
indenting of most of this file, make the indentation more consistent.

Reviewed by:	simon
MFC after:	1 week
2012-02-12 23:18:05 +00:00
Ulrich Spörlein
aa12cea2cc mdoc: order prologue macros consistently by Dd/Dt/Os
Although groff_mdoc(7) gives another impression, this is the ordering
most widely used and also required by mdocml/mandoc.

Reviewed by:	ru
Approved by:	philip, ed (mentors)
2010-04-14 19:08:06 +00:00
Gabor Kovesdan
7c34436e66 - The weekly periodic runs occur on Saturday mornings, not on Sunday mornings
PR:		docs/113975
Submitted by:	Marian Cerny <jojo@matfyz.cz>
Reviewed by:	keramida
Approved by:	re (bmah)
2007-09-07 21:54:45 +00:00
Xin LI
9a0e6be26a Stop mentioning /usr/X11R6.
Approved by:	re (hrs)
2007-07-24 06:41:07 +00:00
David Malone
68c35072f9 Add an option to make periodic(8) quiet when no output was generated.
The man page part of the patch is my fault, the changes to the
periodic script is Dominik's.

PR:		88486
Submitted by:	Dominik Brettnacher <domi@saargate.de>
Reviewed by:	brian
Approved by:	re
MFC after:	1 month
2007-06-22 10:04:05 +00:00
Ruslan Ermilov
59a3c79da6 Sort sections. 2005-01-18 20:02:45 +00:00
Ruslan Ermilov
a866e17077 Added the EXIT STATUS section where appropriate. 2005-01-17 07:44:44 +00:00
Philippe Charnier
490d5836b5 The .Nm utility 2002-07-14 14:47:15 +00:00
Brian Somers
cb36028eff Mention the ``end of output'' for each periodic script.
Submitted by:	David Wolfskill <david@catwhisker.org>
PR:		37036
MFC after:	1 week
2002-05-14 01:15:35 +00:00
Ruslan Ermilov
c9d99fb534 mdoc(7) police: fix markup in revision 1.25. 2001-12-08 16:15:44 +00:00
Crist J. Clark
2204f3ce42 Long ago, there was just /etc/daily. Then /etc/security was split out
of /etc/daily. Some time later, /etc/daily became a set of periodic(8)
scripts. Now, this evolution continues, and /etc/security has been
broken into periodic(8) scripts to make local customization easier and
more maintainable.

Reviewed by:	ru
Approved by:	ru
2001-12-07 23:57:39 +00:00
Crist J. Clark
a4771d5fb3 Add a BUGS section noting that the basename of a directory containing
periodic(8) scripts must be useable as a sh(1) variable.

MFC after:	2 days
2001-11-28 21:43:53 +00:00
Ruslan Ermilov
5849041b6f mdoc(7) police: Fix markup. 2001-11-20 12:38:18 +00:00
Ruslan Ermilov
6575e6daae mdoc(7) police: expand plain text xrefs. 2001-08-08 11:48:28 +00:00
Dima Dorfman
f247324df7 Remove whitespace at EOL. 2001-07-15 08:06:20 +00:00
Ruslan Ermilov
a4c37c816b mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 15:12:08 +00:00
Ruslan Ermilov
eb0838029f mdoc(7) police: normalize .Nd. 2001-04-18 15:54:10 +00:00
Dima Dorfman
5e75e35cca Grammar police: "its", not "it's", is the possessive form of "it". 2001-04-15 19:53:47 +00:00
Ruslan Ermilov
b9ad8c8635 beforeinstall -> SCRIPTS. 2001-04-07 11:21:35 +00:00
Ruslan Ermilov
345e52e742 - Backout botched attempt to introduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:42:20 +00:00
Ruslan Ermilov
9884911506 mdoc(7) police: fixed broken references. 2001-01-16 11:52:00 +00:00
Ruslan Ermilov
ed40311694 mdoc(7) police: removed history info from the .Os FreeBSD call. 2000-12-14 11:52:05 +00:00