Hi,
I’m trying to set-up OpenSearch with TLS certificates on Docker opensearchproject/opensearch:1.0.0
.
My probem is when I run the securityadmin.sh
script:
docker-compose exec os01 bash -c "bash plugins/opensearch-security/tools/securityadmin.sh -cd plugins/opensearch-security/securityconfig -icl -nhnv -cacert config/certificates/ca/ca.pem -cert config/certificates/ca/admin.pem -key config/certificates/ca/admin.key -h localhost"
I get the following error :
plugins/opensearch-security/tools/securityadmin.sh: line 20: which: command not found
WARNING: JAVA_HOME not set, will use
So the problem is which: command not found
Thanks for your help,
I haven’t run odfe with docker yet but can you try to enter the container and run the command?
Entering the container with docker exec -it <ID> bash
and then run the command does the same.
Anyway the which
command is not installed in this Docker image. This is the problem but I don’t know how to fix it.
I’ve moved to the security category.
I just set up a ODFE container.
It contains a file called securityadmin_demo.sh. Run it then your problem will be resolved.
Thanks but I’m using OpenSearch, not OpenDistro
@janstack You will need to add below line to docker-compose.yml:
environment:
“JAVA_HOME=/usr/share/opensearch/jdk”
I think the docs need to be updated
2 Likes
yeah lol, I just figured it out too
After set it no need to run security for the first time since it already executed while init the container i guess
Hmm, this is what I get and this is why I need to run the securityadmin :
os02_1 | [2021-07-14T19:01:33,581][ERROR][o.o.s.c.ConfigurationLoaderSecurity7] [os02] Failure no such index [.opendistro_security] retrieving configuration for [INTERNALUSERS, ACTIONGROUPS, CONFIG, ROLES, ROLESMAPPING, TENANTS, NODESDN, WHITELIST, AUDIT] (index=.opendistro_security)
os02_1 | [2021-07-14T19:01:33,581][ERROR][o.o.s.c.ConfigurationLoaderSecurity7] [os02] Failure no such index [.opendistro_security] retrieving configuration for [INTERNALUSERS, ACTIONGROUPS, CONFIG, ROLES, ROLESMAPPING, TENANTS, NODESDN, WHITELIST, AUDIT] (index=.opendistro_security)
os02_1 | [2021-07-14T19:01:33,581][ERROR][o.o.s.c.ConfigurationLoaderSecurity7] [os02] Failure no such index [.opendistro_security] retrieving configuration for [INTERNALUSERS, ACTIONGROUPS, CONFIG, ROLES, ROLESMAPPING, TENANTS, NODESDN, WHITELIST, AUDIT] (index=.opendistro_security)
os01_1 | [2021-07-14T19:01:35,781][ERROR][o.o.s.a.BackendRegistry ] [os01] Not yet initialized (you may need to run securityadmin)
os02_1 | [2021-07-14T19:01:35,793][ERROR][o.o.s.a.BackendRegistry ] [os02] Not yet initialized (you may need to run securityadmin)
os03_1 | [2021-07-14T19:01:35,799][ERROR][o.o.s.a.BackendRegistry ] [os03] Not yet initialized (you may need to run securityadmin)
os01_1 | [2021-07-14T19:01:35,804][ERROR][o.o.s.a.BackendRegistry ] [os01] Not yet initialized (you may need to run securityadmin)
kibana_1 | {"type":"log","@timestamp":"2021-07-14T19:01:35Z","tags":["error","opensearch","data"],"pid":1,"message":"[ResponseError]: Response Error"}
And this is in the official documentation
@janstack When using docker-compose, make sure to use docker-compose down -v command to remove any volumes between testing.
If this is still generating the error, could you share your docker-compose file?
Hi @Anthony, thanks. Please find it here : GitHub - flavienbwk/opensearch-docker-compose: Dockerized cluster architecture for OpenSearch with compose.
Commands to reproduce :
git clone https://github.com/flavienbwk/opensearch-docker-compose
cd opensearch-docker-compose
bash generate-certs.sh
docker-compose up -d
docker-compose exec os01 bash -c "bash plugins/opensearch-security/tools/securityadmin.sh -cd plugins/opensearch-security/securityconfig -icl -nhnv -cacert config/certificates/ca/ca.pem -cert config/certificates/ca/admin.pem -key config/certificates/ca/admin.key -h localhost"
@janstack After running docker-compose up -d
can you try to run below command:
docker exec -it opensearch-docker-compose_os03_1 bash -c “bash plugins/opensearch-security/tools/securityadmin.sh -cd plugins/opensearch-security/securityconfig -icl -nhnv -cacert config/certificates/ca/ca.pem -cert config/certificates/ca/admin.pem -key config/certificates/ca/admin.key -h localhost”
Do you get any error?
Sounds like the problem is additionally JAVA_HOME is not defined? Hence the branch with which
is run in the first place?
There’s an open ticket on the OpenSearch repo for it:
Setting the env variable JAVA_HOME: /usr/share/opensearch/jdk
solves the problem and is going to be fixed in 1.1.0
. Thanks.
1 Like