2019-03-11 18:56:48 +02:00
package cmd
2018-12-06 23:50:17 +02:00
import (
2020-09-02 03:20:01 +02:00
"github.com/go-acme/lego/v4/lego"
2022-02-13 13:28:51 +02:00
"github.com/urfave/cli/v2"
"software.sslmate.com/src/go-pkcs12"
2018-12-06 23:50:17 +02:00
)
func CreateFlags ( defaultPath string ) [ ] cli . Flag {
return [ ] cli . Flag {
2022-02-13 13:28:51 +02:00
& cli . StringSliceFlag {
Name : "domains" ,
Aliases : [ ] string { "d" } ,
Usage : "Add a domain to the process. Can be specified multiple times." ,
} ,
& cli . StringFlag {
Name : "server" ,
Aliases : [ ] string { "s" } ,
Usage : "CA hostname (and optionally :port). The server certificate must be trusted in order to avoid further modifications to the client." ,
Value : lego . LEDirectoryProduction ,
} ,
& cli . BoolFlag {
Name : "accept-tos" ,
Aliases : [ ] string { "a" } ,
Usage : "By setting this flag to true you indicate that you accept the current Let's Encrypt terms of service." ,
} ,
& cli . StringFlag {
Name : "email" ,
Aliases : [ ] string { "m" } ,
Usage : "Email used for registration and recovery contact." ,
} ,
& cli . StringFlag {
Name : "csr" ,
Aliases : [ ] string { "c" } ,
Usage : "Certificate signing request filename, if an external CSR is to be used." ,
} ,
& cli . BoolFlag {
2018-12-06 23:50:17 +02:00
Name : "eab" ,
Usage : "Use External Account Binding for account registration. Requires --kid and --hmac." ,
} ,
2022-02-13 13:28:51 +02:00
& cli . StringFlag {
2018-12-06 23:50:17 +02:00
Name : "kid" ,
Usage : "Key identifier from External CA. Used for External Account Binding." ,
} ,
2022-02-13 13:28:51 +02:00
& cli . StringFlag {
2018-12-06 23:50:17 +02:00
Name : "hmac" ,
Usage : "MAC key from External CA. Should be in Base64 URL Encoding without padding format. Used for External Account Binding." ,
} ,
2022-02-13 13:28:51 +02:00
& cli . StringFlag {
Name : "key-type" ,
Aliases : [ ] string { "k" } ,
Value : "ec256" ,
Usage : "Key type to use for private keys. Supported: rsa2048, rsa4096, rsa8192, ec256, ec384." ,
2018-12-06 23:50:17 +02:00
} ,
2022-02-13 13:28:51 +02:00
& cli . StringFlag {
2018-12-06 23:50:17 +02:00
Name : "filename" ,
2019-01-03 17:59:53 +02:00
Usage : "(deprecated) Filename of the generated certificate." ,
2018-12-06 23:50:17 +02:00
} ,
2022-02-13 13:28:51 +02:00
& cli . StringFlag {
Name : "path" ,
EnvVars : [ ] string { "LEGO_PATH" } ,
Usage : "Directory to use for storing the data." ,
Value : defaultPath ,
2018-12-06 23:50:17 +02:00
} ,
2022-02-13 13:28:51 +02:00
& cli . BoolFlag {
2019-01-03 17:59:53 +02:00
Name : "http" ,
Usage : "Use the HTTP challenge to solve challenges. Can be mixed with other types of challenges." ,
2018-12-06 23:50:17 +02:00
} ,
2022-02-13 13:28:51 +02:00
& cli . StringFlag {
2019-01-03 17:59:53 +02:00
Name : "http.port" ,
Usage : "Set the port and interface to use for HTTP based challenges to listen on.Supported: interface:port or :port." ,
Value : ":80" ,
2018-12-06 23:50:17 +02:00
} ,
2022-02-13 13:28:51 +02:00
& cli . StringFlag {
2019-10-05 13:44:38 +02:00
Name : "http.proxy-header" ,
Usage : "Validate against this HTTP header when solving HTTP based challenges behind a reverse proxy." ,
Value : "Host" ,
} ,
2022-02-13 13:28:51 +02:00
& cli . StringFlag {
2019-01-03 17:59:53 +02:00
Name : "http.webroot" ,
2019-11-19 02:43:07 +02:00
Usage : "Set the webroot folder to use for HTTP based challenges to write directly in a file in .well-known/acme-challenge. This disables the built-in server and expects the given directory to be publicly served with access to .well-known/acme-challenge" ,
2018-12-06 23:50:17 +02:00
} ,
2022-02-13 13:28:51 +02:00
& cli . StringSliceFlag {
2019-01-03 17:59:53 +02:00
Name : "http.memcached-host" ,
2018-12-06 23:50:17 +02:00
Usage : "Set the memcached host(s) to use for HTTP based challenges. Challenges will be written to all specified hosts." ,
} ,
2022-02-13 13:28:51 +02:00
& cli . BoolFlag {
2019-01-03 17:59:53 +02:00
Name : "tls" ,
Usage : "Use the TLS challenge to solve challenges. Can be mixed with other types of challenges." ,
2018-12-06 23:50:17 +02:00
} ,
2022-02-13 13:28:51 +02:00
& cli . StringFlag {
2019-01-03 17:59:53 +02:00
Name : "tls.port" ,
Usage : "Set the port and interface to use for TLS based challenges to listen on. Supported: interface:port or :port." ,
Value : ":443" ,
2018-12-06 23:50:17 +02:00
} ,
2022-02-13 13:28:51 +02:00
& cli . StringFlag {
2018-12-06 23:50:17 +02:00
Name : "dns" ,
2019-01-03 17:59:53 +02:00
Usage : "Solve a DNS challenge using the specified provider. Can be mixed with other types of challenges. Run 'lego dnshelp' for help on usage." ,
2018-12-06 23:50:17 +02:00
} ,
2022-02-13 13:28:51 +02:00
& cli . BoolFlag {
2019-01-03 17:59:53 +02:00
Name : "dns.disable-cp" ,
2018-12-06 23:50:17 +02:00
Usage : "By setting this flag to true, disables the need to wait the propagation of the TXT record to all authoritative name servers." ,
} ,
2022-02-13 13:28:51 +02:00
& cli . StringSliceFlag {
2019-01-03 17:59:53 +02:00
Name : "dns.resolvers" ,
2018-12-06 23:50:17 +02:00
Usage : "Set the resolvers to use for performing recursive DNS queries. Supported: host:port. The default is to use the system resolvers, or Google's DNS resolvers if the system's cannot be determined." ,
} ,
2022-02-13 13:28:51 +02:00
& cli . IntFlag {
2019-01-03 17:59:53 +02:00
Name : "http-timeout" ,
Usage : "Set the HTTP timeout value to a specific value in seconds." ,
} ,
2022-02-13 13:28:51 +02:00
& cli . IntFlag {
2018-12-06 23:50:17 +02:00
Name : "dns-timeout" ,
2019-01-03 17:59:53 +02:00
Usage : "Set the DNS timeout value to a specific value in seconds. Used only when performing authoritative name servers queries." ,
Value : 10 ,
2018-12-06 23:50:17 +02:00
} ,
2022-02-13 13:28:51 +02:00
& cli . BoolFlag {
2018-12-06 23:50:17 +02:00
Name : "pem" ,
Usage : "Generate a .pem file by concatenating the .key and .crt files together." ,
} ,
2022-02-13 13:28:51 +02:00
& cli . BoolFlag {
2021-12-25 20:36:01 +02:00
Name : "pfx" ,
Usage : "Generate a .pfx (PKCS#12) file by with the .key and .crt and issuer .crt files together." ,
} ,
2022-02-13 13:28:51 +02:00
& cli . StringFlag {
2021-12-25 20:36:01 +02:00
Name : "pfx.pass" ,
Usage : "The password used to encrypt the .pfx (PCKS#12) file." ,
Value : pkcs12 . DefaultPassword ,
} ,
2022-02-13 13:28:51 +02:00
& cli . IntFlag {
2019-01-09 09:29:17 +02:00
Name : "cert.timeout" ,
Usage : "Set the certificate timeout value to a specific value in seconds. Only used when obtaining certificates." ,
Value : 30 ,
} ,
2022-06-29 20:56:56 +02:00
& cli . StringFlag {
Name : "user-agent" ,
Usage : "Add to the user-agent sent to the CA to identify an application embedding lego-cli" ,
} ,
2018-12-06 23:50:17 +02:00
}
}