fogbound.net




Sun, 22 Oct 2006

Reverse SSH tunnels in Mac OS X

— SjG @ 9:02 am

I’m one of the many people who will be using VNC to do remote assistance for a relative using Windows.

There are a number of tutorials out there. Most of them fail because they require the ability to VNC in to the remote system, which won’t work in my case because the remote Windows box is behind a firewall/router that I can’t configure. There are also several reverse approaches out there, where the user needing assistance initiates the connection. The first of these I say was Gina Trapani’s approach at Geek to Live, which uses UltraVNC on both ends. This is almost the solution I want, except that it requires Windows on my end as well. It also assumes that I’m at a fixed location.

In the comments, I came across Fazal Majid’s response. He had the same requirements as I do, and links to his source where he built a customized VNC server that targets a fixed IP address. Fazal’s approach matches my needs exactly.
But then I ran into the problem of the last step: the reverse SSH tunnel from my known server (which gets hard-coded into the executable) to my notebook running Chicken of the VNC.
Building reverse SSH tunnels is really not that difficult. But when I created the setup, I was able to make it work from a Linux machine and from a Cygwin terminal under Windows, but it mysteriously failed under Mac OS. Using lots of -v flags, I kept seeing the service for the port on the Mac side refusing the connection from the tunnel. The ssh debug looked like:

debug1: remote forward success for: listen 5900, connect localhost:5500
debug1: client_input_channel_open: ctype forwarded-tcpip rchan 2 win 131072 max 32768
debug1: client_request_forwarded_tcpip: listen localhost port 5900, originator ::1 port 60475
debug1: channel 0: new [::1]
debug1: confirm forwarded-tcpip
debug3: channel 0: waiting for connection
debug1: channel 0: not connected: Connection refused
debug2: channel 0: zombie
debug2: channel 0: garbage collecting
It turns out that this means the tunnel doesn’t even see the service. After wasting time with firewall tests and a lot of other false leads, I finally noticed the [::1] notation in there. Yup, that’s an IPv6 address. The solution is to make sure the ssh tunnel is using IPv4. For reference, the command that works is:

ssh -nNT4 -R 5500:localhost:5500 -l my_username myhost.com


Thu, 31 Aug 2006

Another Reason to Hate Microsoft

— SjG @ 3:00 pm

So a Windows Update breaks the ability to allocate big chunks fo contiguous memory (http://support.microsoft.com/kb/924054/), which causes this JBoss configuration to fail. Restarting summons the dreaded VM Error: Could not reserve enough space for object heap error message.

So Microsoft knows they broke stuff. They have a “hotfix” (which, despite the “hot” part of the name will require a reboot). But I can’t just download it. Nope. Gotta pay for a support contract.

Now, I don’t have a huge issue with a bug like this creeping into a Windows security update. Let’s face it, bugs happen. But to charge me to fix the problem, even after I paid for the OS? That’s just not right. Cast my vote for Free Software.


Wed, 26 Jul 2006

Computers

— SjG @ 10:36 pm

Why do they have to be so damn difficult?

I’ve been working on upgrading my grandmother’s machine from a five or six year-old eMachine PII/300 running Windows 98 to a brand new Compaq deal I got at CompUSA along with a monitor and printer. The machine is reasonably fast, and, after I uninstalled all the crap that it came with and threw on some more reasonable software, I’m nearly at the point where it works the way she can use it.

Frustration 1. Moving files from one machine to another. I knew I wasn’t going to be able to use the network, as the old machine doesn’t have ethernet. New machine has no floppy. I could have uploaded all of the files via modem (probably get about 2 kB/sec), but that would have been painful. Easy, though, I’d use my USB memory key. Except that Win98 doesn’t natively support USB keys. Download the drivers… discover that they all want Win98SE, and won’t install. Grind teeth. Outcome: Success — finally had to use a USB CDR I had at home, since it at least had drivers on CD for Win98.

Frustration 2. Printer failure. The HP Deskjet 3915 just sits there flashing its light. Figure it’s a driver problem, so download 8MB of updates (over that mighty 2kB/sec connection). Still, nothing. Paper manual says that I should read documentation on CD. Documentation on CD says that I should consult the error code provided by the HP software. HP software says everything is fine. CD documentation’s best suggestion is to reboot. Windows thinks the driver is fine; HP thinks the printer is fine. The printer queue says it’s printing. Nothing ever happens. Reinstall drivers. Repeat. Outcome: still unsolved. Next step — call HP tech support. Oh, joy.

Frustration 3. Importing old mail from Netscape 4.8 to Thunderbird. Importing address book was simple — worked beautifully. But for old email, no such luck. There’s a tool “Wizard” for importing mail. But it doesn’t allow you to point it at files, it wants you to pick the profile. But it doesn’t see any profiles. I try putting the Netscape 4.8 user directories in all of the reasonable places (no, really. I tried all of them), but it never sees them. Documentation doesn’t yield any help. Try other directories. Try copying mail files directly into the appropriate directory in Thunderbird’s profile to no avail. Outcome: gave up.


Fri, 28 Apr 2006

Redraw delay in Photoshop script.

— SjG @ 11:11 am

I’ve been working on a script to do a bunch of crazy manipulation of images in Photoshop. Basically, it sequentially opens all the image files in a directory, and displays a dialog box requiring user interaction to determine what to do with the image.

I was having the problem that the dialog box would come up before the image could redraw (in the case of large images), so the user would be asked what to do, but would be unable to see the image in question. This, of course, doesn’t work.

I tried writing delay code, to no avail. I had a very hard time finding help, because I didn’t know what search terms to use. None of “delay,” “repaint,” “refresh,” “sleep,” and “wait” yielded anything useful when combined with”Photoshop” and “Javascript.”

Finally I found this posting by Tom Hart in the Adobe forums, where he provides a function called WaitForRedraw which solves the exact problem!

Here’s a link to Tom’s Posting.


Thu, 12 Jan 2006

sa-exim config tweak

— SjG @ 11:13 pm

This is probably obvious to everyone in the universe but me, but I was having a problem where my outbound email was being scanned by sa-exim, in addition to the desired scanning of incoming email.

The trick is in setting your SAEximRunCond in sa-exim.conf correctly. This is probably documented somewhere, but I totally missed it. In any case, assuming you want to skip scanning of email originating in your local network (e.g., IP address of 10.3.2.0/24) and that you changed the secret SA-Do-Not-Run header’s name to SA-Do-Not-Think-Of-Running, you would use the following line in your sa-exim.conf:

SAEximRunCond: ${if and {{def:sender_host_address} {!eq {${mask:$sender_host_add
ress/24}}{10.3.2.0/24}} {!eq {$h_X-SA-Do-Not-Think-Of-Running:}{Yes}} } {1}{0}}

Voila, outbound emails are no longer checked. Of course, if you are sending spam, please do not make the above change, but instead please swallow whole six to ten large, unpeeled pineapples.