Skip to content

Commit 6316bea

Browse files
committed
Improve documentation.
Fixes #46, #47
1 parent 7789bd2 commit 6316bea

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

README.md

+30-6
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,19 @@ Let's Encrypt client and ACME library written in Go
44
[![GoDoc](https://godoc.org/github.com/xenolf/lego/acme?status.svg)](https://godoc.org/github.com/xenolf/lego/acme)
55
[![Build Status](https://travis-ci.org/xenolf/lego.svg?branch=master)](https://travis-ci.org/xenolf/lego)
66

7-
This is a work in progress. Please do *NOT* run this on a production server.
7+
#### General
8+
This is a work in progress. Please do *NOT* run this on a production server and please report any bugs you find!
89

9-
Please report any bugs you find!
10+
#### Installation
11+
lego supports both binary installs and install from source.
12+
13+
To get the binary just download the latest release for your OS/Arch from [the release page](https://github.com/xenolf/lego/releases)
14+
and put the binary somewhere convenient. lego does not assume anything about the location you run it from.
15+
16+
To install from source, just run
17+
```
18+
go get -u github.com/xenolf/lego
19+
```
1020

1121
#### Current Status
1222
The code in this repository is under development.
@@ -30,10 +40,22 @@ Please keep in mind that CLI switches and APIs are still subject to change.
3040
When using the standard --path option, all certificates and account configurations are saved to a folder *.lego* in the current working directory.
3141

3242
#### Sudo
33-
I tried to not need sudo apart from challenges where binding to a privileged port is necessary.
43+
The CLI does not require root permissions but needs to bind to port 80 and 443 for certain challenges.
3444
To run the CLI without sudo, you have two options:
35-
- Use ```setcap 'cap_net_bind_service=+ep' /path/to/program```
36-
- Pass the --port option and specify a custom port to bind to. In this case you have to forward port 443 to this custom port.
45+
46+
- Use setcap 'cap_net_bind_service=+ep' /path/to/program
47+
- Pass the `--port` option and specify a custom port to bind to. In this case you have to forward port 443 to this custom port.
48+
49+
#### Port Usage
50+
By default lego assumes it is able to bind to ports 80 and 443 to solve challenges.
51+
If this is not possible in your environment, you can use the `--port` option to instruct
52+
lego to listen on that port for any incoming challenges.
53+
54+
If you are using this option, make sure you proxy all of the following traffic to that port:
55+
- All plaintext HTTP requests to port 80 which begin with a request path of `/.well-known/acme/` for the HTTP-01 challenge.
56+
- All TLS handshakes on port 443 for TLS-SNI-01.
57+
58+
This traffic redirection is only needed as long as lego solves challenges. As soon as you have received your certificates you can deactivate the forwarding.
3759

3860
#### Usage
3961

@@ -68,6 +90,7 @@ GLOBAL OPTIONS:
6890
##### CLI Example
6991

7092
Assumes the `lego` binary has permission to bind to ports 80 and 443. You can get a pre-built binary from the [releases](https://github.com/xenolf/lego/releases) page.
93+
If your environment does not allow you to bind to these ports, please read [Port Usage](#port-usage).
7194

7295
Obtain a certificate:
7396

@@ -118,7 +141,8 @@ myUser := MyUser{
118141
// A client facilitates communication with the CA server. This CA URL is
119142
// configured for a local dev instance of Boulder running in Docker in a VM.
120143
// We specify an optPort of 5001 because we aren't running as root and can't
121-
// bind a listener to port 443 (used later when we attempt to pass challenge).
144+
// bind a listener to port 80 or 443 (used later when we attempt to pass challenges).
145+
// Keep in mind that we still need to proxy challenge traffic to port 5001.
122146
client, err := acme.NewClient("http://192.168.99.100:4000", &myUser, rsaKeySize, "5001")
123147
if err != nil {
124148
log.Fatal(err)

cli.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ func main() {
8383
},
8484
cli.StringFlag{
8585
Name: "port",
86-
Usage: "Challenges will use this port to listen on. Please make sure to forward port 443 to this port on your machine. Otherwise use setcap on the binary",
86+
Usage: "Challenges will use this port to listen on. Please make sure to forward port 80 and 443 to this port on your machine. Otherwise use setcap on the binary",
8787
},
8888
}
8989

0 commit comments

Comments
 (0)