Category Archives: Allgemein

Using Java to read Oracle Wallet files

A while ago, i was given the task to write a program to check for the expiration of client certificates. Since the program was supposed to be workable on Windows, Linux, Solaris, and AIX, i decided to not use the openssl libraries, instead, i wrote a java program. Now, when i started to make it productive, the guy actually in charge told me “great thing, and we actually have a few PEM certificates, but most of them are Oracle Wallets”.

Continue reading

Make wordpress require login for all pages

If you’re building a site, you don’t want the public to be able to access it, especially if there’s legal requirements it doesn’t meet yet.

Easiest way to do this: put

<?php
if (!is_user_logged_in()) {
        auth_redirect();
}
?>

at the start of your wp-content/themes/<your theme>/header.php.

Warning: If you update or change your theme, you’ll re-enable login. This might as well be a good thing – if you can’t remember how you made your site require login, and want to remove the feature, just reinstall your theme.

Getting ubuntu to boot with correct resolution even if the monitor is disconnected

Problem: I’m administrating several ubuntu linux boxes in a rack at a friend’s company, where there is one monitor and no KVM switch for them. Whenever someone wants to do something with one of them, they connect the monitor to the one they want to work with.

When i remotely reboot Linux after some upgrades, the computer typically doesn’t find a monitor and enters 640×480 mode. When the monitor is connected later, the display is unusable; the same happens when i vnc into the machine.

Solution: use xrandr to set the display mode upon boot.

Continue reading

Playing FreeOrion on Ubuntu

I tried FreeOrion on Windows before i switched over to Linux, and liked it, so it was nice for me to hear it runs on Linux as well. Unfortunately, the version that comes with the software manager for Ubuntu 14.04 is 0.4.3, and i was already used to 0.4.4 from playing with Windows, so i decided to compile it myself.

I didn’t compile any of the requirements myself; the packages i had to install were:

cmake
libogre-1.8-dev
libboost-filesystem1.54-dev
libfreetype6-dev
libjpeg8-dev
libtiff-dev
libboost-regex1.54-dev
libboost-signals1.54-dev
libois-dev
libboost-python1.54-dev
libopenal-dev
libvorbis-dev
libbullet-dev

Of course, this list might not be complete; i have stuff like gcc, make, … installed anyways, but these seem to be the prereqs you don’t typically install on your workstation.

There is one problem that seems to occur only with XUbuntu, not Ubuntu: XFCE interferes with the keyboard grabbing of the OIS Library that FreeOrion uses, and since OIS is obsolete, noone is going to fix that. What helped me is to put

x11_keyboard_grab=true

into my ~/.freeorion/OISInput.cfg which keeps the keyboard focus on FreeOrion all the time. I’m still not 100% happy with this, as a) i can’t use any applications on my 2nd screen while playing, and b) minimizing FreeOrion drops the keyboard focus, but restoring the window doesn’t grab it again, so i have a way to quickly run another app if i need to, but i’ll have to save the game and restart it to be able to type again.

 

 

Furmark for Linux

Furmark for Linux is available, in the form of GpuTest 0.7.0.

If you don’t want to use the gui, there’s lots of (undocumented) options – use strings on the GpuTest executable.

For example:

./GpuTest /test=fur /width=1280 /height=1024 /benchmark /benchmark_duration_ms=5000 /no_scorebox /print_score

to run the test for 5 seconds and print the results to the terminal without waiting for the score box to pop open/need to be closed.

Running the software this way has the additional advantage that video modes can be used that aren’t supported by the GUI, like 1280×1024 on my old screens.

And here’s the scores for various video boards. Each of them was made with the same command line:

GpuTest /test=fur /width=1280 /height=1024 /benchmark /no_scorebox /print_score
Results:
GeForce GTX 980/PCIe/SSE2 6189 points, 103 FPS
Geforce GTX 660/PCIe/SSE2 2879 points, 47 FPS
Gallium 0.4 on AMD BARTS (this is the free driver on a Radeon HD 6870): 1874 points, 31 FPS
AMD Radeon HD 6800 Series (same HD 6870, proprietary driver): 2489 points, 41 FPS
GeForce GTX 460/PCIe/SSE2 1862 points, 31 FPS
Mesa DRI Intel(R) Haswell Desktop: 656 points, 10 FPS
Mesa DRI Intel(R) Ivybridge Desktop: 219 points, 3 FPS
Gallium 0.4 on NVC4 (free driver on GForce GTX 460 from above) 114 points, 1 FPS
Gallium 0.4 on AMD RS880 (free driver on a Radeon HD 4250): 70 points, 1 FPS

Of  course i didn’t expect great results with any of the onboard cards, but i found it astonishing how good the Haswell GPU was, and how much the RS880 sucked. By the way, the proprietary driver doesn’t seem to support the HD4250 at all, so i couldn’t use it to speed up the card.

Edimaxd – a daemon that collects data from your Edimax device and writes it to an RRD file

This is my first attempt at a daemon to collect data from the SP-2101W and write a rrd file from it. It’s in C source and is tested to compile on Ubuntu and Fedora.

Warning: the daemon will query your device once per second, which makes the device become unresponsive after 2 days. I assume the web server fills up the log file system which causes something to crash. Use with caution, or change the default query interval to something like 5 minutes.

 

Deobfuscating the Edimax SP-2101W cloud protocol

As i mentioned in another post, the Edimax SP-2101W sends out packets to the cloud, that are obfuscated somewhat, but not really encrypted.

I don’t really understand why the edimax engieers did that; In my opinion, they chose the worst path they could go. If you’re sending data to the cloud:

  • either, send plain text, and tell everyone what you’re sending and when you’re sending it. That way, nothing is hidden, and anyone can check your claim that nothing harmful is sent.
  • or, use strong encryption for your data, and tell everyone how you’re encrypting it, so people can have confidence that noone will be able to read what you’re sending.

By obfuscating the data in a really primitive way, you don’t protect customer’s data, but you deprive people of checking what’s actually sent. This just builds distrust, and will give you a “XXX’s cloud encryption hacked” headline some day in the – not too far – future.

Anyway, here’s how it works:

Continue reading

Debouncing mice in Linux (esp. Ubuntu)

I’ve been using Ubuntu 14.04 as my main desktop for 3 months now, and i guess i’m 95% satisfied, 5% disgruntled. One of the things that caused me pain was how mice seem to auto-doubleclick sometimes. Of course, that’s the input switches that should be debounced in hardware, but obviously aren’t.

The problem started for me when i installed Ubuntu for the first time – my mouse, that had always worked well, had the problem with the new Ubuntu installation. Went out and bought a cheap 7,95 € one. It auto-doubleclicked from the first day on. Bought another, by Logitech, for 20 €. No problems yet. But …. on my other PC, my 60 € Razer mouse started double-clicking as well. So i started to investigate more.

Seems some guy named Matt Whitlock had the same problem a few years ago, and he developed a patch to the evdev code to add software debouncing. Unfortunately, the X maintainers refused to add it to the official sources, because of the cost of testing involved. This is even though many people seem to have this problem, and since all mice that had the problem in Ubuntu work well in Windows, i assume a) windows does its own software debouncing and b) hardware manufacturers don’t properly debounce their cheap mice because of a).

But the patch still works, and it can be added to your installation quite easily:

Continue reading

Edimax SP-2101W

I bought two Edimax SP-2102W devices, that allow measuring power usage and send the results to an android application. This works no matter if you’re at home or not, so the devices seem to store some information in the cloud. Two problems:

  • I’m not sure if i want information about my power usage in the cloud somewhere
  • Why android app? I want the information, along with long term data, on my PC.

A german forum had some information about the Edimax, so i decided to start from there. Here’s what i found out:

Continue reading