后台日志出现
2023-08-30T16:38:10.720015+08:00 [error] State machine <0.3073.0> terminating. Reason: function_clause. Stack: [{public_key,pkix_decode_cert,[[],otp],[{file,“public_key.erl”},{line,516}]},{ssl_handshake,get_cert_params,1,[{file,“ssl_handshake.erl”},{line,1764}]},{tls_handshake_1_3,get_certificate_params,1,[{file,“tls_handshake_1_3.erl”},{line,2450}]},{tls_handshake_1_3,select_server_cert_key_pair,7,[{file,“tls_handshake_1_3.erl”},{line,3013}]},{tls_handshake_1_3,do_start,2,[{file,“tls_handshake_1_3.erl”},{line,678}]},{tls_connection_1_3,do_server_start,2,[{file,“tls_connection_1_3.erl”},{line,578}]},{gen_statem,loop_state_callback,11,[{file,“gen_statem.erl”},{line,1426}]},{tls_connection,init,1,[{file,“tls_connection.erl”},{line,160}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]. Last event: {internal,{client_hello,{3,3},<<161,131,184,16,61,247,166,146,248,243,103,248,151,155,205,29,208,111,116,210,30,35,247,174,175,166,75,102,118,158,73,198>>,<<192,238,81,74,236,158,174,37,144,234,190,40,242,106,162,45,180,110,199,164,166,111,116,74,152,105,155,223,11,92,27,146>>,undefined,[<<19,3>>,<<19,1>>,<<19,2>>,<<“À/”>>,<<“À+”>>,<<“À0”>>,<<“À,”>>,<<204,169>>,<<204,168>>,<<“À\t”>>,<<192,19>>,<<“À\n”>>,<<192,20>>,<<0,156>>,<<0,157>>,<<0,47>>,<<0,53>>,<<0,10>>],[0],#{alpn => undefined,certificate_authorities => undefined,client_hello_versions => {client_hello_versions,[{3,4},{3,3}]},cookie => undefined,ec_point_formats => {ec_point_formats,[0]},elliptic_curves => {supported_groups,[x25519,secp256r1,secp384r1]},key_share => {key_share_client_hello,[{key_share_entry,x25519,<<198,150,156,131,212,157,191,92,33,137,234,107,11,41,80,29,199,217,102,135,99,135,108,124,252,196,181,242,180,162,3,80>>}]},pre_shared_key => undefined,psk_key_exchange_modes => {psk_key_exchange_modes,[psk_dhe_ke]},renegotiation_info => {renegotiation_info,<<0>>},signature_algs => {signature_algorithms,[ecdsa_secp256r1_sha256,rsa_pss_rsae_sha256,rsa_pkcs1_sha256,ecdsa_secp384r1_sha384,rsa_pss_rsae_sha384,rsa_pkcs1_sha384,rsa_pss_rsae_sha512,rsa_pkcs1_sha512,rsa_pkcs1_sha1]},signature_algs_cert => undefined,sni => undefined}}}. State: [{data,[{“State”,{start,{state,{static_env,server,gen_tcp,tls_gen_connection,tcp,tcp_closed,tcp_error,tcp_passive,“localhost”,8883,#Port<0.29>,#Ref<0.1124696735.1199177733.987>,no_longer_defined,ssl_server_session_cache_db,{ssl_crl_cache,{{#Ref<0.1124696735.1199177733.990>,#Ref<0.1124696735.1199177733.991>},[]}},{#Ref<0.1124696735.1199177733.988>,#Ref<0.1124696735.1199177733.989>},#Ref<0.1124696735.1199046664.2247>,[{session_id_tracker,<0.3042.0>}]},“",#{sni_hosts => [],dhfile => undefined,alpn_preferred_protocols => undefined,hibernate_after => 5000,client_renegotiation => true,receiver_spawn_opts => [],next_protocol_selector => undefined,server_name_indication => undefined,cert => "”,honor_cipher_order => true,verify => verify_none,max_handshake_size => 262144,log_level => notice,renegotiate_at => 268435456,supported_groups => {supported_groups,[x25519,x448,secp256r1,secp384r1]},sni_fun => undefined,verify_fun => {#Fun<ssl.12.97316091>,[]},crl_check => false,dh => “",psk_identity => "”,anti_replay => undefined,cookie => true,signature_algs_cert => undefined,partial_chain => #Fun<ssl.11.97316091>,reuse_session => #Fun<ssl.13.97316091>,certificate_status => undefined,crl_cache => {ssl_crl_cache,{internal,[]}},cacerts => “",alpn_advertised_protocols => undefined,certificate_authorities => true,protocol => tls,sender_spawn_opts => [],signature_algs => [eddsa_ed25519,eddsa_ed448,ecdsa_secp521r1_sha512,ecdsa_secp384r1_sha384,ecdsa_secp256r1_sha256,rsa_pss_pss_sha512,rsa_pss_pss_sha384,rsa_pss_pss_sha256,rsa_pss_rsae_sha512,rsa_pss_rsae_sha384,rsa_pss_rsae_sha256,{sha512,ecdsa},{sha512,rsa},{sha384,ecdsa},{sha384,rsa},{sha256,ecdsa},{sha256,rsa},{sha224,ecdsa},{sha224,rsa},{sha,ecdsa},{sha,rsa},{sha,dsa}],ocsp_responder_certs => [],early_data => undefined,ocsp_stapling => false,depth => 10,key => "”,session_tickets => disabled,middlebox_comp_mode => true,cacertfile => <<>>,user_lookup_fun => {fun emqx_tls_psk:lookup/3,undefined},fallback => undefined,honor_ecc_order => false,padding_check => true,customize_hostname_check => [],fail_if_no_peer_cert => false,beast_mitigation => one_n_minus_one,key_update_at => 388736063997,eccs => {elliptic_curves,[{1,3,132,0,35},{1,3,132,0,34},{1,3,132,0,10},{1,2,840,10045,3,1,7},{1,3,132,0,33}]},password => “",handshake => full,erl_dist => false,srp_identity => "”,certfile => <<>>,next_protocols_advertised => undefined,keep_secrets => false,ciphers => [<<19,2>>,<<19,1>>,<<19,3>>,<<19,4>>,<<19,5>>,<<“À,”>>,<<“À0”>>,<<“À$”>>,<<“À(”>>,<<“À.”>>,<<“À2”>>,<<“À&”>>,<<“À*”>>,<<0,163>>,<<0,106>>,<<0,157>>,<<0,61>>,<<“À+”>>,<<“À/”>>,<<“À#”>>,<<“À’”>>,<<“À-”>>,<<“À1”>>,<<“À%”>>,<<“À)”>>,<<0,162>>,<<0,64>>,<<0,156>>,<<0,60>>,<<“À\n”>>,<<192,20>>,<<0,56>>,<<192,5>>,<<192,15>>,<<“À\t”>>,<<192,19>>,<<0,50>>,<<192,4>>,<<192,14>>,<<0,173>>,<<0,183>>,<<0,172>>,<<0,182>>,<<0,149>>,<<0,148>>],use_ticket => undefined,secure_renegotiate => true,max_fragment_length => undefined,ocsp_nonce => true,reuse_sessions => true,keyfile => <<>>,versions => [{3,4},{3,3}]},{socket_options,binary,0,0,0,false},““,””,not_requested,#{active_n => 100,active_n_toggle => false,change_cipher_spec => ignore,sender => <0.3072.0>},““,undefined,””,““,””,undefined,{<0.3069.0>,#Ref<0.1124696735.1199046659.3271>},undefined}}}]}].
2023-08-30T16:38:10.721628+08:00 [error] crasher: initial call: ssl_gen_statem:init/1, pid: <0.3073.0>, registered_name: [], error: {function_clause,[{public_key,pkix_decode_cert,[[],otp],[{file,“public_key.erl”},{line,516}]},{ssl_handshake,get_cert_params,1,[{file,“ssl_handshake.erl”},{line,1764}]},{tls_handshake_1_3,get_certificate_params,1,[{file,“tls_handshake_1_3.erl”},{line,2450}]},{tls_handshake_1_3,select_server_cert_key_pair,7,[{file,“tls_handshake_1_3.erl”},{line,3013}]},{tls_handshake_1_3,do_start,2,[{file,“tls_handshake_1_3.erl”},{line,678}]},{tls_connection_1_3,do_server_start,2,[{file,“tls_connection_1_3.erl”},{line,578}]},{gen_statem,loop_state_callback,11,[{file,“gen_statem.erl”},{line,1426}]},{tls_connection,init,1,[{file,“tls_connection.erl”},{line,160}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}, ancestors: [<0.3071.0>,tls_connection_sup,tls_sup,ssl_connection_sup,ssl_sup,<0.1871.0>], message_queue_len: 0, messages: [], links: [<0.3071.0>], dictionary: [{ssl_pem_cache,ssl_pem_cache},{ssl_manager,ssl_manager},{log_level,notice}], trap_exit: true, status: running, heap_size: 46422, stack_size: 28, reductions: 42934; neighbours:
2023-08-30T16:38:10.722080+08:00 [error] Supervisor: {<0.3071.0>,tls_dyn_connection_sup}. Context: child_terminated. Reason: {function_clause,[{public_key,pkix_decode_cert,[[],otp],[{file,“public_key.erl”},{line,516}]},{ssl_handshake,get_cert_params,1,[{file,“ssl_handshake.erl”},{line,1764}]},{tls_handshake_1_3,get_certificate_params,1,[{file,“tls_handshake_1_3.erl”},{line,2450}]},{tls_handshake_1_3,select_server_cert_key_pair,7,[{file,“tls_handshake_1_3.erl”},{line,3013}]},{tls_handshake_1_3,do_start,2,[{file,“tls_handshake_1_3.erl”},{line,678}]},{tls_connection_1_3,do_server_start,2,[{file,“tls_connection_1_3.erl”},{line,578}]},{gen_statem,loop_state_callback,11,[{file,“gen_statem.erl”},{line,1426}]},{tls_connection,init,1,[{file,“tls_connection.erl”},{line,160}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]}. Offender: id=receiver,pid=<0.3073.0>.
2023-08-30T16:38:10.722109+08:00 [error] supervisor: ‘esockd_connection_sup - <0.2594.0>’, errorContext: connection_shutdown, reason: {ssl_failure,{{function_clause,[{public_key,pkix_decode_cert,[[],otp],[{file,“public_key.erl”},{line,516}]},{ssl_handshake,get_cert_params,1,[{file,“ssl_handshake.erl”},{line,1764}]},{tls_handshake_1_3,get_certificate_params,1,[{file,“tls_handshake_1_3.erl”},{line,2450}]},{tls_handshake_1_3,select_server_cert_key_pair,7,[{file,“tls_handshake_1_3.erl”},{line,3013}]},{tls_handshake_1_3,do_start,2,[{file,“tls_handshake_1_3.erl”},{line,678}]},{tls_connection_1_3,do_server_start,2,[{file,“tls_connection_1_3.erl”},{line,578}]},{gen_statem,loop_state_callback,11,[{file,“gen_statem.erl”},{line,1426}]},{tls_connection,init,1,[{file,“tls_connection.erl”},{line,160}]},{proc_lib,init_p_do_apply,3,[{file,“proc_lib.erl”},{line,240}]}]},{gen_statem,call,[<0.3073.0>,{start,15000},infinity]}}}, offender: [{pid,<0.3069.0>},{name,connection},{mfargs,{emqx_connection,start_link,[#{enable_authn => true,limiter => undefined,listener => {ssl,default},zone => default}]}}]
emqx.conf 配置如下
node {
name = “emqx@127.0.0.1”
cookie = “emqxsecretcookie”
data_dir = “/var/lib/emqx”
}
cluster {
name = emqxcl
discovery_strategy = manual
}
dashboard {
listeners.http {
bind = 18083
}
}
listeners.ssl.default {
bind = “0.0.0.0:8883”
max_connections = 512000
ssl_options {
keyfile = “etc/emqx/certs/server.key”
certfile = “etc/emqx/certs/server.crt”
cacertfile = “etc/emqx/certs/rootCA.crt”
verify = verify_none
}
}
证书也是根据网站文档生成的 。是什么问题呢?