Skip to content

Commit f9b8205

Browse files
authored
Merge branch 'main' into dependabot/go_modules/github.com/hashicorp/terraform-json-0.17.0
2 parents b6687fb + aba5cb8 commit f9b8205

File tree

4 files changed

+87
-1
lines changed

4 files changed

+87
-1
lines changed

.github/workflows/security.yaml

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
schedule:
1212
# Run every 6 hours Monday-Friday!
13-
- cron: "0 0,6,12,18 * * 1-5"
13+
- cron: "0 0/6 * * 1-5"
1414

1515
# Cancel in-progress runs for pull requests when developers push
1616
# additional changes
@@ -117,6 +117,14 @@ jobs:
117117
make -j "$image_job"
118118
echo "image=$(cat "$image_job")" >> $GITHUB_OUTPUT
119119
120+
- name: Run Prisma Cloud image scan
121+
uses: PaloAltoNetworks/prisma-cloud-scan@v1
122+
with:
123+
pcc_console_url: ${{ secrets.PRISMA_CLOUD_URL }}
124+
pcc_user: ${{ secrets.PRISMA_CLOUD_ACCESS_KEY }}
125+
pcc_pass: ${{ secrets.PRISMA_CLOUD_SECRET_KEY }}
126+
image_name: ${{ steps.build.outputs.image }}
127+
120128
- name: Run Trivy vulnerability scanner
121129
uses: aquasecurity/trivy-action@41f05d9ecffa2ed3f1580af306000f734b733e54
122130
with:

docs/admin/audit-logs.md

+53
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,59 @@ The supported filters are:
4343
- `date_to` - The inclusive end date with format `YYYY-MM-DD`.
4444
- `build_reason` - To be used with `resource_type:workspace_build`, the [initiator](https://pkg.go.dev/github.com/coder/coder/codersdk#BuildReason) behind the build start or stop.
4545

46+
## Capturing/Exporting Audit Logs
47+
48+
In addition to the user interface, there are multiple ways to consume or query audit trails.
49+
50+
## REST API
51+
52+
Audit logs can be accessed through our REST API. You can find detailed information about this in our [endpoint documentation](../api/audit#get-audit-logs).
53+
54+
## Service Logs
55+
56+
Audit trails are also dispatched as service logs and can be captured and categorized using any log management tool such as [Splunk](https://splunk.com).
57+
58+
Example of a [JSON formatted](../cli/server#--log-json) audit log entry:
59+
60+
```json
61+
{
62+
"ts": "2023-06-13T03:45:37.294730279Z",
63+
"level": "INFO",
64+
"msg": "audit_log",
65+
"caller": "/home/runner/work/coder/coder/enterprise/audit/backends/slog.go:36",
66+
"func": "github.com/coder/coder/enterprise/audit/backends.slogBackend.Export",
67+
"logger_names": ["coderd"],
68+
"fields": {
69+
"ID": "033a9ffa-b54d-4c10-8ec3-2aaf9e6d741a",
70+
"Time": "2023-06-13T03:45:37.288506Z",
71+
"UserID": "6c405053-27e3-484a-9ad7-bcb64e7bfde6",
72+
"OrganizationID": "00000000-0000-0000-0000-000000000000",
73+
"Ip": "{IPNet:{IP:\u003cnil\u003e Mask:\u003cnil\u003e} Valid:false}",
74+
"UserAgent": "{String: Valid:false}",
75+
"ResourceType": "workspace_build",
76+
"ResourceID": "ca5647e0-ef50-4202-a246-717e04447380",
77+
"ResourceTarget": "",
78+
"Action": "start",
79+
"Diff": {},
80+
"StatusCode": 200,
81+
"AdditionalFields": {
82+
"workspace_name": "linux-container",
83+
"build_number": "9",
84+
"build_reason": "initiator",
85+
"workspace_owner": ""
86+
},
87+
"RequestID": "bb791ac3-f6ee-4da8-8ec2-f54e87013e93",
88+
"ResourceIcon": ""
89+
}
90+
}
91+
```
92+
93+
Example of a [human readable](../cli/server#--log-human) audit log entry:
94+
95+
```sh
96+
2023-06-13 03:43:29.233 [info] coderd: audit_log ID=95f7c392-da3e-480c-a579-8909f145fbe2 Time="2023-06-13T03:43:29.230422Z" UserID=6c405053-27e3-484a-9ad7-bcb64e7bfde6 OrganizationID=00000000-0000-0000-0000-000000000000 Ip=<nil> UserAgent=<nil> ResourceType=workspace_build ResourceID=988ae133-5b73-41e3-a55e-e1e9d3ef0b66 ResourceTarget="" Action=start Diff="{}" StatusCode=200 AdditionalFields="{\"workspace_name\":\"linux-container\",\"build_number\":\"7\",\"build_reason\":\"initiator\",\"workspace_owner\":\"\"}" RequestID=9682b1b5-7b9f-4bf2-9a39-9463f8e41cd6 ResourceIcon=""
97+
```
98+
4699
## Enabling this feature
47100

48101
This feature is only available with an enterprise license. [Learn more](../enterprise.md)

examples/templates/envbox/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,20 @@ The following environment variables can be used to configure various aspects of
2727
| `CODER_CPUS` | Dictates the number of CPUs to allocate the inner container. It is recommended to set this using the Kubernetes [Downward API](https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/#use-container-fields-as-values-for-environment-variables). | false |
2828
| `CODER_MEMORY` | Dictates the max memory (in bytes) to allocate the inner container. It is recommended to set this using the Kubernetes [Downward API](https://kubernetes.io/docs/tasks/inject-data-application/environment-variable-expose-pod-information/#use-container-fields-as-values-for-environment-variables). | false |
2929

30+
# Migrating Existing Envbox Templates
31+
32+
Due to the [deprecation and removal of legacy parameters](https://coder.com/docs/v2/latest/templates/parameters#legacy)
33+
it may be necessary to migrate existing envbox templates on newer versions of
34+
Coder. Consult the [migration](https://coder.com/docs/v2/latest/templates/parameters#migration)
35+
documentation for details on how to do so.
36+
37+
To supply values to existing existing Terraform variables you can specify the
38+
`--variable` flag. For example
39+
40+
```bash
41+
coder templates create envbox --variable namespace="mynamespace" --variable max_cpus=2 --variable min_cpus=1 --variable max_memory=4 --variable min_memory=1
42+
```
43+
3044
## Contributions
3145

3246
Contributions are welcome and can be made against the [envbox repo](https://github.com/coder/envbox).

examples/templates/envbox/main.tf

+11
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ data "coder_parameter" "home_disk" {
2727
variable "use_kubeconfig" {
2828
type = bool
2929
sensitive = true
30+
default = true
3031
description = <<-EOF
3132
Use host kubeconfig? (true/false)
3233
Set this to false if the Coder host is itself running as a Pod on the same
@@ -36,6 +37,10 @@ variable "use_kubeconfig" {
3637
EOF
3738
}
3839

40+
provider "coder" {
41+
feature_use_managed_variables = "true"
42+
}
43+
3944
variable "namespace" {
4045
type = string
4146
sensitive = true
@@ -46,12 +51,14 @@ variable "create_tun" {
4651
type = bool
4752
sensitive = true
4853
description = "Add a TUN device to the workspace."
54+
default = false
4955
}
5056

5157
variable "create_fuse" {
5258
type = bool
5359
description = "Add a FUSE device to the workspace."
5460
sensitive = true
61+
default = false
5562
}
5663

5764
variable "max_cpus" {
@@ -138,11 +145,15 @@ resource "kubernetes_persistent_volume_claim" "home" {
138145

139146
resource "kubernetes_pod" "main" {
140147
count = data.coder_workspace.me.start_count
148+
141149
metadata {
142150
name = "coder-${lower(data.coder_workspace.me.owner)}-${lower(data.coder_workspace.me.name)}"
143151
namespace = var.namespace
144152
}
153+
145154
spec {
155+
restart_policy = "Never"
156+
146157
container {
147158
name = "dev"
148159
image = "ghcr.io/coder/envbox:latest"

0 commit comments

Comments
 (0)