Changeset 1137

Show
Ignore:
Timestamp:
01/24/08 02:08:33 (10 months ago)
Author:
hachi
Message:

Add --chmod-mountpoints option to mogautomount, which drops read/write access on the underlying filesystem directory where a mogile filesystem before it's mounted.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/server/CHANGES

    r1131 r1137  
    1         * New optional argument 'startpos' to fsck_reset. 
     1        * Add --chmod-mountpoints option to mogautomount, in an attempt to  
     2          prevent mogstored machines from accidentally writing to their under- 
     3          lying filesystem. 
     4         
     5        * New optional argument 'startpos' to fsck_reset. 
    26 
    37        * Use correct per-Store port, defaulting to UNIX sockets on localhost. 
  • trunk/server/mogautomount

    r1009 r1137  
    77$0 = $_ = $0; 
    88 
    9 my ($help, $verbose); 
     9my ($help, $verbose, $chmod_mountpoints); 
    1010usage(0) unless GetOptions( 
    1111                           'help' => \$help, 
    1212                           'verbose' => \$verbose, 
     13                           'chmod-mountpoints' => \$chmod_mountpoints, 
    1314                           ); 
    1415usage(0) if @ARGV; 
     
    4950    unless (-d $mnt) { mkdir $mnt or die "Failed to mkdir $mnt: $!"; } 
    5051    next if $mounted{$dev}; 
     52 
     53    if ($chmod_mountpoints and ((stat($mnt))[2] & 0777) != 0) { 
     54        warn "Mountpoint on parent filesystem is writable, fixing.\n" if $verbose; 
     55        chmod 0, $mnt 
     56            or die "Unable to set mogile device mountpoint '$mnt' mode to 0 (no access)"; 
     57    } 
    5158 
    5259    if (system("mount", '-o', 'noatime', $dev, $mnt)) { 
     
    94101be verbose 
    95102 
     103=item --chmod-mountpoints 
     104 
     105If a mogile device isn't mounted yet, check to make sure the underlying filesystem has the directory set 
     106to be not readable or writable at all (chmod 0). This could help prevent mogstored from accidentally writing 
     107to the underlying filesystem. 
     108 
    96109=back 
    97110