mirror of
https://github.com/openziti/ziti.git
synced 2026-10-13 23:59:53 +00:00
Merge pull request #388 from openziti/posture.check.mop.fixes
fixes for mop/sdks
This commit is contained in:
@@ -285,7 +285,8 @@ func (r *IdentityRouter) getPolicyAdvice(ae *env.AppEnv, rc *response.RequestCon
|
||||
}
|
||||
|
||||
func (r *IdentityRouter) getPostureData(ae *env.AppEnv, rc *response.RequestContext) {
|
||||
postureData := ae.GetHandlers().PostureResponse.PostureData(rc.Identity.Id)
|
||||
id, _ := rc.GetEntityId()
|
||||
postureData := ae.GetHandlers().PostureResponse.PostureData(id)
|
||||
|
||||
rc.RespondWithOk(postureData, nil)
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/openziti/edge/controller/persistence"
|
||||
"go.etcd.io/bbolt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type PostureCheckOperatingSystem struct {
|
||||
@@ -34,14 +35,22 @@ func (p *PostureCheckOperatingSystem) Evaluate(pd *PostureData) bool {
|
||||
validOses := map[string]map[string]struct{}{}
|
||||
|
||||
for _, os := range p.OperatingSystems {
|
||||
osType := strings.ToLower(os.OsType)
|
||||
validOses[osType] = map[string]struct{}{}
|
||||
for _, version := range os.OsVersions {
|
||||
validOses[os.OsType] = map[string]struct{}{}
|
||||
validOses[os.OsType][version] = struct{}{}
|
||||
validOses[osType][strings.ToLower(version)] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
if validOs, isValidOs := validOses[pd.Os.Type]; isValidOs {
|
||||
if _, isValidVersion := validOs[pd.Os.Version]; isValidVersion {
|
||||
osType := strings.ToLower(pd.Os.Type)
|
||||
osVersion := strings.ToLower(pd.Os.Version)
|
||||
if validOs, isValidOs := validOses[osType]; isValidOs {
|
||||
if len(validOs) == 0 {
|
||||
//any version
|
||||
return true
|
||||
}
|
||||
|
||||
if _, isValidVersion := validOs[osVersion]; isValidVersion {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"fmt"
|
||||
"github.com/openziti/edge/controller/persistence"
|
||||
"go.etcd.io/bbolt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type PostureCheckWindowsDomains struct {
|
||||
@@ -32,7 +33,7 @@ func (p *PostureCheckWindowsDomains) Evaluate(pd *PostureData) bool {
|
||||
}
|
||||
|
||||
for _, domain := range p.Domains {
|
||||
if domain == pd.Domain.Name {
|
||||
if strings.ToLower(domain) == strings.ToLower(pd.Domain.Name) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ type PostureResponseMacAddressCreate struct {
|
||||
|
||||
// mac addresses
|
||||
// Required: true
|
||||
// Min Items: 1
|
||||
MacAddresses []string `json:"macAddresses"`
|
||||
}
|
||||
|
||||
@@ -76,7 +75,6 @@ func (m *PostureResponseMacAddressCreate) UnmarshalJSON(raw []byte) error {
|
||||
|
||||
// mac addresses
|
||||
// Required: true
|
||||
// Min Items: 1
|
||||
MacAddresses []string `json:"macAddresses"`
|
||||
}
|
||||
buf := bytes.NewBuffer(raw)
|
||||
@@ -126,7 +124,6 @@ func (m PostureResponseMacAddressCreate) MarshalJSON() ([]byte, error) {
|
||||
|
||||
// mac addresses
|
||||
// Required: true
|
||||
// Min Items: 1
|
||||
MacAddresses []string `json:"macAddresses"`
|
||||
}{
|
||||
|
||||
@@ -185,12 +182,6 @@ func (m *PostureResponseMacAddressCreate) validateMacAddresses(formats strfmt.Re
|
||||
return err
|
||||
}
|
||||
|
||||
iMacAddressesSize := int64(len(m.MacAddresses))
|
||||
|
||||
if err := validate.MinItems("macAddresses", "body", iMacAddressesSize, 1); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -5463,7 +5463,6 @@ func init() {
|
||||
"properties": {
|
||||
"macAddresses": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
@@ -23130,7 +23129,6 @@ func init() {
|
||||
"properties": {
|
||||
"macAddresses": {
|
||||
"type": "array",
|
||||
"minItems": 1,
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
@@ -6612,7 +6612,6 @@ definitions:
|
||||
properties:
|
||||
macAddresses:
|
||||
type: array
|
||||
minItems: 1
|
||||
items:
|
||||
type: string
|
||||
x-class: "MAC"
|
||||
|
||||
Reference in New Issue
Block a user