Sometimes those modules run on TLS distribution, so for the script to work, it must look like…
#!/usr/bin/env escript
%%! -sname external@localhost -setcookie cookie -proto_dist inet_tls -ssl_dist_opt client_verify verify_peer server_verify verify_peer -ssl_dist_opt server_certfile server_cert.pem client_certfile server_cert.pem -ssl_dist_opt server_keyfile server_key.pem client_keyfile server_key.pem -ssl_dist_opt server_cacertfile ca_cert.pem client_cacertfile ca_cert.pem
%% (Yeah, I don't know how to use multiple lines for `%%!` either, but that's a different topic)
main([NodeName]) ->
Node = list_to_atom(NodeName ++ "@localhost"),
io:format("Is ~p up? ~p\n", [Node, net_adm:ping(Node)]).
In other words, they must be started with the inet_tls distribution protocol and all its parameters. But then, those scripts can’t ping the non-tls nodes.
The question is: Is there any way to write the scripts so that they can communicate with some nodes over inet_tls but with others over regular inet_tcp?
…does work for non-tls nodes, but I don’t seem to be able to tell net_kernel that I want to start it using inet_tls as the proto_dist param. For what I can find, net_kernel and friends pick that value from init:get_argument(proto_dist) and so far I could not find a way to set that once the VM is already started.
#!/usr/bin/bash
# I had not written this one yet,
# but the idea would be to use a parameter to figure out
# which one of the other two scripts to call and then call it.