Merge pull request #1616 from bennerv/dbtoken-oidcv2-clientid

Add dbTokenClientID to RP Config
This commit is contained in:
Mangirdas Judeikis 2021-08-03 09:10:05 +01:00 коммит произвёл GitHub
Родитель cb04f2d338 7ffd4b5dcd
Коммит 57688ed8ce
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 36 добавлений и 9 удалений

Просмотреть файл

@ -30,6 +30,7 @@ func dbtoken(ctx context.Context, log *logrus.Entry) error {
for _, key := range []string{ for _, key := range []string{
"MDM_ACCOUNT", "MDM_ACCOUNT",
"MDM_NAMESPACE", "MDM_NAMESPACE",
"AZURE_DBTOKEN_CLIENT_ID",
} { } {
if _, found := os.LookupEnv(key); !found { if _, found := os.LookupEnv(key); !found {
return fmt.Errorf("environment variable %q unset", key) return fmt.Errorf("environment variable %q unset", key)
@ -85,9 +86,7 @@ func dbtoken(ctx context.Context, log *logrus.Entry) error {
// example value: https://login.microsoftonline.com/11111111-1111-1111-1111-111111111111/v2.0 // example value: https://login.microsoftonline.com/11111111-1111-1111-1111-111111111111/v2.0
issuer := _env.Environment().ActiveDirectoryEndpoint + _env.TenantID() + "/v2.0" issuer := _env.Environment().ActiveDirectoryEndpoint + _env.TenantID() + "/v2.0"
clientID := os.Getenv("AZURE_DBTOKEN_CLIENT_ID")
// example value: https://dbtoken.aro.azure.com/
clientID := "https://dbtoken." + _env.Environment().AppSuffix + "/"
verifier, err := oidc.NewVerifier(ctx, issuer, clientID) verifier, err := oidc.NewVerifier(ctx, issuer, clientID)
if err != nil { if err != nil {

Просмотреть файл

@ -50,6 +50,9 @@
"databaseAccountName": { "databaseAccountName": {
"value": "" "value": ""
}, },
"dbtokenClientId": {
"value": ""
},
"disableCosmosDBFirewall": { "disableCosmosDBFirewall": {
"value": false "value": false
}, },

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -228,6 +228,22 @@ locations.
TODO: more steps are needed to configure aro-v4-portal-shared. TODO: more steps are needed to configure aro-v4-portal-shared.
1. Create an AAD application which will fake up the dbtoken client.
1. Create the application and set `requestedAccessTokenVersion`
```bash
AZURE_DBTOKEN_CLIENT_ID="$(az ad app create --display-name dbtoken \
--oauth2-allow-implicit-flow false \
--query appId \
-o tsv)"
OBJ_ID="$(az ad app show --id $AZURE_DBTOKEN_CLIENT_ID --query objectId)"
az rest --method PATCH \
--uri https://graph.microsoft.com/v1.0/applications/$OBJ_ID/ \
--body '{"api":{"requestedAccessTokenVersion": 2}}'
```
## Certificates ## Certificates
@ -320,6 +336,7 @@ locations.
export AZURE_ARM_CLIENT_ID='$AZURE_ARM_CLIENT_ID' export AZURE_ARM_CLIENT_ID='$AZURE_ARM_CLIENT_ID'
export AZURE_FP_CLIENT_ID='$AZURE_FP_CLIENT_ID' export AZURE_FP_CLIENT_ID='$AZURE_FP_CLIENT_ID'
export AZURE_FP_SERVICE_PRINCIPAL_ID='$(az ad sp list --filter "appId eq '$AZURE_FP_CLIENT_ID'" --query '[].objectId' -o tsv)' export AZURE_FP_SERVICE_PRINCIPAL_ID='$(az ad sp list --filter "appId eq '$AZURE_FP_CLIENT_ID'" --query '[].objectId' -o tsv)'
export AZURE_DBTOKEN_CLIENT_ID='$AZURE_DBTOKEN_CLIENT_ID'
export AZURE_PORTAL_CLIENT_ID='$AZURE_PORTAL_CLIENT_ID' export AZURE_PORTAL_CLIENT_ID='$AZURE_PORTAL_CLIENT_ID'
export AZURE_PORTAL_ACCESS_GROUP_IDS='$ADMIN_OBJECT_ID' export AZURE_PORTAL_ACCESS_GROUP_IDS='$ADMIN_OBJECT_ID'
export AZURE_PORTAL_ELEVATED_GROUP_IDS='$ADMIN_OBJECT_ID' export AZURE_PORTAL_ELEVATED_GROUP_IDS='$ADMIN_OBJECT_ID'

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -50,6 +50,7 @@ type Configuration struct {
ClusterMDSDNamespace *string `json:"clusterMdsdNamespace,omitempty" value:"required"` ClusterMDSDNamespace *string `json:"clusterMdsdNamespace,omitempty" value:"required"`
ClusterParentDomainName *string `json:"clusterParentDomainName,omitempty" value:"required"` ClusterParentDomainName *string `json:"clusterParentDomainName,omitempty" value:"required"`
DatabaseAccountName *string `json:"databaseAccountName,omitempty" value:"required"` DatabaseAccountName *string `json:"databaseAccountName,omitempty" value:"required"`
DBTokenClientID *string `json:"dbtokenClientId,omitempty" value:"required"`
DisableCosmosDBFirewall *bool `json:"disableCosmosDBFirewall,omitempty"` DisableCosmosDBFirewall *bool `json:"disableCosmosDBFirewall,omitempty"`
ExtraClusterKeyvaultAccessPolicies []interface{} `json:"extraClusterKeyvaultAccessPolicies,omitempty" value:"required"` ExtraClusterKeyvaultAccessPolicies []interface{} `json:"extraClusterKeyvaultAccessPolicies,omitempty" value:"required"`
ExtraDBTokenKeyvaultAccessPolicies []interface{} `json:"extraDBTokenKeyvaultAccessPolicies,omitempty" value:"required"` ExtraDBTokenKeyvaultAccessPolicies []interface{} `json:"extraDBTokenKeyvaultAccessPolicies,omitempty" value:"required"`

Просмотреть файл

@ -377,11 +377,11 @@ func (g *generator) rpVMSS() *arm.Resource {
for _, variable := range []string{ for _, variable := range []string{
"acrResourceId", "acrResourceId",
"adminApiClientCertCommonName",
"armApiClientCertCommonName",
"armClientId", "armClientId",
"azureCloudName", "azureCloudName",
"azureSecPackVSATenantId", "azureSecPackVSATenantId",
"adminApiClientCertCommonName",
"armApiClientCertCommonName",
"billingE2EStorageAccountId", "billingE2EStorageAccountId",
"clusterMdmAccount", "clusterMdmAccount",
"clusterMdsdAccount", "clusterMdsdAccount",
@ -389,10 +389,11 @@ func (g *generator) rpVMSS() *arm.Resource {
"clusterMdsdNamespace", "clusterMdsdNamespace",
"clusterParentDomainName", "clusterParentDomainName",
"databaseAccountName", "databaseAccountName",
"dbtokenClientId",
"fpClientId", "fpClientId",
"fpServicePrincipalId", "fpServicePrincipalId",
"keyvaultPrefix",
"keyvaultDNSSuffix", "keyvaultDNSSuffix",
"keyvaultPrefix",
"mdmFrontendUrl", "mdmFrontendUrl",
"mdsdEnvironment", "mdsdEnvironment",
"portalAccessGroupIds", "portalAccessGroupIds",
@ -660,6 +661,7 @@ EOF
cat >/etc/sysconfig/aro-dbtoken <<EOF cat >/etc/sysconfig/aro-dbtoken <<EOF
DATABASE_ACCOUNT_NAME='$DATABASEACCOUNTNAME' DATABASE_ACCOUNT_NAME='$DATABASEACCOUNTNAME'
AZURE_DBTOKEN_CLIENT_ID='$DBTOKENCLIENTID'
KEYVAULT_PREFIX='$KEYVAULTPREFIX' KEYVAULT_PREFIX='$KEYVAULTPREFIX'
MDM_ACCOUNT='$RPMDMACCOUNT' MDM_ACCOUNT='$RPMDMACCOUNT'
MDM_NAMESPACE=DBToken MDM_NAMESPACE=DBToken
@ -679,6 +681,7 @@ ExecStart=/usr/bin/docker run \
--name %N \ --name %N \
--rm \ --rm \
-e DATABASE_ACCOUNT_NAME \ -e DATABASE_ACCOUNT_NAME \
-e AZURE_DBTOKEN_CLIENT_ID \
-e KEYVAULT_PREFIX \ -e KEYVAULT_PREFIX \
-e MDM_ACCOUNT \ -e MDM_ACCOUNT \
-e MDM_NAMESPACE \ -e MDM_NAMESPACE \

Просмотреть файл

@ -43,6 +43,7 @@ func (g *generator) rpTemplate() *arm.Template {
"clusterMdsdAccount", "clusterMdsdAccount",
"clusterMdsdConfigVersion", "clusterMdsdConfigVersion",
"clusterMdsdNamespace", "clusterMdsdNamespace",
"dbtokenClientId",
"disableCosmosDBFirewall", "disableCosmosDBFirewall",
"extraCosmosDBIPs", "extraCosmosDBIPs",
"fpClientId", "fpClientId",