Skip to content

Sync Servers setup fails during first initialization #266

@m4dh4t

Description

@m4dh4t

Hi !

I am setting up a MISP instance which is sync with another using the SYNCSERVERS parameters of the compose file:

SYNCSERVERS=1
SYNCSERVERS_1_URL=<REDACTED>
SYNCSERVERS_1_NAME=Example
SYNCSERVERS_1_UUID=00000000-0000-0000-0000-000000000000 
SYNCSERVERS_1_KEY=<REDACTED>

During the first initialization of the instance, the setup fails:

misp-core-1     | MISP | Create sync servers ...
misp-core-1     | ... searching sync server Example
misp-core-1     | jq: error (at <stdin>:0): Cannot index string with string "Server"
misp-core-1     | ... searching remote organization 00000000-0000-0000-0000-000000000000
misp-core-1     | ... adding missing organization 00000000-0000-0000-0000-000000000000
misp-core-1     | ... adding new sync server Example with organization id

Likely because the API is not ready yet, which would explain jq receiving an unexpected value when querying for an existing server here:

get_server() {
    curl -s --show-error -k \
     -H "Authorization: ${2}" \
     -H "Accept: application/json" \
     -H "Content-type: application/json" ${1}/servers | jq -e -r ".[] | select(.Server[\"name\"] == \"${3}\") | .Server.id"
}

Once the first initialization is done, performing docker compose down && docker compose up will go through the sync servers setup again and complete successfully:

misp-core-1     | MISP | Create sync servers ...
misp-core-1     | ... searching sync server Example
misp-core-1     | ... searching remote organization 00000000-0000-0000-0000-000000000000
misp-core-1     | ... adding missing organization 00000000-0000-0000-0000-000000000000
misp-core-1     | ... adding new sync server Example with organization id 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions