Chris Zakelj wrote:
Justin H Haynes wrote:
Thanks Nick Holmes and misc for
http://www.openbsdsupport.org/GalleryInChroot.html. It was very
helpful in getting Gallery working in OpenBSD in the chrooted Apache
environment for me. However, I need to use an external smtp server to
handle registration emails. I was getting this error message in my
logs when I tried to use the registration feature:
[Mon Jan 2 10:23:57 2006] [error] PHP Warning: fsockopen():
php_network_getaddresses: gethostbyname failed in
/htdocs/gallery/classes/Mail/smtp.php on line 87
[Mon Jan 2 10:23:57 2006] [error] PHP Warning: fsockopen(): unable
to connect to smtp-server.houston.rr.com:25 in
/htdocs/gallery/classes/Mail/smtp.php on line 87
So I just copied resolv.conf to /var/www/etc/resolv.conf and it now
works just fine.
So, Nick, if you feel like modifying your script:
patch gallery-openbsd-chroot-install.sh << EOF
103a104
mkdir -p /var/www/etc
114a116,118
echo 'Copying resolv.conf...'
cd /var/www/etc
cp /etc/resolv.conf .
EOF
Thanks again,
Justin H Haynes
Not sure that just copying /etc/resolv.conf wholesale without sanity
checking is such a good idea... folks on dynamic IP's (PPPoE and cable,
for instance) may have ISPs who assign DNS service based on which IP
address the client gets. A better idea may be to append a couple of the
OpenNIC (or other 3rd party DNS service) Tier 2 DNS servers to
/var/www/etc/resolv.conf or /v/w/e/r.c.tail.
Good Idea. Actually, since everyone may not even need this little hack,
I've just changed it to create in /var/www/etc/:
resolv.conf.local
resolv.conf.OpenNIC
Then users can copy one if they need it. here is a diff to the original
script.
Also, ./secure.sh is on its own line in the original script. I've left
this alone here, as it doesn't hurt anything, and it's probably a good
idea anyway.
patch gallery-openbsd-chroot-install.sh << EOF
64c64,72
< # 16 After it's all working, cd to /var/www/htdocs/gallery and run
---
# 16 For Email functionality, you may need a resolv.conf in the
# chrooted environment if you are using a remote smtp server.
# This script will have placed two files in /var/www/etc:
# resolv.conf.local (from /etc), and resolv.conf.OpenNIC (from
# OpenNIC. If you need one, then just
# cd /var/www/etc
# cp <one of those> resolv.conf
# (1/3/2006: Justin at Haynes dot net)
# 17 After it's all working, cd to /var/www/htdocs/gallery and run
103a112
mkdir -p /var/www/etc
104a114,118
# Get nameservers from OpenNIC.
#
echo "Getting nameservers from OpenNIC"
cd /var/www/etc/
lynx -dump http://www.opennic.unrated.net/cgi-bin/get_tier2_txt.sh | grep -v ^$ | awk
'{print "nameserver " $2}' > resolv.conf.OpenNIC
114a129,131
echo 'Copying resolv.conf...'
cd /var/www/etc
cp /etc/resolv.conf resolv.conf.local
EOF