Wednesday, July 21, 2010

MySQL Workbench install annoyance - you have to have windows firewall service running

When you try to install MySQL workbench on an Amazon EC2 server you receive a "cannot connect to firewall" error which causes the setup to fail.

I assume this is because setup wants to set FW exceptions, but of course Amazon EC2 servers have the firewall service disabled because they programmatically implement the firewall using the AWS control panel.

So to solve this you need to enable the firewall service, start it, run the setup, stop the service and again disable it.

Wednesday, July 14, 2010

How to install IIS on amazon EC2

When you enter your EC2 instance and want to add IIS [ via the add/remove programs -> add/remove windows components -> Application Server (double click) ... ], the server will ask you for a directory of installation files: convlog.exe on Service Pack 2 CD-ROM
and gives you a default directory such as: C:\sysprep\i386\i386

This directory doesn't exist, you need to mount a special snapshot EBS volume.
This can be done in 2 methods:

1) GUI method :
  1.1) (if you previously created the correct volume - skip to step 1.3) Go to the EC2 control panel (in AWS), click Elastic Block Storage -> Snapshots, filter by All snapshots.

Select the correct (matching your running EC2 instance configuration) snapshot:

The following is a list of available snapshots for US:
  • Windows 2003 R2 Enterprise 32-bit: snap-bb10f6d2
  • Windows 2003 R2 Datacenter 32-bit: snap-8010f6e9
  • Windows 2003 R2 Enterprise 64-bit: snap-d010f6b9
  • Windows 2003 R2 Datacenter 64-bit: snap-a310f6ca

The following is a list of available snapshots for EU:
  • Windows 2003 R2 Enterprise 32-bit: snap-a4bb5ecd
  • Windows 2003 R2 Datacenter 32-bit: snap-b8bb5ed1
  • Windows 2003 R2 Enterprise 64-bit: snap-a6bb5ecf
  • Windows 2003 R2 Datacenter 64-bit: snap-babb5ed3 
  1.2)  Right click the correct snapshot and 'Create Volume From Snapshot' - make sure you use a region that is exactly the same region as your instance (up to the last letter - e.g., "us-east-1b" - the 'b' is important !)
This step may take 10-15 minutes.

  1.3) Go to Elastic Block Storage -> Volumes, wait until the volume is created (status column), then right click it and select 'attach volume'. If you used the correct region, the combo box in the following dialog should allow you to select your image. Choose a drive and click OK.

The CDROM will be mounted on a new drive on your running EC2 instance (no need to close the running session during this procedure).

Locate the i386 directory on that driver and continue the installation process of IIS as described at the beginning of the blog post.

2) Command line method:
Using the amazon API Tools, follow the instructions here. You will need to install java & set the EC2_HOME and JAVA_HOME env variables before running the API Tools on your computer and you will need your private key too (login to this page for your private key info or in AWS panel go to 'account' -> 'Security Credentials' ).

Wednesday, July 7, 2010

How to access GoDaddy PIX firewall for dedicatd servers (java problem)

It turns out that you can not access godaddy PIX firewall using the latest java, because the PIX control panel uses depricated java functionality, so you need to downgrade your java - following are steps on how to do this without uninstalling the latest java version you have:

You'll need to use java version 1.6.0_11 or older. Newer versions are not compatible with the Pix Device Manager.

You can install a second version of Java. And when you need to access the firewall you can disable the newer version.
Go to:
http://java.sun.com/products/archive/ and download an appropriate version.
Once installed navigate to Start > Control Panel > Java > Java > Uncheck all other versions > Ok.

Multiple SSL/HTTPS web sites on one IIS server

An SSL certificate can be attached only to a physical IP address – so if you have multiple web sites with different host names on the same server and you want them all to be secure (SSL/HTTPS) then you need one of the 2 following scenarios:

1. A ‘wildcard’ SSL certificate (e.g., *.foo.com) which costs more, ~$200/year.
If you choose this solution, the certificate needs to be installed on all web site nodes in the IIS admin and further command line functions need to be done (see http://blumenthalit.net/blog/Lists/Posts/Post.aspx?List=35b60df2-0af2-4e52-8c6f-d3a64a542f45&ID=14&RootFolder=* for more details)


2. If you have separate different certificates each one for a different host name (e.g., one for site1.foo.com and the other for site2.foo.com) , you will need to add IP addresses (GoDaddy say they must be real IPs, other web sites claim internal NAT IPs can be enough) – the dedicated control panel can be used for issuing a new “real IP” (up to 3 are given), the godaddy firewall needs to be configured for this new IP and the dedicated host needs to be configured for it too.
[note that accessing godaddy PIX firewall for a dedicated server requires you to downgrade your java because the latest java can't access the control panel - i will add a post for this too ]

I got mail from their support detailing the steps for scenario #2 above:

To request additional IP addresses:



  1. Log into your Account Manager.

  2. Under the My Products section, select Servers.

  3. Click Launch Manager next to the server account that you would like to manage. The virtual Dedicated/Dedicated Hosting Manager opens in a new window.

  4. Click Request Additional IP and allow the system several minutes for the IP address to be allocated.


NOTE:If you use Parallels Plesk Panel , the new IP address will need to be re-read from the Parallels Plesk Panel under Server > IP Addresses. Without Parallels Plesk Panel, you will need to add your IP addresses to your server's IP address pool through the applicable means before it will work.


Additional IP addresses past the first three cost extra.


Before we can allocate additional IP addresses to your server, we will need the following information submitted in a trouble ticket:



  1. How many additional IP addresses you would like us to allocate to your server (up to 3 at a time).

  2. The reason that you need additional IP addresses.

  3. The host name for your server.

  4. The last 4 digits of the payment method on file that you want to use.


Once you have requested another IP address, you would need to add the IP address to your server, there are instructions for this here : http://help.godaddy.com/article/1478. You would also need to add the IP translation rules to your firewall on the server.

Some of the information in this article is advanced material we make available as a courtesy. Please be advised that you are responsible for properly following the procedures below. Customer Support cannot assist with these topics.


Translation rules must be added for all new IP addresses. When the Cisco PIX 501 hardware firewall is installed, the translation rules for existing IP addresses are created automatically.


For each new IP address, you create two static translation rules, one outside traffic and one for inside traffic.


NOTE: For this example, we will use 22.33.44.55 to represent the new IP address. It is assumed that the next available internal IP address is 10.0.0.2.


To Add an IP Address to the Cisco PIX 501 Firewall



  1. In a Web browser, navigate to: https://[your firewall management IP address]/

  2. You may receive a number of security certificate warnings. If you accept the certs and save them as "Trusted," you will avoid warnings in the future.

  3. Enter your User name and Password, and then click OK.

    NOTE: Your browser must have Java enabled and allow pop-ups from your firewall management IP.



  4. In the Device Manager toolbar, click the Configuration icon.

  5. Click the Translation Rules tab.

  6. Click the Translation Rules radio button.

  7. Click the New Rule icon.

  8. In the window, enter the following information:

    • Interface: Inside

    • IP Address: 10.0.0.2

    • Mask: 255.255.255.255

    • Translate address on interface: outside

    • Translate address to: select (x) static IP Address: 22.33.44.55



  9. Click the New Rule icon.

  10. In the window, enter the following information:

    • Interface: Outside

    • IP Address: 22.33.44.55

    • Mask: 255.255.255.255

    • Translate address on interface: inside

    • Translate address to: select (x) static IP Address: 10.0.0.2



  11. Add 10.0.0.2, the internal IP address, to your server.


    • Windows In the advanced section of your local area network TCP/IP settings, add the internal IP, using the 255.255.255.0 netmask.


    • Linux At root, copy "/etc/sysconfig/network-scripts/ifcfg-eth0" to "/etc/sysconfig/network-scripts/ifcfg-eth0:0". Edit /etc/sysconfig/network-scripts/ifcfg-eth0:0 changing the IP to the new IP and change the DEVICE to equal eth0:0. Restart your networking with: service network restart




NOTE: IP address allocation is monitored. Attempting to add IP addresses to your server that have not been purchased is a violation of your terms of service agreement and may result in the suspension of your account.



Once these steps have been completed, we would be able to install the second IP address on your server for you.

How to implement HTTPS / SSL on IIS 6.0 web servers

You need to buy a certificate signed by a trusted certificate authority (trusted by your browsers) or by an authority which also has an 'intermediate certificate bundle' (which traces that authority up to the root CA authorities which are trusted by your browsers).

The example below explains how to do it with a GoDaddy certificate and a GoDaddy dedicated server:

When buying a new certificate or downloading an existing one (from GoDaddy account) you receive a zip file that contains the certificate (.crt) and an intermediate certificate (.p7b)

The certificate is a signed certificate by GoDaddy and the intermediate certificate is a ‘chain certificate’ that shows who signed the GoDaddy certificate, and who signed that one, on and on up until the root certificate authority (this is needed because GoDaddy itself is not trusted by FireFox browsers, only by IE).

In order to download the certificate from GoDaddy, you need to initiate a request from the web site on IIS:

Taken from http://help.godaddy.com/topic/746/article/5277 :

Follow the below instructions to generate a CSR for your website. When you have completed generating your CSR, cut/copy and paste it into the CSR field on the SSL certificate-request page.

NOTE: You must have at least Service Pack 1 installed before generating a CSR.

To Generate and Submit the Certificate Signing Request (CSR)

1. Open the Administrative Tools menu (right click on My Computer; select Manage or Control Panel; select Administrative Tools.)

2. Select Internet Information Services.

3. Select the computer and website (host) that you wish to secure. Right click and select Properties.

4. Click the Directory Security tab.

5. Click the server Certificate. button (located in the Secure communications area)

6. Click Next in the Welcome to the Web Server Certificate Wizard window.

7. Select Create a new certificate; then click Next.

8. Select Prepare the request now, but send it later and click Next.

9. In the Name and Security Settings window, fill in the name field for the new certificate; then select the bit length (2048 or higher). Click Next.

10. Enter your Distinguished Name field information. The following characters cannot be accepted:

< > ~ ! @ # $ % ^ * / \ ( ) ? &.

11. Complete the Distinguished Name Fields:

o Organization - The name under which your business is legally registered. The listed organization must be the legal registrant of the domain name in the certificate request. If you are enrolling as an individual, please enter the certificate requestor's name in the "Organization" field, and the DBA (doing business as) name in the "Organizational Unit" field.

o Organizational Unit - Optional. Use this field to differentiate between divisions within an organization. For example, "Engineering" or "Human Resources." If applicable, you may enter the DBA (doing business as) name in this field.

o Common Name - The Common Name is the fully-qualified domain name - or URL - for which you plan to use your certificate, e.g., the area of your site you wish customers to connect to using SSL. For example, an SSL certificate issued for "www.yourcompanyname.com" will not be valid for "secure.yourcompanyname.com." If the Web address to be used for SSL is "secure.yourcompanyname.com," ensure that the common name submitted in the CSR is "secure.yourcompanyname.com."

NOTE:If you are requesting a Wildcard certificate, please add an asterisk (*) on the left side of the Common Name (e.g., "*.coolexample.com" or "www*.coolexample.com"). This will secure all subdomains of the Common Name.

o Country - The two-letter International Organization for Standardization- (ISO-) format country code for the country in which your organization is legally registered.

o State/Province - Name of state or province where your organization is located. Please enter the full name. Do not abbreviate.

o City/Locality Name of the city in which your organization is registered/located. Please spell out the name of the city. Do not abbreviate.

12. Enter your Administrator contact information.

13. Enter a path and file name for the CSR.

14. Verify the information in the request and click Next.

15. On the Completing the Web Server screen, click Finish.

16. Open the generated CSR file; then, using a plain-text editor, such as Windows Notepad, copy and paste the CSR into our online enrollment form.

Now you can download the certificate zip file by accessing the SSL in “my products” of godaddy, selecting a certificate and choosing ‘rekey’ and giving the dialog your CSR.

Install both the certificate (.crt) and the intermediate certificate (.p7b) according to this site:

http://help.godaddy.com/topic/742/article/4875

After your certificate request is approved, you can download your SSL and intermediate certificate from within the SSL application. For more information see Downloading Your SSL Certificate. Both of these files must be installed on your Web server.

You may also download the intermediate certificate from the repository.

To Install the Intermediate Certificate Bundle

1. Click the Start menu and click Run.... Type mmc in the Run window and click OK to start the Microsoft Management Console (MMC).

2. In the Management Console, select File then Add/Remove Snap In.

3. In the Add or Remove Snap-ins dialog, click the Add button and then select Certificates.

4. Choose Computer Account then click Next.

5. Choose Local Computer, then click Finish.

6. Close the Add or Remove Snap-ins dialog and click OK to return to the main MMC window.

7. If necessary, click the + icon to expand the Certificates folder so that the Intermediate Certification Authorities folder is visible.

8. Right-click on Intermediate Certification Authorities and choose All Tasks, then click Import.

9. Follow the wizard prompts to complete the installation procedure.

10. Click Browse to locate the certificate file. Change the file extension filter in the bottom right corner to be able to select the file. Click Open after selecting the appropriate file.

11. Click Next in the Certificate Import Wizard.

12. Choose Place all certificates in the following store; then use the Browse function to locate Intermediate Certification Authorities. Click Next. Click Finish.

NOTE: If the Go Daddy Class 2 Certification Authority root certificate is currently installed on your machine you will need to disable it from the Trusted Root Certification Authorities folder.

13. Expand the Trusted Root Certification Authorities folder

14. Double-click the Certificates folder to show a list of all certificates.

15. Find the Go Daddy Class 2 Certification Authority certificate.

16. Right-click on the certificate and select Properties.

17. Select the radio button next to Disable all purposes for this certificate.

18. Click OK.

19. Repeat steps 13 to 18, using Starfield Class 2 Certificate Authority as the certificate name to disable.

NOTE: Do not disable the Go Daddy Secure Certification Authority certificate located in the Intermediate Certification Authorities folder. Doing so will break the server, causing it to stop sending the correct certificate chain to the browser.

To Install the SSL Certificate

1. Select the Internet Information Service console within the Administrative Tools menu.

2. Select the website (host) for which the certificate was made.

3. Right mouse-click and select Properties.

4. Select the Directory Security tab.

5. Select the Server Certificate option.

6. The Welcome to the Web Server Certificate Wizard windows opens. Click OK.

7. Select Process the pending request and install the certificate. Click Next.

8. Enter the location for the certificate file at the Process a Pending Request window. The file extension may be .txt or .crt instead of .cer (search for files of type all files).

9. When the correct certificate file is selected, click Next.

10. Verify the Certificate Summary to make sure all information is accurate. Click Next.

11. Select Finish.

And finally restart the “IIS admin service” from the windows services panel.
Note: If after this step the web server is marked as stopped (refresh with F5 to see it), it might mean you have another existing SSL web site on the same server – this is a special case and it will cause both web servers to stop functioning until one SSL certificate is removed from one of them (see my next post on multiple SSL/HTTPS web sites on one IIS server).

If you have more than one server with the same host name (like the case of multiple IPs for one DNS name for the sake of load balancing) -

Repeat this process for each server only this time, instead of initiating a request for each IIS, you should export the first certificate you installed to a .pfx file and import it on the other servers (the process will ask you to set a password for exporting and you will need to use the password for importing). Importing and exporting certificates is done in the certificate button in the properties of your web site.