FreeBSD ports build fails because of gfortran

I’ve been having some fun. I wanted to install the latest ported versions of Apache and PHP for test purposes, so set the thing compiling. There are a couple of gotchas!

First off, the current ports tree will throw errors on the Makefile due to invalid ‘t’ options and other fun things. That’s because make has been updated. In order to prevent you from using old “insecure” versions of FreeBSD, it’s considered “a good thing” to cause the build to break. I’m not kidding – it’s there in the bug reports.

You can get around this by extracting the new version of make for the 8.4 iso image (oldest updated version) – just copy it over the old one.

Some of the ports also require unzip, which you can build and install from its port in archivers.

Now we get to the fun part – because the current system uses CLANG but some of the ports disagree, when you go to build things like php5_extensions (I think the gd library in particular) it depends gcc, the GNU ‘C’ compiler, and other GNU tools – so it tries to build them. The preferred version appears to be 4.7, so off it goes. Until it goes crunch. On inspection it was attempting to build Fortran at the time. Fortran? It wasn’t obvious why it broke, but I doubted I or anyone else wanted stodgy old Fortran anyway, so why was it being built?

Please generate and paste your ad code here. If left empty, the ad location will be highlighted on your blog pages with a reminder to enter your code. Mid-Post

If you look in the config options you can choose whether or not you want Java. (No thanks). But in the Makefile it lists
LANGUAGES:=    c,c++,objc,fortran
I’m guessing that’s Objective C in there – no thanks to that too. Unfortunately removing them from this assignment doesn’t solve the problem, but it helps. The next problem will come when, thanks to the new binary package system, it tries to make a tarball of the fortran stuff it never compiled. I haven’t found how this mechanism works, but if you create a couple of empty directories and a an empty file for the man page it’ll proceed oblivious. I haven’t noticed and adverse effects yet.

A final Pooh trap if you’re trying to build Apache 2.4, mod_php5 and php5-extensions is the Zen Thread-Safe options (ZTS). If you’re not consistent with these then Apache/mod_php will fail to load the extensions and print a warning in httpd-error.log. If you build www/mod_php5 you’ll see a warning like:

 

/!\ WARNING /!\
!!! If you have a threaded Apache, you must build lang/php5 with ZTS support to enable thread-safety in extensions !!!

 

Naturally, this was scary enough to make me stop the build “make config” to select the option. Unfortunately it’s also an option on lang/php5 and if you didn’t set it there then it’ll go crunch. Many, many thanks to Matthew Seaman from FreeBSD.org, who figured out what I’d done wrong.

No-IP, no sales

No IP is my Dynamic DNS provider of choice. They provide a fuss free service if you need to assign a DNS entry to a dynamic address, and it’s also free of charge. What’s not to like?

If that’s not reason enough to support them, they had a bit of bullying from Microsoft lately, but are now back on-line. If I needed an external DNS provider, I reckon they deserve my business. So how curious that they don’t have a sales department? At least none that I’ve been able to contact. Out of desperation I emailed the webmaster (the most likely contact in their published list) and got an (automated) reply suggesting I raise a support ticket.

Needless to say, when I tried to raise a ticket it asked me a load of questions about the product I had. “Not applicable”.

If it turns to be too much hassle trying to buy a service from them, I’ll just have to peer with someone. Does anyone with BIND running in a DS that I’m not in want to do a swap on DNS replication? Why? 512K day, that’s why!

Windstream spammers

Poor old Windstream, or should that be Spamstream? Okay, perhaps not a laughing matter for them as stuff is coming from their outgoing mail cluster thick and fast, but we’ve just sent off a dozen samples and are awaiting a response. Pretty unremarkable, really, except they have an on-line help/chat facility and we just had to have a go…

Wendy: Hello, I am Wendy our Virtual Agent. I am here to help you with your support questions on High-Speed Internet, Digital TV and Home Phone.
You: We’re getting a lot of spam from a couple of your SMTP servers. Is there any reason why we shouldn’t blacklist all your IP addresses?
Wendy: I would be happy to help you set up your e-mail. Choose what you would like help with from the options below:
– Server and port settings for Windstream e-mail
– Detailed instructions to set up e-mail
Ho hum! Let’s help their abuse department is better than their on-line support service. And sorry guys, but you are spewing…

Scammers ask for money for Ukrainian Government

We have intercepted a large number of spam e-mails sent from various compromised systems, pretending to be from the Ukrainian government and asking for donations to fight off those nasty Russian backed separatists. Having checked, there is a pretty good chance that the scammers are actually based in Russia. It’s unclear whether this is in fact the work of president Putin, but perhaps he is trying to collect extra cash before the sanctions come into effect.

We have yet to see any serious attempt at exploiting the situation in Gaza, which is something of a surprise. Most likely they’re not making it through the basic spam filters.

Does freezing a broken hard disk help with data recovery?

The idea that freezing an unreadable hard disk could bring it back to life has been around for a long time. Ordinarily I’d say “No way, don’t do it”. If you’ve lost your hard disk the last thing you want to do is mess with it in any way. Take it to an expert; a real expert that is – not some shop on the high street with a sign up saying “Data recovery and virus removal”.

However, this story doesn’t go away. And there is a grain of truth in it. I remember some mid-1990’s drives did benefit from the freezer treatment – it shrunk the platters slightly and realigned the bearings. Or that was the theory. Anyway, it sometimes worked. Back then. However, luser forums are full of stories where people have used this technique on modern drives and claimed success.

On my desk at the moment I have a 160Gb SATA Maxtor, vintage 2002. And it wouldn’t read. This is partly because parts of the platter are now unreadable, and partly because the NTFS filing system is mangled. I know this kind of stuff. After a couple of days I reckon I’ve got all the blocks off it that it’s going to yield, but repeatedly retrying the bad sectors. Some read eventually, other’s don’t.

Now it’s an observable fact with dodgy platters on winchesters that they’ll sometimes, briefly, come good. It’s worth powering down the drive, letting it cool and trying again later. It’s even worth trying it at different angles. Having a few fans around it to keep it cool is a good idea anyway. Using these techniques I’ve recovered about 80% of the bad sectors, with about 2500 left that aren’t doing it. A good candidate for the freezer perhaps? Well, as a last resort – I’ve tried the drive at room temperature, working temperature (about 35C) – where’s the harm in trying it sub-zero?

I mus emphasise here – this is a last resort – 99.999% of the data is off it and it’s stuck a that. There’s nothing to lose.

So, in to an airtight box and into the freezer with it.

Did it work? No! In fact the whole drive ended up unreadable. I’d put that down to the condensation. If you want to knacker a drive without leaving marks, condensation on the platters is a good way to go.

Leaving it to get back to room temperature did result in it coming back to life, although I only got two more sectors back.

So why do all these people keep insisting it worked for them? Coincidence, I reckon. If they’d left the drive alone for 12 hours it might have started working anyway. They often do, even for a brief period. This drive had proved that some sectors were heat-sensitive; more could be read while it was still cool and the recovery rate dropped off when it was warm. If it didn’t help with this drive, I seriously doubt it would work on other candidates.

Getting Caller-ID with BT Inspiration or Pathway PABX

For years I’ve thought that caller-ID was broken on BT Inspiration switchboards (which are almost identical to BT Pathway, so this applies to both). More precisely, I assumed that BT’s Caller-ID signal was either not working on my POTS lines, or was not of a standard compatible with the Inspiration. It wouldn’t be the first one – note the nonsense with the default “Guarded Clear” mode, which isn’t actually implemented on any BT lines I’ve ever come across.

CLI on ISDN worked fine, incidentally. It was just an irritation that it didn’t on the POTS lines.

Well, it turns out that it does work just fine, except it’s called CDR, and for some reason, it’s not enabled by default! Technically, they’re right not to call it CLI, which technically, is the standard used on ISDN. However, in the real world the term is applied to caller ID on analogue lines too. As a user of the telephone, why should you care about such technicalities? But you do, and you will have to enable it separately, as CDR, for any lines you want it to work on. IN the menus go to  System Programming/Lines/PSTN Programming/CDS Detection and turn it on. After which it just works.

In other places the terms Caller-ID and CLI are used interchangeably (for example, the CLI History refers doesn’t care whether it was ISDN/CLI or POTS/CDS). Don’t let common sense put you off.

Do also make sure that Caller-ID is enabled on the line – from BT dial *234#. Sometimes this is a “paid for” service, and has to be enabled. If you ask them nicely, because you’re being plagued by nuisance calls, they’ll enable it for free. I think it’s free if you renew your contract for 12 months too, but I have caught them starting off  at no charge and then billing you for it later. Watch out.

 

No-IP back on-line

I’ve just had a note from No-IP that says that Microsoft has returned all twenty-tree of second level domains it had seized by court order. It’ll obviously take a while for DNS to propagate. I’ve been testing this periodically, and it’s been a right mess with the Microsoft DNS failing to return anything in many cases.

I actually use No-IP for a couple of non-critical purposes, but I don’t use the hostname under their second-level domain directly. Given recent events, others may wish to follow the same idea. It comes down to customer routers on domestic ISP lines, and how you get to them easily if they’re on a dynamic IP address.

Basically, the trick is to map yourname.no-ip.net to yourname.yourdomain.com using a CNAME in the zone file. You can then program to the router to register yourname.no-ip.net, but you refer to it as yourname.yourdomain.com. How does this help? Well when the problem happens you only have to mess with your zone file to make the changes. If you can find out the changeable dynamic IP you can set it as an A record directly. If (as was the case here) you needed to choose a new second-level domain from No-IP’s remaining stock, all you need to is change the zone file and the affected equipment. Anything else accessing it does so through yourname.yourdomain.com, and therefore can remain as-is.

It’s still a pain, and something for which Microsoft should probably pay (or their side of the story had better be spectacularly better than it has been thus far). But it’s somewhat less of a pain than if you’d programmed everything in your universe with the no-ip version.

 

 

Microsoft wipes out No-IP in botched cyber security move

Microsoft has accidentally taken down potentially millions of dynamic IP users while going after subdomains used by criminals taking advantage of the free No-IP service, run by Vitalwerks Internet Solutions in Nevada. Yesterday (US time) they used a court order to take control of domains belonging to no-IP, which their users map to their temporary dynamic addresses, and stopped them from all from working. According to No-IP themselves, what Microsoft tried to do is redirect the domain names to their own servers and filter off the bad ones, but they failed spectacularly because Microsoft’s servers weren’t up to the job (as per usual) and collapsed under the weight of traffic.

No-IP are decidedly hacked off by Microsoft, pointing out that they have a good reputation when it comes to dealing with abuse and had Microsoft but contacted them about the sub-domains in question they’d have done something about it. Instead, secretly, Microsoft goes and gets a court order and acts without warning.

According to, Richard  Boscovich, Assistant General Counsel, Microsoft Digital Crimes Unit, “Despite numerous reports by the security community on No-IP domain abuse, the company has not taken sufficient steps to correct, remedy, prevent or control the abuse or help keep its domains safe from malicious activity”. He’s referring to Cisco here, as far as I know. The security community regularly reports on all anonymous free services, all of which are exploited by criminals. As yet, I’ve heard nothing from Microsoft to actually back his statement up. In another post, Microsoft’s Tom Rains, a marketing manager in the their Trustworthy Computing division, explains that they were after Bladabindi and Jenxcus, both of which use No-IP provided subnets in the C&C. He doesn’t imply any wrongdoing by Vitalwerks, or justify the way Microsoft has treated them.

Quite why Microsoft has any claim to be the world’s cyber-police is hard to see, given that most criminals (based on our research) prefer Microsoft’s free, no-checks, outlook.com email service. Perhaps Microsoft should try getting its own house in order first?

I’m still waiting for any official comment back from Microsoft.

 

How to hack UNIX and Linux using wildcards

Leon Juranic from Croatian security research company Defensecode has written a rather good summary of some of the nasty tricks you can play on UNIX sysadmins by the careful choice of file names and the shell’s glob functionality.

The shell is the UNIX/Linux command line, and globbing is the shell’s wildcard argument expansion. Basically, when you type in a command with a wildcard character in the argument, the shell will expand it into any number of discrete arguments. For example, if you have a directory containing the files test, junk and foo, specifying cp * /somewhere-else will expand to cp test junk foo /somewhere else when it’s run. Go and read a shell tutorial if this is new to you.

Anyway, I’d thought most people knew about this kind of thing but I was probably naïve. Leon Juranic’s straw poll suggests that only 20% of Linux administrators are savvy.

The next alarming thing he points out is as follows:
Another interesting attack vector similar to previously described 'chown'
attack is 'chmod'.
Chmod also has --reference option that can be abused to specify arbitrary permissions on files selected with asterisk wildcard.

Chmod manual page (man chmod):
--reference=RFILE
use RFILE's mode instead of MODE values

 

Oh, er! Imagine what would happen if you created a file named “–reference=myfile”. When the root user ran “chmod 700 *” it’d end up setting the access permissions on everything to match those of “myfile”. chown has the same option, allowing you to take ownership of all the files as well.

It’s funny, but I didn’t remember seeing those options to chmod and chown. So I checked. They don’t actually exist on any UNIX system I’m aware of (including FreeBSD). On closer examination it’s an enhancement of the Linux bash shell, where many a good idea turns out to be a new vulnerability. That said, I know of quite a few people using bash on UNIX.

This doesn’t detract from his main point – people should take care over the consequences of wildcard expansion. The fact that those cool Linux guys didn’t see this one coming proves it.

This kind of stuff is (as he acknowledges) nothing new. One of the UNIX administrators I work with insists on putting a file called “-i” in every directory to stop wild-card file deletes (-i as an argument to rm forces an “Are you sure?” prompt on every file. And then there’s the old chestnut of how to remove a file with a name beginning with a ‘-‘. You can easily create one with:
echo test >-example
Come back tomorrow and I’ll tell you how to get rid of it!

Update 2nd July:

Try this:
rm ./-example

Smart TVs attacked over the airwaves

A group of researchers from Columbia University have published the results of some experiments with mixed mode digital TV broadcasts here.

The problem is that the new but widely implemented HbbTV standard allows HTML to be embedded in with the picture data. What could possibly go wrong?

Well apart from the fact you only need an encoder and transmitter to mess up all the sets in range by sending them HTML spam, the Columbians reckon that with the right HTML you can turn people’s tellies into a botnet and attack targets through their internet connection. I’m not yet convinced this will work in practice, but building a web browser in to anything has always been risky when it implements more than plain HTM. It’s always been possible to broadcast alternative TV and radio signals over the top of legitimate channels, but generally, it doesn’t happen in practice.