if exist "%RABBITMQ_BASE%\RabbitMQ-env.bat" (
call "%RABBITMQ_BASE%\RabbitMQ-env.bat"
)REM User-defined environment variable overrides
set ERLANG_HOME="D:\Erlang"
set RABBITMQ_NODE_PORT="5672"On Windows, the locations are C:\Users\Current User\.erlang.cookie (%HOMEDRIVE% + %HOMEPATH%\.erlang.cookie) or C:\Documents and Settings\Current User\.erlang.cookie, and C:\Windows\.erlang.cookie for RabbitMQ Windows service. If Windows service is used, the cookie should be placed in both places.
> I have tested out the following which would allow the cookie location to
> be defined via environment variable otherwise to continue to use the
> defaults as it currently does:
If we were talking about Unix I would definitely view this as wrong,
since it allows non-privileged users on the same system to see the
Erlang cookie by inspecting the output of "ps" and thus gain the ability
to run rabbitmqctl.
I think the same problem exists for Windows, although I think culturally
people might be inclined to see it as less of a problem.
I would rather see a solution which changes the HOMEDRIVE or HOMEPATH
just before starting the server / ctl.
We don't have an equivalent of rabbitmq-env.conf on Windows. I wonder if
it's possible to construct one?
REM Pull the .erlang.cookie value from file
set /p cookie= <!RABBITMQ_BASE!\.erlang.cookie
set RABBITMQ_SERVER_ERL_ARGS=-setcookie %cookie%
set RABBITMQ_CTL_ERL_ARGS=-setcookie %cookie%
> I see a few options here:
>
> 1. Override HOME in the ERL init flags, if possible
> * init:get_argument(home)
> o It looks like *-env Variable Value* could be used to get the
> desired effect, but it doesn't work for /home, homedrive,
> /or /homepath /in my testing.
> o http://erlang.org/doc/man/erl.html
I don't understand this option. Could you please expand a bit?
-pa "D:\\RabbitMQ\\rabbitmq_server-3.4.3\\sbin\\..\\ebin"
-boot start_sasl
-s rabbit boot
-config "D:\\RabbitMQ\\rabbitmq" +W w +A30 +P 1048576
-kernel inet_default_connect_options "[{nodelay,true}]"
-setcookie WBODDWUVKLKNOVHBCOBY
-sasl errlog_type error
-sasl sasl_error_logger false -rabbit error_logger {file,\""D:/RabbitMQ/log/rab...@SERVERA.log"\"}
-rabbit sasl_error_logger {file,\""D:/RabbitMQ/log/rab...@SERVERA-sasl.log"\"}
-rabbit enabled_plugins_file \""D:/RabbitMQ/enabled_plugins"\"
-rabbit plugins_dir \""D:/RabbitMQ/rabbitmq_server-3.4.3/sbin/../plugins"\"
-rabbit plugins_expand_dir \""D:/RabbitMQ/db/rabbit@SERVERA-plugins-expand"\"
-rabbit windows_service_config \""D:/RabbitMQ/rabbitmq"\"
-os_mon start_cpu_sup false
-os_mon start_disksup false
-os_mon start_memsup false
-mnesia dir \""D:/RabbitMQ/db/rabbit@SERVERA-mnesia"\"
As Simon pointed out, there is a security concern as the cookie appears
in the command line. However, if .erlang.cookie is already readable by
anyone, then this issue is irrelevant.
To be honest, I don't know the best practices on Windows and can't
really give advice on this topic.