Wednesday, October 8, 2014

Fix Chrome 37 and 38 issues with Outlook Web Access OWA on Linux

Chrome 37 and 38 have breaking changes with respect to OWA.  The popup dialogs don't appear, attachments don't work, and pasted URLs aren't properly formated.  More info here and here.

Basically Chrome has disabled modal dialogs.  You have to enable them to make OWA work properly with Chrome.

On Windows this is fixed with a registry setting and a group policy object.  On OSX you need to edit the plist file (see the comment section of the previous link).  On Linux, you must setup the Chrome policies directory and add a json file.

Here's the quick fix:
sudo mkdir -p /etc/opt/chrome/policies/managed
echo '{"EnableDeprecatedWebPlatformFeatures": ["ShowModalDialog_EffectiveUntil20150430"]}' | sudo tee /etc/opt/chrome/policies/managed/owafix.json
Apparently this fix is only good through April 2015, when this functionality will be completely removed from Chrome.

More information on managing Chrome policies can be found here.



Tuesday, September 2, 2014

Fix Docky Chrome icon

Docky no longer handles Google Chrome properly and shows two icons.  To fix it, you need to add StartupWMClass=Google-chrome-stable to each section in /usr/share/applications/google-chrome.desktop (Ubuntu and Mint, maybe be elsewhere on other distros).  You'll have to do this every time Chrome is updated.  Here's a one liner:

sudo sed -i '/^\[/a StartupWMClass=Google-chrome-stable' /usr/share/applications/google-chrome.desktop

Monday, April 14, 2014

Heartbleed: A postmortem

I saw a new article without comments on Hacker News about Heartbleed as I was about to go to sleep on Monday night.  I skimmed over it quickly, figured it was sensationalist crap, and went to sleep.  When I got to work on Tuesday morning, it was clear that Heartbleed was in fact serious.

By Tuesday morning Redhat had already released an update for openssl.  We don't really take proper advantage of RHN/Satellite, so I used Chef's knife tool to update the vulnerable servers.  Since only RHEL 6.5 was affected:
 knife ssh "platform_version:6.5" "yum update openssl -y && /etc/init.d/httpd restart"  

I used one of the online scanners to verify our external network was secure.  Only a lone McAfee server was found to still be vulnerable and was patched as soon as McAfee had released an update.

We use a wildcard SSL certificate for most of our public facing sites.  It is due to expire later this year, so I decided to purchase a new certificate rather than re-key.  Our previous certificate was issued by Comodo, but their web site is infuriating so I purchased the new certificate from DigiCert.  Compared to Comodo, this was a much more pleasant experience.

Installing the new certificate on the Chef controlled Linux servers was just a simple cookbook modification.  However, we had many devices and Windows Servers controlled by other groups that needed updating as well.  To get a list of servers using the old certificate, I used the DNS zone file to get a list of all subdomains (obviously this is highly variable and would only work for our zone file):
 cat example.com.zone | grep -v static- | grep -v ";" \  
 | grep -e '^$' -v | grep -v SRV | grep IN | grep -v NS \  
 | tail -n+5 | awk '{print $1 ".example.com"}' >> examplesites  

I then looped through the list of sites using curl to connect to each site on port 443, looking for a certificate with an expiration date that matched the old certificate:
 #!/bin/bash  
 while read p; do  
   headers=`curl -Ivs --connect-timeout 2 https://$p 2>&1`  
     if [[ $headers == *2014-10-21* ]]  
   then  
     echo $p >> badsites  
   fi    
 done < "examplesites"  

Interestingly, we later ran into an issue where an application running on a RHEL 5.7 system was unable to connect to a system using the new DigiCert issued certificate.  The application was using curl  and this system's /etc/pki/tls/certs/ca-bundle.crt file did not trust DigiCert.  After updating openssl to get an updated ca-bundle.crt, the issue went away.  I ended up just updating openssl on every system we have with:
 knife ssh "name:*" "yum update openssl -y && /etc/init.d/httpd restart"  

Next came the task of finding all other vulnerable systems on the internal network.  The author of masscan added Heartbleed support and I was able to scan our entire /8 network in just a few minutes.  I also wanted the memory contents of each system as I didn't know what most of them were and I wanted to see what heartbleed would reveal.  I took the output of masscan and looped it through heartbleed.c:
 ./masscan 10.0.0.0/8 -p443 -S 10.200.200.200 --rate 100000 --heartbleed > bleeders  
 grep HEARTBLEED bleeders | awk '{print $6}' | sed 's/://' | xargs -I {} ./heartbleed -p 443 -f {}.bleed -t 1 -s {}  

It was then easy to use strings to examine each memory dump.  I found a ton of interesting things such as PHP session cookies and even a Cisco VCS server that revealed its admin username and password.

Saturday, March 1, 2014

Install Intel Linux Graphics Installer on Mint 16

The Intel Linux Graphics Installer won't install on Mint 16 due to "unsupported distro".  To trick it into installing anyway, replace /etc/lsb-release with the version from Ubuntu 13.10.

Backup your /etc/lsb-release file, then replace with:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=13.10
DISTRIB_CODENAME=saucy
DISTRIB_DESCRIPTION="Ubuntu 13.10"

Run sudo intel-linux-graphics-installer and it should install correctly and update your packages. Once it's finished, replace /etc/lsb-release with your backup copy.

Tuesday, February 18, 2014

Upload Pages to Confluence with cURL over webdav.

If you want to interact with Confluence documents programmatically, one way is to use curl to connect the Confluence webdav interface.

To get the URL to the page you want to use, use your browser to navigate to:
https://yourconfluenceserver/plugins/servlet/confluence/default/Global/

You should see a list of Confluence Spaces.  Navigate to your space and page and copy the link to yourpage.txt.

To download the page:
curl --request GET --user username:password "https://yourconfluenceserver/plugins/servlet/confluence/default/Global/YOURSPACE/YOURPAGE/YOURPAGE.txt" > yourpage.txt

To upload the page:
curl --request PUT --data-binary "@YOURPAGE.txt" --user username:password "https://yourconfluenceserver/plugins/servlet/confluence/default/Global/YOURSPACE/YOURPAGE/YOURPAGE.txt" > yourpage.txt

Friday, January 3, 2014

Apache logs: Get unique visitors in the last 60 seconds

This is modified from: http://nixcraft.com/showthread.php/13554-Script-to-count-unique-ips-in-apache-access-log/page3?p=32816&viewfull=1#post32816

To get the number of unique visitors (by ip) in the last 60 seconds from an Apache log:

awk  '{if ( substr($4,14) > strftime("%H:%M:%S", systime()-(60) )  && substr($4,2,9) == strftime("%d/%b/%C")) !a[$1]++}END{for(i in  a) k++; print k }' access_log

Monday, July 8, 2013

AIMP 3 Convert to MP3

AIMP 3 no longer supports mp3 conversion out of the box.  You need to manually install the LAME library.  Download the 32bit LAME bundle here: http://www.rarewares.org/mp3-lame-bundle.php

Then exact and copy lame_enc.dll to your AIMP3 modules directory (C:\Program Files (x86)\AIMP3\Modules)