Documentation ¶
Index ¶
- Constants
- Variables
- func AsSHA256(v interface{}) string
- func BoolPointer(b bool) *bool
- func BoolPointerToString(b *bool) string
- func BoolToString(b bool) string
- func GenarateConfigMapName(wlid string) string
- func GetClusterFromWlid(wlid string) string
- func GetK8SKindFronList(kind string) string
- func GetK8sWLID(level0, level1, k, name string) string
- func GetKindFromWlid(wlid string) string
- func GetNameFromWlid(wlid string) string
- func GetNamespaceFromWlid(wlid string) string
- func GetNativeWLID(level0, level1, k, name string) string
- func GetWLID(level0, level1, k, name string) string
- func IfIgnoreNamespace(ns string) bool
- func IfKubeNamespace(ns string) bool
- func InitNamespacesListToIgnore(caNamespace string)
- func IsAttached(labels map[string]string) *bool
- func IsK8SKindInList(kind string) bool
- func IsSecretProtected(labels map[string]string) *bool
- func IsSid(id string) bool
- func IsWlid(id string) bool
- func IsWlidValid(wlid string) error
- func RestoreMicroserviceIDs(spiffe string) []string
- func RestoreMicroserviceIDsFromSpiffe(spiffe string) ([]string, error)
- func SetEnv(key, value string)
- func StringHasWhitespace(str string) bool
- func StringToBool(s string) bool
- func StringToBoolPointer(s string) *bool
- func WildWlidContainsWlid(wildWlid, wlid string) bool
- type ClusterConfig
- type ImageInfo
- type SpiffeBasicInfo
Constants ¶
const ( ArmoPrefix string = "armo" ArmoAttach string = ArmoPrefix + ".attach" ArmoInitialSecret string = ArmoPrefix + ".initial" ArmoSecretStatus string = ArmoPrefix + ".secret" ArmoCompatibleLabel string = ArmoPrefix + ".compatible" ArmoSecretProtectStatus string = "protect" ArmoSecretClearStatus string = "clear" )
labels added to the workload
const ( ArmoUpdate string = ArmoPrefix + ".last-update" ArmoWlid string = ArmoPrefix + ".wlid" ArmoSid string = ArmoPrefix + ".sid" ArmoJobID string = ArmoPrefix + ".job" ArmoJobIDPath string = ArmoJobID + "/id" ArmoJobParentPath string = ArmoJobID + "/parent" ArmoJobActionPath string = ArmoJobID + "/action" ArmoCompatibleAnnotation string = ArmoAttach + "/compatible" ArmoReplaceheaders string = ArmoAttach + "/replaceheaders" )
annotations added to the workload
const ( CAAttachLabel string = "cyberarmor" Patched string = "Patched" Done string = "Done" Encrypted string = "Protected" CAInjectOld = "injectCyberArmor" CAPrefix string = "cyberarmor" CAProtectedSecret string = CAPrefix + ".secret" CAInitialSecret string = CAPrefix + ".initial" CAInject string = CAPrefix + ".inject" CAIgnore string = CAPrefix + ".ignore" CAReplaceHeaders string = CAPrefix + ".removeSecurityHeaders" )
const ( CAUpdate string = CAPrefix + ".last-update" CAStatus string = CAPrefix + ".status" CAWlid string = CAPrefix + ".wlid" )
const (
PackagePath = "vendor/github.com/armosec/capacketsgo"
)
wlid/ sid utils
const (
SpiffePrefix = "://"
)
wlid/ sid utils
Variables ¶
var ( WlidPrefix = "wlid://" SidPrefix = "sid://" ClusterWlidPrefix = "cluster-" NamespaceWlidPrefix = "namespace-" DataCenterWlidPrefix = "datacenter-" ProjectWlidPrefix = "project-" SecretSIDPrefix = "secret-" SubSecretSIDPrefix = "subsecret-" K8SKindsList = []string{"ComponentStatus", "ConfigMap", "ControllerRevision", "CronJob", "CustomResourceDefinition", "DaemonSet", "Deployment", "Endpoints", "Event", "HorizontalPodAutoscaler", "Ingress", "Job", "Lease", "LimitRange", "LocalSubjectAccessReview", "MutatingWebhookConfiguration", "Namespace", "NetworkPolicy", "Node", "PersistentVolume", "PersistentVolumeClaim", "Pod", "PodDisruptionBudget", "PodSecurityPolicy", "PodTemplate", "PriorityClass", "ReplicaSet", "ReplicationController", "ResourceQuota", "Role", "RoleBinding", "Secret", "SelfSubjectAccessReview", "SelfSubjectRulesReview", "Service", "ServiceAccount", "StatefulSet", "StorageClass", "SubjectAccessReview", "TokenReview", "ValidatingWebhookConfiguration", "VolumeAttachment"} NativeKindsList = []string{"Dockerized", "Native"} KindReverseMap = map[string]string{} )
API fields
var KubeNamespaces = []string{metav1.NamespaceSystem, metav1.NamespacePublic}
var NamespacesListToIgnore = make([]string, 0)
Functions ¶
func AsSHA256 ¶
func AsSHA256(v interface{}) string
AsSHA256 takes anything turns it into string :) https://blog.8bitzen.com/posts/22-08-2019-how-to-hash-a-struct-in-go
func BoolPointer ¶
func BoolPointerToString ¶
func BoolToString ¶
func GenarateConfigMapName ¶
func GetClusterFromWlid ¶
GetClusterFromWlid parse wlid and get cluster
func GetK8SKindFronList ¶
GetK8SKindFronList get the calculated wlid
func GetK8sWLID ¶
GetK8sWLID get the k8s calculated wlid
func GetKindFromWlid ¶
GetKindFromWlid parse wlid and get kind
func GetNameFromWlid ¶
GetNameFromWlid parse wlid and get name
func GetNamespaceFromWlid ¶
GetNamespaceFromWlid parse wlid and get Namespace
func GetNativeWLID ¶
GetNativeWLID get the native calculated wlid
func IfIgnoreNamespace ¶
func IfKubeNamespace ¶
func InitNamespacesListToIgnore ¶
func InitNamespacesListToIgnore(caNamespace string)
NamespacesListToIgnore namespaces to ignore if a pod
func IsAttached ¶
func IsK8SKindInList ¶
IsK8SKindInList Check if the kind is a known kind
func IsSecretProtected ¶
func RestoreMicroserviceIDs ¶
RestoreMicroserviceIDsFromSpiffe -
func RestoreMicroserviceIDsFromSpiffe ¶
RestoreMicroserviceIDsFromSpiffe -
func StringHasWhitespace ¶
StringHasWhitespace check if a string has whitespace
func StringToBool ¶
func StringToBoolPointer ¶
func WildWlidContainsWlid ¶
WildWlidContainsWlid does WildWlid contains Wlid
Types ¶
type ClusterConfig ¶
type ClusterConfig struct { EventReceiverREST string `json:"eventReceiverREST"` EventReceiverWS string `json:"eventReceiverWS"` MaserNotificationServer string `json:"maserNotificationServer"` Postman string `json:"postman"` Dashboard string `json:"dashboard"` Portal string `json:"portal"` CustomerGUID string `json:"customerGUID"` ClusterGUID string `json:"clusterGUID"` ClusterName string `json:"clusterName"` OciImageURL string `json:"ociImageURL"` NotificationWSURL string `json:"notificationWSURL"` NotificationRestURL string `json:"notificationRestURL"` VulnScanURL string `json:"vulnScanURL"` OracleURL string `json:"oracleURL"` ClairURL string `json:"clairURL"` }
func LoadConfig ¶
func LoadConfig(configPath string, loadToEnv bool) (*ClusterConfig, error)
func (*ClusterConfig) LoadConfigToEnv ¶
func (clusterConfig *ClusterConfig) LoadConfigToEnv()
type ImageInfo ¶
type ImageInfo struct { Registry string `json:"registry"` VersionImage string `json:"versionImage"` }
func ImageTagToImageInfo ¶
type SpiffeBasicInfo ¶
type SpiffeBasicInfo struct { //cluster/datacenter Level0 string `json:"level0"` Level0Type string `json:"level0Type"` //namespace/project Level1 string `json:"level0"` Level1Type string `json:"level0Type"` Kind string `json:"kind"` Name string `json:"name"` }
represents workload basic info
func SpiffeToSpiffeInfo ¶
func SpiffeToSpiffeInfo(spiffe string) (*SpiffeBasicInfo, error)