Tue Feb 14 10:16:15 GMT 2012

OpenDNS limitation with lookups

I wanted a contact form on my website, using PHP to contact me through the Exim installation on my server.

To complement this, I also wanted the sender's email address to be verified as correct, if not legitimate...

Email addresses are basically:
but 'someone' can be a series of punctuation if the person so desires it, so the verification requires parsing of possible escape codes.

'Somewhere.suffix' should also resolve to somewhere with a mail exchanger server, there begins my problems...

php DNS lookup:

That code looks into /etc/resolv.conf (possibly done at PHP load time, but for simplicity, we'll run with this version...), gets the DNS server address, and asks for the A record of the domain.

However, this is where the problems begin. OpenDNS returns an IP for ANY domain, if the domain doesn't exist you get the IP for 'guide.opendns.com', which for our purposes is definitely not desirable.

The only workaround I have at the moment is using
php DNS MX lookup:

when I find out how to force PHP to use a custom DNS server, I will write again. (I suspect it will involve either a chroot or 'exec nslookup MY_DNS_SERVER' parsed for a regular expression.


Posted by Phill | Permalink

Sun Feb 12 19:05:58 GMT 2012

Changing X screen resolution on Gentoo

In the past I have been happy with the manual editing of config files to set things how I want them, however, the xorg.conf file is a beast, a royal beast, with big pointy claws and sharp sharp teeth.

It's about the only time I approve of a GUI for things... anyway, back to the topic of the blog...

I have Intel i915 integrated graphics card on my laptop, support was compiled into my kernel, but
# Xorg -configure
yielded some error about multiple interfaces and no idea how to work between them.

A trip to the Gentoo forums yielded a result... Apparently I needed to add KMS support in my kernel:
# cd /usr/src/linux
# make menuconfig

Location:                                                                                                                │  
  -> Device Drivers                                                                                                      │  
    -> Graphics support                                                                                                  │  
      -> Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) (DRM [=y])                                      │  
        -> Intel 8xx/9xx/G3x/G4x/HD Graphics (DRM_I915 [=y]) 
          -> Enable modesetting on intel by default 
Then install your new kernel, reboot, generate your new Xorg xorg.conf file:
# make install (or cp arch/x86/boot/bzImage /boot/kernel_<version>)
# shutdown -r now (or reboot)
# Xorg -configure (then copy /root/xorg.conf to /etc/X11/xorg.conf)
# startx 
Then assuming your .xsession is correctly configured, you should be able to select different resolutions from your window manager's settings manager :) -----

Posted by Phill | Permalink

Sun Feb 12 09:02:57 GMT 2012

udev rules to get links running over DirectFB

For ages I've been annoyed with the inability to run links in graphics mode on a frambuffer with the command:
$ links -g
it worked as the root user, but not as a normal user...

A little bit of research later and I find that running
# chmod 660 /dev/tty[0-1]
made a temporary solution, so now there were two obvious ways to proceed:
# echo chmod /dev/tty[0-1] >> /etc/local.d/tty.start && chmod +x /etc/local.d/tty.start
or... add these lines to a custom udev rule (I chose /etv/udev/rules.d/80-tty.rules)
KERNEL=="tty0", MODE="0660"
KERNEL=="tty1", MODE="0660"
then restart udev and check tty permissions...
# /etc/init.d/udev restart
# ls -l /dev/tty[0-1]
crw-rw---- 1 root tty 4, 0 Feb 12 08:46 /dev/tty0
crw-rw---- 1 root tty 4, 1 Feb 12 08:59 /dev/tty1
Then run links as a normal user and hey presto.... it works :)


Posted by Phill | Permalink