Re: /usr/ports/net-im/ejabberd

2010-11-17 Thread Mark Shroyer
On 11/15/2010 9:26 AM, t...@diogunix.com wrote:
 surprisingly, the port for /usr/ports/net-im/ejabberd too tries to build a 
 bunch of software usually not associated with ejabberd (such as a lot of 
 Java, X11, OpenMotif, GTK and don't know what else).
 
 After hours, the build of ejabberd then failed with:
 
 [snip]
 
 Stop in /usr/ports/net-im/ejabberd.
 
 I did not include any special compile options.
 
 Any hints out there ?

I don't know about this specific error, but to stop the port from
causing X11 and such to be built you can try setting

WITHOUT_X11=yes

in /etc/make.conf (unless you actually use X11 ports on this machine).

-- 
Mark Shroyer
http://markshroyer.com/contact/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Upgrading ports while processes are running.

2010-08-16 Thread Mark Shroyer
On Tue, 17 Aug 2010 03:23:27 +0200, Polytropon free...@edvax.de wrote:
 At least, the step that wants to write will fail, and this will
 mostly be (finally) signaled by a make error.

This is sort of pedantic for me to bring up, but I wouldn't count on the
install failing.  Because Unix makes a distinction between unlinking and
file deletion, you can generally unlink the binary of a running
executable without any problem; the filesystem won't actually delete it
at least until the process in question stops running and the inode's
reference count drops to zero.  See Advanced Programming in the Unix
Environment for details.

Here's a quick example on FreeBSD:

$ cat hello.c
#include stdio.h

int main(int argc, char* argv[])
{
  while (1) {
printf(Hello\n);
sleep(1);
  }

  return 0;
}
$ cc -o hello hello.c
$ ./hello

This simple program will start printing Hello repeatedly.  Now if I
switch to another terminal, I can delete the hello binary:

$ rm hello

But switching back to the first terminal, I see the program is still
running just fine.  Running programs can be unlinked.

And this is what the install program used by FreeBSD ports appears to
do; from /usr/src/usr.bin/xinstall/install.c:

create_newfile(const char *path, int target, struct stat *sbp)
{
char backup[MAXPATHLEN];
int saved_errno = 0;
int newfd;

if (target) {
/*
 * Unlink now... avoid ETXTBSY errors later.  Try to turn
 * off the append/immutable bits -- if we fail, go ahead,
 * it might work.
 */
if (sbp-st_flags  NOCHANGEBITS)
(void)chflags(path, sbp-st_flags  ~NOCHANGEBITS);

if (dobackup) {
if ((size_t)snprintf(backup, MAXPATHLEN, %s%s,
path, suffix) != strlen(path) + strlen(suffix))
errx(EX_OSERR, %s: backup filename too long,
path);
(void)snprintf(backup, MAXPATHLEN, %s%s,
path, suffix);
if (verbose)
(void)printf(install: %s - %s\n,
path, backup);
if (rename(path, backup)  0)
err(EX_OSERR, rename: %s to %s, path, backup);
} else
if (unlink(path)  0)
saved_errno = errno;
}

newfd = open(path, O_CREAT | O_RDWR | O_TRUNC, S_IRUSR | S_IWUSR);
if (newfd  0  saved_errno != 0)
errno = saved_errno;
return newfd;
}

That isn't to say you won't see any negative consequences from
overwriting a running port with a newer version.  Hypothetically, you
might install a new Python including a new standard library, and if your
running (old) Python process tries to load one of its deleted modules
from disk something could break.  Or not; I'm no expert on the ports
system, they might have some way of working around this.  But as for a
pragmatic answer to your question, I err on the side of caution with
this stuff :)

-- 
Mark Shroyer
http://markshroyer.com/contact/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: procmail regex help ... sometimes works, sometimes doesn't...

2010-03-29 Thread Mark Shroyer
On 3/29/2010 3:27 AM, p...@pair.com wrote:
 From: osdeiiftn...@gmail.com xjyfgz...@gmail.com
 Reply-To: osdeiiftn...@gmail.com xjyfgz...@gmail.com
 Message-ID: 533pbxxy2oc
 To: me m...@me.com
 Subject: Fw: 
 \xb8\xf2\xad\xe8\xa5X\xa8\xd3\xbd\xe6~\xb1o\xb4\xa9\xa9f\xaa\xb1\xb5L\xaeM\xa4\xba\xaeg\xb2n\xa7o
 X-Mailer: inhalation
 Organization: Microsoft Outlook Express 6.00.2462.
 Mime-Version: 1.0
 Content-Type: multipart/alternative;
 boundary=1-104247307-2712732737=:8213
 Status: RO
 X-Status:
 X-Keywords:
 X-UID: 63502

 --1-104247307-2712732737=:8213
 Content-Type: text/plain; charset=big5
 Content-Transfer-Encoding: quoted-printable

 [...]
 
 Is Content-Type: completely missing from the body of your first
 example?  Do you have your examples flipped?  I would have thought
 that first example would have delivered in your inbox  second one
 in your unreadable_messages one.

It's actually a single example of a multipart message; that blank line
followed by the random dashes and numbers delimits a part.  I'm
wondering if Procmail is having trouble matching this because the
offending charset is specified in a multipart content header rather than
in the message headers.

-- 
Mark Shroyer
http://markshroyer.com/contact/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: procmail regex help ... sometimes works, sometimes doesn't...

2010-03-28 Thread Mark Shroyer
On 3/28/2010 6:34 PM, George Sanders wrote:
 I have added a very standard, very common regex line to my
 .procmailrc to filter character sets I can't read:
 
 UNREADABLE='[^?]*big5|iso-2022-jp|ISO-2022-KR|euc-kr|gb2312|ks_c_5601-1987|ks_c_5601|3Deuc-kr|koi8'
 :0:
 * ^Content-Type:.*multipart
 * B ?? $ ^Content-Type:.*^?.*charset=?($UNREADABLE)
 unreadable_messages
 
 I know that this works because my unreadable_messages mail file is
 now full of messages with headers like:
 
 From: =?GB2312?B?xMLTq9Or?= uigvru...@heki.net
 Subject: =?GB2312?B?MjAxMMTqyMvBptfK1LS4w9bYytPKssO0?=
 To: me m...@me.com
 Content-Type: text/html;
 charset=gb2312
 
 However, a lot of mail gets through to my inbox that matches:
 
 From: osdeiiftn...@gmail.com xjyfgz...@gmail.com
 Reply-To: osdeiiftn...@gmail.com xjyfgz...@gmail.com
 Message-ID: 533pbxxy2oc
 To: me m...@me.com
 Subject: Fw: 
 \xb8\xf2\xad\xe8\xa5X\xa8\xd3\xbd\xe6~\xb1o\xb4\xa9\xa9f\xaa\xb1\xb5L\xaeM\xa4\xba\xaeg\xb2n\xa7o
 X-Mailer: inhalation
 Organization: Microsoft Outlook Express 6.00.2462.
 Mime-Version: 1.0
 Content-Type: multipart/alternative;
 boundary=1-104247307-2712732737=:8213
 Status: RO
 X-Status:
 X-Keywords:
 X-UID: 63502
 
 --1-104247307-2712732737=:8213
 Content-Type: text/plain; charset=big5
 Content-Transfer-Encoding: quoted-printable
 
 However, big5 is very clearly listed in my regex above, and as far
 as I can tell, this mail should match perfectly...
 
 I cannot see why these big5 emails are not matching my procmail
 regex ... is it obvious to anyone ?

This is just a shot in the dark, but do you find that the unreadable
messages that this rule successfully matches have the relevant
Content-Type header in the message's main header group, whereas the
messages that should match but fail to do so have the Content-Type
header in a MIME attachment, as in your example?

(Apologies for the imprecise terminology.)

-- 
Mark Shroyer
http://markshroyer.com/contact/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: ezjail

2010-03-21 Thread Mark Shroyer
On 3/21/2010 1:10 AM, Aiza wrote:
 I don't have sources installed on my system. Just use the binary
 Freebsd-update function. At new releases I do a clean install.
 I only have a single public IP address.
 
 Now I would like to play with jails. One for postfix, apache, and ftp.
 My reading of EZJAIL and the jails section of the handbook lead me to
 believe I need a unique IP address for each jail. Is that correct?

Yes.  But if you have only one public IP address, you can give the jail
a loopback interface with an address in 127.0.0/24 or one of the RFC
1918 private blocks (there's some debate as to which is the more
correct type of address to use, but either will work), then use NAT if
you need your jail to be able to access the Internet.

If it helps you to reason about this, keep in mind that your jail does
*not* have its own virtualized network stack, like with Solaris Zones
for instance.  The best way to think about your jails is as a group of
processes running on the same operating system as the host, just with
the restriction that (among other things) they can only communicate with
the outside world using a limited subset of the IP addresses available
to non-jailed processes.

 I have no need to build world or install world because it does this from
 /usr/src which i don't install. Is there some EZJAIL option to just copy
 over the running system binaries instead of the sources?

Until recently, the method for creating ezjail's basejail was to issue
the ezjail-admin update command, which compiles the basejail from
/usr/src.  Just recently an ezjail-admin install command was added,
which downloads binaries from a FreeBSD FTP server instead.  So you
shouldn't need sources to get started, however I'm not sure what the
update mechanism is if you use the install command.

 The handbook 15.4 Creating and Controlling Jails talks about
 “complete” jails, which resemble a real FreeBSD system, and “service”
 jails, dedicated to one application or service. Section 15.4 is the
 procedure for building a complete jail using the jail command.
 
 The 15.6 Application of Jails (service jails) talks about creating a
 root skeleton containing the host running files which are shared with
 all the guest jails in read only mode. This eliminates the massive
 duplication of running system files in each jail as in the complete jail
 system talked about in handbook section 15.4 Creating and Controlling
 Jails.
 
 Now reading the ezjail man pages I see that ezjail also creates a base
 template that is shared between all jails. Is this the same method
 talked about in the handbook section 15.6 Application of Jails (service
 jail)?

It's essentially the same approach.  (With ezjail you'll still be
duplicating binaries between the host system and the basejail, but I
wouldn't loose sleep over it.)

-- 
Mark Shroyer
http://markshroyer.com/contact/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: ezjail

2010-03-21 Thread Mark Shroyer
On 3/21/2010 8:21 PM, Aiza wrote:
 Does the ip address notation for the jail include the port number?
 Like 10.0.20.2:80 Nat port forwarding is the long way around just to get
 the correct port number to the jail ip address.

Nope, jails are assigned one (or more) specific IP addresses, but not
specific port numbers.  So if you don't have a separate public IP for
your jail, you'll be relying on some sort of packet filter to redirect
traffic to its private IP address.

This isn't as big a deal as it may sound, especially if you're already
using PF, which has built-in packet redirection capabilities that do not
require you to run a separate NAT daemon.

 I found the man ezjail-admin has this format
 ezjail-admin install -h file://   Where -h file:// means get the
 binaries from the host system the jails are running on.  Am I correct?

Yes, according to the man page.  I haven't tried it yet myself, since I
set up my basejail before this option was available.

 My understanding of handbook section 15.6 Application of Jails
 (service jails)is a copy of the host binaries is populated into the
 basejail and all the other jails have read only access to it. Each guest
 jail also has a read/write space for installing ports/packages unique to
 that jail including /var /usr /etc.  Am I correct? Is this how ezjail is
 configured now?

Yes, that's correct.

-- 
Mark Shroyer
http://markshroyer.com/contact/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: How to make a process detect time zone change?

2010-03-16 Thread Mark Shroyer
On 3/16/2010 11:23 AM, Peter Steele wrote:
 We have a system controlled through a Java GUI and one of the
 commands provided in the GUI is to change the date/time, including
 the time zone. When the time zone is changed the FreeBSD system
 immediately recognizes the change (that is, the date command from the
 command line shows the correct time and time zone). However, our
 running C apps do not recognize that a time zone change has occurred
 unless they are restarted. What's the proper way to inform an active
 process that a time zone change has occurred? I've tried tzset() and
 tzsetwall() but neither seem to do the trick. The only thing I've
 found that works is to restart the process, and that's not really a
 solution.

I think I have a solution.  First I tried the following code:

 #include stdio.h
 #include time.h
 #include unistd.h

 int main(int argc, char* argv[])
 {
 time_t now;
 struct tm localNow;

 for (;;) {
 time(now);
 tzsetwall();
 localtime_r(now, localNow);
 printf(%02d:%02d:%02d %s\n, localNow.tm_hour,
   localNow.tm_min,
   localNow.tm_sec,
   localNow.tm_zone);
 sleep(1);
 }

 return 0;
 }

While this was running I set /etc/localtime to a different time zone,
and sure enough, my process failed to pick up the new zone until I
killed and restarted it.  However, when I passed the environment
variable TZ=/etc/localtime to the program:

 $ env TZ=/etc/localtime ./a.out
 06:11:30 MET
 06:11:31 MET
 06:11:32 MET
 06:11:33 MET
 01:11:34 EDT
 01:11:35 EDT
 01:11:36 EDT
 ^C$

So there it is: set TZ=/etc/localtime and use tzsetwall() to update the
time zone within the process.  In my reading, the tzsetwall(3)
documentation does seem to imply tzsetwall() would check /etc/localtime
even if TZ isn't set, but apparently this isn't the case; maybe the man
page could be clarified on this point?

Anyway, I hope this helps...

-- 
Mark Shroyer
http://markshroyer.com/contact/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Replacing Home Router With PC

2010-03-12 Thread Mark Shroyer
On 3/12/2010 2:39 PM, C. P. Ghost wrote:
 On Fri, Mar 12, 2010 at 7:26 PM, Nerius Landys nlan...@gmail.com wrote:
 Yep! Geode-based boxes are great. The ALIX boards are looking like
 Soekris gear, which I'm very happy with (of course running FreeBSD):

 http://www.soekris.com/net5501.htm

 Is there a nice guide that explains how to install FreeBSD onto a
 headless system (such as one of these small devices) via serial port?
 
 Basically, you have two options:
 
 [...]
 
 2. Install FreeBSD on a HDD or CF from a working computer, then move
 the disk/card to the embedded device.

A slight variant of this, which I used to get OpenBSD on my Alix board,
is to boot the installer in VMware Workstation with your CF card
connected as a VMware physical disk.  This makes it easy to get up and
running if all you have is a USB CF adapter, because within VMware
FreeBSD will see it as a SCSI disk.  Plus you get to save a CD-R/DVD-R
by mounting the installer ISO in VMware without burning it to disc :)

So don't worry, installing FreeBSD or OpenBSD in this manner is super
easy; it's basically the same as any other installation, just with the
added step of setting up the serial console at the very end.

-- 
Mark Shroyer
http://markshroyer.com/contact/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: FreeBSD Version recommend for OLD machine

2010-03-11 Thread Mark Shroyer
On 3/11/2010 11:29 PM, Jorge Biquez wrote:
 I have an old machine that has been running 4.11-Stable for some years.
 This week something weird happened when I tried to update to latest
 version on 4.x. Anyway, I thought that was a good idea to update to 5.x
 and after doing all the process finally I can not have it running
 corrcetly. Not a big problem since a secondary  DNS an an email server
 for one domain. I am still trying to recover it downloading and
 installing the sae version it has but in case I can not fix I would like
 to install a mor erecent version.
 
 The machine has a Motherboard that supports 2 double pentium III
 processors with 1GB of ram and a hard disk with 40GB.
 
 It won't do anything else but a dns slave for maybe 100 domains, mail
 and squirrel for 10 domain, not more than 100 users with very low
 volume. That's all.
 
 Can you give me your opinions on what would you?

If you're going to reinstall anyway, you might as well run the latest
and greatest version.  FreeBSD 8.0 will do just fine on this hardware.

-- 
Mark Shroyer
http://markshroyer.com/contact/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Replacing Home Router With PC

2010-03-11 Thread Mark Shroyer
On 3/10/2010 8:50 PM, Ed Jobs wrote:
 On Thursday 11 of March 2010 03:36, mailinglist wrote:
 The question is, can it use that wireless card to
 act as a access point instead of a client (how the card is intended to be
 used)?
 you can run the hostapd daemon to configure a card as an access point. I did 
 this on an openbsd box, so i'm perfectly sure you can do it on a freebsd box 
 too.

