diff --git a/frontends/php/disc_prototypes.php b/frontends/php/disc_prototypes.php index 917ee1cdc7..d5e7264dff 100644 --- a/frontends/php/disc_prototypes.php +++ b/frontends/php/disc_prototypes.php @@ -248,13 +248,14 @@ $fields = [ null ], 'http_authtype' => [T_ZBX_INT, O_OPT, null, - IN([HTTPTEST_AUTH_NONE, HTTPTEST_AUTH_BASIC, HTTPTEST_AUTH_NTLM]), + IN([HTTPTEST_AUTH_NONE, HTTPTEST_AUTH_BASIC, HTTPTEST_AUTH_NTLM, HTTPTEST_AUTH_DIGEST]), null ], 'http_username' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({http_authtype})'. ' && ({http_authtype} == '.HTTPTEST_AUTH_BASIC. ' || {http_authtype} == '.HTTPTEST_AUTH_NTLM. + ' || {http_authtype} == '.HTTPTEST_AUTH_DIGEST. ')', _('Username') ], @@ -262,6 +263,7 @@ $fields = [ '(isset({add}) || isset({update})) && isset({http_authtype})'. ' && ({http_authtype} == '.HTTPTEST_AUTH_BASIC. ' || {http_authtype} == '.HTTPTEST_AUTH_NTLM. + ' || {http_authtype} == '.HTTPTEST_AUTH_DIGEST. ')', _('Password') ], diff --git a/frontends/php/host_discovery.php b/frontends/php/host_discovery.php index d86e8cc78e..e50d0c2c27 100644 --- a/frontends/php/host_discovery.php +++ b/frontends/php/host_discovery.php @@ -198,19 +198,21 @@ $fields = [ null ], 'http_authtype' => [T_ZBX_INT, O_OPT, null, - IN([HTTPTEST_AUTH_NONE, HTTPTEST_AUTH_BASIC, HTTPTEST_AUTH_NTLM]), + IN([HTTPTEST_AUTH_NONE, HTTPTEST_AUTH_BASIC, HTTPTEST_AUTH_NTLM, HTTPTEST_AUTH_DIGEST]), null ], 'http_username' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({http_authtype})'. ' && ({http_authtype} == '.HTTPTEST_AUTH_BASIC. - ' || {http_authtype} == '.HTTPTEST_AUTH_NTLM.')', + ' || {http_authtype} == '.HTTPTEST_AUTH_NTLM. + ' || {http_authtype} == '.HTTPTEST_AUTH_DIGEST.')', _('Username') ], 'http_password' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({http_authtype})'. ' && ({http_authtype} == '.HTTPTEST_AUTH_BASIC. - ' || {http_authtype} == '.HTTPTEST_AUTH_NTLM.')', + ' || {http_authtype} == '.HTTPTEST_AUTH_NTLM. + ' || {http_authtype} == '.HTTPTEST_AUTH_DIGEST.')', _('Password') ], 'preprocessing' => [T_ZBX_STR, O_OPT, P_NO_TRIM, null, null], diff --git a/frontends/php/httpconf.php b/frontends/php/httpconf.php index cc466a1e74..bfdc116974 100644 --- a/frontends/php/httpconf.php +++ b/frontends/php/httpconf.php @@ -55,12 +55,14 @@ $fields = [ 'http_user' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({authentication}) && ({authentication}=='.HTTPTEST_AUTH_BASIC. ' || {authentication}=='.HTTPTEST_AUTH_NTLM. + ' || {authentication}=='.HTTPTEST_AUTH_DIGEST. ')', _('User') ], 'http_password' => [T_ZBX_STR, O_OPT, P_NO_TRIM, null, '(isset({add}) || isset({update})) && isset({authentication}) && ({authentication}=='.HTTPTEST_AUTH_BASIC. ' || {authentication}=='.HTTPTEST_AUTH_NTLM. + ' || {authentication}=='.HTTPTEST_AUTH_DIGEST. ')', _('Password') ], diff --git a/frontends/php/include/classes/api/services/CHttpTest.php b/frontends/php/include/classes/api/services/CHttpTest.php index cd126c2f1b..8507c6e139 100644 --- a/frontends/php/include/classes/api/services/CHttpTest.php +++ b/frontends/php/include/classes/api/services/CHttpTest.php @@ -286,7 +286,7 @@ class CHttpTest extends CApiService { 'value' => ['type' => API_STRING_UTF8, 'flags' => API_REQUIRED | API_NOT_EMPTY, 'length' => DB::getFieldLength('httptest_field', 'value')] ]], 'status' => ['type' => API_INT32, 'in' => implode(',', [HTTPTEST_STATUS_ACTIVE, HTTPTEST_STATUS_DISABLED])], - 'authentication' => ['type' => API_INT32, 'in' => implode(',', [HTTPTEST_AUTH_NONE, HTTPTEST_AUTH_BASIC, HTTPTEST_AUTH_NTLM])], + 'authentication' => ['type' => API_INT32, 'in' => implode(',', [HTTPTEST_AUTH_NONE, HTTPTEST_AUTH_BASIC, HTTPTEST_AUTH_NTLM, HTTPTEST_AUTH_DIGEST])], 'http_user' => ['type' => API_STRING_UTF8, 'length' => DB::getFieldLength('httptest', 'http_user')], 'http_password' => ['type' => API_STRING_UTF8, 'length' => DB::getFieldLength('httptest', 'http_password')], 'verify_peer' => ['type' => API_INT32, 'in' => implode(',', [HTTPTEST_VERIFY_PEER_OFF, HTTPTEST_VERIFY_PEER_ON])], @@ -380,7 +380,7 @@ class CHttpTest extends CApiService { 'value' => ['type' => API_STRING_UTF8, 'flags' => API_REQUIRED | API_NOT_EMPTY, 'length' => DB::getFieldLength('httptest_field', 'value')] ]], 'status' => ['type' => API_INT32, 'in' => implode(',', [HTTPTEST_STATUS_ACTIVE, HTTPTEST_STATUS_DISABLED])], - 'authentication' => ['type' => API_INT32, 'in' => implode(',', [HTTPTEST_AUTH_NONE, HTTPTEST_AUTH_BASIC, HTTPTEST_AUTH_NTLM])], + 'authentication' => ['type' => API_INT32, 'in' => implode(',', [HTTPTEST_AUTH_NONE, HTTPTEST_AUTH_BASIC, HTTPTEST_AUTH_NTLM, HTTPTEST_AUTH_DIGEST])], 'http_user' => ['type' => API_STRING_UTF8, 'length' => DB::getFieldLength('httptest', 'http_user')], 'http_password' => ['type' => API_STRING_UTF8, 'length' => DB::getFieldLength('httptest', 'http_password')], 'verify_peer' => ['type' => API_INT32, 'in' => implode(',', [HTTPTEST_VERIFY_PEER_OFF, HTTPTEST_VERIFY_PEER_ON])], diff --git a/frontends/php/include/classes/api/services/CItemGeneral.php b/frontends/php/include/classes/api/services/CItemGeneral.php index f4fe0b006d..3d23755fdb 100644 --- a/frontends/php/include/classes/api/services/CItemGeneral.php +++ b/frontends/php/include/classes/api/services/CItemGeneral.php @@ -2144,14 +2144,14 @@ abstract class CItemGeneral extends CApiService { ], 'authtype' => [ 'type' => API_INT32, - 'in' => implode(',', [HTTPTEST_AUTH_NONE, HTTPTEST_AUTH_BASIC, HTTPTEST_AUTH_NTLM]) + 'in' => implode(',', [HTTPTEST_AUTH_NONE, HTTPTEST_AUTH_BASIC, HTTPTEST_AUTH_NTLM, HTTPTEST_AUTH_DIGEST]) ] ]; $data = $item + $db_item; if (array_key_exists('authtype', $data) - && ($data['authtype'] == HTTPTEST_AUTH_BASIC || $data['authtype'] == HTTPTEST_AUTH_NTLM)) { + && ($data['authtype'] == HTTPTEST_AUTH_BASIC || $data['authtype'] == HTTPTEST_AUTH_NTLM || $data['authtype'] == HTTPTEST_AUTH_DIGEST)) { $rules += [ 'username' => [ 'type' => API_STRING_UTF8, 'length' => DB::getFieldLength('items', 'username')], 'password' => [ 'type' => API_STRING_UTF8, 'length' => DB::getFieldLength('items', 'password')] diff --git a/frontends/php/include/defines.inc.php b/frontends/php/include/defines.inc.php index e4521f1cd3..60cd469453 100644 --- a/frontends/php/include/defines.inc.php +++ b/frontends/php/include/defines.inc.php @@ -873,6 +873,7 @@ define('ZBX_AGENT_OTHER', -1); define('HTTPTEST_AUTH_NONE', 0); define('HTTPTEST_AUTH_BASIC', 1); define('HTTPTEST_AUTH_NTLM', 2); +define('HTTPTEST_AUTH_DIGEST', 3); define('HTTPTEST_STATUS_ACTIVE', 0); define('HTTPTEST_STATUS_DISABLED', 1); diff --git a/frontends/php/include/httptest.inc.php b/frontends/php/include/httptest.inc.php index 3a42587278..f324276839 100644 --- a/frontends/php/include/httptest.inc.php +++ b/frontends/php/include/httptest.inc.php @@ -26,7 +26,8 @@ function httptest_authentications($type = null) { $authentication_types = [ HTTPTEST_AUTH_NONE => _('None'), HTTPTEST_AUTH_BASIC => _('Basic'), - HTTPTEST_AUTH_NTLM => _('NTLM') + HTTPTEST_AUTH_NTLM => _('NTLM'), + HTTPTEST_AUTH_DIGEST => _('Digest') ]; if (is_null($type)) { diff --git a/frontends/php/include/views/configuration.host.discovery.edit.php b/frontends/php/include/views/configuration.host.discovery.edit.php index 2ac0ee0421..704b52abec 100644 --- a/frontends/php/include/views/configuration.host.discovery.edit.php +++ b/frontends/php/include/views/configuration.host.discovery.edit.php @@ -274,7 +274,8 @@ $form_list (new CComboBox($data['limited'] ? '' : 'http_authtype', $data['http_authtype'], null, [ HTTPTEST_AUTH_NONE => _('None'), HTTPTEST_AUTH_BASIC => _('Basic'), - HTTPTEST_AUTH_NTLM => _('NTLM') + HTTPTEST_AUTH_NTLM => _('NTLM'), + HTTPTEST_AUTH_DIGEST => _('Digest') ]))->setEnabled(!$data['limited']) ], 'http_authtype_row' diff --git a/frontends/php/include/views/configuration.item.edit.php b/frontends/php/include/views/configuration.item.edit.php index 90758d949c..8c2609c297 100644 --- a/frontends/php/include/views/configuration.item.edit.php +++ b/frontends/php/include/views/configuration.item.edit.php @@ -317,7 +317,8 @@ $form_list (new CComboBox($readonly ? '' : 'http_authtype', $data['http_authtype'], null, [ HTTPTEST_AUTH_NONE => _('None'), HTTPTEST_AUTH_BASIC => _('Basic'), - HTTPTEST_AUTH_NTLM => _('NTLM') + HTTPTEST_AUTH_NTLM => _('NTLM'), + HTTPTEST_AUTH_DIGEST => _('Digest') ]))->setEnabled(!$readonly) ], 'http_authtype_row' diff --git a/frontends/php/include/views/configuration.item.prototype.edit.php b/frontends/php/include/views/configuration.item.prototype.edit.php index 24b82da6e7..f0328fe274 100644 --- a/frontends/php/include/views/configuration.item.prototype.edit.php +++ b/frontends/php/include/views/configuration.item.prototype.edit.php @@ -302,7 +302,8 @@ $form_list (new CComboBox($readonly ? '' : 'http_authtype', $data['http_authtype'], null, [ HTTPTEST_AUTH_NONE => _('None'), HTTPTEST_AUTH_BASIC => _('Basic'), - HTTPTEST_AUTH_NTLM => _('NTLM') + HTTPTEST_AUTH_NTLM => _('NTLM'), + HTTPTEST_AUTH_DIGEST => _('Digest') ]))->setEnabled(!$readonly) ], 'http_authtype_row' diff --git a/frontends/php/include/views/js/common.item.edit.js.php b/frontends/php/include/views/js/common.item.edit.js.php index f9a4b6019e..8a1f4e9577 100644 --- a/frontends/php/include/views/js/common.item.edit.js.php +++ b/frontends/php/include/views/js/common.item.edit.js.php @@ -266,7 +266,8 @@ zbx_subarray_push($this->data['authTypeVisibility'], ITEM_AUTHTYPE_PUBLICKEY, 'r if ($('#http_authtype').length) { new CViewSwitcher('http_authtype', 'change', ['http_username_row', 'http_password_row'], - HTTPTEST_AUTH_NTLM => ['http_username_row', 'http_password_row'] + HTTPTEST_AUTH_NTLM => ['http_username_row', 'http_password_row'], + HTTPTEST_AUTH_DIGEST => ['http_username_row', 'http_password_row'] ], true) ?>); } [T_ZBX_INT, O_OPT, null, - IN([HTTPTEST_AUTH_NONE, HTTPTEST_AUTH_BASIC, HTTPTEST_AUTH_NTLM]), + IN([HTTPTEST_AUTH_NONE, HTTPTEST_AUTH_BASIC, HTTPTEST_AUTH_NTLM, HTTPTEST_AUTH_DIGEST]), null ], 'http_username' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({http_authtype})'. ' && ({http_authtype} == '.HTTPTEST_AUTH_BASIC. - ' || {http_authtype} == '.HTTPTEST_AUTH_NTLM.')', + ' || {http_authtype} == '.HTTPTEST_AUTH_NTLM. + ' || {http_authtype} == '.HTTPTEST_AUTH_DIGEST.')', _('Username') ], 'http_password' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({http_authtype})'. ' && ({http_authtype} == '.HTTPTEST_AUTH_BASIC. - ' || {http_authtype} == '.HTTPTEST_AUTH_NTLM.')', + ' || {http_authtype} == '.HTTPTEST_AUTH_NTLM. + ' || {http_authtype} == '.HTTPTEST_AUTH_DIGEST.')', _('Password') ], // actions diff --git a/include/common.h b/include/common.h index 5ba27a0e19..a1b4878875 100644 --- a/include/common.h +++ b/include/common.h @@ -899,7 +899,8 @@ typedef enum { HTTPTEST_AUTH_NONE = 0, HTTPTEST_AUTH_BASIC, - HTTPTEST_AUTH_NTLM + HTTPTEST_AUTH_NTLM, + HTTPTEST_AUTH_DIGEST } zbx_httptest_auth_t; diff --git a/src/libs/zbxhttp/http.c b/src/libs/zbxhttp/http.c index 8a6637ca04..0ea893d6dc 100644 --- a/src/libs/zbxhttp/http.c +++ b/src/libs/zbxhttp/http.c @@ -150,6 +150,9 @@ int zbx_http_prepare_auth(CURL *easyhandle, unsigned char authtype, const char * case HTTPTEST_AUTH_NTLM: curlauth = CURLAUTH_NTLM; break; + case HTTPTEST_AUTH_DIGEST: + curlauth = CURLAUTH_DIGEST; + break; default: THIS_SHOULD_NEVER_HAPPEN; break;