Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in logic of certificate generation for RPC #1936

Open
l0k18 opened this issue Jan 13, 2023 · 0 comments
Open

Error in logic of certificate generation for RPC #1936

l0k18 opened this issue Jan 13, 2023 · 0 comments

Comments

@l0k18
Copy link
Contributor

l0k18 commented Jan 13, 2023

https://github.com/btcsuite/btcd/blob/master/server.go#L2679

I could be reading this wrong but I think that this should be OR not AND:

		// Generate the TLS cert and key file if both don't already
		// exist.
		if !fileExists(cfg.RPCKey) && !fileExists(cfg.RPCCert) {
			err := genCertPair(cfg.RPCCert, cfg.RPCKey)
			if err != nil {
				return nil, err
			}
		}

In the current state of the code, if either file exists but the other doesn't, it won't generate a new one, but the RPC will not have the necessary, inseparable pair of keys to work with.

It should either flag a terminal error or assume a non atomic write occurred and overwrite the two files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant