-- EumedUser - 2010-11-29
  • Step 1 : Machine preparation

- CA Machine or CA Server (offline)

With security measurements that should be defined in CPS, it must be all time not connected to any network.
It's a CA Server which sign certificates.
It can be a simple machine, it doesn't need a lot of resources as CPU or RAM ( a simple machine with 512G of RAM and Pentium 4 can be enough)

It offers 2 access modes :

--> CA interface
--> Node interface

- RA Machine or RA Server (online)

It's the web server machine witch hosting the online services of OpenCA .
It's the RA Server witch allow to users to request certificates and retrieve them, and also offers the RA service for approving requests and handling certificates
It can be a simple machine, it doesn't need a lot of resources as CPU or RAM ( a simple machine with 512G of RAM and Pentium 4 can be enough)

It offers 3 access modes :

--> Pub interface
--> RA interface
--> Node interface

NB : these machines should not hosting any other services, they should be dedicated to only CA services for security measurements.

  • Step 2 : OS installation

The installation based on CentOS distribution of Linux (http://www.centos.org)

If your choice is CentOS 5 or 6 , you can check this URL(http://www.centos.org/product.html) for hardware requirements (In our case Morocco we installed the 6.4 / 64bits architecture)

Otherwise you can check this URL(http://www.openca.org/projects/openca/downloads.shtml) and you can choose the OS depending the version of openca you want to install.

The following will be based on CentOS 6.4 / 64bits Architecture

During the installation of OS, it's important to install some packages (graphical mode, PERL package, MySQL server and MySQL-devel, and other ordinary packages of course).
When you configure hostname and IP for RA machine according to your CP/CPS (IP and hostname should be declared in DNS as public IP Ex : ra.magrid.ma), the CA machine must be offline so IP and hostname in really shoud be a local adress, but to avoid some issues in the post configuration, It's it is desirable to do the same installation in the two machines (with the same IP and hostname, and only one machine can be connected to network at the moment of the configuration),

Genarraly we begin with the CA Server, and the OS installation and the configuration is the same of the RA machine.

  • Step 3 : OpenCA installation

Create OpenCA user

useradd openca

Prerequisite packages and modules

Now we need to install some prerequisites on both of the installations:
Login as root and type:

yum install gpg ftp links make unzip openssl-devel expat-devel httpd mod_ssl mysql-server perl-CPAN

to install required packages. Also we need some Perl modules. I am using the CPAN directory for this. You may be able to find a CentOS repository with the according rpms.

perl -MCPAN -e shell              
install CGI::Session
install Convert::ASN1
install Digest::MD5
install Digest::SHA1
install Digest::SHA256
install Encode::Unicode
install IO::Socket::SSL
install IO::Stringy
install MIME::Base64
install MIME::Lite
install MIME::Tools
install MailTool
install Net::Server
install URI
install XML::Twig
install XML::SAX::Base
install Digest::HMAC
install Authen::SASL 
install Net::SSLeay
install GUIDO/libintl-perl-1.23.tar.gz      //Maybe changed you have to find the latest one --> tape: i /libintl-perl/
install M/MA/MARSCHAP/perl-ldap-0.64.tar.gz     //Maybe changed you have to find the latest one --> tape: i /perl-ldap/

Hosts config

edit /etc/hosts

Change this file and add your machine hostname like this:

# Do not remove following line,or various programs
#that require network Functionality will fail    localhost.localdomain    localhost
X.X.X.X     ra.marwan.ma          ra 

Apache config

edit /etc/httpd/conf/httpd.conf

Change this line to your hostname:

ServerName ra.marwan.ma

configure apache server to launch at restart :

chkconfig httpd on

MySQL config

Init mysql:


if using centos 5 , Fix a CentOS MySQL bug:

edit /etc/my.cnf

In the section mysqld add the following line:


Start daemon:

service mysqld start

Set root password:

mysqladmin -u root password 'new_password'
mysqladmin -u root -h your_hostname password 'new_password'

Create database and change permissions for openca:

mysql -p
create database openca;
GRANT create,drop,select,delete,insert,update ON openca.* TO 'openca_u'@'localhost' IDENTIFIED by 'database_password';
FLUSH privileges;

configure MySQL server to launch at restart :

chkconfig mysqld on

Install OpenCA package

Now we have to configure the openca tools package:

wget ftp://www.cnrst.ma/pub/openca/openca-tools-1.3.0.tar.gz
tar xvzf openca-tools-1.3.0.tar.gz
cd openca-tools-1.3.0

./configure –-prefix=/opt/openca –-exec-prefix=/opt/openca –-with-openca-prefix=/opt/openca –-with-openca-user=openca –-with-openca-group=openca

then install the openca tools package:

make install 

Now for the OpenCA ! application itself. Download and uncompress package:

wget ftp://www.cnrst.ma/pub/openca/openca-base-1.5.0.tar.gz
tar xvzf openca-base-1.5.0.tar.gz

Configure and install OpenCA :

We install openca in the directory /opt/openca

cd openca-base-1.5.0

./configure –-prefix=/opt/openca –-exec-prefix=/opt/openca –-with-openca-prefix=/opt/openca –-with-openca-user=openca –-with-openca-group=openca -–with-module-prefix=/opt/openca/modules –with-web-host=ra.marwan.ma --with-httpd-user=apache –-with-httpd-group=apache -–with-openca-tools-prefix=/opt/openca



Now, depending on whether you want to install the offline or online service you have to execute

make install-offline


make install-online

Now we install a few helper scripts (it seems there is a bug and they are not installed by default):

cd src/scripts
make install

Edit: After installing the above command also does not work anymore. You'll have to copy the scripts in this directory manually to /opt/openca/bin and change owner and permissions.

Start OpenCA at boottime

create the file /etc/init.d/openca and put the following in it:

# chkconfig: 345 75 55
# description: OpenCA Server

cd /opt/openca/etc/openca  || exit 1
case "$1" in
        echo -n "Starting OpenCA ... "
        echo OK
        echo "Shutting down OpenCA ... "
        $0 stop
        $0 start
    echo "Usage: $0 {start|stop|restart}"
    exit 1

or copy the one provided

ln -s /opt/openca/etc/init.d/openca /etc/init.d/openca

Now the install part of the OpenCA package is finished. Now we have to go to the configuration step.

  • Step 4 : OpenCA configuration (for both offline and online machines)

Edit config.xml (You can downlaod the files andthen changes the values)

We have to edit the file /opt/openca/etc/openca/config.xml in order to make changes to the default OpenCA configuration. These are the parts I edited (the complete config file is attached on this page):

First we set the name of the organization the CA is set up for:

   <value>MARWAN CA</value>

And the country the CA is located in:


These two values are the first two tokens of the DN a certificate of this CA is going to have.
Now we change the way the mail server is invoked:

<value>/usr/lib/sendmail -t </value>

What is the ca email address?


A link to your CA's policy:


The value must be the same as indicated in the CP/CPS, be careful!!
Here is the database configuration:

            <!-- you can use DB or DBI -->
               a namespace is prefix in front of every table
               Example: table user1
                        select * from user1.certificate;
               This is not required for MySQL, PostgreSQL and IBM DB2.
               Nevertheless all supported database can use such namespaces
               and it is the default behaviour of Oracle. Oracle uses as
               namespace usually the name of the database.

We need activate LOAS (Levels of Authentication):


Now for a very important part, the dataexchange. For the Ofline machine comment the "no dataexchange configuration" and uncomment the "acts as CA only" section. For the Online machine also comment the "no dataexchange configuration" but uncomment the "acts as RA only" section.

We also have to configure the way we exchage data between Offline and Online machine (will add details later).


You can dowmlaod the config.xml for the 2 machine (they will be availaibles as soon as possible) :

in CA Machine
wget ftp://serv1.marwan.ma/pub/packages/config_CA.xml
mv /opt/openca/etc/openca/config.xml /opt/openca/etc/openca/config_back.xml 
mv config_CA.xml /opt/openca/etc/openca/config.xml

in RA Machine
wget ftp://serv1.marwan.ma/pub/packages/config_RA.xml
mv /opt/openca/etc/openca/config.xml /opt/openca/etc/openca/config_back.xml 
mv config_RA.xml /opt/openca/etc/openca/config.xml

When you are finished editing config.xml you have to apply the content of config.xml to the appropriate templates to create the "real" config files:

cd /opt/openca/etc/openca

Other stuff

Fix log file permission:

chown -R apache:apache /opt/openca/var/openca/log/

Configure the Offline machine

OK. Now is the time to start the openca service for the first time and use the web interface:

service openca start

Point your browser to https://your_hostname/ca. You will be prompted to trust a server certificate. This certificate was created when installing the apache package and it is self-signed. We will exchange it later. Trust it for now.

Login with the default login/password root/root.

At this stage if every think is Ok you shoud access the CA interface of OpenCA

Next configuration will be availaible as soon as possible !!!

Topic attachments
I Attachment Action Size Date Who Comment
xmlxml config.xml manage 32.6 K 2011-01-21 - 15:33 EumedUser  
Topic revision: r10 - 2015-02-19 - 14:11:43 - EumedUser
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback