Setup OTW/SSL and InterBase
From InterBase
Go Up to Main Page
Contents
Before you begin
- The setup process requires OpenSSL for windows, you can obtain a compiled version here or you can obtain the source files here. Once you have a compiled version of OpenSSL place the files on the
c:\opensslfolder in the InterBase server you plan to use. - Download the file openssl.cnf here to self-sign the keys. Place the file on the
c:\openSSLfolder, backup and overwrite any existing file if necessary. - Create a folder called
c:\certs - Create an environment variable
OPENSSL_CONF=c:\openssl\openssl.cnf - Stop the InterBase server.
Generating a key
- Run CMD as an Administrator.
- Using the command line go to
c:\openssl - To generate a private key with password run:
openssl genrsa -aes256 -out c:\certs\key.pem 2048
- Type your password and verify it when asked.
- The file
key.pemis created in thec:\certsfolder.
Requesting a key
- To request a key, on the command line run:
openssl req -new -key c:\certs\key.pem -out c:\certs\csr.pem -config openssl.cnf
- Type the password you set previously.
- When asked for information, you don't need to be specific.
- Note: use
[email protected]as email because real emails can cause issues.
- Note: use
- The file
csr.pemis created in thec:\certsfolder.
Signing the key
- To sign the key request file with your private key, on the command line run:
openssl req -x509 -days 3650 -key c:\certs\key.pem -in c:\certs\csr.pem -out c:\certs\ibservercafile.pem
- type the password you set before.
- The file
ibservercafile.pemis created on thec:\certsfolder. Use this file on your clients.
Creating the server side file
- On the command line, go to the
c:\certsfolder. - Add ibservercafile to your private key file. On the command line run:
copy /b ibservercafile.pem + key.pem ibservercafileserver.pem
- The file
ibservercafileserver.pemis created on thec:\certsfolder. Your server requires this file for performing OTW encryption. - You can now close the CMD window.
Configuring InterBase
- Make sure the InterBase server is stopped.
- Search for the file
ibss_config.default. For example:C:\ProgramData\Embarcadero\InterBase\gds_db\secure\server - Open Notepad or other text editor as Administrator.
- Type the following text and use the password you set previously:
- IBSSL_SERVER_PORT_NO=4000
- IBSSL_SERVER_CERTFILE="c:\certs\ibservercafileserver.pem"
- IBSSL_SERVER_PASSPHRASE=<password>
- Note: This example uses port 4000 instead of the standard port 3065 for security reasons, you can use any free port.
- Save the file as
ibss_config.txtand place it in the same folder asibss_config.default - Go to the folder where
ibss_config.txtis located and rename it toibss_config(You may need to disable the "Hide extensions for known file types" option on the Windows folder settings) - Open a text editor as Administrator and open the file
serviceslocated in thec:\windows\system32\drivers\etcfolder. - Change
gds_db 3050/TCPtogds_db 3051/TCP, port 3050 is non encrypted. - Add the following line at the bottom:
gds_ssl 4000/tcp #InterBase SSL Server
- Note: Use the port number you set on previous steps.
- Save and close the file.
- Start InterBase server.
Note: On this example, port 3051 was closed on the firewall to prevent any unwanted unencrypted access and port 4000 was opened. Port 4000 is open only to IP addresses that needed it keeping it secure.
Remote connection with FireDAC
The following steps describe how to connect remotely with FireDAC in Delphi:
- Place
ibservercafile.pemandgds32.dllin your Delphi application directory. - Place
TFDconnectionandTFDPhysIBDriverLinkon your form. - Change the name of
TFDPhysIBDriverLinktoMyLink - Change
MyLinkDriverID property to MYIB - Change the
FDconnection1DriverName property to MYIB. Then put this in yourform.createevent. Don’t forget to change the name of your server(YOURSERVER) and database or database alias (YOURDATABASE):
procedure Tform1.FormCreate(Sender: Tobject); Var AppFolder : string; begin AppFolder:=ExtractFilePath(ParamStr(0)); FDConnection1.Params.Clear; FDConnection1.Params.add(‘server=YOURSERVER/4000?ssl=true?serverPublicFile=”’+ AppFolder + ‘ibservercafile.pem”??’); FDConnection1.Params.Database:=’:YOURDATABASE’; FDConnection1.Params.Add(‘Protocol=TCPIP’); FDConnection1.Params.UserName:=’sysdba’; FDConnection1.Params.Password:=’masterkey’; FDConnection1.Params.Add(‘CharacterSet=win1250’); FDConnection1.Params.Add(‘ExtendedMetadata=True’); FDConnection1.Params.DriverID:=’MyIB’; MyLink.VendorLib:=Appfolder + ‘gds32.dll’; FDConnection1.Connected:=true; end;