Get the current configuration:
Update the current configuration:
Update Harbor to use LDAP authentication:
Command
curl -X PUT -u "<username>:<password>" -H "Content-Type: application/json" -ki https://harbor.sample.domain/api/v2.0/configurations -d'{"auth_mode":"ldap_auth"}'
Restrict project creation to Harbor administrators:
Command
curl -X PUT -u "<username>:<password>" -H "Content-Type: application/json" -ki https://harbor.sample.domain/api/v2.0/configurations -d'{"project_creation_restriction":"adminonly"}'
Output
HTTP/1.1 200 OK
Date: Wed, 08 May 2019 08:24:32 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 0
Connection: keep-alive
Update the token expiration time:
Output
HTTP/1.1 200 OK
Date: Wed, 08 May 2019 08:23:38 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 0
Connection: keep-alive
Set-Cookie: sid=cc1bc93ffa2675253fc62b4bf3d9de0e; Path=/; HttpOnly
Introduced in 2.3.0 is the ability to use an environment variable, CONFIG_OVERWRITE_JSON
, in the core container to set the configuration. Once the variable is set, you can only update or remove the configuration by updating the CONFIG_OVERWRITE_JSON
and restarting the container. You will not be able to update the configuration in the Harbor interface or in the commandline.
Example CONFIG_OVERWRITE_JSON configuration:
CONFIG_OVERWRITE_JSON={"ldap_verify_cert":"false", "auth_mode":"ldap_auth","ldap_base_dn":"dc=example,dc=com", "ldap_search_dn":"cn=admin,dc=example,dc=com","ldap_search_password":"admin","ldap_url":"myldap.example.com", "ldap_scope":2}
See the table below for more information about available inputs for CONFIG_OVERWRITE_JSON
.
Both booleans and numbers can be enclosed with double quote in the request json, for example: 123
, "123"
, "true"
or true
is OK.