Skip to content

Commit

Permalink
Update to generate server name unique per application.
Browse files Browse the repository at this point in the history
  • Loading branch information
blakerouse committed Jun 1, 2020
1 parent ab19e72 commit 320259c
Show file tree
Hide file tree
Showing 8 changed files with 127 additions and 92 deletions.
2 changes: 1 addition & 1 deletion NOTICE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1683,7 +1683,7 @@ limitations under the License.
--------------------------------------------------------------------
Dependency: github.com/elastic/elastic-agent-client/v7
Version: v7.0.0
Revision: f4b379d5629b
Revision: d6a9eb4f6d07
License type (autodetected): ELASTIC
./vendor/github.com/elastic/elastic-agent-client/v7/LICENSE.txt:
--------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ require (
github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4
github.com/eclipse/paho.mqtt.golang v1.2.1-0.20200121105743-0d940dd29fd2
github.com/elastic/ecs v1.5.0
github.com/elastic/elastic-agent-client/v7 v7.0.0-20200527171518-f4b379d5629b
github.com/elastic/elastic-agent-client/v7 v7.0.0-20200601155656-d6a9eb4f6d07
github.com/elastic/go-libaudit/v2 v2.0.0-20200515221334-92371bef3fb8
github.com/elastic/go-licenser v0.2.1
github.com/elastic/go-lookslike v0.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ github.com/elastic/dhcp v0.0.0-20200227161230-57ec251c7eb3 h1:lnDkqiRFKm0rxdljqr
github.com/elastic/dhcp v0.0.0-20200227161230-57ec251c7eb3/go.mod h1:aPqzac6AYkipvp4hufTyMj5PDIphF3+At8zr7r51xjY=
github.com/elastic/ecs v1.5.0 h1:/VEIBsRU4ecq2+U3RPfKNc6bFyomP6qnthYEcQZu8GU=
github.com/elastic/ecs v1.5.0/go.mod h1:pgiLbQsijLOJvFR8OTILLu0Ni/R/foUNg0L+T6mU9b4=
github.com/elastic/elastic-agent-client/v7 v7.0.0-20200527171518-f4b379d5629b h1:cRn/LL2vYlfuKE2maYF+X6V2qr54IGCwbp5C8Z0u9BQ=
github.com/elastic/elastic-agent-client/v7 v7.0.0-20200527171518-f4b379d5629b/go.mod h1:uh/Gj9a0XEbYoM4NYz4LvaBVARz3QXLmlNjsrKY9fTc=
github.com/elastic/elastic-agent-client/v7 v7.0.0-20200601155656-d6a9eb4f6d07 h1:s/41t2QLLkaa83VlS5UuyKH0ctX3bG4RMnE3Eha+8fU=
github.com/elastic/elastic-agent-client/v7 v7.0.0-20200601155656-d6a9eb4f6d07/go.mod h1:uh/Gj9a0XEbYoM4NYz4LvaBVARz3QXLmlNjsrKY9fTc=
github.com/elastic/fsevents v0.0.0-20181029231046-e1d381a4d270 h1:cWPqxlPtir4RoQVCpGSRXmLqjEHpJKbR60rxh1nQZY4=
github.com/elastic/fsevents v0.0.0-20181029231046-e1d381a4d270/go.mod h1:Msl1pdboCbArMF/nSCDUXgQuWTeoMmE/z8607X+k7ng=
github.com/elastic/go-libaudit/v2 v2.0.0-20200515221334-92371bef3fb8 h1:Jcnojiuok7Ea5hitJK9VWmBigganE2MMETOH0VZasEA=
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ github.com/eclipse/paho.mqtt.golang
github.com/eclipse/paho.mqtt.golang/packets
# github.com/elastic/ecs v1.5.0
github.com/elastic/ecs/code/go/ecs
# github.com/elastic/elastic-agent-client/v7 v7.0.0-20200527171518-f4b379d5629b
# github.com/elastic/elastic-agent-client/v7 v7.0.0-20200601155656-d6a9eb4f6d07
github.com/elastic/elastic-agent-client/v7/pkg/client
github.com/elastic/elastic-agent-client/v7/pkg/proto
github.com/elastic/elastic-agent-client/v7/pkg/utils
Expand Down
7 changes: 6 additions & 1 deletion x-pack/elastic-agent/pkg/core/plugin/authority/ca.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,17 @@ func NewCA() (*CertificateAuthority, error) {

// GeneratePair generates child certificate
func (c *CertificateAuthority) GeneratePair() (*Pair, error) {
return c.GeneratePairWithName("localhost")
}

// GeneratePairWithName generates child certificate with provided name as the common name.
func (c *CertificateAuthority) GeneratePairWithName(commonName string) (*Pair, error) {
// Prepare certificate
certTemplate := &x509.Certificate{
SerialNumber: big.NewInt(1658),
Subject: pkix.Name{
Organization: []string{"elastic-fleet"},
CommonName: "localhost",
CommonName: commonName,
},
NotBefore: time.Now(),
NotAfter: time.Now().AddDate(10, 0, 0),
Expand Down
Loading

0 comments on commit 320259c

Please sign in to comment.