Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to load the SSL privatekey? How to input the passphrase or configure it ?? #987

Closed
wy3148 opened this issue Nov 10, 2016 · 5 comments

Comments

@wy3148
Copy link

wy3148 commented Nov 10, 2016

When I tried to setup opensips wss/tls for webrtc testing, I got some error after I generated the necessary certificate and private key files,
error is like following:

Nov 9 23:35:25 localhost /usr/sbin/opensips[9706]: WARNING:tls_mgm:init_ssl_ctx_behavior: client verification NOT activated. Weaker security.
Nov 9 23:35:25 localhost /usr/sbin/opensips[9706]: NOTICE:tls_mgm:init_tls_domains: no crl for tls, using none
Nov 9 23:35:25 localhost /usr/sbin/opensips[9706]: NOTICE:tls_mgm:init_tls_domains: no CA for tls[0.0.0.0:0] defined, using default '(null)'
Nov 9 23:35:25 localhost /usr/sbin/opensips[9706]: NOTICE:tls_mgm:init_tls_domains: no CA for tls[0.0.0.0:0] defined, using default '/etc/pki/CA/'
Nov 9 23:35:25 localhost /usr/sbin/opensips[9706]: ERROR:tls_mgm:load_private_key: unable to load private key file '/etc/pki/CA/yyuserprivate.key'. #012Retry (2 left) (check password case)
Nov 9 23:35:25 localhost /usr/sbin/opensips[9706]: ERROR:tls_mgm:load_private_key: unable to load private key file '/etc/pki/CA/yyuserprivate.key'. #012Retry (1 left) (check password case)
Nov 9 23:35:25 localhost /usr/sbin/opensips[9706]: ERROR:tls_mgm:load_private_key: unable to load private key file '/etc/pki/CA/yyuserprivate.key'. #012Retry (0 left) (check password case)
Nov 9 23:35:25 localhost /usr/sbin/opensips[9706]: ERROR:tls_mgm:load_private_key: unable to load private key file '/etc/pki/CA/yyuserprivate.key'
Nov 9 23:35:25 localhost /usr/sbin/opensips[9706]: ERROR:core:init_mod: failed to initialize module tls_mgm

Nov 9 23:35:25 localhost /usr/sbin/opensips[9706]: ERROR:core:main: error while initializing modules
Nov 9 23:35:25 localhost /usr/sbin/opensips[9706]: INFO:core:cleanup: cleanup
Nov 9 23:35:25 localhost /usr/sbin/opensips[9706]: NOTICE:core:main: Exiting....
Nov 9 23:35:25 localhost opensips: INFO:core:daemonize: pre-daemon process exiting with -1

opensips version information is

version: opensips 2.2.2 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, F_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
git revision: d250e1c
main.c compiled on 01:48:22 Nov 2 2016 with gcc 4.4.7

my part of opensips.cfg is like

#set module path
mpath="/usr/lib64/opensips/modules"

loadmodule "proto_ws.so"
loadmodule "proto_wss.so"

loadmodule "tls_mgm.so"
modparam("tls_mgm", "tls_method", "TLSv1")
modparam("tls_mgm", "certificate", "/etc/pki/CA/yyuserca.pem")
modparam("tls_mgm", "private_key", "/etc/pki/CA/yyuserprivate.key")

@razvancrainea
Copy link
Member

You either have to start opensips interactively, so that you can input the passphrase of the private key, or simply, as @jarrodb mentioned on IRC, remove the passphrase:

mv /etc/pki/CA/yyuserprivate.key /etc/pki/CA/yyuserprivate.key.secure
openssl rsa -in /etc/pki/CA/yyuserprivate.key.secure -out /etc/pki/CA/yyuserprivate.key

@prathibhacdac
Copy link

facing the same issue. Generated the certificate using tls command.

@prathibhacdac
Copy link

unable to load private key file '/etc/opensips/tls/user/user-privkey.pem'. #012Retry (2 left) (check password case)
Sep 23 10:23:59 ip-172-31-34-24 /usr/sbin/opensips[171888]: ERROR:tls_openssl:load_private_key: unable to load private key file '/etc/opensips/tls/user/user-privkey.pem'. #012Retry (1 left) (check password case)
Sep 23 10:23:59 ip-172-31-34-24 /usr/sbin/opensips[171888]: ERROR:tls_openssl:load_private_key: unable to load private key file '/etc/opensips/tls/user/user-privkey.pem'. #012Retry (0 left) (check password case)
Sep 23 10:23:59 ip-172-31-34-24 /usr/sbin/opensips[171888]: ERROR:tls_openssl:tls_print_errstack: TLS errstack: error:05800074:x509 certificate routines::key values mismatch
Sep 23 10:23:59 ip-172-31-34-24 /usr/sbin/opensips[171888]: message repeated 2 times: [ ERROR:tls_openssl:tls_print_errstack: TLS errstack: error:05800074:x509 certificate routines::key values mismatch]
Sep 23 10:23:59 ip-172-31-34-24 /usr/sbin/opensips[171888]: ERROR:tls_openssl:load_private_key: unable to load private key file '/etc/opensips/tls/user/user-privkey.pem'

@prathibhacdac
Copy link

opensips is not working with self signed certificate.

@prathibhacdac
Copy link

prathibhacdac commented Sep 23, 2023

Now I'm using a certificate generated by letsencrypt. Still getting these errors.

ERROR:proto_wss:ws_parse_req_handshake: Invalid Connection header
Sep 23 11:13:48 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:proto_wss:wss_read_req: cannot complete WebSocket handshake
Sep 23 11:14:50 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:nathelper:fix_nated_contact_f: SCRIPT BUG - second attempt to change URI Contact
Sep 23 11:14:50 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:core:tcp_connect_blocking_timeout: poll error: flags 28 - 4 8 16 32
Sep 23 11:14:50 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:core:tcp_connect_blocking_timeout: failed to retrieve SO_ERROR [server=111.92.8.58:61509] (111) Connection refused
Sep 23 11:14:50 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:proto_wss:ws_sync_connect: tcp_blocking_connect failed
Sep 23 11:14:50 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:proto_wss:ws_connect: connect failed
Sep 23 11:14:50 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:proto_wss:proto_wss_send: connect failed
Sep 23 11:14:50 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:tm:msg_send: send() to 111.92.8.58:61509 for proto wss/6 failed
Sep 23 11:14:50 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:tm:t_forward_nonack: sending request failed
Sep 23 11:14:50 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:core:tcp_connect_blocking_timeout: poll error: flags 28 - 4 8 16 32
Sep 23 11:14:50 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:core:tcp_connect_blocking_timeout: failed to retrieve SO_ERROR [server=111.92.8.58:61636] (111) Connection refused
Sep 23 11:14:50 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:proto_wss:ws_sync_connect: tcp_blocking_connect failed
Sep 23 11:14:50 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:proto_wss:ws_connect: connect failed
Sep 23 11:14:50 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:proto_wss:proto_wss_send: connect failed
Sep 23 11:14:50 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:tm:msg_send: send() to 111.92.8.58:61636 for proto wss/6 failed
Sep 23 11:14:50 ip-172-31-34-24 /usr/sbin/opensips[172700]: ERROR:tm:t_forward_nonack: sending request failed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants