conformal/btcd — pull request #192 by davecgh (2014-12-21 00:11:34+00:00)
Title: [DON'T MERGE YET] Allow disabling RPC server TLS for localhost only.

This pull request introduces a new flag, `--notls`, which can be used to disable
TLS for the RPC server. However, the flag can only be used when the RPC
server is bound to localhost interfaces. This is intended to prevent the
situation where someone decides they want to expose the RPC server to the
web for remote management/access, but forgot they have TLS disabled.

Here is an example of the functionality:

**Disallowed**

> $ ./btcd --notls --rpclisten=whateverdomain.com
> loadConfig: the --notls option may not be used when binding to non localhost addresses: whateverdomain.com:8334
> Use btcd -h to show usage
>
> $ ./btcd --notls --rpclisten=whateverdomain.com:12345
> loadConfig: the --notls option may not be used when binding to non localhost addresses: whateverdomain.com:12345
> Use btcd -h to show usage
>
> $ ./btcd --notls --rpclisten=1.2.3.4
> loadConfig: the --notls option may not be used when binding to non localhost addresses: 1.2.3.4:8334
> Use btcd -h to show usage
>
> $ ./btcd --notls --rpclisten=1.2.3.4:12345
> loadConfig: the --notls option may not be used when binding to non localhost addresses: 1.2.3.4:12345
> Use btcd -h to show usage
>
> $ ./btcd --notls --rpclisten=1234::1234
> loadConfig: the --notls option may not be used when binding to non localhost addresses: [1234::1234]:8334
> Use btcd -h to show usage
>
> $ ./btcd --notls --rpclisten=[1234::1234]:12345
> loadConfig: the --notls option may not be used when binding to non localhost addresses: [1234::1234]:12345
> Use btcd -h to show usage
>

**Allowed**

> $ ./btcd --notls --rpclisten=localhost
> 17:31:49 2014-12-20 [INF] BTCD: Version 0.9.0-beta
>
> $ ./btcd --notls --rpclisten=localhost:12345
> 17:31:52 2014-12-20 [INF] BTCD: Version 0.9.0-beta
>
> $ ./btcd --notls --rpclisten=127.0.0.1
> 17:32:09 2014-12-20 [INF] BTCD: Version 0.9.0-beta
>
> $ ./btcd --notls --rpclisten=127.0.0.1:12345
> 17:32:13 2014-12-20 [INF] BTCD: Version 0.9.0-beta
>
> $ ./btcd --notls --rpclisten=::1
> 17:32:16 2014-12-20 [INF] BTCD: Version 0.9.0-beta
>
> $ ./btcd --notls --rpclisten=[::1]:12345
> 17:32:20 2014-12-20 [INF] BTCD: Version 0.9.0-beta

**NOTE: The sample config file still needs to be updated to reflect the new option, so this pull request is not ready to be merged yet.**