Porovnávané verzie

Kľúč

  • Tento riadok sa pridal
  • Riadok je odstránený.
  • Formátovanie sa zmenilo.

In this chapter, we will explain how to configure the connection on the D2000 application side for the Smartweb platform needs using examples. For communication between the SmartWeb application and D2000, the JAPI library is used which communicates with the D2Connector process on the D2000 side. To make use of this chapter, we need an active D2000 application (kernel at least) to which we can connect. Connection possibilities are divided into three categories and the possibilities from individual categories can be combined freely.

A connection can be established in two basic ways: 

  • Connection actively follows the SmartWeb server (basic way of connecting). It is a standard method, easier for usage and debugging and can be applied in every network in which the security policy allows it.
  • Connection actively follows D2Connector (reverse connection). This method is used when the SmartWeb server is located in a so-called "demilitarized zone" (DMZ) - it is a computer network segment with which you can establish connection also from a local intranet and from outside internet but you cannot establish any connection from DMZ outside. (Supported from the 10.1.39 version)

From the point of view of the wiretapping protection, you can establish: 

  • Unsecured connection. Although the JAPI protocol is binary, all texts are transmitted in a readable way. An unsecured connection is good when debugging or in the case when commConfiguration of the D2Connector Process for SmartWebunication between  D2Connector and JConnector runs in a secure network. 
  • Connection secured by the TLS v1.2 protocol. JAPI and D2Connectorcommunicate with each other by an encrypted protocol while D2Connector shows its identity by a certificate and a private key which JConnector compares with its own certificate. (Supported from the 10.1.39 version)

From the point of view of connection to "hot" kernel in a redundant group:

  • D2Connector always connects to the "hot" server
  • D2Connector is always connected to the same Kernel regardless of whether it is "hot" or "standby server". 

Parameters for Running D2Connector

D2Connector is a process of the D2000 system and it is distributed as a console application (d2connector.exe). It accepts standard parameters of D2000 processes for running from the command line which are described in the D2000 Online Reference Help. Besides, it accepts the following parameters of a command line

V tejto kapitole je na príkladoch vysvetlené, ako nakofigurovať spojenie na strane D2000 aplikácie pre potreby SmartWeb platformy. Na komunikáciu medzi SmartWeb aplikáciou a D2000 sa využíva JAPI knižnica ktorá komunikuje s procesom D2Connector na strane D2000. Predpokladom tejto kapitoly je aktívna D2000 aplikácia (prinajmenšom kernel), ku ktorej sa môžeme pripojiť. Spôsoby pripojenia sú rozdelené do troch kategórií, pričom možnosti z jednotlivých kategórií možno ľubovoľne kombinovať. 

Pripojenie je možné nadviazať dvomi základnými spôsobmi:

  • Spojenie aktívne nadväzuje SmartWeb server(základný spôsob pripojenia). Je to štandardný postup, jednoduchší na použitie a ladenie a je aplikovateľný všade tam, kde to bezpečnostná politika v miestnej sieti dovoľuje.
  • Spojenie aktívne nadväzuje D2Connector (reverzné pripojenie). Tento postup sa používa v prípade, že sa SmartWeb server nachádza v tzv. „demilitarizovanej zóne" (DMZ) – segmente počítačovej siete, do ktorej je možné nadviazať spojenie aj z lokálneho intranetu aj z vonkajšieho internetu, ale z DMZ von nie je možné nadviazať žiadne spojenie. (Podporované od verzie 10.1.39)

Z hľadiska zabezpečenia pred odpočúvaním je možné nadviazať:

  • Nezabezpečené spojenie. Hoci je JAPI protokol binárny, všetky texty sa prenášajú v čitateľnej podobe. Nezabezpečené spojenie je vhodné počas ladenia alebo v prípade, že komunikácia medzi D2Connector-om a JConnector om prebieha v bezpečnej sieti.
  • Spojenie zabezpečené protokolom TLS v1.2. JAPI D2Connector komunikujú šifrovaným protokolom, pričom D2Connector preukazuje svoju identitu certifikátom a privátnym kľúčom, ktorý JConnector porovná s certifikátom, ktorý vlastní on. (Podporované od verzie 10.1.39)

Z hľadiska pripojenia k „hot" kernel-u v redundantnej skupine:

  • D2Connector sa vždy pripája k „hot" serveru.
  • D2Connector je stále pripojený k tomu istému Kernel u bez ohľadu na to, či je „hot" alebo „stand-by server".

Parametre pre spustenie D2Connector-a

D2Connector je proces systému D2000 a je distribuovaný ako konzolová aplikácia (d2connector.exe). Akceptuje štandardné parametre procesov D2000 pre spustenie z príkazového riadku, ktoré sú popísané v Online referenčnej príručke systému D2000. Okrem toho akceptuje nasledovné parametre príkazového riadku:

  • --CONNECTOR_LISTEN_PORT=<port> - nastaví číslo TCP portu, na ktorom D2Connector počúva na prichádzajúce spojenie od JAPI. Ak nie je uvedené inak, počúva na porte 3120. (Parameter je ignorovaný, ak sa použije v kombinácii s --DCCit sets the number of the TCP port on which D2Connector listens for incoming connections from JAPI. If it is not stated differently, it will listen on the 3120 port. (The parameter will be ignored if the combination with --DCC is used)
  • --DCC=<hostname:port> - prepne D2Connector z režimu počúvania do režimu aktívneho pripájania sa na uvedenú adresu (DNS alebo IP) a port. Pokým sa mu nepodarí nadviazať spojenie, pokúša sa o to každých 30 sekúnd. Po ukončení spojenia sa opäť začne pokúšať o nadviazanie spojeniait switches D2Connector from the listening mode to the mode of active connecting to the given address (DNS or IP) and to a port. It tries to establish a connection every 30 seconds until it succeeds. After ending the connection, it again tries to establish one.
  • --CONNECTOR_TLS_CERT=<path.crt> - zapne TLS zabezpečenie a nastaví cestu k súboru s certifikátom vo formáte .crt.it turns on the TLS security and sets the path to the file with a certificate in the .crt format. 
  • --CONNECTOR_TLS_PK=<path.pem> - zapne TLS zabezpečenie a nastaví cestu k súboru s privátnym kľúčom k certifikátu vo formáte .pem. Obidva TLS parametre je potrebné použiť spolu.

D2Connector nadväzuje spojenie vždy len jedným spôsobom z ôsmych možných kombinácií. Tzn. buď sa aktívne pripája, alebo počúva, ale nie obidvoje naraz. Rovnako komunikuje buď nezabezpečeným alebo zabezpečeným spôsobom, ale nikdy neumožňuje obidva spôsoby súčasne. Buď je pripojený stále k jednému Kernel-u alebo sa prepína na aktuálny „hot". V prípade, že sa ku D2000 aplikácií pripája viac rôznych klientských aplikácií, ktoré vyžadujú rôzne spôsoby pripojenia, je potrebné naštartovať pre každý spôsob samostatnú inštanciu D2Connectora.

Základný spôsob pripojenia

Ide o nezabezpečené spojenie, ktoré iniciuje JAPI.

  • it turns on the TLS security and sets the path to the file with a private key to a certificate in the.pem format. Both TLS parameters have to be used together. 

D2Connector establishes connection only in one way from eight possible combinations. This means that it either actively connects or listens but not both at the same time. Similarly, it communicates either in unsecured or secured way but never in both ways at the same time. Either it is connected to one Kernel all the time or it switches to current "hot" one. In the case that more various client applications connect to the D2000 application and these client applications require different methods of connecting, it is necessary to run an individual instance of D2Connector for each method.

Basic Connection Method

It is an unsecured connection initiated by JAPI.

We can start D2Connector without parameters and it will listen to connection on the 3120 portD2Connector môžeme naštartovať bez parametrov a bude počúvať na pripojenie na porte 3120

Blok kódu
languagepowershell
themeEclipse
> d2connector.exe

alebo zmeniť počúvajúci port napríklad na or we can change the listening port to for example 3121:

Blok kódu
languagepowershell
themeEclipse
> d2connector.exe --CONNECTOR_LISTEN_PORT=3121

Nadviazanie reverzného spojenia

Ide o nezabezpečené spojenie medzi D2Connector-om a SmartWeb aplikáciou nachádzajúcou sa v DMZ, z ktorej nedokáže iniciovať TCP spojenie. Môže však počúvať na prichádzajúce TCP spojenie, ktoré bude iniciovať D2Connector.

Establishing a Reverse Connection

It is an unsecured connection between D2Connector  and the SmartWeb application located in the DMZ from which it cannot initiate the TCP connection. However, it can listen to upcoming TCP connection which will be initiated by D2Connector.

The client application is located on the computer Klientská aplikácia je umiestnená na počítači portal.dmz.customer.com a počúva na porte 3125 na všetkých svojich sieťových rozhraniach. D2Connector spustíme v režime pripájania sa and listens on the 3125 port on all of its network interfaces. We run D2Connector in the mode of connecting:

Blok kódu
languagepowershell
themeEclipse
> d2connector.exe --DCC=portal.dmz.customer.com:3125

Nadviazanie zabezpečeného spojenia

Establishing a Secure Connection

It is a connection between D2Connector  and JConnector secured by the Ide o spojenie medzi D2Connector-om a JConnector-om zabezpečené protokolom TLS v1.2 . Postup je podobný pre štandardné aj reverzné spojenie, príklad preto zahŕňa obidve možnosti.

Pre nadviazanie TLS spojenia je potrebné, aby bol jeden z účastníkov v roli „TLS servera" a druhý „TLS klienta", pričom tieto roly nie sú závislé na tom, kto inicioval TCP spojenie. „TLS server" sa preukazuje certifikátom, ku ktorému vlastní aj súkromný kľúč. „TLS klient" overuje platnosť certifikátu a pravosť kľúčov5. Pre JAPI je „TLS server" vždy D2Connector a „TLS klient" vždy JConnector.

Predpokladom pre vytvorenie zabezpečeného spojenia je, že máme RSA kľúčový pár a k nemu X.509 certifikát. Certifikát je uložený v súbore vo formáte *.crt a musí mať k jeho kópii prístup aj D2Connector aj JConnector. Privátny kľúč je uložený v nešifrovanej forme v súbore vo formáte *.pem a prístup k nemu musí mať iba JConnector. Vzhľadom k tomu, že JConnector považuje D2Connector za dôveryhodný iba na základe toho, že sa preukázal rovnakým certifikátom, ako očakával, použitý certifikát môže byť „self-signed" a nie je vôbec potrebné získať certifikát od nejakej certifikačnej autority.

Varovanie

POZOR: Z bezpečnostného hľadiska je veľmi dôležité, aby bol súbor s certifikátom uložený tak, aby ho nikto bez príslušného oprávnenia nemohol zmeniť. (Na čítanie môže byť verejný.) Takisto je veľmi dôležité, aby súbor so súkromným kľúčom mohol prečítať iba D2Connector a nikto ho nemohol zmeniť. V prípade porušenia týchto podmienok hrozí kompromitácia dôveryhodnosti certifikátu a otvára sa možnosť odpočúvania zabezpečenej komunikácie.

protocol. The process is similar for standard and reverse connections. That is why the example encompasses both possibilities. 

For establishing the TLS connection, it is necessary for one party to be in the role of the "TLS server" and the second party in the role of the "TLS client" while these roles are not dependent on who initiated the TCP connection. The "TLS server" shows a certificate to which it owns a personal key. The "TLS client" verifies the license validity and the key authenticity5. For JAPI, the "TLS server" is always D2Connector and the "TLS client" is always JConnector.

The requirement for creating a secure connection is that we have the RSA key pair and the X.509 certificate. The certificate is stored in the file in the *.crt format and both D2Connector and JConnector have to have access to its copies. The private key is stored in an unencrypted form in the file in the *.pem format and only JConnector has to have access to it.  Since JConnector considers D2Connector trustworthy only based on showing the certificate it expected, the used certificate can be "self-signed" and it is not necessary to acquire the certificate from some certification authority. 

Varovanie

WARNING: From security reasons, it is very important for the file with a certificate to be stored in such a way that no one without given permission could change it (it can be public for reading). It is also very important that the file with a private key could be read only by D2Connector and no one could change it. In a case of breaking these conditions, there is a danger of compromising the certificate's trustworthiness and there is a possibility of wiretapping of secured communication. 

It is necessary to run D2Connector with parameters D2Connector je potrebné spustiť s parametrami --CONNECTOR_TLS_CERT a  and --CONNECTOR_TLS_PK, ktoré odkazujú na súbory s certifikátom a súkromným kľúčom. V príklade je certifikát uložený v súbore certificate.crt a súkromný kľúč v súbore private.pem. Podľa potreby sa môže použiť aj parameter --DCC alebo  which refer to files with a certificate and a private key. In the example, the certificate is stored in the file certificate.crt and the private key in the file private.pem. According to the needs, also parameters  --DCC or --CONNECTOR_LISTEN_PORT can be used. 

Blok kódu
languagepowershell
themeEclipse
> d2connector.exe --CONNECTOR_TLS_CERT=certificate.crt --CONNECTOR_TLS_PK=private.pem

Vytvorenie certifikátu pre účely zabezpečeného spojenia

Creatinig a Certificate for Purposes of Secure Connection

For creating a "self-signed" certificate, it is possible to use for example the application OpenSSL from a command line. First, we have to create a key pair for the RSA code. In the example, we generate a 2048 bit key pair into the file Pre vytvorenie „self-signed" certifikátu je možné použiť napríklad aplikáciu OpenSSL z príkazového riadku. Najskôr musíme vytvoriť kľúčový pár pre RSA šifru. V príklade generujeme 2048 bitový kľúčový pár do súboru private.pem.

Blok kódu
languagepowershell
themeEclipse
> openssl.exe genrsa -out private.pem 2048

Ku kľúčovému páru vytvoríme „Certificate Signing Request" žiadosť o vystavenie certifikátu, ktorá bude uložená v súbore To the key pair, we create a "Certificate Signing Request" request for drawing certificate that would be stored in the file request.csr. OpenSSL sa opýta na viaceré údaje, ktoré zapíše do žiadosti a ktoré budú vo výslednom certifikáte uvedené. JAPI však tieto údaje neskúma a nekontroluje.queries more data which it writes into the request and which will be stated in the final certificate. However, JAPI does not examine or check this data. 

Blok kódu
languagepowershell
themeEclipse
> openssl.exe req -new -key private.pem -out request.csr

Následne podpíšeme žiadosť vygenerovaným súkromným kľúčom, čím z neho vytvoríme „selfsigned" certifikát, ktorý bude v súbore certificate.crt. Certifikát bude mať platnosť 365 dní počínajúc aktuálnym časom.Then, we sign the request by a generated private key. This way, we create "selfsigned" certificate that will be located in the file certificate.crt. The certificate will be valid for 365 days starting with the current time. 

Blok kódu
languagepowershell
themeEclipse
> openssl.exe x509 -req -days 365 -in request.csr -signkey private.pem -out certificate.crt

...