github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/command/tls.go (about)

     1  package command
     2  
     3  import (
     4  	"os"
     5  	"strings"
     6  
     7  	"github.com/mitchellh/cli"
     8  )
     9  
    10  type TLSCommand struct {
    11  	Meta
    12  }
    13  
    14  func fileDoesNotExist(file string) bool {
    15  	if _, err := os.Stat(file); os.IsNotExist(err) {
    16  		return true
    17  	}
    18  	return false
    19  }
    20  
    21  func (c *TLSCommand) Help() string {
    22  	helpText := `
    23  Usage: nomad tls <subcommand> <subcommand> [options]
    24  
    25  This command groups subcommands for creating certificates for Nomad TLS configuration. 
    26  The TLS command allows operators to generate self signed certificates to use
    27  when securing your Nomad cluster.
    28  
    29  Some simple examples for creating certificates can be found here.
    30  More detailed examples are available in the subcommands or the documentation.
    31  
    32  Create a CA
    33  
    34      $ nomad tls ca create
    35  
    36  Create a server certificate
    37  
    38      $ nomad tls cert create -server
    39  
    40  Create a client certificate
    41  
    42      $ nomad tls cert create -client
    43  
    44  `
    45  	return strings.TrimSpace(helpText)
    46  }
    47  
    48  func (c *TLSCommand) Synopsis() string {
    49  	return "Generate Self Signed TLS Certificates for Nomad"
    50  }
    51  
    52  func (c *TLSCommand) Name() string { return "tls" }
    53  
    54  func (c *TLSCommand) Run(_ []string) int {
    55  	return cli.RunResultHelp
    56  }