天天看點

EJBCA 在windows上的安裝

為了做EJBCA的封裝測試,在我自己電腦上裝了個,但是在國内的開發上面的介紹實在是太少,有的也隻是些傻瓜式的安裝介紹,這是介紹在Windows上安裝的過程,(後面介紹下 linux 紅帽上的),有些也是在網上看看,有一些比較關鍵的地方 在下面會指出來:

推薦一個比較不錯的網址:https://sourceforge.net/p/ejbca/discussion/

EJBCA是一個基于J2EE技術的全功能的開源CA系統軟體,并提供了一個強大的、高性能并基于元件的CA。EJBCA兼具靈活性和平台獨立性,能夠獨立使用,也能和任何J2EE應用程式內建。

特性:網上很多 不說了。

使用的軟體清單(我自己在CSDN上上傳的):

J2SE6

jce_policy-6.zip

JDK 1.6 update 12和JCE Unlimited Strength Jurisdiction Policy Files 6 Release Candidate

JBoss:

JBoss-5.0.1.GA-jdk6 (注意請下載下傳JBoss-5.0.1.GA-jdk6.zip)  這個120兆太大了傳不了。

去官方網站轉了半天不知道再哪下載下傳,于是去了sourceforge。

EJBCA:

ejbca_4_0_10  

http://download.csdn.net/detail/liweifengwf/7391473

或者官網:

ANT:

apache-ant-1.8.4   

MySQL:

MySQL 5.1     

mysql-connector-java-5.1.7.zip   

安裝步驟:

1、安裝j2se6;

還有就是 解壓jce_policy,并将解壓後的jce_policy-1_4_2\jce中的local_policy.jar和US_export_policy.jar複

制,覆寫C:\Program Files\Java\j2re1.4.2_02\lib\security中的同名檔案。。

2、安裝mysql。使用者名密碼均為"root”。運作開始菜單裡的mysql command line client指令行工具,輸入密碼"root",并建立一個空資料庫ejbca,指令行為"create database ejbca;"。而後退出指令行工具,他會自己把需要的建好 不用操心。

3、解壓ejbca、jboss、ant到C槽根目錄下。

4、mysql的jar檔案,

把mysql-connector-java-5.1.7.zip裡的mysql-connector-java-5.1.7-bin.jar拷貝到%JBOSS_HOME%/server/default/lib目錄下。

5、設定環境變量。(這個就不用細說了,記得在配置好後 把cmd的視窗關了在打開)

JAVA_HOME = C:/Program Files/Java/jdk1.6.0_12

JBOSS_HOME = C:/jboss-5.0.1.GA

ANT_HOME = C:/apache-ant-1.7.1

ANT_OPTS = -Xmx640m

PATH = %JAVA_HOME%/BIN;%JBOSS_HOME%/BIN;%ANT_HOME%/bin;

CLASSPATH= %JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar;%JAVA_HOME%/lib;

6、運作jboss的run.bat。待jboss完全啟動後,在浏覽器中通路 ,出現jboss歡迎頁面便表示jboss成功運作。然後一定要停止jboss運作。

7.配置ejbca

将%EJBCA_HOME%/conf/ejbca.properties.sample 複制儲存為   %EJBCA_HOME%/conf/ejbca.properties

記得一定要修改ejbca.properties檔案下标紅地方

這個檔案中的下面紅色部分:

# To prevent accidental runs of tests or deploying the wrong thing in a production

# environment, we could prevent this by setting this variable to either "ca" or "ocsp"

ejbca.productionmode=ca

#ejbca.productionmode=ocsp

将%EJBCA_HOME%/conf/web.properties.sample,複制儲存為   %EJBCA_HOME%/conf/web.properties

将%EJBCA_HOME%/conf/database.properties.sample複制儲存為%EJBCA_HOME%/conf/database.properties

編輯database.properties如下 (主要是标色的地方下文中沒有‘#‘的幾行在原檔案中是有‘#‘,修改就是把‘#‘去掉)

# ------------- Database configuration ------------------------

# jndi name of the datasource to use in deployment descriptors of ejbs.

# default: EjbcaDS

#datasource.jndi-name=EjbcaDS

# Prefix for the jndi name of the datasource to use in deployment descriptors of ejbs. 

# JBoss requires ‘java:/‘ as prefix, while Weblogic does not want anything (‘‘), and Glassfish wants jdbc/

# Oracle usually uses jdbc/ as well.

# For Websphere use jdbc/.

# default: java:/

#datasource.jndi-name-prefix=java:/

#datasource.jndi-name-prefix=

#datasource.jndi-name-prefix=jdbc/

# Weblogic in combination with Oracle requires special handling of LONG/BLOB columns

# If, and only if, you are using Weblogic and Oracle, uncomment the row below.

# Use OracleBlob in Weblogic 8.x and Blob in Weblogic 9.x

# Note: This setting is not needed in Weblogic 9.2. Leave it commented out.

# default: 

#[email protected] Blob

# The database name selected for deployment, used to copy XDoclet merge files.

# All supported databases are defined below, others can easily be added

# See the document doc/howto/HOWTO-database.txt for database specifics and tips and tricks.

# Default: hsqldb

database.name=mysql

#database.name=postgres

#database.name=mssql2000

#database.name=oracle

#database.name=sapdb

#database.name=sybase

#database.name=informix

#database.name=derby

#database.name=db2

# The datasource mapping selected for deployment.

# The J2EE server needs to be configured with the appropriate datasource mapping. 

# For JBoss this maps to a setting in standardjbosscmp-jdbc.xml and must match the database chosen above.

# All supported mappings are defined below, others can easily be added

# Default: Hypersonic SQL

datasource.mapping=mySQL

#datasource.mapping=PostgreSQL 7.2

#datasource.mapping=PostgreSQL 8.0

#datasource.mapping=MS SQLSERVER2000

#datasource.mapping=Oracle8

#datasource.mapping=Oracle9i

#datasource.mapping=SapDB

#datasource.mapping=Sybase

#datasource.mapping=Informix92

#datasource.mapping=InformixDB

#datasource.mapping=Derby

#datasource.mapping=DB2

# Database connection url.

# This is the URL used to connect to the database, used to configure a new datasource in JBoss.

# Default: jdbc:hsqldb:${jboss.server.data.dir}${/}hypersonic${/}localDB

#database.url=jdbc:mysql://127.0.0.1:3306/ejbca

database.url=jdbc:mysql://127.0.0.1:3306/ejbca?characterEncoding=UTF-8

#database.url=jdbc:postgresql://127.0.0.1/ejbca

#database.url=jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=ejbca

#database.url=jdbc:oracle:thin:@127.0.0.1:1521:ejbca

#database.url=jdbc:datadirect:oracle://127.0.0.1:1521;SID=ejbca

#database.url=jdbc:informix-sqli://127.0.0.1:1525/ejbca:informixserver=mydbservername;DBDATE=DMY4/;

#database.url=jdbc:derby://127.0.0.1/ejbca;create=true

#database.url=jdbc:db2://127.0.0.1:50000/ejbca

# JDBC driver classname.

# The J2EE server needs to be configured with the appropriate JDBC driver for the selected database

# Default: org.hsqldb.jdbcDriver

database.driver=com.mysql.jdbc.Driver

#database.driver=org.postgresql.Driver

#database.driver=com.microsoft.jdbc.sqlserver.SQLServerDriver

#database.driver=oracle.jdbc.driver.OracleDriver

#database.driver=com.ddtek.jdbc.oracle.OracleDriver

#database.driver=com.informix.jdbc.IfxDriver

#database.driver=org.apache.derby.jdbc.ClientDriver

#database.driver=com.ibm.db2.jcc.DB2Driver

# Database username.

# Default: sa (works with hsqldb)

#database.username=ejbca

#database.username=postgres

database.username=root

# Database password.

# Default: (blank works with hsqldb)

#database.password=ejbca

#database.password=postgres

database.password=root

 配置完了,接下來就按下面的步驟走就行;

8.cmd到%EJBCA_HOME%目錄下,運作ant bootstrap,進行ejbca的編譯(如果是老的版本需要在編譯之後把C:\ejbca_4_0_10\dist下的ejbca.ear檔案拷到C:\jboss-5.1.0.GA\server\default\deploy目錄下,新版本會自動編譯進去的)。

EJBCA 在windows上的安裝

出現Total time 表明 編譯完成。

9、不用切換目錄,敲入start run.bat,啟動jboss控制台(會單獨起來一個視窗,這個jboss啟動的目錄不要關)。

EJBCA 在windows上的安裝
EJBCA 在windows上的安裝

出現Started in tIime 表明jboss啟動完成。

10、不用切換目錄,敲入ant install 進行ejbca的安裝(安裝會生成p12檔案,如無此檔案,檢查前幾步是否有漏項)。(注意)在jboss的啟動視窗如果出現JCE

cannot authenticate the provider BC錯誤,把%EJBCA_HOME%/lib/bc*.jar拷貝到%JBOSS_HOME%server/default/lib下。如下圖:

EJBCA 在windows上的安裝

安裝時候 注意jboss的啟動視窗的日志,出錯的時候 上面的比較清楚。

11、按一下Ctrl+C,停止JBOSS。

12、不用切換目錄,敲入ant deploy,進行ejbca的部署。

EJBCA 在windows上的安裝

出現Total time EJBCA安裝完成。

13、去%EJBCA_HOME%/p12下,安裝superadmin.p12證書,密碼為"ejbca"。

修改預設證書密碼:(修改預設密碼在%EJBCA_HOME%\conf\web.properties\superadmin.password=ejbca)

14、安裝成功。

cmd到%EJBCA_HOME%目錄下,運作run.bat啟動JBOSS。

在ie位址欄中敲入https://localhost:8443/ejbca/administrator出現證書選擇對話框,選擇SuperAdmin證書後出現管理控制台頁面:

EJBCA 在windows上的安裝