basho/node_package — pull request #145 by hectcastro (2014-06-19 21:43:45+00:00)
Title: Prevent root ownership of Erlang cookie in platform data directory

The process for pinging a Riak node does not go through the bootstrap
procedure so that non-root users can easily detect if Riak is up/down.

When using the `service` command to manage the Riak service, any
subcommands to the Riak runner that make use of ping (AKA `ping_node()`)
can inadvertently create a root owned `.erlang.cookie` inside
`/var/lib/riak`. This causes problems when the Riak user attempts to read
the Erlang cookie later.

This change makes it so that if `ping_node()` gets called by root in any
way, the home directory is explicitly set to /root. That prevents future
issues around reading `/var/lib/riak/.erlang.cookie`.

### Basic tests

Can I start Riak with the `service` command:

```bash
$ sudo service riak start
```

Can I ping Riak with the `service` command:

```bash
$ sudo service riak ping
```

Can I ping Riak with a non-root user:

```bash
$ riak ping
```

### Platforms to test

- [ ] Ubuntu 12.04
- [ ] Ubuntu 14.04
- [ ] RHEL 6
- [ ] RHEL 5
- [ ] SUSE v?