Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes license check issue with invalid license UUID and check on 32 bits system. #11649

Merged
merged 8 commits into from
Apr 4, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d
- Report faulting file when config reload fails. {pull}[11304]11304
- Fix a typo in libbeat/outputs/transport/client.go by updating `c.conn.LocalAddr()` to `c.conn.RemoteAddr()`. {pull}11242[11242]
- Management configuration backup file will now have a timestamps in their name. {pull}11034[11034]
- Relax License UUID validation. {issue}11640[11640]
ph marked this conversation as resolved.
Show resolved Hide resolved

*Auditbeat*

Expand Down
3 changes: 1 addition & 2 deletions x-pack/libbeat/licenser/elastic_fetcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"testing"
"time"

"github.com/gofrs/uuid"
"github.com/stretchr/testify/assert"

"github.com/elastic/beats/libbeat/outputs/elasticsearch"
Expand Down Expand Up @@ -133,7 +132,7 @@ func TestParseJSON(t *testing.T) {
return
}

id, _ := uuid.FromString("936183d8-f48c-4a3f-959a-a52aa2563279")
id := "936183d8-f48c-4a3f-959a-a52aa2563279"
assert.Equal(t, id, license.UUID)

assert.NotNil(t, license.Type)
Expand Down
4 changes: 1 addition & 3 deletions x-pack/libbeat/licenser/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ package licenser

import (
"time"

"github.com/gofrs/uuid"
)

// License represents the license of this beat, the license is fetched and returned from
Expand All @@ -27,7 +25,7 @@ import (
// mode is the license in operation. (effective license)
// status is the type installed is active or not.
type License struct {
UUID uuid.UUID `json:"uid"`
UUID string `json:"uid"`
ph marked this conversation as resolved.
Show resolved Hide resolved
Type LicenseType `json:"type"`
Mode LicenseType `json:"mode"`
Status State `json:"status"`
ph marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
2 changes: 1 addition & 1 deletion x-pack/libbeat/licenser/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func mustUUIDV4() uuid.UUID {
// OSSLicense default license to use.
var (
OSSLicense = &License{
UUID: mustUUIDV4(),
UUID: mustUUIDV4().String(),
Type: OSS,
Mode: OSS,
Status: Active,
Expand Down
10 changes: 5 additions & 5 deletions x-pack/libbeat/licenser/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (m *mockFetcher) Close() {

func TestRetrieveLicense(t *testing.T) {
i := &License{
UUID: mustUUIDV4(),
UUID: mustUUIDV4().String(),
Type: Basic,
Mode: Basic,
Status: Active,
Expand Down Expand Up @@ -124,7 +124,7 @@ func TestRetrieveLicense(t *testing.T) {
}

i := &License{
UUID: mustUUIDV4(),
UUID: mustUUIDV4().String(),
Type: Platinum,
Mode: Platinum,
Status: Active,
Expand All @@ -144,7 +144,7 @@ func TestRetrieveLicense(t *testing.T) {

func TestWatcher(t *testing.T) {
i := &License{
UUID: mustUUIDV4(),
UUID: mustUUIDV4().String(),
Type: Basic,
Mode: Basic,
Status: Active,
Expand Down Expand Up @@ -246,7 +246,7 @@ func TestWatcher(t *testing.T) {
if c == 0 {
assert.Equal(t, Basic, license.Get())
mock.Insert(&License{
UUID: mustUUIDV4(),
UUID: mustUUIDV4().String(),
Type: Platinum,
Mode: Platinum,
Status: Active,
Expand Down Expand Up @@ -288,7 +288,7 @@ func TestWatcher(t *testing.T) {

func TestWaitForLicense(t *testing.T) {
i := &License{
UUID: mustUUIDV4(),
UUID: mustUUIDV4().String(),
Type: Basic,
Mode: Basic,
Status: Active,
Expand Down