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.

0 604 0

Where Next?

Popular Pragmatic Bookshelf topics Top

brianokken
Many tasks_proj/tests directories exist in chapters 2, 3, 5 that have tests that use the custom markers smoke and get, which are not decl...
2 1374 2
New
ianwillie
Hello Brian, I have some problems with running the code in your book. I like the style of the book very much and I have learnt a lot as...
0 1500 3
New
raul
Page 28: It implements io.ReaderAt on the store type. Sorry if it’s a dumb question but was the io.ReaderAt supposed to be io.ReadAt? ...
0 1297 3
New
joepstender
The generated iex result below should list products instead of product for the metadata. (page 67) iex> product = %Product{} %Pento....
0 1798 20
New
swlaschin
The book has the same “Problem space/Solution space” diagram on page 18 as is on page 17. The correct Problem/Solution space diagrams ar...
1 1071 1
New
akraut
The markup used to display the uploaded image results in a Phoenix.LiveView.HTMLTokenizer.ParseError error. lib/pento_web/live/product_l...
2 2083 9
New
creminology
Skimming ahead, much of the following is explained in Chapter 3, but new readers (like me!) will hit a roadblock in Chapter 2 with their ...
6 1112 5
New
rainforest
Hi, I’ve got a question about the implementation of PubSub when using a Phoenix.Socket.Transport behaviour rather than channels. Before ...
0 1506 3
New
andreheijstek
After running /bin/setup, the first error was: The foreman' command exists in these Ruby versions: That was easy to fix: gem install fore...
1 1111 3
New
dtonhofer
@parrt In the context of Chapter 4.3, the grammar Java.g4, meant to parse Java 6 compilation units, no longer passes ANTLR (currently 4....
0 1005 3
New

Other popular topics Top

AstonJ
A thread that every forum needs! Simply post a link to a track on YouTube (or SoundCloud or Vimeo amongst others!) on a separate line an...
201 4638 102
New
siddhant3030
I’m thinking of buying a monitor that I can rotate to use as a vertical monitor? Also, I want to know if someone is using it for program...
51 4319 20
New
Exadra37
I am asking for any distro that only has the bare-bones to be able to get a shell in the server and then just install the packages as we ...
66 21694 24
New
AstonJ
In case anyone else is wondering why Ruby 3 doesn’t show when you do asdf list-all ruby :man_facepalming: do this first: asdf plugin-upd...
11 5382 4
New
PragmaticBookshelf
Learn different ways of writing concurrent code in Elixir and increase your application's performance, without sacrificing scalability or...
78 4119 24
New
PragmaticBookshelf
“A Mystical Experience” Hero’s Journey with Paolo Perrotta @nusco Ever wonder how authoring books compares to writing articles?...
31 3538 15
New
rustkas
Intensively researching Erlang books and additional resources on it, I have found that the topic of using Regular Expressions is either c...
91 5152 43
New
mafinar
This is going to be a long an frequently posted thread. While talking to a friend of mine who has taken data structure and algorithm cou...
108 9152 31
New
AstonJ
If you want a quick and easy way to block any website on your Mac using Little Snitch simply… File > New Rule: And select Deny, O...
5 8045 3
New
hilfordjames
There appears to have been an update that has changed the terminology for what has previously been known as the Taskbar Overflow - this h...
3 1664 2
New

Sub Categories: