In-Portal Developers Guide

This is a wiki-based Developers Guide for In-Portal Open Source CMS. The purpose of this guide is to provide advanced users, web developers and programmers with documentation on how to expand, customize and improve the functionality and the code the In-Portal software. Please consider contributing to our documentation writing effort.

K4:Как включить SSL-режим

From In-Portal Developers Guide

(Difference between revisions)
Jump to: navigation, search
(general fixes/updates)
Line 9: Line 9:
|}
|}
The above example shows how a browser window looks when a valid SSL-certificate is installed versus when an invalid SSL-certificate is installed (for example, because it was issued to a different site).
The above example shows how a browser window looks when a valid SSL-certificate is installed versus when an invalid SSL-certificate is installed (for example, because it was issued to a different site).
-
 
+
<br /><br />
-
== Общие положения - General Items?? ==
+
All [[K4:Configuration|configuration variables]] needed for configuring an SSL can be found in the section "<code>Configuration -> System Variables</code>" in the administrative console. It doesn't matter for which side of the site the SSL is being setup, a value for the configuration variable [[K4:Configuration#SSL_URL|SSL_URL]] ("<code><nowiki>SSL Full URL (https://www.domain.com/path)</nowiki></code>")  must always be entered.
All [[K4:Configuration|configuration variables]] needed for configuring an SSL can be found in the section "<code>Configuration -> System Variables</code>" in the administrative console. It doesn't matter for which side of the site the SSL is being setup, a value for the configuration variable [[K4:Configuration#SSL_URL|SSL_URL]] ("<code><nowiki>SSL Full URL (https://www.domain.com/path)</nowiki></code>")  must always be entered.
-
== SSL for the administrative console ==
+
== SSL for Administrative Console ==
[[Image:ssl_admin.jpg|thumb|left|Administrative console in SSL mode]]
[[Image:ssl_admin.jpg|thumb|left|Administrative console in SSL mode]]
To configure an SSL for the administrative console, the configuration variable [[K4:Configuration#Require_AdminSSL|Require_AdminSSL]] ("<code>Require SSL for Administrative Console</code>") must be turned on. Then, we press the <code>Save</code> button in the toolbar and exit the system (<code>logout</code>). On the login page, you should see what's circled on the image to the left. That's it - the protocol has been configured successfully for the administrative console. {{clear|left}}
To configure an SSL for the administrative console, the configuration variable [[K4:Configuration#Require_AdminSSL|Require_AdminSSL]] ("<code>Require SSL for Administrative Console</code>") must be turned on. Then, we press the <code>Save</code> button in the toolbar and exit the system (<code>logout</code>). On the login page, you should see what's circled on the image to the left. That's it - the protocol has been configured successfully for the administrative console. {{clear|left}}
-
== SSL for the site front-end ==
+
== SSL for Front-end ==
To configure an SSL for the front-end part of the site (user's side), a couple (depending on functionality of the site) of the following configuration variables must be turned on:  
To configure an SSL for the front-end part of the site (user's side), a couple (depending on functionality of the site) of the following configuration variables must be turned on:  

Revision as of 21:01, 30 March 2009

Настройка системы Настройка системы
Статьи в этой категории

Before configuring the protocol, a valid SSL-certificate must be installed on the server.

valid SSL-certificate invalid SSL-certificate
действительный SSL-сертификат не действительный SSL-сертификат

The above example shows how a browser window looks when a valid SSL-certificate is installed versus when an invalid SSL-certificate is installed (for example, because it was issued to a different site).

All configuration variables needed for configuring an SSL can be found in the section "Configuration -> System Variables" in the administrative console. It doesn't matter for which side of the site the SSL is being setup, a value for the configuration variable SSL_URL ("SSL Full URL (https://www.domain.com/path)") must always be entered.


SSL for Administrative Console

Administrative console in SSL mode
Administrative console in SSL mode

To configure an SSL for the administrative console, the configuration variable Require_AdminSSL ("Require SSL for Administrative Console") must be turned on. Then, we press the Save button in the toolbar and exit the system (logout). On the login page, you should see what's circled on the image to the left. That's it - the protocol has been configured successfully for the administrative console.

SSL for Front-end

To configure an SSL for the front-end part of the site (user's side), a couple (depending on functionality of the site) of the following configuration variables must be turned on:

configuration variable description
Require_SSL
Require SSL for login & checkout
Turns on SSL mode for site pages where, in the html code of the templates, there is the tag <inp2:m_CheckSSL mode="required" condition="Require_SSL"/>
Force_HTTP_When_SSL_Not_Required
Redirect to HTTP when SSL is not required
This option is needed so that there is an automatic redirect to an address without https when a user goes from a page with the SSL protocol to a page without SSL.
UseModRewriteWithSSL
Enable MOD_REWRITE for SSL
If the front-end uses MOD_REWRITE technology, then it's possible (but not required) to turn on MOD_REWRITE so that in SSL-mode links are also built using MOD_REWRITE.

To switch into SSL-mode and back on templates, the m_CheckSSL tag must be used. It's recommended to put the tag at the beginning of the template or after the m_RequireLogin tag, when this tag is used. Below is an example of using this tag in a template:

<inp2:m_CheckSSL mode="required"/>
<inp2:m_include template="inc/header"/> // inside the template "inc/header" there must be the tag <inp2:m_CheckSSL/>
HTML Code
<inp2:m_include template="inc/footer"/>

Description of the m_CheckSSL tag parameters:

name description
mode (string) If this parameter is set to "required", then the template will be marked as requiring an SSL to work correctly. If visiting this page while not in SSL-mode, then SSL-mode will be automatically turned on. If the parameter is not set or an empty value is set, then it'll have the opposite effect.
for_logged_in_only (int) If this parameter is set, then SSL-mode will only turn on for authenticated users.
condition (string) The name of the configuration variable, whose value must be checked before allowing a switch to SSL-mode. If this configuration variable is missing or turned off, then a change into SSL-mode will not happen.
Image:Tipbox Icon.gif For the front-end, the Require_SSL configuration variable can be used.
If the plan is to switch parts of a site into SSL-mode depending on configuration settings, then this is the parameter that's needed.
My Account in SSL mode
My Account in SSL mode

Basically, that's it, after turning on all corresponding options and setting up the m_CheckSSL tag, we can consider setup to be complete. On the left is an image of a My Account page with the SSL protocol turned on. On the page, we can see the 2 correct "SSL locks", that indicate that the protected mode has been setup properly. If these "locks" are shown with a line through them, then it means that the protocol wasn't setup correctly on the server or that it's expired.

[[Image:secure_warning.jpg|thumb|left|SSL certificate warning] It's possible that the browser, when loading a page, may show a warning like the one in the image on the left. As a rule, this kind of warning is shown when the page has a link that's not written using a relative path, instead using an absolute path and without the SSL protocol. To avoid this, it's strongly recommended to format all links to elements on the site (images, stylesheets, etc.) using the tag m_TemplatesBase:
  • incorrect: <img src="http://www.youdomain.com/img/sample_image.gif" alt=""/>
  • correct: <img src="<inp2:m_TemplatesBase/>/img/sample_image.gif" alt=""/>