[SR-Users] help with tls error :sslv3 alert bad certificate

peter_green lion betergreen at live.com
Mon Sep 13 11:10:42 CEST 2010




> Date: Mon, 13 Sep 2010 10:38:34 +0200
> From: klaus.mailinglists at pernau.at
> To: betergreen at live.com
> CC: sr-users at lists.sip-router.org
> Subject: Re: [SR-Users] help with tls error :sslv3 alert bad certificate
> 
> Show us your complete TLS configuration
> 
> regards
> Klaus
> Am 09.09.2010 20:06, schrieb peter_green lion:
> > SSL alert number 40

hi Klaus and all,
my configure as:

first i install kamailio with mysql, db mysql and tls.

i configure kamailio to use mysql database , it work ok. i add 2 sip account :101/101 , 102/102.

i follow document tls module :http://www.kamailio.org/docs/modules/3.0.x/modules/tls.html#tls.overview

i make cert as :

Creating CA certificate
-----------------------
1. create CA dir
	mkdir ca
	cd ca
	
2. create ca dir structure and files  (see ca(1))
	mkdir demoCA #default CA name, edit /etc/ss/openssl.cnf
	mkdir  demoCA/private
	mkdir demoCA/newcerts
	touch demoCA/index.txt
	echo 01 >demoCA/serial
	
2. create CA private key
	openssl genrsa -out demoCA/private/cakey.pem 2048
	chmod 600 demoCA/private/cakey.pem
	
3. create CA self-signed certificate
	openssl req -out demoCA/cacert.pem   -x509 -new -key demoCA/private/cakey.pem


Creating a server/client certificate
------------------------------------
1. create a certificate request (and its private key in privkey.pem)
	openssl req -out ser1_cert_req.pem -new -nodes
   WARNING: the organization name should be the same as in the ca certificate.
	
2. sign it with the ca certificate
	openssl ca -in ser1_cert_req.pem -out ser1_cert.pem
	
3. copy ser1_cert.pem to your ser config. dir


Setting ser to use the certificate
----------------------------------
1. create the ca list file:
	for each of your ca certificates that you intend to use do:
		cat cacert.pem >>calist.pem
	
2. copy your ser certificate, private key and ca list file to your 
	intended machine (preferably in your ser cfg. directory, this is the 
	default place ser searches for)
	
3. set up ser.cfg to use the certificate
	if your ser certificate name is different from cert.pem or it is not
	placed in ser cfg. directory, add to your ser.cfg:
		modparam("tls", "certificate", "/path/cert_file_name")
	
4. set up ser to use the private key
	if your private key is not contained in the certificate (or the
	 certificate name is not the default cert.pem), add to your ser.cfg:
		modparam("tls", "private_key", "/path/private_key_file")
	
5. set up ser to use the ca list (optional)
	add to your ser.cfg:
		modparam("tls", "ca_list", "/path/ca_list_file")
	
6. set up tls authentication options:
		modparam("tls", "verify_certificate", 1)
		modparam("tls", "require_certificate", 1) 
	(for more information see the module parameters documentation)

as follow your link :http://www.kamailio.org/dokuwiki/doku.php/tls:create-certificates
i copy ser1_cert.pem, privkey.pem, cacert.pem to /usr/local/etc/kamailio
i transfer cacert.pem to another pc to add to sip certificate. 
i add some line in kamailio.cfg as bellow:

enable_tls=1


tcp_async=no


listen=tls:192.168.1.81:5060


modparam("tls", "tls_method", "TLSv1")

modparam("tls", "tls_method", "SSLv23")


modparam("tls", "certificate", "ser1_cert.pem")


modparam("tls", "private_key", "privkey.pem")


modparam("tls", "ca_list", "cacert.pem")


modparam("tls", "verify_certificate", 1)


modparam("tls", "require_certificate", 1)

i start kamailio ok. the log have line :

Sep  4 05:17:42 appliance /usr/local/sbin/kamailio[3103]: INFO: tls [tls_domain.c:175]: TLSc<default>: tls_method=9
Sep  4 05:17:42 appliance /usr/local/sbin/kamailio[3103]: INFO: tls [tls_domain.c:185]: TLSc<default>: certificate='/usr/local/etc/kamailio//tls/user/user-cert.pem'
Sep  4 05:17:42 appliance /usr/local/sbin/kamailio[3103]: INFO: tls [tls_domain.c:190]: TLSc<default>: ca_list='/usr/local/etc/kamailio//tls/user/user-calist.pem'
Sep  4 05:17:42 appliance /usr/local/sbin/kamailio[3103]: INFO: tls [tls_domain.c:193]: TLSc<default>: require_certificate=1
Sep  4 05:17:42 appliance /usr/local/sbin/kamailio[3103]: INFO: tls [tls_domain.c:198]: TLSc<default>: cipher_list='(null)'
Sep  4 05:17:42 appliance /usr/local/sbin/kamailio[3103]: INFO: tls [tls_domain.c:203]: TLSc<default>: private_key='/usr/local/etc/kamailio//tls/user/user-privkey.pem'
Sep  4 05:17:42 appliance /usr/local/sbin/kamailio[3103]: INFO: tls [tls_domain.c:206]: TLSc<default>: verify_certificate=1
Sep  4 05:17:42 appliance /usr/local/sbin/kamailio[3103]: INFO: tls [tls_domain.c:209]: TLSc<default>: verify_depth=9
Sep  4 05:17:42 appliance /usr/local/sbin/kamailio[3103]: INFO: tls [tls_domain.c:331]: TLSc<default>: Server MUST present valid certificate
Sep  4 05:17:42 appliance /usr/local/sbin/kamailio[3103]: WARNING: tls [tls_domain.c:395]: tls: set_ssl_options: openssl SSL_OP_TLS_BLOCK_PADDING bug workaround enabled (openssl version 90802f)
Sep  4 05:17:42 appliance /usr/local/sbin/kamailio[3116]: INFO: ctl [io_listener.c:224]: io_listen_loop:  using epoll_lt io watch method (config)

when i add certificate to 3CX phone, i register, the log in server is :

 SSL error:error:14094412:SSL routines:SSL3_READ_BYTES:sslv3 alert bad certificate.

so i thing my problem is the certificate,or the bug in opnessl, my openssl version is OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008i used QJsimple is have the same problem.

please help me to check it again or suggest what i do to fix it.
thanks and regards,
Peter Green.



 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20100913/5d7495ea/attachment.htm>


More information about the sr-users mailing list