Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: support config hive with kerberos (#11858)
ecmadaoedc770fba93b
diff --git a/backend/api/v1/instance_service.go b/backend/api/v1/instance_service.goindex 1a7e051ffc..65ff49aeb8 100644--- a/backend/api/v1/instance_service.go+++ b/backend/api/v1/instance_service.go@@ -845,16 +845,14 @@ func (s *InstanceService) UpdateDataSource(ctx context.Context, request *v1pb.UpdataSource.ExternalSecret = externalSecretpatch.ExternalSecret = externalSecretpatch.RemoveExternalSecret = externalSecret == nil-case "sasl_config":dataSource.SASLConfig = convertToStoreDataSourceSaslConfig(request.DataSource.SaslConfig)patch.SASLConfig = dataSource.SASLConfig-+ patch.RemoveSASLConfig = dataSource.SASLConfig == nilcase "authentication_type":authType := convertToAuthenticationType(request.DataSource.AuthenticationType)dataSource.AuthenticationType = authTypepatch.AuthenticationType = &authType-default:return nil, status.Errorf(codes.InvalidArgument, `unsupport update_mask "%s"`, path)}@@ -1158,6 +1156,7 @@ func convertToV1DataSources(dataSources []*store.DataSourceMessage) ([]*v1pb.DatServiceName: ds.ServiceName,ExternalSecret: externalSecret,AuthenticationType: authenticationType,+ SaslConfig: convertToV1DataSourceSaslConfig(ds.SASLConfig),})}@@ -1231,6 +1230,30 @@ func convertToStoreDataSourceSaslConfig(saslConfig *v1pb.SASLConfig) *storepb.SAreturn storeSaslConfig}+func convertToV1DataSourceSaslConfig(saslConfig *storepb.SASLConfig) *v1pb.SASLConfig {+ if saslConfig == nil {+ return nil+ }+ storeSaslConfig := &v1pb.SASLConfig{}+ switch m := saslConfig.Mechanism.(type) {+ case *storepb.SASLConfig_KrbConfig:+ storeSaslConfig.Mechanism = &v1pb.SASLConfig_KrbConfig{+ KrbConfig: &v1pb.KerberosConfig{+ Primary: m.KrbConfig.Primary,+ Instance: m.KrbConfig.Instance,+ Realm: m.KrbConfig.Realm,+ Keytab: m.KrbConfig.Keytab,+ KdcHost: m.KrbConfig.KdcHost,+ KdcPort: m.KrbConfig.KdcPort,+ KdcTransportProtocol: m.KrbConfig.KdcTransportProtocol,+ },+ }+ default:+ return nil+ }+ return storeSaslConfig+}+func convertToAuthenticationType(authType v1pb.DataSource_AuthenticationType) storepb.DataSourceOptions_AuthenticationType {authenticationType := storepb.DataSourceOptions_AUTHENTICATION_UNSPECIFIEDswitch authType {diff --git a/backend/plugin/db/hive/hive.go b/backend/plugin/db/hive/hive.goindex ef09e3a3c7..12cb386b6d 100644--- a/backend/plugin/db/hive/hive.go+++ b/backend/plugin/db/hive/hive.go@@ -52,7 +52,10 @@ func (d *Driver) Open(_ context.Context, _ storepb.Engine, config db.ConnectionCif d.connPool == nil {if config.SASLConfig == nil {- config.SASLConfig = &db.PlainSASLConfig{}+ config.SASLConfig = &db.PlainSASLConfig{+ Username: config.Username,+ Password: config.Password,+ }}if !config.SASLConfig.Check() {return nil, errors.New("SASL settings error")diff --git a/backend/plugin/db/hive/hive_conn_pool.go b/backend/plugin/db/hive/hive_conn_pool.goindex 3ea6859231..09dbea1f13 100644--- a/backend/plugin/db/hive/hive_conn_pool.go+++ b/backend/plugin/db/hive/hive_conn_pool.go@@ -49,13 +49,16 @@ func CreateHiveConnPool(// SASL settings.switch t := config.SASLConfig.(type) {- // Kerberos.case *db.KerberosConfig:+ // Kerberos.hiveConfig.Hostname = config.HosthiveConfig.Service = t.Primary- // Plain.+ case *db.PlainSASLConfig:+ // Plain.+ hiveConfig.Username = t.Username+ hiveConfig.Password = t.Passworddefault:- hiveConfig.Username = config.Username+ return nil, errors.Errorf("invalid SASL config")}for i := 0; i < numMaxConn; i++ {diff --git a/backend/plugin/db/sasl.go b/backend/plugin/db/sasl.goindex 07c97221f7..6279b9fdf4 100644--- a/backend/plugin/db/sasl.go+++ b/backend/plugin/db/sasl.go@@ -40,8 +40,13 @@ var (singletonEnv = KerberosEnv{DefaultKrbConfPath: "/etc/krb5.conf",}+ // KinitCmdFmt is the cmd for kinit, should be+ // kinit -kt {keytab file path} {principal}+ // The principal is in {primary}/{instance}@{realm} or {primary}@{realm} format// example: 'root/[email protected]' or '[email protected]'.KinitCmdFmt = "kinit -kt %s %s@%s"+ // KrbConfRealmFmt is the config content for /etc/krb5.conf, it should like+ // [realms] {realm} = { kdc = [service/]host[:port]// example:// [realm]// EXAMPLE.COM = {diff --git a/backend/store/data_source.go b/backend/store/data_source.goindex 11d6e3f889..b73fd2e6d2 100644--- a/backend/store/data_source.go+++ b/backend/store/data_source.go@@ -7,7 +7,6 @@ import ("time""github.com/pkg/errors"- "google.golang.org/protobuf/proto""google.golang.org/protobuf/encoding/protojson"@@ -75,6 +74,7 @@ func (m *DataSourceMessage) Copy() *DataSourceMessage {AuthenticationPrivateKeyObfuscated: m.AuthenticationPrivateKeyObfuscated,ExternalSecret: m.ExternalSecret,AuthenticationType: m.AuthenticationType,+ SASLConfig: m.SASLConfig,}}@@ -111,7 +111,8 @@ type UpdateDataSourceMessage struct {RemoveExternalSecret boolAuthenticationType *storepb.DataSourceOptions_AuthenticationType// SASLConfig.- SASLConfig *storepb.SASLConfig+ SASLConfig *storepb.SASLConfig+ RemoveSASLConfig bool}func (*Store) listDataSourceV2(ctx context.Context, tx *Tx, instanceID string) ([]*DataSourceMessage, error) {@@ -174,6 +175,7 @@ func (*Store) listDataSourceV2(ctx context.Context, tx *Tx, instanceID string) (dataSourceMessage.SSHObfuscatedPrivateKey = dataSourceOptions.SshObfuscatedPrivateKeydataSourceMessage.AuthenticationPrivateKeyObfuscated = dataSourceOptions.AuthenticationPrivateKeyObfuscateddataSourceMessage.ExternalSecret = dataSourceOptions.ExternalSecret+ dataSourceMessage.SASLConfig = dataSourceOptions.SaslConfigdataSourceMessage.AuthenticationType = dataSourceOptions.AuthenticationTypedataSourceMessages = append(dataSourceMessages, &dataSourceMessage)}@@ -312,7 +314,13 @@ func (s *Store) UpdateDataSourceV2(ctx context.Context, patch *UpdateDataSourceMoptionSet, args = append(optionSet, fmt.Sprintf("jsonb_build_object('externalSecret', $%d::JSONB)", len(args)+1)), append(args, nil)}if v := patch.SASLConfig; v != nil {- optionSet, args = append(optionSet, fmt.Sprintf("jsonb_build_object('saslConfig', $%d::JSONB)", len(args)+1)), append(args, proto.Clone(v))+ protoBytes, err := protojson.Marshal(v)+ if err != nil {+ return errors.Wrap(err, "failed to marshal sasl config")+ }+ optionSet, args = append(optionSet, fmt.Sprintf("jsonb_build_object('saslConfig', $%d::JSONB)", len(args)+1)), append(args, protoBytes)+ } else if patch.RemoveSASLConfig {+ optionSet, args = append(optionSet, fmt.Sprintf("jsonb_build_object('saslConfig', $%d::JSONB)", len(args)+1)), append(args, nil)}if len(optionSet) != 0 {set = append(set, fmt.Sprintf(`options = options || %s`, strings.Join(optionSet, "||")))@@ -365,6 +373,7 @@ func (*Store) addDataSourceToInstanceImplV2(ctx context.Context, tx *Tx, instancAuthenticationPrivateKeyObfuscated: dataSource.AuthenticationPrivateKeyObfuscated,ExternalSecret: dataSource.ExternalSecret,AuthenticationType: dataSource.AuthenticationType,+ SaslConfig: dataSource.SASLConfig,}protoBytes, err := protojson.Marshal(&dataSourceOptions)if err != nil {diff --git a/frontend/src/components/InstanceForm/DataSourceSection/DataSourceForm.vue b/frontend/src/components/InstanceForm/DataSourceSection/DataSourceForm.vueindex e0f3966b15..7f8602c7bf 100644--- a/frontend/src/components/InstanceForm/DataSourceSection/DataSourceForm.vue+++ b/frontend/src/components/InstanceForm/DataSourceSection/DataSourceForm.vue@@ -24,6 +24,20 @@</NRadio></NRadioGroup></div>+ <div+ v-else-if="basicInfo.engine === Engine.HIVE"+ class="mt-2 sm:col-span-3 sm:col-start-1"+ >+ <NRadioGroup+ :value="hiveAuthentication"+ class="textlabel"+ :disabled="!allowEdit"+ @update:value="onHiveAuthenticationChange"+ >+ <NRadio value="PASSWORD"> Plain password </NRadio>+ <NRadio value="KERBEROS"> Kerberos </NRadio>+ </NRadioGroup>+ </div><CreateDataSourceExampleclass-name="sm:col-span-3 border-none mt-2":create-instance-flag="isCreating"@@ -31,138 +45,214 @@:data-source-type="dataSource.type":authentication-type="dataSource.authenticationType"/>- <div class="mt-4 sm:col-span-3 sm:col-start-1">- <label for="username" class="textlabel block">- {{ $t("common.username") }}- </label>- <!-- For mysql, username can be empty indicating anonymous user.- But it's a very bad practice to use anonymous user for admin operation,- thus we make it REQUIRED here.-->- <NInput- v-model:value="dataSource.username"- class="mt-2 w-full"- :disabled="!allowEdit"- :placeholder="- basicInfo.engine === Engine.CLICKHOUSE ? $t('common.default') : ''- "- />- </div><div- v-if="- dataSource.authenticationType === DataSource_AuthenticationType.PASSWORD- "- class="mt-4 sm:col-span-3 sm:col-start-1"+ v-if="!!dataSource.saslConfig?.krbConfig"+ class="sm:col-span-3 sm:col-start-1">- <div class="mb-4">- <NRadioGroup- class="textlabel"- :value="state.passwordType"+ <div class="mt-4 sm:col-span-3 sm:col-start-1">+ <label class="textlabel block">+ Principal+ <span class="text-red-600">*</span>+ </label>+ <div class="flex mt-2 items-center space-x-2">+ <NInput+ v-model:value="dataSource.saslConfig.krbConfig.primary"+ :disabled="!allowEdit"+ placeholder="primary"+ />+ <span>/</span>+ <NInput+ v-model:value="dataSource.saslConfig.krbConfig.instance"+ :disabled="!allowEdit"+ placeholder="instance, optional"+ />+ <span>@</span>+ <NInput+ v-model:value="dataSource.saslConfig.krbConfig.realm"+ :disabled="!allowEdit"+ placeholder="realm"+ />+ </div>+ </div>+ <div class="mt-4 sm:col-span-3 sm:col-start-1">+ <label class="textlabel block">+ KDC+ <span class="text-red-600">*</span>+ </label>+ <div class="flex mt-2 items-center space-x-2">+ <div class="w-fit">+ <NRadioGroup+ v-model:value="+ dataSource.saslConfig.krbConfig.kdcTransportProtocol+ "+ class="textlabel w-32"+ :disabled="!allowEdit"+ >+ <NRadio value="tcp"> TCP </NRadio>+ <NRadio value="udp"> UDP </NRadio>+ </NRadioGroup>+ </div>+ <NInput+ v-model:value="dataSource.saslConfig.krbConfig.kdcHost"+ :disabled="!allowEdit"+ placeholder="KDC host"+ />+ <span>:</span>+ <NInput+ v-model:value="dataSource.saslConfig.krbConfig.kdcPort"+ :disabled="!allowEdit"+ placeholder="KDC port, optional"+ :allow-input="onlyAllowNumber"+ />+ </div>+ </div>+ <div class="mt-4 sm:col-span-3 sm:col-start-1">+ <label class="textlabel block">+ Keytab File Path+ <span class="text-red-600">*</span>+ </label>+ <NInput+ v-model:value="dataSource.saslConfig.krbConfig.keytab"+ class="mt-2 w-full":disabled="!allowEdit"- @update:value="changeSecretType"- >- <NRadio- :value="- DataSourceExternalSecret_SecretType.SAECRET_TYPE_UNSPECIFIED- "- >- {{ $t("instance.password-type.password") }}- </NRadio>- <NRadio :value="DataSourceExternalSecret_SecretType.VAULT_KV_V2">- <div class="flex items-center gap-x-1">- {{ $t("instance.password-type.external-secret-vault") }}- <FeatureBadge feature="bb.feature.external-secret-manager" />- </div>- </NRadio>- <NRadio- :value="DataSourceExternalSecret_SecretType.AWS_SECRETS_MANAGER"- >- <div class="flex items-center gap-x-1">- {{ $t("instance.password-type.external-secret-aws") }}- <FeatureBadge feature="bb.feature.external-secret-manager" />- </div>- </NRadio>- <NRadio- :value="DataSourceExternalSecret_SecretType.GCP_SECRET_MANAGER"- >- <div class="flex items-center gap-x-1">- {{ $t("instance.password-type.external-secret-gcp") }}- <FeatureBadge feature="bb.feature.external-secret-manager" />- </div>- </NRadio>- </NRadioGroup>- <LearnMoreLink- url="http://www.bytebase.com/docs/get-started/instance/#use-external-secret-manager"- class="text-sm"+ placeholder="keytab file path"+ />+ </div>+ </div>+ <div v-else class="sm:col-span-3 sm:col-start-1">+ <div class="mt-4 sm:col-span-3 sm:col-start-1">+ <label for="username" class="textlabel block">+ {{ $t("common.username") }}+ </label>+ <!-- For mysql, username can be empty indicating anonymous user.+ But it's a very bad practice to use anonymous user for admin operation,+ thus we make it REQUIRED here.-->+ <NInput+ v-model:value="dataSource.username"+ class="mt-2 w-full"+ :disabled="!allowEdit"+ :placeholder="+ basicInfo.engine === Engine.CLICKHOUSE ? $t('common.default') : ''+ "/></div><divv-if="- state.passwordType ===- DataSourceExternalSecret_SecretType.SAECRET_TYPE_UNSPECIFIED+ dataSource.authenticationType ===+ DataSource_AuthenticationType.PASSWORD"+ class="mt-4 sm:col-span-3 sm:col-start-1">- <label class="textlabel block">- {{ $t("common.password") }}- </label>- <div class="flex space-x-2 text-sm">- <div class="text-gray-400">- {{ $t("instance.password-type.password-tip") }}- </div>- <LearnMoreLink- url="https://www.bytebase.com/docs/get-started/instance/#use-secret-manager?source=console"- class="ml-1 text-sm"- />- <FeatureBadge feature="bb.feature.external-secret-manager" />- </div>- <div class="mt-2">- <NCheckbox- v-if="!isCreating && allowUsingEmptyPassword"- :size="'small'"- :checked="dataSource.useEmptyPassword"+ <div class="mb-4">+ <NRadioGroup+ class="textlabel"+ :value="state.passwordType":disabled="!allowEdit"- @update:checked="toggleUseEmptyPassword"+ @update:value="changeSecretType">- {{ $t("instance.no-password") }}- </NCheckbox>- <NInput- class="w-full"- :input-props="{ autocomplete: 'off' }"- :placeholder="- dataSource.useEmptyPassword- ? $t('instance.no-password')- : $t('instance.password-write-only')- "- :disabled="!allowEdit || dataSource.useEmptyPassword"- :value="- dataSource.useEmptyPassword ? '' : dataSource.updatedPassword- "- @update:value="dataSource.updatedPassword = $event.trim()"+ <NRadio+ :value="+ DataSourceExternalSecret_SecretType.SAECRET_TYPE_UNSPECIFIED+ "+ >+ {{ $t("instance.password-type.password") }}+ </NRadio>+ <NRadio :value="DataSourceExternalSecret_SecretType.VAULT_KV_V2">+ <div class="flex items-center gap-x-1">+ {{ $t("instance.password-type.external-secret-vault") }}+ <FeatureBadge feature="bb.feature.external-secret-manager" />+ </div>+ </NRadio>+ <NRadio+ :value="DataSourceExternalSecret_SecretType.AWS_SECRETS_MANAGER"+ >+ <div class="flex items-center gap-x-1">+ {{ $t("instance.password-type.external-secret-aws") }}+ <FeatureBadge feature="bb.feature.external-secret-manager" />+ </div>+ </NRadio>+ <NRadio+ :value="DataSourceExternalSecret_SecretType.GCP_SECRET_MANAGER"+ >+ <div class="flex items-center gap-x-1">+ {{ $t("instance.password-type.external-secret-gcp") }}+ <FeatureBadge feature="bb.feature.external-secret-manager" />+ </div>+ </NRadio>+ </NRadioGroup>+ <LearnMoreLink+ url="http://www.bytebase.com/docs/get-started/instance/#use-external-secret-manager"+ class="text-sm"/></div>- </div>- <div v-else-if="dataSource.externalSecret" class="space-y-4"><divv-if="state.passwordType ===- DataSourceExternalSecret_SecretType.VAULT_KV_V2+ DataSourceExternalSecret_SecretType.SAECRET_TYPE_UNSPECIFIED"- class="space-y-4">- <div class="sm:col-span-2 sm:col-start-1">- <label class="textlabel block">- {{ $t("instance.external-secret-vault.vault-url") }}- <span class="text-red-600">*</span>- </label>- <BBTextField- v-model:value="dataSource.externalSecret.url"- :required="true"- class="mt-2 w-full"+ <label class="textlabel block">+ {{ $t("common.password") }}+ </label>+ <div class="flex space-x-2 text-sm">+ <div class="text-gray-400">+ {{ $t("instance.password-type.password-tip") }}+ </div>+ <LearnMoreLink+ url="https://www.bytebase.com/docs/get-started/instance/#use-secret-manager?source=console"+ class="ml-1 text-sm"+ />+ <FeatureBadge feature="bb.feature.external-secret-manager" />+ </div>+ <div class="mt-2">+ <NCheckbox+ v-if="!isCreating && allowUsingEmptyPassword"+ :size="'small'"+ :checked="dataSource.useEmptyPassword":disabled="!allowEdit"- :placeholder="$t('instance.external-secret-vault.vault-url')"+ @update:checked="toggleUseEmptyPassword"+ >+ {{ $t("instance.no-password") }}+ </NCheckbox>+ <NInput+ class="w-full"+ :input-props="{ autocomplete: 'off' }"+ :placeholder="+ dataSource.useEmptyPassword+ ? $t('instance.no-password')+ : $t('instance.password-write-only')+ "+ :disabled="!allowEdit || dataSource.useEmptyPassword"+ :value="+ dataSource.useEmptyPassword ? '' : dataSource.updatedPassword+ "+ @update:value="dataSource.updatedPassword = $event.trim()"/></div>- <!-- AppRole is not enabled -->- <!-- <div class="sm:col-span-2 sm:col-start-1 space-y-2">+ </div>+ <div v-else-if="dataSource.externalSecret" class="space-y-4">+ <div+ v-if="+ state.passwordType ===+ DataSourceExternalSecret_SecretType.VAULT_KV_V2+ "+ class="space-y-4"+ >+ <div class="sm:col-span-2 sm:col-start-1">+ <label class="textlabel block">+ {{ $t("instance.external-secret-vault.vault-url") }}+ <span class="text-red-600">*</span>+ </label>+ <BBTextField+ v-model:value="dataSource.externalSecret.url"+ :required="true"+ class="mt-2 w-full"+ :disabled="!allowEdit"+ :placeholder="$t('instance.external-secret-vault.vault-url')"+ />+ </div>+ <!-- AppRole is not enabled -->+ <!-- <div class="sm:col-span-2 sm:col-start-1 space-y-2"><label class="textlabel block">{{ $t("instance.external-secret-vault.vault-auth-type.self") }}</label>@@ -179,198 +269,204 @@</NRadio></NRadioGroup></div> -->- <div- v-if="- dataSource.externalSecret.authType ===- DataSourceExternalSecret_AuthType.TOKEN- "- class="sm:col-span-2 sm:col-start-1"- >- <label class="textlabel block">- {{- $t("instance.external-secret-vault.vault-auth-type.token.self")- }}- <span class="text-red-600">*</span>- </label>- <div class="flex space-x-2 text-sm">- <div class="text-gray-400">- {{- $t(- "instance.external-secret-vault.vault-auth-type.token.tips"- )- }}- </div>- <LearnMoreLink- url="https://developer.hashicorp.com/vault/tutorials/operations/generate-root"- class="ml-1 text-sm"- />- </div>- <BBTextField- :value="dataSource.externalSecret.token ?? ''"- class="mt-2 w-full"- :disabled="!allowEdit"- :placeholder="secretInputPlaceholder"- :required="isCreating"- @update:value="- (val: string) => {- const ds = dataSource;- ds.externalSecret!.token = val;- }+ <div+ v-if="+ dataSource.externalSecret.authType ===+ DataSourceExternalSecret_AuthType.TOKEN"- />- </div>- <div v-else-if="dataSource.externalSecret.appRole" class="space-y-4">- <div class="sm:col-span-2 sm:col-start-1">+ class="sm:col-span-2 sm:col-start-1"+ ><label class="textlabel block">{{$t(- "instance.external-secret-vault.vault-auth-type.approle.role-id"+ "instance.external-secret-vault.vault-auth-type.token.self")}}<span class="text-red-600">*</span></label>+ <div class="flex space-x-2 text-sm">+ <div class="text-gray-400">+ {{+ $t(+ "instance.external-secret-vault.vault-auth-type.token.tips"+ )+ }}+ </div>+ <LearnMoreLink+ url="https://developer.hashicorp.com/vault/tutorials/operations/generate-root"+ class="ml-1 text-sm"+ />+ </div><BBTextField- :value="dataSource.externalSecret.appRole.roleId"- :required="isCreating"+ :value="dataSource.externalSecret.token ?? ''"class="mt-2 w-full":disabled="!allowEdit"- :placeholder="`${$t(- 'instance.external-secret-vault.vault-auth-type.approle.role-id'- )} - ${$t('common.write-only')}`"+ :placeholder="secretInputPlaceholder"+ :required="isCreating"@update:value="(val: string) => {const ds = dataSource;- ds.externalSecret!.appRole!.roleId = val;+ ds.externalSecret!.token = val;}"/></div>- <div class="sm:col-span-2 sm:col-start-1">- <label class="textlabel block">- {{- $t(- "instance.external-secret-vault.vault-auth-type.approle.secret-id"- )- }}- <span class="text-red-600">*</span>- </label>- <i18n-t- tag="div"- keypath="instance.external-secret-vault.vault-auth-type.approle.secret-tips"- class="text-gray-400 text-sm"- >- <template #learn_more>- <LearnMoreLink- url="https://developer.hashicorp.com/vault/tutorials/auth-methods/approle"- class="ml-1 text-sm"- />- </template>- </i18n-t>- <NRadioGroup- v-model:value="dataSource.externalSecret.appRole.type"- class="textlabel my-1"- :disabled="!allowEdit"- >- <NRadio- :value="- DataSourceExternalSecret_AppRoleAuthOption_SecretType.PLAIN- "- >+ <div+ v-else-if="dataSource.externalSecret.appRole"+ class="space-y-4"+ >+ <div class="sm:col-span-2 sm:col-start-1">+ <label class="textlabel block">{{$t(- "instance.external-secret-vault.vault-auth-type.approle.secret-plain-text"+ "instance.external-secret-vault.vault-auth-type.approle.role-id")}}- </NRadio>- <NRadio- :value="- DataSourceExternalSecret_AppRoleAuthOption_SecretType.ENVIRONMENT+ <span class="text-red-600">*</span>+ </label>+ <BBTextField+ :value="dataSource.externalSecret.appRole.roleId"+ :required="isCreating"+ class="mt-2 w-full"+ :disabled="!allowEdit"+ :placeholder="`${$t(+ 'instance.external-secret-vault.vault-auth-type.approle.role-id'+ )} - ${$t('common.write-only')}`"+ @update:value="+ (val: string) => {+ const ds = dataSource;+ ds.externalSecret!.appRole!.roleId = val;+ }"- >+ />+ </div>+ <div class="sm:col-span-2 sm:col-start-1">+ <label class="textlabel block">{{$t(- "instance.external-secret-vault.vault-auth-type.approle.secret-env-name"+ "instance.external-secret-vault.vault-auth-type.approle.secret-id")}}- </NRadio>- </NRadioGroup>+ <span class="text-red-600">*</span>+ </label>+ <i18n-t+ tag="div"+ keypath="instance.external-secret-vault.vault-auth-type.approle.secret-tips"+ class="text-gray-400 text-sm"+ >+ <template #learn_more>+ <LearnMoreLink+ url="https://developer.hashicorp.com/vault/tutorials/auth-methods/approle"+ class="ml-1 text-sm"+ />+ </template>+ </i18n-t>+ <NRadioGroup+ v-model:value="dataSource.externalSecret.appRole.type"+ class="textlabel my-1"+ :disabled="!allowEdit"+ >+ <NRadio+ :value="+ DataSourceExternalSecret_AppRoleAuthOption_SecretType.PLAIN+ "+ >+ {{+ $t(+ "instance.external-secret-vault.vault-auth-type.approle.secret-plain-text"+ )+ }}+ </NRadio>+ <NRadio+ :value="+ DataSourceExternalSecret_AppRoleAuthOption_SecretType.ENVIRONMENT+ "+ >+ {{+ $t(+ "instance.external-secret-vault.vault-auth-type.approle.secret-env-name"+ )+ }}+ </NRadio>+ </NRadioGroup>+ <BBTextField+ :value="dataSource.externalSecret.appRole.secretId"+ class="mt-2 w-full"+ :disabled="!allowEdit"+ :placeholder="secretInputPlaceholder"+ @update:value="+ (val: string) => {+ const ds = dataSource;+ ds.externalSecret!.appRole!.secretId = val;+ }+ "+ />+ </div>+ </div>+ <div class="sm:col-span-2 sm:col-start-1">+ <label class="textlabel block">+ {{+ $t("instance.external-secret-vault.vault-secret-engine-name")+ }}+ <span class="text-red-600">*</span>+ </label>+ <div class="flex space-x-2 text-sm text-gray-400">+ {{+ $t("instance.external-secret-vault.vault-secret-engine-tips")+ }}+ </div><BBTextField- :value="dataSource.externalSecret.appRole.secretId"+ v-model:value="dataSource.externalSecret.engineName"+ :required="true"class="mt-2 w-full":disabled="!allowEdit"- :placeholder="secretInputPlaceholder"- @update:value="- (val: string) => {- const ds = dataSource;- ds.externalSecret!.appRole!.secretId = val;- }+ :placeholder="+ $t('instance.external-secret-vault.vault-secret-engine-name')"/></div></div><div class="sm:col-span-2 sm:col-start-1"><label class="textlabel block">- {{- $t("instance.external-secret-vault.vault-secret-engine-name")- }}+ {{ secretNameLabel }}<span class="text-red-600">*</span></label>- <div class="flex space-x-2 text-sm text-gray-400">- {{- $t("instance.external-secret-vault.vault-secret-engine-tips")- }}+ <div+ v-if="+ state.passwordType ===+ DataSourceExternalSecret_SecretType.GCP_SECRET_MANAGER+ "+ class="flex space-x-2 text-sm text-gray-400"+ >+ {{ $t("instance.external-secret-gcp.secret-name-tips") }}</div><BBTextField- v-model:value="dataSource.externalSecret.engineName"+ v-model:value="dataSource.externalSecret.secretName":required="true"class="mt-2 w-full":disabled="!allowEdit"- :placeholder="- $t('instance.external-secret-vault.vault-secret-engine-name')- "+ :placeholder="secretNameLabel"/></div>- </div>- <div class="sm:col-span-2 sm:col-start-1">- <label class="textlabel block">- {{ secretNameLabel }}- <span class="text-red-600">*</span>- </label><divv-if="- state.passwordType ===+ state.passwordType !==DataSourceExternalSecret_SecretType.GCP_SECRET_MANAGER"- class="flex space-x-2 text-sm text-gray-400"+ class="sm:col-span-2 sm:col-start-1">- {{ $t("instance.external-secret-gcp.secret-name-tips") }}+ <label class="textlabel block">+ {{ secretKeyLabel }}+ <span class="text-red-600">*</span>+ </label>+ <BBTextField+ v-model:value="dataSource.externalSecret.passwordKeyName"+ :required="true"+ class="mt-2 w-full"+ :disabled="!allowEdit"+ :placeholder="secretKeyLabel"+ /></div>- <BBTextField- v-model:value="dataSource.externalSecret.secretName"- :required="true"- class="mt-2 w-full"- :disabled="!allowEdit"- :placeholder="secretNameLabel"- />- </div>- <div- v-if="- state.passwordType !==- DataSourceExternalSecret_SecretType.GCP_SECRET_MANAGER- "- class="sm:col-span-2 sm:col-start-1"- >- <label class="textlabel block">- {{ secretKeyLabel }}- <span class="text-red-600">*</span>- </label>- <BBTextField- v-model:value="dataSource.externalSecret.passwordKeyName"- :required="true"- class="mt-2 w-full"- :disabled="!allowEdit"- :placeholder="secretKeyLabel"- /></div></div></div>@@ -588,6 +684,8 @@ import type { DataSourceOptions } from "@/types/dataSource";import { Engine } from "@/types/proto/v1/common";import type { DataSource } from "@/types/proto/v1/instance_service";import {+ SASLConfig,+ KerberosConfig,DataSourceType,DataSourceExternalSecret,DataSourceExternalSecret_AuthType,@@ -649,6 +747,23 @@ watch({ immediate: true, deep: true });+const hiveAuthentication = computed(() => {+ return props.dataSource.saslConfig?.krbConfig ? "KERBEROS" : "PASSWORD";+});++const onHiveAuthenticationChange = (val: "KERBEROS" | "PASSWORD") => {+ const ds = props.dataSource;+ if (val === "KERBEROS") {+ ds.saslConfig = SASLConfig.fromPartial({+ krbConfig: KerberosConfig.fromPartial({+ kdcTransportProtocol: "tcp",+ }),+ });+ } else {+ ds.saslConfig = undefined;+ }+};+const secretInputPlaceholder = computed(() => {switch (state.passwordType) {case DataSourceExternalSecret_SecretType.SAECRET_TYPE_UNSPECIFIED:diff --git a/frontend/src/components/InstanceForm/InstanceForm.vue b/frontend/src/components/InstanceForm/InstanceForm.vueindex ae4e6ad327..a5a87694a9 100644--- a/frontend/src/components/InstanceForm/InstanceForm.vue+++ b/frontend/src/components/InstanceForm/InstanceForm.vue@@ -1183,6 +1183,17 @@ const checkDataSource = (dataSources: DataSource[]) => {}}+ if (ds.saslConfig?.krbConfig) {+ if (+ !ds.saslConfig.krbConfig.primary ||+ !ds.saslConfig.krbConfig.realm ||+ !ds.saslConfig.krbConfig.kdcHost ||+ !ds.saslConfig.krbConfig.keytab+ ) {+ return false;+ }+ }+if (!ds.externalSecret) {return true;}