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:Enabling SSL

From In-Portal Developers Guide

(Difference between revisions)
Jump to: navigation, search
Line 26: Line 26:
|-
|-
| [[K4:Configuration#Require_SSL|Require_SSL]]<br><code>Require SSL for login & checkout</code>
| [[K4:Configuration#Require_SSL|Require_SSL]]<br><code>Require SSL for login & checkout</code>
-
| Включение SSL режима для страниц сайта, где в html коде шаблона прописан тег <code><inp2:m_CheckSSL mode="required" condition="Require_SSL"/></code>
+
| Turns on SSL mode for site pages where, in the html code of the templates, there is the tag <code><inp2:m_CheckSSL mode="required" condition="Require_SSL"/></code>
|-
|-
| [[K4:Configuration#Force_HTTP_When_SSL_Not_Required|Force_HTTP_When_SSL_Not_Required]]<br><code>Redirect to HTTP when SSL is not required</code>
| [[K4:Configuration#Force_HTTP_When_SSL_Not_Required|Force_HTTP_When_SSL_Not_Required]]<br><code>Redirect to HTTP when SSL is not required</code>
-
| Эта опция нужна для того, чтобы при переходе со страницы с включенным SSL протоколом на страницу без SSL, происходил автоматический переход на адрес без https.
+
| 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.
|-
|-
| [[K4:Configuration#UseModRewriteWithSSL|UseModRewriteWithSSL]]<br><code>Enable MOD_REWRITE for SSL</code>
| [[K4:Configuration#UseModRewriteWithSSL|UseModRewriteWithSSL]]<br><code>Enable MOD_REWRITE for SSL</code>
-
| Если пользовательская часть сайта использует технологию MOD_REWRITE, то можно (но не обязательно) включить данную опцию, для того, чтобы в SSL-режиме тоже строились MOD_REWRITE ссылки.
+
| 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.  
|}
|}
-
Для перехода в SSL-режим и обратно на шаблонах следует использовать тэг '''<code>m_CheckSSL</code>'''. Его рекомендуется ставить в начале шаблона или после тэга <code>m_RequireLogin</code>, когда таковой используется. Ниже приведён пример использования данного тега в шаблоне:
+
To switch into SSL-mode and back on templates, the '''<code>m_CheckSSL</code>''' tag must be used. It's recommended to put the tag at the beginning of the template or after the <code>m_RequireLogin</code> tag, when this tag is used. Below is an example of using this tag in a template:
<source lang="xml">
<source lang="xml">
<inp2:m_CheckSSL mode="required"/>
<inp2:m_CheckSSL mode="required"/>
-
<inp2:m_include template="inc/header"/> // внутри шаблона "inc/header" должен быть тэг <inp2:m_CheckSSL/>
+
<inp2:m_include template="inc/header"/> // inside the template "inc/header" there must be the tag <inp2:m_CheckSSL/>
HTML Code
HTML Code
<inp2:m_include template="inc/footer"/>
<inp2:m_include template="inc/footer"/>
</source>
</source>
-
Описание параметров тега <code>m_CheckSSL</code>:
+
Description of the <code>m_CheckSSL</code> tag parameters:
{| class="prettytable"
{| class="prettytable"
-
! название || описание
+
! name || description
|-
|-
-
| {{ConfigProperty|mode|string}} || Если указать "<code>required</code>" в качестве значения данного параметра, то шаблон будет помечен, как требующий наличия SSL-режима для своей корректной работы. Если потом зайти на этот шаблон не из SSL-режима, то будет автоматически включён SSL-режим. Если параметр не указывать или указать пустое значение, то произойдёт обратное действие.
+
| {{ConfigProperty|mode|string}} || If this parameter is set to "<code>required</code>", 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.
|-
|-
-
| {{ConfigProperty|for_logged_in_only|int}} || Если указать данный параметр, то SSL-режим будет включаться только для авторизованных пользователей.
+
| {{ConfigProperty|for_logged_in_only|int}} || If this parameter is set, then SSL-mode will only turn on for authenticated users.
|-
|-
-
| {{ConfigProperty|condition|string}} || Название [[K4:Configuration|конфигурационной переменной]], значение которой нужно проверить перед тем, как разрешать переход в SSL-режим. Если указанная конфигурационная переменная отсутствует или выключена, то переход в SSL-режим осуществлён не будет. {{TipBox|Для пользовательской части сайта можно использовать конфигурационную переменную [[K4:Configuration#Require_SSL|Require_SSL]].}} Если планируется переключать некоторые части сайта в SSL-режим в зависимости от настроек конфигурации, то этот параметр является тем, что нужно.  
+
| {{ConfigProperty|condition|string}} || The name of the [[K4:Configuration|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.  
 +
{{TipBox|For the front-end, the [[K4:Configuration#Require_SSL|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.
|}
|}

Revision as of 02:49, 27 March 2009

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

Перед настройкой протокола нужно, что бы на сервере был установлен действительный (valid) SSL-сертификат. 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).

Общие положения - General Items??

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 the 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 the site 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.
Профиль пользователя в режиме SSL
Профиль пользователя в режиме SSL

Вот в принципе и все, после включения всех соответствующих опций и установки тэга m_CheckSSL можно считать настройку законченной. На приведённом слева изображении показана страница My Account, со включенным протоколом SSL. На ней также можно отчётливо видеть 2 корректных "SSL замочка", которые свидетельствуют о том, что защищённый режим установлен правильно. Если же эти "замочки" показаны с перечёркнутой линией, то это означает, что протокол не корректно установлен на сервере или время его действия истекло.

Предупреждение SSL сертификата
Предупреждение SSL сертификата
Возможна ситуация, когда браузер может, при попадании на страницу, показывать приведённое на изображении слева сообщение об ошибке. Как правило, такое сообщение можно увидеть тогда, когда на странице есть ссылка, которая прописана не через относительный путь, а через абсолютный и без указания факта использования протокола SSL. Чтобы этого избежать настоятельно рекомендуется все ссылки на элементы сайта (изображения, таблицы стилей и т.п.) формировать при помощи тэга m_TemplatesBase:
  • не правильно: <img src="http://www.youdomain.com/img/sample_image.gif" alt=""/>
  • правильно: <img src="<inp2:m_TemplatesBase/>/img/sample_image.gif" alt=""/>