mirror of
https://github.com/openappsec/openappsec.git
synced 2025-11-20 02:47:12 +03:00
Compare commits
3 Commits
danielei-h
...
orianelou-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
805e958cb9 | ||
|
|
5bcd7cfcf1 | ||
|
|
ae6f2faeec |
@@ -79,7 +79,6 @@ class DefaultBackend
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void load(cereal::JSONInputArchive &);
|
void load(cereal::JSONInputArchive &);
|
||||||
bool doesExist() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool is_exists = false;
|
bool is_exists = false;
|
||||||
@@ -91,7 +90,6 @@ public:
|
|||||||
void load(cereal::JSONInputArchive &archive_in);
|
void load(cereal::JSONInputArchive &archive_in);
|
||||||
|
|
||||||
const std::vector<IngressDefinedRule> & getRules() const;
|
const std::vector<IngressDefinedRule> & getRules() const;
|
||||||
bool doesDefaultBackendExist() const;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string ingress_class_name;
|
std::string ingress_class_name;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ private:
|
|||||||
SecurityAppsWrapper security_apps;
|
SecurityAppsWrapper security_apps;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PolicyMakerUtils : Singleton::Consume<I_EnvDetails>
|
class PolicyMakerUtils
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
std::string proccesSingleAppsecPolicy(
|
std::string proccesSingleAppsecPolicy(
|
||||||
|
|||||||
@@ -86,12 +86,6 @@ DefaultBackend::load(cereal::JSONInputArchive &)
|
|||||||
is_exists = true;
|
is_exists = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
DefaultBackend::doesExist() const
|
|
||||||
{
|
|
||||||
return is_exists;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
IngressSpec::load(cereal::JSONInputArchive &archive_in)
|
IngressSpec::load(cereal::JSONInputArchive &archive_in)
|
||||||
{
|
{
|
||||||
@@ -107,12 +101,6 @@ IngressSpec::getRules() const
|
|||||||
return rules;
|
return rules;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
|
||||||
IngressSpec::doesDefaultBackendExist() const
|
|
||||||
{
|
|
||||||
return default_backend.doesExist();
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
SingleIngressData::load(cereal::JSONInputArchive &archive_in)
|
SingleIngressData::load(cereal::JSONInputArchive &archive_in)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -532,16 +532,6 @@ K8sPolicyUtils::createPolicy(
|
|||||||
map<AnnotationKeys, string> &annotations_values,
|
map<AnnotationKeys, string> &annotations_values,
|
||||||
const SingleIngressData &item) const
|
const SingleIngressData &item) const
|
||||||
{
|
{
|
||||||
if (policies.find(annotations_values[AnnotationKeys::PolicyKey]) == policies.end()) {
|
|
||||||
policies[annotations_values[AnnotationKeys::PolicyKey]] = appsec_policy;
|
|
||||||
}
|
|
||||||
if (item.getSpec().doesDefaultBackendExist()) {
|
|
||||||
dbgTrace(D_LOCAL_POLICY)
|
|
||||||
<< "Inserting Any host rule to the specific asset set";
|
|
||||||
K ingress_rule = K("*");
|
|
||||||
policies[annotations_values[AnnotationKeys::PolicyKey]].addSpecificRule(ingress_rule);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const IngressDefinedRule &rule : item.getSpec().getRules()) {
|
for (const IngressDefinedRule &rule : item.getSpec().getRules()) {
|
||||||
string url = rule.getHost();
|
string url = rule.getHost();
|
||||||
for (const IngressRulePath &uri : rule.getPathsWrapper().getRulePaths()) {
|
for (const IngressRulePath &uri : rule.getPathsWrapper().getRulePaths()) {
|
||||||
@@ -554,12 +544,14 @@ K8sPolicyUtils::createPolicy(
|
|||||||
<< uri.getPath()
|
<< uri.getPath()
|
||||||
<< "'";
|
<< "'";
|
||||||
K ingress_rule = K(url + uri.getPath());
|
K ingress_rule = K(url + uri.getPath());
|
||||||
policies[annotations_values[AnnotationKeys::PolicyKey]].addSpecificRule(ingress_rule);
|
appsec_policy.addSpecificRule(ingress_rule);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
policies[annotations_values[AnnotationKeys::PolicyKey]] = appsec_policy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::tuple<map<string, AppsecLinuxPolicy>, map<string, V1beta2AppsecLinuxPolicy>>
|
std::tuple<map<string, AppsecLinuxPolicy>, map<string, V1beta2AppsecLinuxPolicy>>
|
||||||
K8sPolicyUtils::createAppsecPoliciesFromIngresses()
|
K8sPolicyUtils::createAppsecPoliciesFromIngresses()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -126,7 +126,6 @@ NewAppsecPolicySpec::load(cereal::JSONInputArchive &archive_in)
|
|||||||
dbgTrace(D_LOCAL_POLICY) << "Loading AppSec policy spec";
|
dbgTrace(D_LOCAL_POLICY) << "Loading AppSec policy spec";
|
||||||
parseAppsecJSONKey<string>("appsecClassName", appsec_class_name, archive_in);
|
parseAppsecJSONKey<string>("appsecClassName", appsec_class_name, archive_in);
|
||||||
parseAppsecJSONKey<NewParsedRule>("default", default_rule, archive_in);
|
parseAppsecJSONKey<NewParsedRule>("default", default_rule, archive_in);
|
||||||
default_rule.setHost("*");
|
|
||||||
parseAppsecJSONKey<vector<NewParsedRule>>("specificRules", specific_rules, archive_in);
|
parseAppsecJSONKey<vector<NewParsedRule>>("specificRules", specific_rules, archive_in);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1636,9 +1636,7 @@ PolicyMakerUtils::createAgentPolicyFromAppsecPolicy(const string &policy_name, c
|
|||||||
createPolicyElements<T, R>(specific_rules, default_rule, appsec_policy, policy_name);
|
createPolicyElements<T, R>(specific_rules, default_rule, appsec_policy, policy_name);
|
||||||
|
|
||||||
// add default rule to policy
|
// add default rule to policy
|
||||||
if (Singleton::Consume<I_EnvDetails>::by<PolicyMakerUtils>()->getEnvType() != EnvType::K8S) {
|
createPolicyElementsByRule<T, R>(default_rule, default_rule, appsec_policy, policy_name);
|
||||||
createPolicyElementsByRule<T, R>(default_rule, default_rule, appsec_policy, policy_name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// LCOV_EXCL_START Reason: no test exist
|
// LCOV_EXCL_START Reason: no test exist
|
||||||
@@ -1661,13 +1659,11 @@ PolicyMakerUtils::createAgentPolicyFromAppsecPolicy<V1beta2AppsecLinuxPolicy, Ne
|
|||||||
);
|
);
|
||||||
|
|
||||||
// add default rule to policy
|
// add default rule to policy
|
||||||
if (Singleton::Consume<I_EnvDetails>::by<PolicyMakerUtils>()->getEnvType() != EnvType::K8S) {
|
createPolicyElementsByRule<V1beta2AppsecLinuxPolicy, NewParsedRule>(
|
||||||
createPolicyElementsByRule<V1beta2AppsecLinuxPolicy, NewParsedRule>(
|
default_rule,
|
||||||
default_rule,
|
default_rule,
|
||||||
default_rule,
|
appsec_policy,
|
||||||
appsec_policy,
|
policy_name);
|
||||||
policy_name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// LCOV_EXCL_STOP
|
// LCOV_EXCL_STOP
|
||||||
|
|
||||||
|
|||||||
1321
config/crds/open-appsec-crd-latest.yaml
Normal file
1321
config/crds/open-appsec-crd-latest.yaml
Normal file
File diff suppressed because it is too large
Load Diff
525
config/crds/open-appsec-crd-v1beta1.yaml
Normal file
525
config/crds/open-appsec-crd-v1beta1.yaml
Normal file
@@ -0,0 +1,525 @@
|
|||||||
|
Enter file contents hereapiVersion: apiextensions.k8s.io/v1
|
||||||
|
kind: CustomResourceDefinition
|
||||||
|
metadata :
|
||||||
|
name : customresponses.openappsec.io
|
||||||
|
|
||||||
|
spec:
|
||||||
|
group: openappsec.io
|
||||||
|
versions:
|
||||||
|
- name: v1beta1
|
||||||
|
served: true
|
||||||
|
storage: true
|
||||||
|
schema:
|
||||||
|
openAPIV3Schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
spec:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
mode:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- block-page
|
||||||
|
#- redirect
|
||||||
|
- response-code-only
|
||||||
|
message-title:
|
||||||
|
type: string
|
||||||
|
message-body:
|
||||||
|
type: string
|
||||||
|
http-response-code:
|
||||||
|
type: integer
|
||||||
|
minimum: 100
|
||||||
|
maximum: 599
|
||||||
|
|
||||||
|
scope: Cluster
|
||||||
|
names:
|
||||||
|
plural: customresponses
|
||||||
|
singular: customresponse
|
||||||
|
kind: CustomResponse
|
||||||
|
shortNames:
|
||||||
|
- customresponse
|
||||||
|
---
|
||||||
|
apiVersion: apiextensions.k8s.io/v1
|
||||||
|
kind: CustomResourceDefinition
|
||||||
|
metadata:
|
||||||
|
name: exceptions.openappsec.io
|
||||||
|
|
||||||
|
spec:
|
||||||
|
group: openappsec.io
|
||||||
|
versions:
|
||||||
|
- name: v1beta1
|
||||||
|
served: true
|
||||||
|
storage: true
|
||||||
|
schema:
|
||||||
|
openAPIV3Schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
spec:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
required:
|
||||||
|
- action
|
||||||
|
properties:
|
||||||
|
action:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- skip
|
||||||
|
- accept
|
||||||
|
- drop
|
||||||
|
- suppressLog
|
||||||
|
sourceIp:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
url:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
sourceIdentifier:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
protectionName:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
paramValue:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
paramName:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
hostName:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
countryCode:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
countryName:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
comment:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
scope: Cluster
|
||||||
|
names:
|
||||||
|
plural: exceptions
|
||||||
|
singular: exception
|
||||||
|
kind: Exception
|
||||||
|
shortNames:
|
||||||
|
- exception
|
||||||
|
---
|
||||||
|
apiVersion: apiextensions.k8s.io/v1
|
||||||
|
kind: CustomResourceDefinition
|
||||||
|
metadata :
|
||||||
|
name : logtriggers.openappsec.io
|
||||||
|
|
||||||
|
spec:
|
||||||
|
group: openappsec.io
|
||||||
|
versions:
|
||||||
|
- name: v1beta1
|
||||||
|
# Each version can be enabled/disabled by Served flag.
|
||||||
|
served: true
|
||||||
|
# One and only one version must be marked as the storage version.
|
||||||
|
storage: true
|
||||||
|
schema:
|
||||||
|
openAPIV3Schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
spec:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
access-control-logging:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
allow-events:
|
||||||
|
type: boolean
|
||||||
|
drop-events:
|
||||||
|
type: boolean
|
||||||
|
appsec-logging:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
detect-events:
|
||||||
|
type: boolean
|
||||||
|
prevent-events:
|
||||||
|
type: boolean
|
||||||
|
all-web-requests:
|
||||||
|
type: boolean
|
||||||
|
additional-suspicious-events-logging:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
enabled:
|
||||||
|
type: boolean
|
||||||
|
minimum-severity:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- high
|
||||||
|
- critical
|
||||||
|
response-body:
|
||||||
|
type: boolean
|
||||||
|
response-code:
|
||||||
|
type: boolean
|
||||||
|
extended-logging:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
url-path:
|
||||||
|
type: boolean
|
||||||
|
url-query:
|
||||||
|
type: boolean
|
||||||
|
http-headers:
|
||||||
|
type: boolean
|
||||||
|
request-body:
|
||||||
|
type: boolean
|
||||||
|
log-destination:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
cloud:
|
||||||
|
type: boolean
|
||||||
|
syslog-service: #change to object array
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
address:
|
||||||
|
type: string
|
||||||
|
port:
|
||||||
|
type: integer
|
||||||
|
file:
|
||||||
|
type: string
|
||||||
|
stdout:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
format:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- json
|
||||||
|
- json-formatted
|
||||||
|
cef-service:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
address:
|
||||||
|
type: string
|
||||||
|
port:
|
||||||
|
type: integer
|
||||||
|
proto:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- tcp
|
||||||
|
- udp
|
||||||
|
|
||||||
|
scope: Cluster
|
||||||
|
names:
|
||||||
|
plural: logtriggers
|
||||||
|
singular: logtrigger
|
||||||
|
kind: LogTrigger
|
||||||
|
shortNames:
|
||||||
|
- logtrigger
|
||||||
|
---
|
||||||
|
apiVersion: apiextensions.k8s.io/v1
|
||||||
|
kind: CustomResourceDefinition
|
||||||
|
metadata :
|
||||||
|
name : policies.openappsec.io
|
||||||
|
|
||||||
|
spec:
|
||||||
|
group: openappsec.io
|
||||||
|
versions:
|
||||||
|
- name: v1beta1
|
||||||
|
# Each version can be enabled/disabled by Served flag.
|
||||||
|
served: true
|
||||||
|
# One and only one version must be marked as the storage version.
|
||||||
|
storage: true
|
||||||
|
schema:
|
||||||
|
openAPIV3Schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
spec:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
default:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
mode:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- prevent-learn
|
||||||
|
- detect-learn
|
||||||
|
- prevent
|
||||||
|
- detect
|
||||||
|
- inactive
|
||||||
|
practices:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
triggers:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
custom-response:
|
||||||
|
type: string
|
||||||
|
source-identifiers:
|
||||||
|
type: string
|
||||||
|
trusted-sources:
|
||||||
|
type: string
|
||||||
|
exceptions:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
specific-rules:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
host:
|
||||||
|
type: string
|
||||||
|
mode:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- prevent-learn
|
||||||
|
- detect-learn
|
||||||
|
- prevent
|
||||||
|
- detect
|
||||||
|
- inactive
|
||||||
|
practices:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
triggers:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
custom-response:
|
||||||
|
type: string
|
||||||
|
source-identifiers:
|
||||||
|
type: string
|
||||||
|
trusted-sources:
|
||||||
|
type: string
|
||||||
|
exceptions:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
scope: Cluster
|
||||||
|
names:
|
||||||
|
plural: policies
|
||||||
|
singular: policy
|
||||||
|
kind: Policy
|
||||||
|
shortNames:
|
||||||
|
- policy
|
||||||
|
---
|
||||||
|
apiVersion: apiextensions.k8s.io/v1
|
||||||
|
kind: CustomResourceDefinition
|
||||||
|
metadata :
|
||||||
|
name : practices.openappsec.io
|
||||||
|
|
||||||
|
spec:
|
||||||
|
group: openappsec.io
|
||||||
|
versions:
|
||||||
|
- name: v1beta1
|
||||||
|
served: true
|
||||||
|
storage: true
|
||||||
|
schema:
|
||||||
|
openAPIV3Schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
spec:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
web-attacks:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
override-mode:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- prevent-learn
|
||||||
|
- detect-learn
|
||||||
|
- prevent
|
||||||
|
- detect
|
||||||
|
- inactive
|
||||||
|
minimum-confidence:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- medium
|
||||||
|
- high
|
||||||
|
- critical
|
||||||
|
max-url-size-bytes:
|
||||||
|
type: integer
|
||||||
|
max-object-depth:
|
||||||
|
type: integer
|
||||||
|
max-body-size-kb:
|
||||||
|
type: integer
|
||||||
|
max-header-size-bytes:
|
||||||
|
type: integer
|
||||||
|
protections:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
csrf-enabled:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- prevent-learn
|
||||||
|
- detect-learn
|
||||||
|
- prevent
|
||||||
|
- detect
|
||||||
|
- inactive
|
||||||
|
error-disclosure-enabled:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- prevent-learn
|
||||||
|
- detect-learn
|
||||||
|
- prevent
|
||||||
|
- detect
|
||||||
|
- inactive
|
||||||
|
open-redirect-enabled:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- prevent-learn
|
||||||
|
- detect-learn
|
||||||
|
- prevent
|
||||||
|
- detect
|
||||||
|
- inactive
|
||||||
|
non-valid-http-methods:
|
||||||
|
type: boolean
|
||||||
|
anti-bot:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
override-mode:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- prevent-learn
|
||||||
|
- detect-learn
|
||||||
|
- prevent
|
||||||
|
- detect
|
||||||
|
- inactive
|
||||||
|
injected-URIs:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
uri:
|
||||||
|
type: string
|
||||||
|
validated-URIs:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
uri:
|
||||||
|
type: string
|
||||||
|
snort-signatures:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
override-mode:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- prevent-learn
|
||||||
|
- detect-learn
|
||||||
|
- prevent
|
||||||
|
- detect
|
||||||
|
- inactive
|
||||||
|
configmap:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
openapi-schema-validation:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
override-mode:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- prevent-learn
|
||||||
|
- detect-learn
|
||||||
|
- prevent
|
||||||
|
- detect
|
||||||
|
- inactive
|
||||||
|
configmap:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
scope: Cluster
|
||||||
|
names:
|
||||||
|
plural: practices
|
||||||
|
singular: practice
|
||||||
|
kind: Practice
|
||||||
|
shortNames:
|
||||||
|
- practice
|
||||||
|
---
|
||||||
|
apiVersion: apiextensions.k8s.io/v1
|
||||||
|
kind: CustomResourceDefinition
|
||||||
|
metadata :
|
||||||
|
name : sourcesidentifiers.openappsec.io
|
||||||
|
|
||||||
|
spec:
|
||||||
|
group: openappsec.io
|
||||||
|
versions:
|
||||||
|
- name: v1beta1
|
||||||
|
served: true
|
||||||
|
storage: true
|
||||||
|
schema:
|
||||||
|
openAPIV3Schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
spec:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
sourceIdentifier:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- headerkey
|
||||||
|
- JWTKey
|
||||||
|
- cookie
|
||||||
|
- sourceip
|
||||||
|
- x-forwarded-for
|
||||||
|
value:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
scope: Cluster
|
||||||
|
names:
|
||||||
|
plural: sourcesidentifiers
|
||||||
|
singular: sourcesidentifier
|
||||||
|
kind: SourcesIdentifier
|
||||||
|
shortNames:
|
||||||
|
- sourcesidentifier
|
||||||
|
---
|
||||||
|
apiVersion: apiextensions.k8s.io/v1
|
||||||
|
kind: CustomResourceDefinition
|
||||||
|
metadata :
|
||||||
|
name : trustedsources.openappsec.io
|
||||||
|
|
||||||
|
spec:
|
||||||
|
group: openappsec.io
|
||||||
|
versions:
|
||||||
|
- name: v1beta1
|
||||||
|
served: true
|
||||||
|
storage: true
|
||||||
|
schema:
|
||||||
|
openAPIV3Schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
spec:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
minNumOfSources:
|
||||||
|
type: integer
|
||||||
|
sourcesIdentifiers:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
|
||||||
|
scope: Cluster
|
||||||
|
names:
|
||||||
|
plural: trustedsources
|
||||||
|
singular: trustedsource
|
||||||
|
kind: TrustedSource
|
||||||
|
shortNames:
|
||||||
|
- trustedsource
|
||||||
1321
config/crds/open-appsec-crd-v1beta2.yaml
Normal file
1321
config/crds/open-appsec-crd-v1beta2.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@@ -13,10 +13,6 @@ profile_id=
|
|||||||
cluster_id=
|
cluster_id=
|
||||||
latest_policy_version=1
|
latest_policy_version=1
|
||||||
|
|
||||||
if [ -f $POLICY_CRDS_PATH ]; then
|
|
||||||
chmod 644 $POLICY_CRDS_PATH
|
|
||||||
fi
|
|
||||||
|
|
||||||
load_agent_details()
|
load_agent_details()
|
||||||
{
|
{
|
||||||
tenant_id=$(awk -F\" '/Tenant ID/{print $4}' /etc/cp/conf/agent_details.json)
|
tenant_id=$(awk -F\" '/Tenant ID/{print $4}' /etc/cp/conf/agent_details.json)
|
||||||
@@ -33,7 +29,7 @@ get_latest_policy_version()
|
|||||||
bucket_list=$(curl -s -w "%{http_code}\n" --request GET \
|
bucket_list=$(curl -s -w "%{http_code}\n" --request GET \
|
||||||
-H "user-agent: Infinity Next (a7030abf93a4c13)" -H "Authorization: Bearer ${ra_token}" \
|
-H "user-agent: Infinity Next (a7030abf93a4c13)" -H "Authorization: Bearer ${ra_token}" \
|
||||||
"$var_fog/agents-core/storage/?list-type=2&prefix=${tenant_id}/${profile_id}")
|
"$var_fog/agents-core/storage/?list-type=2&prefix=${tenant_id}/${profile_id}")
|
||||||
paths_list=$(echo $bucket_list | awk -F'<Key>|</Key>' '/policy-/ {for (i = 1; i <= NF; i++) if ($i ~ /policy/) print $i}')
|
paths_list=$(echo $bucket_list | /etc/cp/bin/yq -p xml | grep "/policy")
|
||||||
|
|
||||||
prefix="${tenant_id}/${profile_id}"
|
prefix="${tenant_id}/${profile_id}"
|
||||||
paths=$(echo $paths_list | tr " " "\n" | grep / )
|
paths=$(echo $paths_list | tr " " "\n" | grep / )
|
||||||
@@ -261,7 +257,6 @@ usage()
|
|||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " --fog <fog address> : Namespace with the relevant Helm Chart"
|
echo " --fog <fog address> : Namespace with the relevant Helm Chart"
|
||||||
echo " --upload_policy_only : Upload policy to the fog, withput changing agent mode"
|
echo " --upload_policy_only : Upload policy to the fog, withput changing agent mode"
|
||||||
echo " --debug : Keep the debuging files"
|
|
||||||
exit 255
|
exit 255
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,8 +277,6 @@ validate_arg_value_exists()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
debug_mode="false"
|
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
if [ "$1" = "--token" ]; then
|
if [ "$1" = "--token" ]; then
|
||||||
validate_arg_value_exists "$1" "$#"
|
validate_arg_value_exists "$1" "$#"
|
||||||
@@ -297,8 +290,6 @@ while true; do
|
|||||||
validate_arg_value_exists "$1" "$#"
|
validate_arg_value_exists "$1" "$#"
|
||||||
shift
|
shift
|
||||||
ra_token="$1"
|
ra_token="$1"
|
||||||
elif [ "$1" = "--debug" ]; then
|
|
||||||
debug_mode="true"
|
|
||||||
elif [ -z "$1" ]; then
|
elif [ -z "$1" ]; then
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
@@ -314,8 +305,5 @@ upload_crds_to_the_cloud
|
|||||||
if [ "$?" = "0" ]; then
|
if [ "$?" = "0" ]; then
|
||||||
echo "SUCCESS"
|
echo "SUCCESS"
|
||||||
fi
|
fi
|
||||||
if [ "$debug_mode" = "false" ]; then
|
|
||||||
rm $POLICY_CRDS_PATH
|
|
||||||
fi
|
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user