Mercurial > hg > orthanc
changeset 7009:b4fb63a96650
Do not create a default orthanc/orthanc user anymore
| author | Alain Mazy <am@orthanc.team> |
|---|---|
| date | Tue, 07 Jul 2026 11:24:19 +0200 |
| parents | 92129a48a9e6 |
| children | c9b7dcda2d08 519b3bf8f0b8 |
| files | NEWS OrthancServer/Sources/main.cpp |
| diffstat | 2 files changed, 13 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Tue Jul 07 11:23:45 2026 +0200 +++ b/NEWS Tue Jul 07 11:24:19 2026 +0200 @@ -4,6 +4,8 @@ General ------- +* Orthanc will now refuse to start if you have "AuthenticationEnabled" and "RemoteAccessAllowed" + set to true and have not defined any users in "RegisteredUsers". * New values for "OverwriteInstances" configuration. In previous versions, this configuration was a Boolean and it is now a string whose allowed values are "Never", "Always", and "IfChanged". For backward compatibility, you may still provide a Boolean value
--- a/OrthancServer/Sources/main.cpp Tue Jul 07 11:23:45 2026 +0200 +++ b/OrthancServer/Sources/main.cpp Tue Jul 07 11:24:19 2026 +0200 @@ -1200,21 +1200,15 @@ status == OrthancConfiguration::RegisteredUsersStatus_NoConfiguration) { /** - * Starting with Orthanc 1.5.8, if no user is explicitly - * defined while remote access is allowed, we create a - * default user, and Orthanc Explorer shows a warning - * message about an "Insecure setup". This convention is - * used in Docker images "jodogne/orthanc", - * "jodogne/orthanc-plugins" and "osimis/orthanc". + * Starting with Orthanc 1.13.0, if no user is explicitly + * defined while remote access is allowed, Orthanc refuses to start + * and asks the user to create at least one user. **/ - LOG(WARNING) << "====> HTTP authentication is enabled, but no user is declared. " - << "Creating a default user: Review your configuration option \"RegisteredUsers\". " - << "Your setup is INSECURE <===="; + std::string errorMessage = "HTTP authentication is enabled and Remote Access is allowed, but no user is declared. " + "Starting with Orthanc 1.13.0, you must at least explicitly declare one user in the configuration option \"RegisteredUsers\"."; + LOG(ERROR) << "====> " << errorMessage << " Orthanc will refuse to start. <===="; - context.SetHttpServerSecure(false); - - // This is the username/password of the default user in Orthanc. - httpServer.RegisterUser("orthanc", "orthanc"); + throw OrthancException(ErrorCode_IncompatibleConfigurations, errorMessage); } else { @@ -1464,6 +1458,7 @@ bool restart = false; ErrorCode error = ErrorCode_Success; + std::string errorDetails; try { @@ -1472,6 +1467,7 @@ catch (OrthancException& e) { error = e.GetErrorCode(); + errorDetails = e.GetDetails(); } dicomServer.Stop(); @@ -1481,7 +1477,7 @@ if (error != ErrorCode_Success) { - throw OrthancException(error); + throw OrthancException(error, errorDetails); } return restart; @@ -2350,7 +2346,7 @@ } catch (const OrthancException& e) { - LOG(ERROR) << "Uncaught exception, stopping now: [" << e.What() << "] (code " << e.GetErrorCode() << ")"; + LOG(ERROR) << "Uncaught exception, stopping now: [" << e.What() << "] (code " << e.GetErrorCode() << ") " << e.GetDetails(); #if defined(_WIN32) if (e.GetErrorCode() >= ErrorCode_START_PLUGINS) {
