Quantcast
Channel: Squeezebox : Community : Forums - Logitech Media Server
Viewing all articles
Browse latest Browse all 5300

Cannot login to mysqueezebox.com on Synology DSM 5.0 based NAS - SHA1 problem

$
0
0
I am having a problem logging in to mysqueezebox.com from LMS on my Synology DS413 since they rolled out their OS update of DSM 5.0. I have spent a few hours debugging and comparing the behavior of LMS on the NAS and OS X.

The problem seems to be with the Perl sha1_base64() function and its implementation in the Digest::SHA1 module. The Digest::SHA module seems to work as expected.

DS413 (different result):
Code:

> perl -MDigest::SHA1=sha1_base64 -le'print sha1_base64("password")'
TPPsBSvwiL6nSnpGzPQnD0MOopM
> perl -MDigest::SHA=sha1_base64 -le'print sha1_base64("password")'
W6ph5Mm5Pz8GgiULbPgzG37mj9g

OS X (same result):
Code:

$ perl -MDigest::SHA1=sha1_base64 -le'print sha1_base64("password")'
W6ph5Mm5Pz8GgiULbPgzG37mj9g
$ perl -MDigest::SHA=sha1_base64 -le'print sha1_base64("password")'
W6ph5Mm5Pz8GgiULbPgzG37mj9g

According to this, the Digest::SHA module implements stronger algorithms (I have 0 posts, so I can't add a proper link):
stackoverflow.com/questions/3420720/what-are-the-advantages-of-digestsha-over-digestsha1

The Digest::SHA1 module is used throughout the LMS code:

Code:

# in @appstore/SqueezeCenter/Slim
> grep -rn Digest\:\:SHA1 *
Control/Commands.pm:35:# use Digest::SHA1 qw(sha1_base64);
Music/Artwork.pm:744:                my $base = catfile( $params->{cacheDir}, Digest::SHA1::sha1_hex($args) );
Networking/SqueezeNetwork.pm:10:# use Digest::SHA1 qw(sha1_base64);
Plugin/iTunes/Common.pm:32:use Digest::SHA1;
Plugin/iTunes/Common.pm:270:        my $sha1 = Digest::SHA1->new;
Utils/PluginDownloader.pm:14:use Digest::SHA1;
Utils/PluginDownloader.pm:182:                my $sha1 = Digest::SHA1->new;
Utils/Firmware.pm:32:use Digest::SHA1;
Utils/Firmware.pm:387:                        my $sha1 = Digest::SHA1->new;
Utils/Firmware.pm:513:        my $sha1 = Digest::SHA1->new;
Utils/Strings.pm:44:use Digest::SHA1 qw(sha1_hex);
Utils/Misc.pm:49:use Digest::SHA1 qw(sha1_hex);
Web/HTTP.pm:14:use Digest::SHA1 qw(sha1_base64);
Web/Settings/Server/SqueezeNetwork.pm:13:# use Digest::SHA1 qw(sha1_base64);
Web/Settings/Server/Security.pm:11:use Digest::SHA1 qw(sha1_base64);
Web/Settings/Server/Wizard.pm:10:use Digest::SHA1 qw(sha1_base64);
bootstrap.pm:55:my @default_required_modules = qw(version Time::HiRes DBI EV XML::Parser::Expat HTML::Parser JSON::XS Digest::SHA1 YAML::XS Sub::Name);

Note the lines with '#'. These are the files I changed to get the mysqueezebox.com login to work.

The change is simply:
Code:

use Digest::SHA qw(sha1_base64);
# use Digest::SHA1 qw(sha1_base64);

I only know enough about Perl to be dangerous, so I don't know why the result is different in the two modules. The version of Perl on my DSM413 is actually newer than what I have on OS X.

DSM413:
Code:

> perl -v
This is perl 5, version 18, subversion 1 (v5.18.1) built for powerpc-linux

OS X:
Code:

$ perl -v
This is perl 5, version 16, subversion 2 (v5.16.2) built for darwin-thread-multi-2level

I'm also not sure why this function produces different results on DSM 5 vs. DSM 4.x. It must be related to the native SHA1 implementation in Linux for Power PC, and I don't know what changed there between DSM 5 and 4.x.

The DS413 is a "FREESCALE QorIQ" (from the admin info screen) based system.

Code:

> uname -a
Linux <my hostname> 2.6.32.12 #4458 SMP Thu Mar 6 14:15:06 CST 2014 ppc GNU/Linux synology_qoriq_413

I downloaded the 7.8 beta nightly build to see if Digest::SHA1 has been updated to Digest::SHA. It has not -- the beta still uses Digest::SHA1. Can this be safely changed in the code base without causing other problems?

Is there another way to fix this problem? Is there any more information I can add that might be helpful in solving this?

Viewing all articles
Browse latest Browse all 5300

Trending Articles