Screensavers, black screens and power management

“Oh nice, for today I’m done! Now lets watch a movie before going to sleep!”

This could be considered a justified desire right? After a day of work why not enjoy a movie?

Unfortunately, if you are running a Linux distro you may encouter some problems depending on the Desktop Environment (DE) and the power management system you are relying on.

Those problems can all be summarized in more or less random screensavers activations and/or consequent screens blanking.



Continue reading “Screensavers, black screens and power management”

Chrome why don’t u default?!

Every distro hopper ends up from time to time on Ubuntu or on its derivatives to check how things goes.

Actually I’m a little bit of a distro hopper, at least in this period, and the distro on which I “hopped” on this time is Xubuntu 14.04 (yep, the LTS).

Now, there are many blog posts and articles that focus on the after installation steps and explain how to setup a productive desktop with all the bells and whistles.

I really like those articles but there are some little things that they don’t (can’t) consider (explain).

One of these things is a strange behavior of XFCE regarding Google Chrome.

Continue reading “Chrome why don’t u default?!”

NTML authentication for Rails from inside Microsoft™ ActiveDirectory

I ended up with a decent setup in which the whole authentication is handled by IIS on a Windows machine that lives inside the ActiveDirectory tree. Adapting from these instructions.

IIS will act as a reverse proxy to your Rails app (typically installed on a *nix server, apache+passenger in my case).

The secret resides in configuring IIS to handle NTLM and then adding this nifty plugin that will basically reproduce the mod_proxy api for IIS.

Here’s an iirf.ini example:

# NOTE: 
# This file should be placed in the IIS document root 
# for the application

StatusInquiry ON
RewriteLogLevel 3
RewriteLog ....TEMPiirf
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [L]
ProxyPass ^/(.*)$$1
ProxyPassReverse /

With this setup you can rely on the fact that the authentication is performed by IIS and you only get authenticated request with the authentication information stored inside HTTP_AUTHORIZATION.

To parse the user data from the auth header I used net-ntlm:

require 'kconv'
require 'net/ntlm'

if /^(NTLM|Negotiate) (.+)/ =~ env["HTTP_AUTHORIZATION"]
  encoded_message = $2
  message = Net::NTLM::Message.decode64(encoded_message)
  user = Net::NTLM::decode_utf16le(message.user)

After that you can even connect to the LDAP ActiveDirectory interface and fetch details about the user.