In all honesty, as much as I love FreeBSD, this is the sort of thing
that OpenBSD really excels at.  So the OP may wish to look at OpenBSD
too, but as you say, either operating system can do the job.

-- 
Mark Shroyer
http://markshroyer.com/contact/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Replacing Home Router With PC

2010-03-11 Thread Mark Shroyer
On 3/11/2010 9:32 AM, Lowell Gilbert wrote:
 mailinglist mailingl...@ucwv.edu writes:
 
 I've got an old Linksys router hanging off of my cable modem that is
 several years old and is about to die (very poor wireless throughput
 should be 54 mb and is 2, runs hot, and buzzes while turned on).
 I've got an older PC that would great as a routerhowever I also
 need it to be a wireless access point for my house.  It has a PCI
 wireless network card (A 54G Belkin, not sure of the exact model).  I
 know FreeBSD is technically capable for acting as my DHCP, DNS,
 router, gateway box if properly configured.  The question is, can it
 use that wireless card to act as a access point instead of a client
 (how the card is intended to be used)?

 Also, any links anyone can provide on how to setup a FreeBSD box to
 act as home router/gateway would be much appreciated!
 
 Bear in mind that the added electricity costs will more than cover the
 cost of a new Linksys (or equivalent) router in a few months.

If energy consumption is a concern, you might try one of these:

http://www.pcengines.ch/alix2d3.htm

I've been running OpenBSD on mine for a year or so, and it makes an
absolutely fantastic home router.  It'll run FreeBSD, too.  Uses about 5
watts.

My one caveat is that you may want to solder on an RTC battery (CR2032)
holder--or just pay a little extra for the alix2d13, which includes the
holder, if you don't like soldering things.

-- 
Mark Shroyer
http://markshroyer.com/contact/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: NetBSD 5.0 looks cool

2010-02-18 Thread Mark Shroyer
On 2/18/2010 10:32 AM, Abdullah Ibn Hamad Al-Marri wrote:
 How about these bench vs FreeBSD?!
 
 http://www.netbsd.org/~ad/50/img11.html
 
 http://www.netbsd.org/~ad/50/img13.html
 
 http://www.netbsd.org/~ad/50/img15.html

If those numbers are characteristic of the operating system's overall
performance, then that's a really impressive leap forward for NetBSD.

That said, I use FreeBSD mainly on small, individual servers; as we all
know, there's a lot more that goes into selecting a server OS than raw
performance numbers.  Stability, security features (like the ability to
run Apache jailed with whatever random, potentially insecure CGI or PHP
applications one must install), and ease of software installation and
maintenance are important too, and for me FreeBSD excels at these things.

But between these massive performance improvements, and its mature Xen
compatibility, and the fact that they evicted Sendmail from the base
system in favor of Postfix, NetBSD really has my attention.  (In fact
I'm setting up a VM right now so I can get a feel for how NetBSD +
pkgsrc handles as a server.)  Now if only it had jails...

-- 
Mark Shroyer
http://markshroyer.com/contact/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


UTF-8 and FreeBSD Ports make config / ncurses

2009-12-24 Thread Mark Shroyer
Hi,

I can't get the ncurses-based menu shown by running make config for an
arbitrary port in FreeBSD 8.0 to use UTF-8 line drawing characters,
rather than ISO-8859-1.

I've configured my locale by setting

:charset=UTF-8:\
:lang=en_US.UTF-8:

in /etc/login.conf and then running cap_mkdb, and this has been
sufficient to get other programs, such as mc, to provide UTF-8 output.
But `make config` in the ports tree is still giving me ISO-8859-1,
resulting in garbled characters in my terminal emulator (PuTTY), which
is configured for UTF-8.  What am I missing?

Thanks,
Mark

-- 
Mark Shroyer
http://markshroyer.com/contact/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org


Re: Root exploit for FreeBSD

2009-12-11 Thread Mark Shroyer
On Fri, Dec 11, 2009 at 08:49:42AM +, Matthew Seaman wrote:
 I dunno.  Haven't seen many MS-DOS exploits recently either...

That's true, it would be difficult to find a local privilege escalation
exploit in an operating system without the concept of limited user
accounts :)

-- 
Mark Shroyer
http://markshroyer.com/contact/
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to freebsd-questions-unsubscr...@freebsd.org