diff --git a/Dockerfile.kratos b/Dockerfile.kratos index f3294c94..c8c3a9d9 100644 --- a/Dockerfile.kratos +++ b/Dockerfile.kratos @@ -14,13 +14,13 @@ RUN addgroup -S ory; \ adduser -S ory -G ory -D -H -s /bin/nologin RUN apk -U --no-cache add build-base git gcc bash -RUN mkdir -p /go/src/github.com/ory -WORKDIR /go/src/github.com/ory -RUN git clone https://github.com/ory/kratos.git +RUN mkdir -p /go/src/github.com/jertel +WORKDIR /go/src/github.com/jertel +RUN git clone https://github.com/jertel/kratos.git -WORKDIR /go/src/github.com/ory/kratos +WORKDIR /go/src/github.com/jertel/kratos -RUN git checkout v0.6.3-alpha.1 +RUN git checkout v0.6.3-alpha.1-so ENV GO111MODULE on ENV CGO_ENABLED 1 @@ -31,8 +31,6 @@ RUN go build -tags sqlite -a FROM ghcr.io/security-onion-solutions/alpine:latest ENV DSN=sqlite:///kratos-data/db.sqlite?_fk=true -ENV SQA_OPT_OUT=true -ENV DISABLE_TELEMETRY=true ARG UID=928 ARG GID=928 @@ -47,11 +45,11 @@ RUN echo "#!/bin/sh" > /start-kratos.sh RUN echo "kratos -c /kratos-conf/kratos.yaml migrate sql -e --yes >> /kratos-log/kratos-migrate.log 2>&1" >> /start-kratos.sh RUN echo "chown kratos:kratos /kratos-data/db.sqlite" >> /start-kratos.sh RUN echo "chmod 600 /kratos-data/db.sqlite" >> /start-kratos.sh -RUN echo "kratos -c /kratos-conf/kratos.yaml serve >> /kratos-log/kratos.log 2>&1" >> /start-kratos.sh +RUN echo "kratos -c /kratos-conf/kratos.yaml serve --sqa-opt-out=true >> /kratos-log/kratos.log 2>&1" >> /start-kratos.sh RUN chmod a+x /start-kratos.sh -COPY --from=builder /go/src/github.com/ory/kratos/kratos /usr/bin/kratos -COPY --from=builder /go/src/github.com/ory/kratos/.schema /.schema +COPY --from=builder /go/src/github.com/jertel/kratos/kratos /usr/bin/kratos +COPY --from=builder /go/src/github.com/jertel/kratos/.schema /.schema USER kratos diff --git a/html/js/routes/settings.js b/html/js/routes/settings.js index 4b841bff..9f3c314a 100644 --- a/html/js/routes/settings.js +++ b/html/js/routes/settings.js @@ -52,10 +52,13 @@ routes.push({ path: '/settings', name: 'settings', component: { this.form.csrfToken = response.data.ui.nodes.find(item => item.attributes && item.attributes.name == 'csrf_token').attributes.value; this.form.method = "password"; var errors = []; - if (response.data.ui.messages) { - const error = response.data.ui.messages.find(item => item.type == "error"); - if (error && error.text) { - errors.push(error.text); + if (response.data.ui.nodes) { + const item = response.data.ui.nodes.find(item => item.messages); + if (item) { + const error = item.messages.find(item => item.type == "error"); + if (error && error.text) { + errors.push(error.text); + } } } if (errors.length > 0) { diff --git a/model/job.go b/model/job.go index 312d1611..6023a61f 100644 --- a/model/job.go +++ b/model/job.go @@ -30,6 +30,7 @@ type Job struct { FailCount int `json:"failCount"` Owner string `json:"owner"` NodeId string `json:"nodeId"` + LegacySensorId string `json:"sensorId"` FileExtension string `json:"fileExtension"` Filter *Filter `json:"filter"` UserId string `json:"userId"` @@ -54,6 +55,11 @@ func (job *Job) GetNodeId() string { // Lower case on the Getter as well since the property could have been // manipulated directly. Consider json.Unmarshall(). job.NodeId = strings.ToLower(job.NodeId) + if len(job.NodeId) == 0 { + // See if there's a legacy sensor ID + job.LegacySensorId = strings.ToLower(job.LegacySensorId) + return job.LegacySensorId + } return job.NodeId } diff --git a/model/job_test.go b/model/job_test.go index 6f645f81..87ceff24 100644 --- a/model/job_test.go +++ b/model/job_test.go @@ -79,4 +79,26 @@ func TestSetNodeId(tester *testing.T) { if job.NodeId != "testingthis2" { tester.Errorf("expected lowercased Node ID after getter but got %s", job.NodeId) } +} + +func TestGetLegacyNodeId(tester *testing.T) { + job := NewJob() + if job.GetNodeId() != "" { + tester.Errorf("expected new jobs to have an empty node ID") + } + + job.NodeId = "Foo" + if job.GetNodeId() != "foo" { + tester.Errorf("expected foo but got %s", job.GetNodeId()) + } + + job.LegacySensorId = "Bar" + if job.GetNodeId() != "foo" { + tester.Errorf("expected foo but got %s", job.GetNodeId()) + } + + job.NodeId = "" + if job.GetNodeId() != "bar" { + tester.Errorf("expected bar but got %s", job.GetNodeId()) + } } \ No newline at end of file