misp-docker icon indicating copy to clipboard operation
misp-docker copied to clipboard

Sync Servers setup fails during first initialization

Open m4dh4t opened this issue 6 months ago • 6 comments

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

m4dh4t avatar Jul 04 '25 06:07 m4dh4t