pylego 0.1.25__py3-none-any.whl → 0.1.31.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pylego/go.mod +116 -86
- pylego/go.sum +431 -0
- pylego/lego.go +12 -7
- pylego/lego.so +0 -0
- pylego/pylego.py +1 -1
- {pylego-0.1.25.dist-info → pylego-0.1.31.1.dist-info}/METADATA +21 -14
- pylego-0.1.31.1.dist-info/RECORD +11 -0
- pylego-0.1.25.dist-info/RECORD +0 -11
- {pylego-0.1.25.dist-info → pylego-0.1.31.1.dist-info}/WHEEL +0 -0
- {pylego-0.1.25.dist-info → pylego-0.1.31.1.dist-info}/licenses/LICENSE +0 -0
- {pylego-0.1.25.dist-info → pylego-0.1.31.1.dist-info}/top_level.txt +0 -0
pylego/lego.go
CHANGED
|
@@ -15,6 +15,7 @@ import (
|
|
|
15
15
|
|
|
16
16
|
"github.com/go-acme/lego/v4/certcrypto"
|
|
17
17
|
"github.com/go-acme/lego/v4/certificate"
|
|
18
|
+
"github.com/go-acme/lego/v4/challenge/dns01"
|
|
18
19
|
"github.com/go-acme/lego/v4/challenge/http01"
|
|
19
20
|
"github.com/go-acme/lego/v4/challenge/tlsalpn01"
|
|
20
21
|
"github.com/go-acme/lego/v4/lego"
|
|
@@ -141,26 +142,30 @@ func requestCertificate(email, privateKeyPem, server, csr, plugin string) (*Lego
|
|
|
141
142
|
|
|
142
143
|
func configureClientChallenges(client *lego.Client, plugin string) error {
|
|
143
144
|
switch plugin {
|
|
144
|
-
case "":
|
|
145
|
-
err := client.Challenge.SetHTTP01Provider(http01.NewProviderServer(os.Getenv("HTTP01_IFACE"), os.Getenv("HTTP01_PORT")))
|
|
146
|
-
if err != nil {
|
|
145
|
+
case "", "http":
|
|
146
|
+
if err := client.Challenge.SetHTTP01Provider(http01.NewProviderServer(os.Getenv("HTTP01_IFACE"), os.Getenv("HTTP01_PORT"))); err != nil {
|
|
147
147
|
return errors.Join(errors.New("couldn't set http01 provider server: "), err)
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
|
|
149
|
+
return nil
|
|
150
|
+
case "tls":
|
|
151
|
+
if err := client.Challenge.SetTLSALPN01Provider(tlsalpn01.NewProviderServer(os.Getenv("TLSALPN01_IFACE"), os.Getenv("TLSALPN01_PORT"))); err != nil {
|
|
151
152
|
return errors.Join(errors.New("couldn't set tlsalpn01 provider server: "), err)
|
|
152
153
|
}
|
|
154
|
+
return nil
|
|
153
155
|
default:
|
|
154
156
|
dnsProvider, err := dns.NewDNSChallengeProviderByName(plugin)
|
|
155
157
|
if err != nil {
|
|
156
158
|
return errors.Join(fmt.Errorf("couldn't create %s provider: ", plugin), err)
|
|
157
159
|
}
|
|
158
|
-
err = client.Challenge.SetDNS01Provider(dnsProvider
|
|
160
|
+
err = client.Challenge.SetDNS01Provider(dnsProvider,
|
|
161
|
+
dns01.CondOption(os.Getenv("DNS_PROPAGATION_DISABLE_ANS") != "",
|
|
162
|
+
dns01.DisableAuthoritativeNssPropagationRequirement()),
|
|
163
|
+
dns01.CondOption(os.Getenv("DNS_PROPAGATION_RNS") != "", dns01.RecursiveNSsPropagationRequirement()))
|
|
159
164
|
if err != nil {
|
|
160
165
|
return errors.Join(fmt.Errorf("couldn't set %s DNS provider server: ", plugin), err)
|
|
161
166
|
}
|
|
167
|
+
return nil
|
|
162
168
|
}
|
|
163
|
-
return nil
|
|
164
169
|
}
|
|
165
170
|
|
|
166
171
|
type LetsEncryptUser struct {
|
pylego/lego.so
CHANGED
|
Binary file
|
pylego/pylego.py
CHANGED
|
@@ -43,7 +43,7 @@ def run_lego_command(
|
|
|
43
43
|
email: the email to be used for registration
|
|
44
44
|
server: the server to be used for requesting a certificate that implements the ACME protocol
|
|
45
45
|
csr: the csr to be signed
|
|
46
|
-
plugin:
|
|
46
|
+
plugin: provider to use. One of: "http" (HTTP-01), "tls" (TLS-ALPN-01), or any LEGO DNS provider from https://go-acme.github.io/lego/dns/.
|
|
47
47
|
env: the environment variables required for the chosen plugin.
|
|
48
48
|
private_key: the private key to be used for the registration on the ACME server (not the private key used to sign the CSR).
|
|
49
49
|
If not provided, a new one will be generated.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pylego
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.31.1
|
|
4
4
|
Summary: A python wrapper package for the lego application written in Golang
|
|
5
5
|
Author-email: Canonical <telco-engineers@lists.canonical.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/canonical/pylego
|
|
@@ -34,27 +34,34 @@ You can import the lego command and run any function that you can run from the C
|
|
|
34
34
|
```python
|
|
35
35
|
from pylego import run_lego_command
|
|
36
36
|
test_env = {"NAMECHEAP_API_USER": "user", "NAMECHEAP_API_KEY": "key"}
|
|
37
|
-
run_lego_command(
|
|
37
|
+
run_lego_command(
|
|
38
|
+
"something@gmail.com",
|
|
39
|
+
"https://localhost/directory",
|
|
40
|
+
b"-----BEGIN CERTIFICATE REQUEST----- ...",
|
|
41
|
+
env=test_env,
|
|
42
|
+
plugin="namecheap",
|
|
43
|
+
private_key="-----BEGIN RSA PRIVATE KEY-----",
|
|
44
|
+
)
|
|
38
45
|
```
|
|
39
46
|
|
|
40
|
-
| Argument
|
|
41
|
-
|
|
|
42
|
-
| `email`
|
|
43
|
-
| `server`
|
|
44
|
-
| `csr`
|
|
45
|
-
| `plugin`
|
|
46
|
-
| `env`
|
|
47
|
-
| `private_key`
|
|
47
|
+
| Argument | Description |
|
|
48
|
+
| ------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
49
|
+
| `email` | The provided email will be registered to the ACME server. It may receive some emails notifying the user about certificate expiry. |
|
|
50
|
+
| `server` | This is the full URL of a server that implements the ACME protocol. While letsencrypt is the most common one, there are other programs that provide this facility like Vault. |
|
|
51
|
+
| `csr` | This must be a PEM string in bytes that is user generated and valid as according to the ACME server that is being provided above. Many providers have different requirements for what is allowed to be in the fields of the CSR. |
|
|
52
|
+
| `plugin` | Provider to use: `http` (HTTP-01), `tls` (TLS-ALPN-01), or any LEGO DNS provider from [here](https://go-acme.github.io/lego/dns/). If no plugin is provided, pylego uses HTTP-01 by default. |
|
|
53
|
+
| `env` | The env is a dictionary mapping of strings to strings that will be loaded into the environment for LEGO to use. All plugins require some configuration values loaded into the environment. You can find them [here](https://go-acme.github.io/lego/dns/) |
|
|
54
|
+
| `private_key` | The provided private key will be used to register the user to the ACME server (not the key that signed the CSR), if not provided pylego will generate a new one |
|
|
48
55
|
|
|
49
56
|
On top of the environment variables that LEGO supports, we have some extra ones that we use to configure the library:
|
|
50
57
|
|
|
51
58
|
| Key | Description |
|
|
52
59
|
| ----------------- | ----------------------------------------------------------------------------------------------------------------------------- |
|
|
53
60
|
| `SSL_CERT_FILE` | Path to a CA certificate file for pylego to trust. This can be used for trusting the certificate of the ACME server provided. |
|
|
54
|
-
| `HTTP01_IFACE` |
|
|
55
|
-
| `HTTP01_PORT` |
|
|
56
|
-
| `TLSALPN01_IFACE` |
|
|
57
|
-
| `TLSALPN01_PORT` |
|
|
61
|
+
| `HTTP01_IFACE` | Interface for the HTTP-01 challenge (when no DNS plugin is used or when `plugin=http`). Any interface by default. |
|
|
62
|
+
| `HTTP01_PORT` | Port for the HTTP-01 challenge (when no DNS plugin is used or when `plugin=http`). 80 by default. |
|
|
63
|
+
| `TLSALPN01_IFACE` | Interface for the TLS-ALPN-01 challenge (when `plugin=tls`). Any interface by default. |
|
|
64
|
+
| `TLSALPN01_PORT` | Port for the TLS-ALPN-01 challenge (when `plugin=tls`). 443 by default. |
|
|
58
65
|
|
|
59
66
|
## How does it work?
|
|
60
67
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
pylego/__init__.py,sha256=7rcUcQcOWsOLxTOEXF2ASkwm_7eED1UIXzxdlgKPr5c,82
|
|
2
|
+
pylego/go.mod,sha256=2zddNtfcY9OT_qrCABQwRB06dvL0QF9kMA1E6lmvOlM,12467
|
|
3
|
+
pylego/go.sum,sha256=-Gl6lIAbKb0cjJHr4dVvA4_XGBSHONqL0lKRGHUoYn0,187420
|
|
4
|
+
pylego/lego.go,sha256=O_tXZN6DRXlVXJfZdjIXTrDWXyn1UuBeZa_ZzPCnGOA,6004
|
|
5
|
+
pylego/lego.so,sha256=nlASF8T39I3b6NodVaPofEqOs1c5Fu6b0zxvn8KI6MM,87291672
|
|
6
|
+
pylego/pylego.py,sha256=x9NTkBi1P4ITPhGBUgMCHVBHqFN7NXAJAc9aknKLcgk,2263
|
|
7
|
+
pylego-0.1.31.1.dist-info/licenses/LICENSE,sha256=aklz9Y8CIpFsN61U4jHlJYp4W_8HoDpY-tINlDcdSZY,10934
|
|
8
|
+
pylego-0.1.31.1.dist-info/METADATA,sha256=rh0voQ1R8_NHfbYvivFzVlMoF5sNOEi6Ua0ikdA6Ea8,5778
|
|
9
|
+
pylego-0.1.31.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
+
pylego-0.1.31.1.dist-info/top_level.txt,sha256=pSOYv55_w90qy3xOvqz_ysSz-X-XRTb-jMpiOyLNnNs,7
|
|
11
|
+
pylego-0.1.31.1.dist-info/RECORD,,
|
pylego-0.1.25.dist-info/RECORD
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
pylego/__init__.py,sha256=7rcUcQcOWsOLxTOEXF2ASkwm_7eED1UIXzxdlgKPr5c,82
|
|
2
|
-
pylego/go.mod,sha256=n2-zLjKRREhmUyfj0u-VQRyEvmlp4wJcVY_Ret6v2bw,10759
|
|
3
|
-
pylego/go.sum,sha256=vWXQ9GPwP6WPKjCuQ1_sWDka9PjTL2Yh28nIQeWKU80,146531
|
|
4
|
-
pylego/lego.go,sha256=iXzvfVQ19PxqwFkgfxT8ueRdtIT6-cegjuzOzSuHkWs,5678
|
|
5
|
-
pylego/lego.so,sha256=ObOt7e40UbDoYqJSEmuxdVvux0yQRT2VUWREKrtGRjs,161224160
|
|
6
|
-
pylego/pylego.py,sha256=LD5BF1c0FM0p3M4Mqz62edNwsM0vV-tJ9J16VCWbyJU,2233
|
|
7
|
-
pylego-0.1.25.dist-info/licenses/LICENSE,sha256=aklz9Y8CIpFsN61U4jHlJYp4W_8HoDpY-tINlDcdSZY,10934
|
|
8
|
-
pylego-0.1.25.dist-info/METADATA,sha256=HXxrOi6AMeyJemyvn8DE1nlNNclk5oo7juLllTwnB30,5637
|
|
9
|
-
pylego-0.1.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
10
|
-
pylego-0.1.25.dist-info/top_level.txt,sha256=pSOYv55_w90qy3xOvqz_ysSz-X-XRTb-jMpiOyLNnNs,7
|
|
11
|
-
pylego-0.1.25.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|