erlang - Run an escript using TLS distribution -


i have been unable make tls distribution work when providing arguments vm via %! line in escript.

cat test.es #!/usr/bin/env escript %%! +p 256000 -env erl_max_ets_tables 256000 -env erl_crash_dump /dev/null -env erl_fullsweep_after 0 -env erl_max_ports 65536 +a 64 +k true +w w -smp auto -boot /tmp/start_clean -proto_dist inet_tls -ssl_dist_opt server_certfile "/var/lib/cinched/cert.pem" server_cacertfile "/var/lib/cinched/cacert.pem" client_certfile "/var/lib/cinched/cert.pem" client_cacertfile "/var/lib/cinched/cacert.pem" server_keyfile "/var/lib/cinched/key.pem" client_keyfile "/var/lib/cinched/key.pem" -name test@192.168.101.1  main(_) ->         io:format("ping: ~p~n",[net_adm:ping('cinched@192.168.101.1')]).   [root@dev1 ~]# ./test.es {error_logger,{{2016,1,15},{23,36,42}},"protocol: ~tp: not supported~n",["inet_tls"]} {error_logger,{{2016,1,15},{23,36,42}},crash_report,[[{initial_call,{net_kernel,init,['argument__1']}},{pid,<0.21.0>},{registered_name,[]},{error_info,{exit,{error,badarg},[{gen_server,init_it,6,[{file,"gen_server.erl"},{line,322}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]}},{ancestors,[net_sup,kernel_sup,<0.10.0>]},{messages,[]},{links,[<0.18.0>]},{dictionary,[{longnames,true}]},{trap_exit,true},{status,running},{heap_size,376},{stack_size,27},{reductions,211}],[]]} {error_logger,{{2016,1,15},{23,36,42}},supervisor_report,[{supervisor,{local,net_sup}},{errorcontext,start_error},{reason,{'exit',nodistribution}},{offender,[{pid,undefined},{name,net_kernel},{mfargs,{net_kernel,start_link,[['test@192.168.101.1',longnames]]}},{restart_type,permanent},{shutdown,2000},{child_type,worker}]}]} {error_logger,{{2016,1,15},{23,36,42}},supervisor_report,[{supervisor,{local,kernel_sup}},{errorcontext,start_error},{reason,{shutdown,{failed_to_start_child,net_kernel,{'exit',nodistribution}}}},{offender,[{pid,undefined},{name,net_sup},{mfargs,{erl_distribution,start_link,[]}},{restart_type,permanent},{shutdown,infinity},{child_type,supervisor}]}]} {error_logger,{{2016,1,15},{23,36,42}},crash_report,[[{initial_call,{application_master,init,['argument__1','argument__2','argument__3','argument__4']}},{pid,<0.9.0>},{registered_name,[]},{error_info,{exit,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'exit',nodistribution}}}}},{kernel,start,[normal,[]]}},[{application_master,init,4,[{file,"application_master.erl"},{line,133}]},{proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,237}]}]}},{ancestors,[<0.8.0>]},{messages,[{'exit',<0.10.0>,normal}]},{links,[<0.8.0>,<0.7.0>]},{dictionary,[]},{trap_exit,true},{status,running},{heap_size,376},{stack_size,27},{reductions,164}],[]]} {error_logger,{{2016,1,15},{23,36,42}},std_info,[{application,kernel},{exited,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'exit',nodistribution}}}}},{kernel,start,[normal,[]]}}},{type,permanent}]} {"kernel pid terminated",application_controller,"{application_start_failure,kernel,{{shutdown,{failed_to_start_child,net_sup,{shutdown,{failed_to_start_child,net_kernel,{'exit',nodistribution}}}}},{kernel,start,[normal,[]]}}}"} 

the boot file it's pointing doesn't seem taken account. i've tried other variations (trying start dependant apps via -s switch), nothing seems work far.

the boot file:

{release,{"start_clean",[]},          {erts,"6.4"},          [{kernel,"3.2"},           {stdlib,"2.4"},           {sasl,"2.4.1"},           {crypto,"3.5"},           {asn1,"3.0.4"},           {public_key,"0.23"},           {ssl,"6.0"}           ]}. 

erlang ssl distribution needs started ssl application should included boot script , passed emulator -boot flag. seems escript doesn't pass -boot flag based on example:

release file:

{release,  {"foo_rel", "0.1"},  {erts, "6.4"},  [{kernel, "3.2"},   {stdlib, "2.4"},   {crypto, "3.5"},   {asn1, "3.0.4"},   {public_key, "0.23"},   {ssl, "6.0"}] }. 

escript source:

#!/usr/bin/env escript %%! -sname foo -boot /path/to/foo main(_) ->     io:format("~p~n", [application:which_applications()]). 

escript result:

[{stdlib,"erts  cxc 138 10","2.4"},  {kernel,"erts  cxc 138 10","3.2"}] 

but booting foo release erl start defined applications in boot file in way confirms boot file correct:

$ erl -boot /path/to/foo erlang/otp 17 [erts-6.4] [...] 1> application:which_applications(). [{ssl,"erlang/otp ssl application","6.0"},  {public_key,"public key infrastructure","0.23"},  {asn1,"the erlang asn1 compiler version 3.0.4","3.0.4"},  {crypto,"crypto","3.5"},  {stdlib,"erts  cxc 138 10","2.4"},  {kernel,"erts  cxc 138 10","3.2"}] 

although don't know why escript doesn't pass boot script emulator, obvious using boot file escript doesn't start ssl application, ssl distribution mode cannot started.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -