Book Image

Security with Go

By : John Daniel Leon, Karthik Gaekwad
Book Image

Security with Go

By: John Daniel Leon, Karthik Gaekwad

Overview of this book

Go is becoming more and more popular as a language for security experts. Its wide use in server and cloud environments, its speed and ease of use, and its evident capabilities for data analysis, have made it a prime choice for developers who need to think about security. Security with Go is the first Golang security book, and it is useful for both blue team and red team applications. With this book, you will learn how to write secure software, monitor your systems, secure your data, attack systems, and extract information. Defensive topics include cryptography, forensics, packet capturing, and building secure web applications. Offensive topics include brute force, port scanning, packet injection, web scraping, social engineering, and post exploitation techniques.
Table of Contents (15 chapters)

Web Applications

Go has a powerful HTTP package in the standard library. The net/http package is documented at https://golang.org/pkg/net/http/ and contains the HTTP and HTTPS utilities. At first, I advise that you stay away from the community HTTP frameworks and stick to the Go standard library. The standard HTTP package includes functions for listening, routing, and templating. The built-in HTTP server is of production quality, and it binds directly to a port, eliminating the need for a separate httpd, such as Apache, IIS, or nginx. However, it is common to see nginx listening on the public port 80 and reverse proxying all requests to Go servers listening on local ports other than 80.

In this chapter, we cover the basics of running an HTTP server, using HTTPS, setting secure cookies, and escaping output. We also cover how to use the Negroni middleware package and implement custom...