Tricks and Tips about Systems/Network

October 26, 2010

Installing same UCC SSL certificate on both Linux and Windows

Filed under: admins,IIS,Windows,Windows 2008 — Liju Mathew @ 8:50 am

I have a Godaddy UCC certificate which having 5 domain included. All of the domains are hosted on my WHM/Cpanel Linux server except one it intend to install on Windows 2008 IIS7 server.

This is the first time I have attempt to install it same cert in differ os. There is two steps.

1. We need to be installed Godaddy intermediate certificates.
2. Import the certificate which is in “pkcs12” format in IIS. But Godaddy would not give you certificate which is using “pkcs12” format.
3. Identify the website the to use the ssl and enable the port 443 to listen on that site.

A. How do I install intermediate certificates in IIS,

1. From the Start menu, select Run…, type mmc, and then click OK.
2. In the Microsoft Management Console (MMC), from the File menu, select Add/Remove Snap-in.
3. In the Add or Remove Snap-ins window, click Certificates, and then click Add.
4. Select Computer Account, and then click Next.
5. Select Local Computer, and then click Finish.
6. Close the Add Standalone Snap-in window, and, in the Add/Remove Snap-in window, click OK.
7. In the MMC window, expand the Certificates folder to view the Intermediate Certification Authorities folder.
8. Right-click Intermediate Certification Authorities, select All Tasks, and then select Import.
9. In the Certificate Import Wizard, click Next.
10. Click Browse to find the intermediate certificate file. Change the file extension filter to PKCS #7 Certificates (*.spc;*.p7b), select the *_iis_intermediates.p7b file, and then click Open.
11. Click Next.
12. Select Place all certificates in the following store.
13. Click Browse, select Intermediate Certification Authorities, and then click Next.
15 Click Finish.

2. How do I generate “pkcs12” type file from the certificate file. Now you may require

a. Certificate file ( Godaddy will give)
b. Private key file ( it’s private key which used to create CSR)
c. CA bundle file ( godaddy will give)

openssl pkcs12 -export -out certificate.pfx -inkey privateKey.key -in certificate.crt -certfile CACert.crt

That’s it. Now you have a “certificate.pfx” file which would support IIS to install SSL.

3. Installing SSL certificate on IIS,

1. from the Start menu, select Control Panel, and then select Administrative Tools.
2. Select Internet Information Services Manager, and click Server Name.
3. In the Security section, double-click Server Certificates.
4. From the Actions menu, select Complete Certificate Request...
5. In the Complete Certificate Request Wizard, enter the location for the certificate file. The file extension might be .txt or .crt instead of .cer (search for all files).
6. Enter a friendly name for the certificate file, and then click OK.

7. From the Actions menu, select Bindings
8. In the Site Bindings window, click Add…
9. In the Add Site Binding window.
10. From the Type drop-down menu, select https.
11. From the IP address drop-down menu, select All Unassigned or the IP address of the site.
* For Port, type 443.
12. From the SSL Certificate drop-down menu, select the SSL certificate you just installed, and then click OK.

Pls do remember that each SSL installations requires a dedicated IP.

-Cheers

September 7, 2010

Running PHP+MSSQL on IIS

Filed under: Hacks,IIS,Windows,Windows 2008 — Liju Mathew @ 7:58 pm

Recently I got a requirement to run a php application which is using MSSQL extension.  I have done to configure IIS to work with Php files and enabled MSSQL extensions on PHP. But the real thing is that I had not luck with able to run the site.  Got the error “canot establish the database connection” After a while search I found that “freetds” library wasn’t enabled on the php to use MSSQL connectivity.

You can download the freetds dll from the noodle repository from here http://download.moodle.org/download.php/dblib/php52/DBLIB_NOTS.zip

This zip containing two files and copy both zip files in “c:\php” and “c:\php\ext” directory.  C”\php has already added in my system path. Then find the proper php.ini and add the following line

“extension=php_dblib.dll “

After restarting IIS service  it’s  starts to work correctly 🙂

Before

After,

Cheers

How do I convert .htaccess file to web.config

Filed under: admins,IIS,PHP,Windows 2008 — Liju Mathew @ 6:09 pm

I have a requirement to re-define the apache re-write rule to IIS knowing language using web.xml on Windows 2008 server. There is one easy trick to achieve this.

Basic operations are,

1. Install Mod Rewrite component on II7
2. Create a website on IIS and import the .httaccess file

1. Installing Mod Rewrite Module

Download and install Mod Rewrite module from the following url according to your OS architecture.
http://learn.iis.net/page.aspx/460/using-the-url-rewrite-module/. Then Close the IIS MMC and reopen it. Now you see that module is present as shown below

Then Click on ” import rules” label showing on the right side of the window tree. Find the .htaccess file and import and t hen click to apply. It will create/update the web.config file in the document root directory.

Here is the sample code which I used for re-writing Codeigniter frame work

It’s file name is “web.config

<?xml version=”1.0″ encoding=”UTF-8″?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name=”Imported Rule 1″ stopProcessing=”true”>
<match url=”^(.*)$” ignoreCase=”false” />
<conditions logicalGrouping=”MatchAll”>
<add input=”{REQUEST_FILENAME}” matchType=”IsFile” ignoreCase=”false” negate=”true” />
<add input=”{REQUEST_FILENAME}” matchType=”IsDirectory” ignoreCase=”false” negate=”true” />
</conditions>
<action type=”Rewrite” url=”index.php/{R:1}” />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>

September 4, 2010

Godaddy : Setting php varibles on IIS7 hosting

Filed under: admins,Godaddy,IIS,Windows 2008 — Liju Mathew @ 5:19 am

Yesterday I had requirement to change/modify certain php variable in Godaddy’s windows hosting. As far as familiar with Godaddy Linux hosting I know the both “php5.ini” file would work for the all the shared hosting. After modifying(created new file and aded entries) the php5.ini, the codignater site(which using php mssql extension) began to stop working.

I had referred many links, forums but seems nothing found to be working for me. Finally it would made me raising a ticket to Godaddy. Their reply was little funny and worth useless. They asked me to use “full php.ini: file in order to solve. but they didn’t hint any template, very sad 😦

I added some more entries and each time I got site down. During the continues trial ad error testing I found that whenever the php5.ini modification was happens, the required module ” mssql” wasn’t present on the info page. This would be the dirty issue causing all this.

Then added the extension dir path in ini file. Till after the moment I got the expected output.

You need to create “php5.ini” in your hosting root first and add the following entries in it,

This is your full php.ini file

[PHP]
asp_tags = Off
y2k_compliance = On
output_buffering = 4096
zlib.output_compression = Off
implicit_flush = Off
unserialize_callback_func=
serialize_precision = 100
disable_functions =
disable_classes =
expose_php = Off
max_execution_time = 1200
max_input_time = 1200
memory_limit = 200M
display_errors = On
display_startup_errors = Off
log_errors_max_len = 1024
ignore_repeated_errors = Off
ignore_repeated_source = Off
report_memleaks = On
track_errors = Off
variables_order = “GPCS”
register_globals = Off
register_long_arrays = On
register_argc_argv = Off
auto_globals_jit = On
post_max_size = 8M
magic_quotes_gpc = Off
magic_quotes_runtime = Off
magic_quotes_sybase = Off
auto_prepend_file =
auto_append_file =
default_mimetype = “text/html”
doc_root =
user_dir =
enable_dl = On
file_uploads = On
upload_max_filesize = 50M
allow_url_fopen = Off
allow_url_include = Off
default_socket_timeout = 60
upload_tmp_dir=”D:\Temp\php”
session.save_path=”D:\TEMP\PHP”
log_errors=On
extension_dir=”c:\php5\ext”
[mail function]
; For Win32 only.
SMTP = relay-hosting.secureserver.net
smtp_port = 25
[SQL]
sql.safe_mode = Off
[ODBC]
odbc.allow_persistent = On
odbc.check_persistent = On
odbc.max_persistent = -1
odbc.max_links = -1
odbc.defaultlrl = 4096
odbc.defaultbinmode = 1
[MySQL]
mysql.allow_persistent = On
mysql.max_persistent = -1
mysql.max_links = -1
mysql.default_port =
mysql.default_socket =
mysql.default_host =
mysql.default_user =
mysql.default_password =
mysql.connect_timeout = 60
mysql.trace_mode = Off
[MySQLi]
mysqli.max_links = -1
mysqli.default_port = 3306
mysqli.default_socket =
mysqli.default_host =
mysqli.default_user =
mysqli.default_pw =
mysqli.reconnect = Off
[mSQL]
msql.allow_persistent = On
msql.max_persistent = -1
msql.max_links = -1
[OCI8]

[Session]
session.save_handler = files
session.use_cookies = 1
session.name = PHPSESSID
session.auto_start = 0
session.cookie_lifetime = 0
session.cookie_path = /
session.cookie_domain =
session.cookie_httponly =
session.serialize_handler = php
session.gc_probability = 1
session.gc_divisor = 1000
session.gc_maxlifetime = 1440
session.bug_compat_42 = 0
session.bug_compat_warn = 1
session.referer_check =
session.entropy_length = 0
session.entropy_file =
session.cache_limiter = nocache
session.cache_expire = 180
session.use_trans_sid = 0
session.hash_function = 0
session.hash_bits_per_character = 5
[MSSQL]
mssql.allow_persistent = On
mssql.max_persistent = -1
mssql.max_links = -1
mssql.min_error_severity = 10
mssql.min_message_severity = 10
mssql.compatability_mode = Off
mssql.secure_connection = Off
[soap]
soap.wsdl_cache_enabled=1
soap.wsdl_cache_dir=”D:\Temp\php”
soap.wsdl_cache_ttl=86400
[PHP_BZ2]
extension=php_bz2.dll
[PHP_CURL]
extension=php_curl.dll
[PHP_GD2]
extension=php_gd2.dll
[PHP_GETTEXT]
extension=php_gettext.dll
[PHP_MCRYPT]
extension=php_mcrypt.dll
[PHP_MYSQL]
extension=php_mysql.dll
[PHP_MYSQLI]
extension=php_mysqli.dll
[PHP_OPENSSL]
extension=php_openssl.dll
[PHP_PDO]
extension=php_pdo.dll
[PHP_PDO_MYSQL]
extension=php_pdo_mysql.dll
[PHP_SOAP]
extension=php_soap.dll
[PHP_SOCKETS]
extension=php_sockets.dll
[PHP_SQLITE]
extension=php_sqlite.dll
[PHP_XSL]
extension=php_xsl.dll
[PHP_ZIP]
extension=php_zip.dll
[PHP_MSSQL]
extension=php_mssql.dll

That’s it

Pls modify your custom variables and note that ” extension_dir path and “temp-upload-dir” which should be same as showing on the initial php variables.

August 31, 2010

Amazon : Configuring software RAID 0 on Windows 2008

Filed under: admins,Amazon EC2,Windows 2008 — Liju Mathew @ 6:24 pm

One of my Amazon client demands that he wants to use the large instance (ephemeral) storage and should be boosted to get the maximum preformance on disk I/O operations.

Basically instance storage in Windows AMI can be enable only by starting the instance from the command line. Now my two of 420GB drives are joined as 840GB single drive after the stripping. Here are the screen shots to how to do that,


August 14, 2010

Configure relay SMTP server on Windows 2008

Filed under: admins,Windows,Windows 2008 — Liju Mathew @ 1:05 am

I have a Windows 2008 server and installed Apache as web server for my php projects. Some application uses email functionality to send subscriptions email and welcome mails.

But the default server configuration did not send the email from the server even though I installed SMTP service integrated with the server.

You may need to do two things,
1. Install SMTP service
2. Enable relay on SMTP service

The following screen shots will help you to do that.

a. Open the server manager and add the role–> choose SMTP server and install.

Now we need to enable the smtp relay in it.

It the time to check mail relay is enabled. Pls note that we are enabled email relay only from the server. If you want to use this server as relay server for your network, You must add your static ip. So all the mails are relayed through this server.

July 27, 2010

Enable ICMP request accepting on Windows 2008 server

Filed under: Windows,Windows 2008 — Liju Mathew @ 11:00 pm

My local server showing down status on Nagios even though it is live. I have enable the firewall and I did not find any option to enable ICMP request on firewall so quickly ( I’m newbie to 2008 server series 🙂

During the goofgle search I found a simple command does everything fine rather than search and finding using mouse.

There is two way,

1. open the command window and execute the command
C:>netsh firewall set icmpsetting 8
for disabling $ netsh firewall set icmpsetting 8 disable

2. Run–>firewall.cpl –> windows firewall with additional security–>
enable “file and printer sharing (ICMP requestv4)

Blog at WordPress.com.