| 1 |
--- a/scripts/inncheck.in |
| 2 |
+++ b/scripts/inncheck.in |
| 3 |
@@ -1093,6 +1093,24 @@ sub checkperm { |
| 4 |
die "Internal error, undefined mode in perm from ", (caller(0))[2], "\n" |
| 5 |
unless (@$m); |
| 6 |
|
| 7 |
+ # system files are usually owned by root |
| 8 |
+ if ($f !~ m#^/(?:run|var)/# and |
| 9 |
+ $u eq $INN::Config::runasuser and $g eq $INN::Config::runasgroup) { |
| 10 |
+ $u = 'root'; |
| 11 |
+ $g = 'root'; |
| 12 |
+ } |
| 13 |
+ |
| 14 |
+ # binaries should be 755 (or x744 if suid or sgid) |
| 15 |
+ if ($m->[1] & 0100 and not -d $f) { |
| 16 |
+ $m->[1] |= $m->[1] & 06000 ? 0744 : 0755; |
| 17 |
+ } |
| 18 |
+ if ($f =~ m#^/etc/#) { |
| 19 |
+ # config files must not be group writeable |
| 20 |
+ $m->[1] &= ~0020; |
| 21 |
+ # if they are not world readable then they must be owned by group news |
| 22 |
+ $g = $INN::Config::runasgroup if not $m->[1] & 004; |
| 23 |
+ } |
| 24 |
+ |
| 25 |
if (!-e $f) { |
| 26 |
eprint "$pfx$f:0: missing\n"; |
| 27 |
} else { |
| 28 |
@@ -1170,7 +1188,7 @@ my @newsbin_public = qw( |
| 29 |
grephistory innconfval inndf innmail innreport innxbatch innxmit mailpost |
| 30 |
news2mail ninpaths nntpget nntpsend perl-nocem pgpverify pullnews |
| 31 |
scanspool send-ihave sendinpaths send-uucp sendxbatches shlock shrinkfile |
| 32 |
- simpleftp sm tinyleaf |
| 33 |
+ sm tinyleaf |
| 34 |
); |
| 35 |
my @newsbin_private = qw( |
| 36 |
buffindexed_d cnfsheadconf ctlinnd expire expireover expirerm gencancel |
| 37 |
@@ -1202,7 +1220,9 @@ sub check_all_perms { |
| 38 |
$INN::Config::runasgroup, |
| 39 |
); |
| 40 |
foreach (keys %prog_modes) { |
| 41 |
- checkperm($paths{$_}, $prog_modes{$_}); |
| 42 |
+ my @owner; |
| 43 |
+ @owner = ($INN::Config::runasuser, 'uucp') if $_ eq 'rnews'; |
| 44 |
+ checkperm($paths{$_}, $prog_modes{$_}, @owner); |
| 45 |
} |
| 46 |
foreach (keys %paths) { |
| 47 |
checkperm($paths{$_}, $modes{$_}) |