Re: How do I set up personal web sites for users?
"Marten Rizwan" <[EMAIL PROTECTED]> writes: > If your users are in /home and you're not willing to modify your filesystem > layout much, you could simply export your /home as readonly nfs share and > mount it to /var/www/users. > something like that should work in /etc/exports: > /home -alldirs,ro 127.0.0.1 > > $ mount_nfs -o rw 127.0.0.1:/home /var/www/users > now you can ignore the fact that apache is chrooted. Don't expect read > performance to be the same though. I'm maybe going to say something totally wrong but i believe that i've read some times ago (and i didn't remember when) that re-mounting a local fs via nfs locally is problematic and unstable, especially when mounting a subdirectory of the original filesystem. I think i've also read that the reason was, once a file opened and referenced through it's specific inode, the underlyning vfs code could never later know when using it's inode if it was opened via the non-nfs-mounted path or via the nfs-mounted path. I then emitted on that some "theory" on my own to try to understand why it was/could be problematic (which i've never took time to investigate further) What i thinked about is that once you have, for exemple, opendir()'ed the directory "/var/www/users" and do listing on it, how the vfs code layer send you back the correct inode value for the special ".." directory (which could make for exemple getcwd() bugging in a weird way), and how it could correctly handle it if you want to chdir() to it, consider the following operations: - open "/var/www/users" - fchdir to it - open .. - fchdir to it Will you expect the system to bring you to "/var/www" or to "/", the parent directory of "/home/"? What it will do in reality? Can the chrooted process in "/var/www" escape the chroot using "/var/www/users/.." in a special way? I originally google'd a bit on words like "mount nfs local" after having some weird unstabilities on an OpenBSD 3.9 box running the same setup above, (on remote box which didn't respond to ping, maybe crashing...), i then stopped to remount the filesystem locally and stopped chroot'ing it and problems never happened anymore since i no longer used weird combinaisons of local filesystem + remount it via nfs elsewhere + chroot. Think of it if you discover some problems. For the purpose of skipping insulting stuff, i'm writing again my first sentence which was a disclaimer: "I'm maybe going to say something totally wrong [...]". -- folays
Re: Sed or perl subsitutions - in place
Parvinder Bhasin <[EMAIL PROTECTED]> writes: > I am writing up a script to automatically increment the serial number > of bind dns zone file , but I am running across issues doing in place > substitution with either sed or even perl for that matter. I can do > this easily in Linux but am having hard time doing so in openbsd. I > would like to search for the serial number , increment by one and then > save the file. > > Any help...highly appreciated. > > Thx. > > Here is my code snippet: > > [...] Hello, Here is such a script I made: http://hyrule.folays.net/serial.pl <<< #!/usr/bin/perl -w use strict; use File::stat; $^I = ""; @ARGV = (); push @ARGV, glob "*.{net,org,fr,com,in-addr.arpa,local}"; push @ARGV, ("private", "public"); my @file = @ARGV; foreach (@file) { my $name = $_; my $sb = stat($name); my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($sb->mtime); $year += 1900; $mon += 1; my $serial = sprintf("%d%02d%02d%02d", $year, $mon, $mday, 1); @ARGV = (); push @ARGV, $name; if ($sb->ctime == $sb->mtime) { while (<>) { if ($_ =~ m/;.*serial/i) { my $last = $_; $last =~ s/^([[:space:]]+)([[:digit:]]+)([[:space:]]*;.*serial.*)/$2/ix; chomp $last; ($serial = $last + 1) if (substr($last,0,8) eq substr($serial,0,8)); s/$last/$serial/; } print; } close STDIN; utime $sb->atime, $sb->mtime-1, $name; printf ";; SOA of $name\n"; printf "; serial: %s.\n", $serial; } else { printf ";; serial/modification time of $_ differ, skipping...\n"; } } >>> The basic idea is that it consider that if the inode time is the same that the modification time, then it will update the serial and set the modification time 1 second back of the inode time (thus removing the needs to keep a separate file to register when the file was last modified or even always updating serial of untouched files). The serial format is a string representation of the date + 2 serial digits I use it on occasionally manual changes, so the counter will overflow to the next day if you use it more than 100 times on a given file. -- folays
Re: Sendmail smarthost
Chris Cohen <[EMAIL PROTECTED]> writes: > On Saturday 12 January 2008 16:21:29 Vijay Sankar wrote: > > On January 12, 2008 07:51:24 am Chris Cohen wrote: > > > Hi again, > > > > > > just wanted to configure 4.2's sendmail to use my smarthost to send > > > status mails. I went to /usr/share/sendmail, edited cf/openbsd-localhost > > > and cd/submit and created the cf files by typing m4 m4/cf.m4 > > > cf/openbsd-localhost.m4 > localhost.cf according > > > to /usr/share/sendmail/README. > > > > > > Now I have this in my /etc/mail/localhost.cf and submit.cf: > > > # "Smart" relay host (may be null) > > > DSmysmarthost.example.com > > > > > > I also pkill -HUP'ed sendmail but mails just don't pass my smarthost, > > > they are just delivered locally and I can't find anything special in my > > > maillog. > > > > > > Is there anything else I have to do? > > > > Probably a silly question, but did you copy the localhost.cf to /etc/mail? > > > Yes, I did :) > > What I forgot to mention: Mails for localhost and myhostname are delivered > locally, mails for other domains do pass my smarthost. I configured my sendmail some times ago, but i believe that relaying to the smarthost can be achieved by adding this to your /etc/mail/mailertable file: . relay:[hostname.of.your.smarthost.com] Or . relay:[ip] And maybe a make in /etc/mail/ if the file is hashed. This is a tips that i've read in one of the openbsd mailling lists, so i bet that checking the archives up to three month ago could give you some advice. -- folays