forked from TrueCloudLab/lego
Remove CA path from config dir.
This commit is contained in:
parent
37b20117bf
commit
0f32c176d7
3 changed files with 32 additions and 42 deletions
10
cli.go
10
cli.go
|
@ -24,7 +24,7 @@ func main() {
|
||||||
app := cli.NewApp()
|
app := cli.NewApp()
|
||||||
app.Name = "lego"
|
app.Name = "lego"
|
||||||
app.Usage = "Let's encrypt client to go!"
|
app.Usage = "Let's encrypt client to go!"
|
||||||
app.Version = "0.0.1"
|
app.Version = "0.0.2"
|
||||||
|
|
||||||
cwd, err := os.Getwd()
|
cwd, err := os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -103,14 +103,6 @@ func main() {
|
||||||
Value: 2048,
|
Value: 2048,
|
||||||
Usage: "Size of the RSA key.",
|
Usage: "Size of the RSA key.",
|
||||||
},
|
},
|
||||||
cli.BoolFlag{
|
|
||||||
Name: "no-confirm",
|
|
||||||
Usage: "Turn off confirmation screens.",
|
|
||||||
},
|
|
||||||
cli.BoolFlag{
|
|
||||||
Name: "agree-tos, e",
|
|
||||||
Usage: "Skip the end user license agreement screen.",
|
|
||||||
},
|
|
||||||
cli.StringFlag{
|
cli.StringFlag{
|
||||||
Name: "path",
|
Name: "path",
|
||||||
Usage: "Directory to use for storing the data",
|
Usage: "Directory to use for storing the data",
|
||||||
|
|
|
@ -44,44 +44,42 @@ func run(c *cli.Context) {
|
||||||
|
|
||||||
logger().Print("!!!! HEADS UP !!!!")
|
logger().Print("!!!! HEADS UP !!!!")
|
||||||
logger().Printf(`
|
logger().Printf(`
|
||||||
Your account credentials have been saved in your Let's Encrypt
|
Your account credentials have been saved in your Let's Encrypt
|
||||||
configuration directory at "%s".
|
configuration directory at "%s".
|
||||||
You should make a secure backup of this folder now. This
|
You should make a secure backup of this folder now. This
|
||||||
configuration directory will also contain certificates and
|
configuration directory will also contain certificates and
|
||||||
private keys obtained from Let's Encrypt so making regular
|
private keys obtained from Let's Encrypt so making regular
|
||||||
backups of this folder is ideal.`, c.GlobalString("config-dir"))
|
backups of this folder is ideal.`, conf.AccountPath(c.GlobalString("email")))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if acc.Registration.Body.Agreement == "" {
|
if acc.Registration.Body.Agreement == "" {
|
||||||
if !c.GlobalBool("agree-tos") {
|
reader := bufio.NewReader(os.Stdin)
|
||||||
reader := bufio.NewReader(os.Stdin)
|
logger().Printf("Please review the TOS at %s", acc.Registration.TosURL)
|
||||||
logger().Printf("Please review the TOS at %s", acc.Registration.TosURL)
|
|
||||||
|
|
||||||
for {
|
for {
|
||||||
logger().Println("Do you accept the TOS? Y/n")
|
logger().Println("Do you accept the TOS? Y/n")
|
||||||
text, err := reader.ReadString('\n')
|
text, err := reader.ReadString('\n')
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger().Fatalf("Could not read from console -> %v", err)
|
logger().Fatalf("Could not read from console -> %v", err)
|
||||||
}
|
|
||||||
|
|
||||||
text = strings.Trim(text, "\r\n")
|
|
||||||
|
|
||||||
if text == "n" {
|
|
||||||
logger().Fatal("You did not accept the TOS. Unable to proceed.")
|
|
||||||
}
|
|
||||||
|
|
||||||
if text == "Y" || text == "y" || text == "" {
|
|
||||||
err = client.AgreeToTos()
|
|
||||||
if err != nil {
|
|
||||||
logger().Fatalf("Could not agree to tos -> %v", err)
|
|
||||||
}
|
|
||||||
acc.Save()
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
logger().Println("Your input was invalid. Please answer with one of Y/y, n or by pressing enter.")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
text = strings.Trim(text, "\r\n")
|
||||||
|
|
||||||
|
if text == "n" {
|
||||||
|
logger().Fatal("You did not accept the TOS. Unable to proceed.")
|
||||||
|
}
|
||||||
|
|
||||||
|
if text == "Y" || text == "y" || text == "" {
|
||||||
|
err = client.AgreeToTos()
|
||||||
|
if err != nil {
|
||||||
|
logger().Fatalf("Could not agree to tos -> %v", err)
|
||||||
|
}
|
||||||
|
acc.Save()
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
logger().Println("Your input was invalid. Please answer with one of Y/y, n or by pressing enter.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ func (c *Configuration) OptPort() string {
|
||||||
// ServerPath returns the OS dependent path to the data for a specific CA
|
// ServerPath returns the OS dependent path to the data for a specific CA
|
||||||
func (c *Configuration) ServerPath() string {
|
func (c *Configuration) ServerPath() string {
|
||||||
srv, _ := url.Parse(c.context.GlobalString("server"))
|
srv, _ := url.Parse(c.context.GlobalString("server"))
|
||||||
srvStr := strings.Replace(srv.Host, ":", "_", -1) + srv.Path
|
srvStr := strings.Replace(srv.Host, ":", "_", -1)
|
||||||
return strings.Replace(srvStr, "/", string(os.PathSeparator), -1)
|
return strings.Replace(srvStr, "/", string(os.PathSeparator), -1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue