bscharm

bscharm

Distributed Services with Go: Secure Your Services final make test fails (page 141)

Just a note for other readers as I have resolved my issue.

On page 141 of the text, we are told to update our TLSConfig in the test to enable client verification on the server. The code block looks as such:

serverTLSConfig, err := config.SetupTLSConfig(config.TLSConfig{
	CertFile:      config.ServerCertFile,
	KeyFile:       config.ServerKeyFile,
	CAFile:        config.CAFile,
	ServerAddress: l.Addr().String(),
	Server: true,
})

where Server: true, is newly added to the config. This will cause the tests to fail given the state of the code and specifically the state of the client configuration in the tests. First, the following change to internal/config/files.go should be made:

var (
	CAFile         = configFile("ca.pem")
	ClientCertFile = configFile("client.pem")
	ClientKeyFile  = configFile("client-key.pem")
	ServerCertFile = configFile("server.pem")
	ServerKeyFile  = configFile("server-key.pem")
)

where ClientCertFile and ClientKeyFile are newly added. As such, we should also update our client config in our tests to reference the files (the actual files should have been generated by a run of make gencert that the book has already had us do). The code in the tests should look as such:

clientTLSConfig, err := config.SetupTLSConfig(
	config.TLSConfig{
		CertFile: config.ClientCertFile,
		KeyFile: config.ClientKeyFile,
		CAFile: config.CAFile,
		Server: false,
	},
)

I hope this helps you if you come across this problem.

Where Next?

Popular Pragmatic Bookshelf topics Top

New
sdmoralesma
Title: Web Development with Clojure, Third Edition - migrations/create not working: p159 When I execute the command: user=> (create-...
New
mikecargal
Title: Hands-On Rust (Chapter 11: prefab) Just played a couple of amulet-less games. With a bit of debugging, I believe that your can_p...
New
raul
Hi Travis! Thank you for the cool book! :slight_smile: I made a list of issues and thought I could post them chapter by chapter. I’m rev...
New
curtosis
Running mix deps.get in the sensor_hub directory fails with the following error: ** (Mix) No SSH public keys found in ~/.ssh. An ssh aut...
New
jskubick
I’m under the impression that when the reader gets to page 136 (“View Data with the Database Inspector”), the code SHOULD be able to buil...
New
s2k
Hi all, currently I wonder how the Tailwind colours work (or don’t work). For example, in app/views/layouts/application.html.erb I have...
New
jwandekoken
Book: Programming Phoenix LiveView, page 142 (157/378), file lib/pento_web/live/product_live/form_component.ex, in the function below: d...
New
New
mcpierce
@mfazio23 I’ve applied the changes from Chapter 5 of the book and everything builds correctly and runs. But, when I try to start a game,...
New

Other popular topics Top

AstonJ
What chair do you have while working… and why? Is there a ‘best’ type of chair or working position for developers?
New
malloryerik
Any thoughts on Svelte? Svelte is a radical new approach to building user interfaces. Whereas traditional frameworks like React and Vue...
New
AstonJ
SpaceVim seems to be gaining in features and popularity and I just wondered how it compares with SpaceMacs in 2020 - anyone have any thou...
New
AstonJ
I ended up cancelling my Moonlander order as I think it’s just going to be a bit too bulky for me. I think the Planck and the Preonic (o...
New
AstonJ
This looks like a stunning keycap set :orange_heart: A LEGENDARY KEYBOARD LIVES ON When you bought an Apple Macintosh computer in the e...
New
PragmaticBookshelf
“Finding the Boundaries” Hero’s Journey with Noel Rappin @noelrappin Even when you’re ultimately right about what the future ho...
New
Maartz
Hi folks, I don’t know if I saw this here but, here’s a new programming language, called Roc Reminds me a bit of Elm and thus Haskell. ...
New
PragmaticBookshelf
Build efficient applications that exploit the unique benefits of a pure functional language, learning from an engineer who uses Haskell t...
New
PragmaticBookshelf
Author Spotlight: Tammy Coron @Paradox927 Gaming, and writing games in particular, is about passion, vision, experience, and immersio...
New
sir.laksmana_wenk
I’m able to do the “artistic” part of game-development; character designing/modeling, music, environment modeling, etc. However, I don’t...
New

Sub Categories: