|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T d
Length: 2378 (0x94a) Types: TextFile Names: »dev.chk«
└─⟦4f9d7c866⟧ Bits:30007245 EUUGD6: Sikkerheds distributionen └─⟦3da311d67⟧ »./cops/1.04/cops_104.tar.Z« └─⟦6a2577110⟧ └─⟦4f9d7c866⟧ Bits:30007245 EUUGD6: Sikkerheds distributionen └─⟦6a2577110⟧ »./cops/1.04/cops_104.tar« └─⟦this⟧ »cops_104/perl/dev.chk«
#!/bin/sh -- need to mention perl here to avoid recursion 'true' || eval 'exec perl -S $0 $argv:q'; eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' & eval 'exec /usr/bin/perl -S $0 $argv:q' if 0; # # dev.chk [-g] # # This shell script checks the permissions of all devs listed in the # file /etc/fstab (the "mount" command would be a preferable way of # getting the file system name, but the syntax of the output is variable # from machine to machine), and flags them if they are readable by using # the "is_readable" command. It also checks for unrestricted NFS # mountings. By default, dev_check will flag devs only if world readable # or writable. The -g option tells it to print out devs that are also # group readable/writable. # As an aside, the fact that NFS mounted dirs are world readable isn't # a big deal, but they shouldn't be world writable. So do two checks here, # instead of one. # # Two types of /etc/fstab formats I've seen so far: # # "old" -- # spec:file:type:freq:passno:name:options # NFS are indicated by an "@" # # "new" -- # fsname dir type opts freq passno # NFS are indicated by an ":" # # tchrist@convex.com # require 'is_able.pl'; $MTAB = '/etc/fstab' unless defined $MTAB; $EXPORTS = '/etc/exports' unless defined $EXPORTS; $TAB_STYLE = 'new' unless defined $TAB_STYLE; # or 'old' &usage if @ARGV > 1; sub usage { die "Usage: $0 [-g]\n"; } if (@ARGV == 1) { if ($ARGV[0] eq '-g') { $group++; } else { &usage; } } open MTAB || die "can't open $MTAB: $!\n"; while (<MTAB>) { next if /^#/; chop; if ($TAB_STYLE eq 'new') { ($dev, $fs) = split; next unless $fs; if ($dev =~ /:/) { push(@nfs_devs, $fs); } else { push(@local_devs, $dev); } } else { ($dev, $fs) = split(/:/); next unless $fs; if ($dev =~ /@/) { push(@nfs_devs, $fs); } else { push(@local_devs, $dev); } } } if (open EXPORTS) { while (<EXPORTS>) { next if /^\s*#/; next if /\S\s+\S/; next if /^\s*$/; chop; print "Warning! NFS file system $_ exported with no restrictions.\n"; } } # WARNING: we may hang if server down.... # for (@nfs_devs, @local_devs) { &is_able($_, 'w', 'w'); next unless $group; &is_able($_, 'g', 'w'); } for (@local_devs) { &is_able($_, 'w', 'r'); next unless $group; &is_able($_, 'g', 'r'); } 1;