Skip to content

Commit

Permalink
Merge pull request #120 from flanksource/canary-checker-testing
Browse files Browse the repository at this point in the history
fix: infra section edits
  • Loading branch information
moshloop authored Jan 9, 2024
2 parents 58607fd + 8555b33 commit 05f67ef
Show file tree
Hide file tree
Showing 10 changed files with 101 additions and 74 deletions.
99 changes: 61 additions & 38 deletions canary-checker/docs/reference/ec2.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ spec:
secretKeyRef:
name: aws-credentials
key: AWS_SECRET_ACCESS_KEY
region: af-south-1
region: eu-west-1
userData: |
#!/bin/bash
yum install -y httpd
Expand All @@ -41,7 +41,7 @@ spec:
chmod 2775 /var/www
find /var/www -type d -exec chmod 2775 {} \;
find /var/www -type f -exec chmod 0664 {} \;
securityGroup: WebAccess
securityGroup: default
```
| Field | Description | Scheme | Required |
Expand Down Expand Up @@ -77,42 +77,65 @@ There are 3 options when connecting to AWS:

2. `connection`, this is the recommended method, connections are reusable and secure

```yaml title="aws-connection.yaml"
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: aws-config-rule
spec:
interval: 30
awsConfigRule:
- name: AWS Config Rule Checker
connection: connection://aws/internal
rules:
- "s3-bucket-public-read-prohibited"
```
```yaml title="aws-connection.yaml"
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: ec2-check
spec:
interval: 30
ec2:
- name: ec2-check
ami: ami-04f7efe62f419d9f5
description: test instance
connection: connection://aws/internal
region: eu-west-1
userData: |
#!/bin/bash
yum install -y httpd
systemctl start httpd
systemctl enable httpd
usermod -a -G apache ec2-user
chown -R ec2-user:apache /var/www
chmod 2775 /var/www
find /var/www -type d -exec chmod 2775 {} \;
find /var/www -type f -exec chmod 0664 {} \;
securityGroup: default
```

3. `accessKey` and `secretKey` <CommonLink to="authentication" anchor="envvar">*EnvVar*</CommonLink> with the credentials stored in a secret.

```yaml title="aws.yaml"
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: aws-config-rule
spec:
interval: 30
awsConfigRule:
- name: AWS Config Rule Checker
accessKey:
valueFrom:
secretKeyRef:
name: aws-credentials
key: AWS_ACCESS_KEY_ID
secretKey:
valueFrom:
secretKeyRef:
name: aws-credentials
key: AWS_SECRET_ACCESS_KEY
region: us-east-1
rules:
- "s3-bucket-public-read-prohibited"
```
```yaml title="aws.yaml"
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: ec2-check
spec:
interval: 30
ec2:
- name: ec2-check
ami: ami-04f7efe62f419d9f5
description: test instance
accessKeyID:
valueFrom:
secretKeyRef:
name: aws-credentials
key: AWS_ACCESS_KEY_ID
secretKey:
valueFrom:
secretKeyRef:
name: aws-credentials
key: AWS_SECRET_ACCESS_KEY
region: eu-west-1
userData: |
#!/bin/bash
yum install -y httpd
systemctl start httpd
systemctl enable httpd
usermod -a -G apache ec2-user
chown -R ec2-user:apache /var/www
chmod 2775 /var/www
find /var/www -type d -exec chmod 2775 {} \;
find /var/www -type f -exec chmod 0664 {} \;
securityGroup: default
```
8 changes: 6 additions & 2 deletions canary-checker/docs/reference/gcs-bucket.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ spec:
- name: gcs auth test
path: gcs://somegcsbucket
gcpConnection:
connection: connection://gcp/internal
connection: connection://gcp/internal
```

3. `accessKey` and `secretKey` <CommonLink to="authentication" anchor="envvar">*EnvVar*</CommonLink> with the credentials stored in a secret.
3. `credentials` <CommonLink to="authentication" anchor="envvar">*EnvVar*</CommonLink> with the service account json key stored in a secret.

```yaml title="aws.yaml"
apiVersion: canaries.flanksource.com/v1
Expand All @@ -81,3 +81,7 @@ spec:
key: AUTH_ACCESS_TOKEN
```
To create the secret
```bash
kubectl create secret generic gcp-credentials --from-file=AUTH_ACCESS_TOKEN=path/to/your/SA_Key.json
```
29 changes: 14 additions & 15 deletions canary-checker/docs/reference/kubernetes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,20 @@ metadata:
name: kube-check
spec:
interval: 30
spec:
kubernetes:
- namespace:
name: default
name: k8s-ready pods
kind: Pod
resource:
labelSelector: app=k8s-ready
- namespace:
name: default
kind: Pod
name: k8s-not-ready pods
ready: false
resource:
labelSelector: app=k8s-not-ready
kubernetes:
- namespace:
name: default
name: k8s-ready pods
kind: Pod
resource:
labelSelector: app=k8s-ready
- namespace:
name: default
kind: Pod
name: k8s-not-ready pods
ready: false
resource:
labelSelector: app=k8s-not-ready
```
| Field | Description | Scheme | Required |
Expand Down
2 changes: 1 addition & 1 deletion canary-checker/docs/reference/ldap.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
interval: 30
ldap:
- name: ldap-org
url: ldap://apacheds.ldap.svc:10389
url: ldap://apacheds.ldap.svc.cluster.local:10389
username:
# value: uid=admin,ou=system
valueFrom:
Expand Down
1 change: 0 additions & 1 deletion canary-checker/docs/reference/pod.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ spec:
httpRetryInterval: 200
expectedContent: bar
expectedHttpStatuses: [200, 201, 202]
priorityClass: canary-checker-priority

```

Expand Down
8 changes: 5 additions & 3 deletions canary-checker/docs/reference/s3-bucket.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ There are 3 options when connecting to AWS:
interval: 30
folder:
- path: s3://some-bucket/folder
awsConnection:
awsConnection:
connection: connection://aws/s3
name: folder-check-min
minCount: 10
Expand Down Expand Up @@ -82,13 +82,15 @@ There are 3 options when connecting to AWS:
secretKeyRef:
name: aws-credentials
key: AWS_SECRET_ACCESS_KEY
region: us-east-1AWS connection fields
region: us-east-1
### AWS connection fields
| Field | Description | Scheme | Required |
| --------------- | ------------------------------------------------------------ | ------------------------------------------------- | -------- |
| `connection` | Path of existing connection e.g. `connection://aws/instance` <br />Mutually exclusive with `accessKey` and `secretKey` <br /> <Commercial /> | [Connection](../concepts/connections) | |
| `accessKey` | Mutually exclusive with `connection` | <CommonLink to="authentication" anchor="envvar">*EnvVar*</CommonLink> | Yes |
| `secretKey` | Mutually exclusive with `connection` | <CommonLink to="authentication" anchor="envvar">*EnvVar*</CommonLink> | Yes |
| `endpoint` | Custom AWS endpoint | *string* | |
| `region` | AWS region | *string* | |
| `region` | AWS region | *string* | Yes |
| `skipTLSVerify` | Skip TLS verify when connecting to aws | *bool* | |
13 changes: 12 additions & 1 deletion canary-checker/docs/reference/s3-protocol.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,17 @@ spec:
- name: s3-check
bucketName: flanksource-public
objectPath: dummy
region: us-east-1
accessKey:
valueFrom:
secretKeyRef:
name: aws-credentials
key: AWS_ACCESS_KEY_ID
secretKey:
valueFrom:
secretKeyRef:
name: aws-credentials
key: AWS_SECRET_ACCESS_KEY
```
| Field | Description | Scheme | Required |
Expand All @@ -47,5 +58,5 @@ spec:
| `accessKey` | Mutually exclusive with `connection` | <CommonLink to="authentication" anchor="envvar">*EnvVar*</CommonLink> | Yes |
| `secretKey` | Mutually exclusive with `connection` | <CommonLink to="authentication" anchor="envvar">*EnvVar*</CommonLink> | Yes |
| `endpoint` | Custom AWS endpoint | *string* | |
| `region` | AWS region | *string* | |
| `region` | AWS region | *string* | Yes |
| `skipTLSVerify` | Skip TLS verify when connecting to aws | *bool* | |
2 changes: 1 addition & 1 deletion canary-checker/docs/reference/sftp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ spec:
folder:
- path: /tmp
name: sample sftp check
maxCount: 10
sftpConnection:
host: 192.168.1.5
auth:
Expand All @@ -31,7 +32,6 @@ spec:
secretKeyRef:
name: sftp-credentials
key: PASSWORD
maxCount: 10
```
| Field | Description | Scheme | Required |
Expand Down
2 changes: 1 addition & 1 deletion canary-checker/docs/reference/smb.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ metadata:
spec:
interval: 30
folder:
- path: smb://192.168.1.9/Some Public Folder/somedir
- path: smb:\\192.168.1.9\Some Public Folder\somedir
name: sample smb check
smbConnection:
username:
Expand Down
11 changes: 0 additions & 11 deletions canary-checker/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -373,16 +373,5 @@ module.exports = {
},
],
},
{
type: 'category',
label: 'References',
items: [
{
type: 'doc',
id: 'reference/connections',
label: 'Connections',
},
],
}
],
};

0 comments on commit 05f67ef

Please sign in to comment.