From 192235cb82b38862f3a53d7fb0100b17a17eb14c Mon Sep 17 00:00:00 2001 From: Dimitri Sokolyuk Date: Tue, 15 Dec 2015 18:42:19 +0100 Subject: Add altname patcher --- cmd/acmed/config.go | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'cmd') diff --git a/cmd/acmed/config.go b/cmd/acmed/config.go index fede62c..cc95557 100644 --- a/cmd/acmed/config.go +++ b/cmd/acmed/config.go @@ -4,6 +4,7 @@ import ( "crypto/rsa" "errors" "path" + "strings" "github.com/BurntSushi/toml" ) @@ -60,6 +61,7 @@ var ( errNoAccount = errors.New("no account specified") errNoKey = errors.New("no key specified") errNoCert = errors.New("no cert specified") + errNoAltNames = errors.New("no altnames specified") ) func LoadConfig(fname string) (*Config, error) { @@ -114,6 +116,15 @@ func LoadConfig(fname string) (*Config, error) { v.Key = path.Join(c.Defaults.Basedir, v.Key) v.Cert = path.Join(c.Defaults.Basedir, v.Cert) } + switch len(v.Altnames) { + case 0: + return nil, errNoAltNames + case 1: + an := v.Altnames[0] + if strings.HasPrefix(an, "www.") { + v.Altnames = append(v.Altnames, an[4:]) + } + } c.Desire[k] = v } return c, nil -- cgit v1.2.3