标签: credentials

如何在 Jenkins 声明式管道的所有阶段获取 Jenkins 凭据变量

如何让 Jenkins 凭证变量(即“mysqlpassword”)可供 Jenkins 声明性管道的所有阶段访问?

下面的代码片段工作正常并打印我的凭据。

node {
  stage('Getting Database Credentials') {
    withCredentials([usernamePassword(credentialsId: 'mysql_creds', passwordVariable: 'mysqlpassword', usernameVariable: 'mysqlusername')]) 
    {
        creds = "\nUsername: ${mysqlusername}\nPassword: ${mysqlpassword}\n"
    }
        println creds
  }
}
Run Code Online (Sandbox Code Playgroud)

如何将上述代码合并到当前的管道中,以便管道脚本的所有阶段(即全局)都可以访问 mysqlusername 和 mysqlpassword 变量。

我的管道脚本布局如下所示:

pipeline {          //indicate the job is written in Declarative Pipeline

    agent { label 'Prod_Slave' }

    environment {
                     STAGE_2_EXECUTED = "0"
    }

        stages {
            stage ("First Stage")  {
                     steps {
                echo "First called in pipeline"
                                script {
                        echo "Inside script of First stage"
                    }

                } 
          } …
Run Code Online (Sandbox Code Playgroud)

credentials jenkins jenkins-plugins jenkins-pipeline

2
推荐指数
1
解决办法
9938
查看次数

为什么我不能使用现成的凭据?

我想使用我的服务器上的现成凭证。

我愿意EDITOR="nano --wait" bin/rails credentials:edit

然后,我将 credential.yml.enc 和 master.key 的内容替换为服务器上这些文件中的内容。但是当我尝试读取凭据时出现错误Couldn't decrypt config/credentials.yml.enc. Perhaps you passed the wrong key?

ruby-on-rails credentials

2
推荐指数
1
解决办法
2287
查看次数

在 LDAP3 中获取 connection.bind 的 invalidCredentials

我正在尝试编写 python 代码,它将使用 LDAP 模块来验证 LDAP 连接:

import configuration
from ldap3 import Server, Connection, SIMPLE, SYNC, ALL

server = Server(configuration.LDAP_SERVER, port=XXXX, get_info=ALL)
c = Connection(server, authentication=SIMPLE, user=configuration.LDAP_USER, password=configuration.LDAP_PASS, check_names=True, lazy=False, client_strategy=SYNC, raise_exceptions=False)
c.open()
c.bind()
Run Code Online (Sandbox Code Playgroud)

运行代码时,我得到:

{'result': 49, 'description': 'invalidCredentials', 'dn': '', 'message': '80090308: LdapErr: DSID-0C09042A, comment: AcceptSecurityContext error, data 52e, v3839\x00', 'referrals': None, 'saslCreds': None, 'type': 'bindResponse'}
Run Code Online (Sandbox Code Playgroud)

我确信我使用的用户名和密码是正确的。你能告诉我代码有什么问题吗?

credentials python-3.6 ldap3

2
推荐指数
1
解决办法
3174
查看次数

如何获取 RDS 只读副本的凭据?

我已为生产 RDS 实例创建了只读副本,但我不知道在哪里可以看到该副本的登录凭据。

当我进入秘密管理屏幕并尝试创建新秘密时,副本实例不存在。

而且我不知道密码(通常在控制台创建数据库后会显示密码)。

我如何获得以下信息?用户名、密码、数据库名

credentials amazon-web-services amazon-rds read-replication aws-secrets-manager

2
推荐指数
1
解决办法
2728
查看次数

无法使用 AWS 安全令牌找到请求目标的有效证书路径

我正在尝试实施以下 AWS 文章中介绍的解决方案:


所以我做了接下来的步骤:

  1. 创建本地密钥库:

    keystore winpty openssl pkcs12 -export -in eeb81a0eb6-certificate.pem.crt -inkey eeb81a0eb6-private.pem.key -name myname -out my.p12 -password pass:mypass

    keytool -importkeystore -destkeystore mykeystore.jks -srckeystore my.p12 -srcstoretype PKCS12 -deststorepass mypass -srcstorepass mypass

  2. 创建本地信任库:

    keytool -keystore my_ca.jks -alias myalias -import -file AmazonRootCA1.pem

  3. 我的代码:

public class AWSSessionCredentialsProviderImpl implements AWSSessionCredentialsProvider  {
    
    private static final Logger LOGGER = LogManager.getLogger(AWSSessionCredentialsProviderImpl.class.getName());
    
    private final Gson gson = new Gson();
    
    private SdkHttpClient client;
    private HttpExecuteRequest request; 
    private String awsAccessKeyId;
    private String awsSecretAccessKeyId; …
Run Code Online (Sandbox Code Playgroud)

java credentials keystore truststore amazon-web-services

2
推荐指数
1
解决办法
1万
查看次数

将 AWS 凭证传递到 docker

我想使用我的测试 aws 凭证创建一个 docker 映像。这是我当前的 Dockerfile 的样子。我想要做的是将我的.aws文件夹复制到容器中并使用该数据,而不通过命令行传递它们。是否可以?那我该怎么办呢?谢谢。 在此输入图像描述

credentials amazon-web-services docker aws-cli dockerfile

2
推荐指数
1
解决办法
1万
查看次数

使用管理控制台 API 导出具有 keycloak 中凭证的用户

如何使用管理控制台 API 在 keycloak 中导出具有凭据的用户
我使用了此端点,但它不包含用户的凭据
curl -X GET https://$KEYCLOAK_IP/auth/admin/realms/$REALM_NAME/users

这是端点不包含凭证的结果

 {
    "id": "dbede89b-dbf8-4b4b-84a6-da7b6c1877e3",
    "createdTimestamp": 1607591201217,
    "username": "admin",
    "enabled": true,
    "totp": false,
    "emailVerified": false,
    "disableableCredentialTypes": [],
    "requiredActions": [],
    "notBefore": 0,
    "access": {
        "manageGroupMembership": true,
        "view": true,
        "mapRoles": true,
        "impersonate": true,
        "manage": true
    }
},
Run Code Online (Sandbox Code Playgroud)

如何恢复具有凭据的用户?

java json credentials spring-boot keycloak

2
推荐指数
1
解决办法
1万
查看次数

使用 Axios Node.js 请求 oAuth2 令牌 - 使用“请求”有效,但不适用于 Axios

以下代码工作正常:

request({
  url: 'https://xxxxxxx/oauth/token',
  method: 'POST',
  auth: {
    user: 'clientId',
    pass: 'clientSecret'
  },
  form: {
    'grant_type': 'client_credentials'
  }
}, function(err, res) {
  var json = JSON.parse(res.body);
  console.log("Access Token:", json.access_token);
});
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试使用 Axios 复制此内容(因为请求现已弃用)时,我不断收到 401

axios.request({
    url: 'https://xxxxxxx/oauth/token',
    method: 'POST',
    auth: {
      username: 'clientId',
      password: 'clientSecret',
    },
    headers: {
      Accept: 'application/json','Content-Type':'application/x-www-form-urlencoded',
    },
    data: {
      grant_type: 'client_credentials',
    },
  }).then(function(res) {
    console.log(res);  
  }).catch(function(err) {
    console.log("error = " + err);
  });
Run Code Online (Sandbox Code Playgroud)

ie catch 获取错误响应 401

关于如何将成功的“请求”编码到 axios 中的任何想法?

client credentials node.js oauth-2.0 axios

2
推荐指数
1
解决办法
7122
查看次数

Winrm basic:指定的凭据被服务器错误拒绝

尝试使用 Ansible 从 Linux Zorin 控制主机连接到 Windows 主机。在 Windows 机器中安装 winrm 并将所有必需的身份验证方法设置为 True。

Window Host 中 winrm 的配置

PS C:\WINDOWS\system32> winrm get winrm/config
Config
    MaxEnvelopeSizekb = 500
    MaxTimeoutms = 60000
    MaxBatchItems = 32000
    MaxProviderRequests = 4294967295
    Client
        NetworkDelayms = 5000
        URLPrefix = wsman
        AllowUnencrypted = true
        Auth
            Basic = true
            Digest = true
            Kerberos = true
            Negotiate = true
            Certificate = true
            CredSSP = false
        DefaultPorts
            HTTP = 5985
            HTTPS = 5986
        TrustedHosts
    Service
        RootSDDL = O:NSG:BAD:P(A;;GA;;;BA)(A;;GXGR;;;S-1-5-21-2039588290-1060779563-2652726705-1011)(A;;GR;;;IU)S:P(AU;FA;GA;;;WD)(AU;SA;GXGW;;;WD)
        MaxConcurrentOperations = 4294967295 …
Run Code Online (Sandbox Code Playgroud)

credentials winrm ansible

2
推荐指数
1
解决办法
7442
查看次数

Access-Control-Expose-Headers不允许JS客户端读取cookie

我对CORS服务器进行AJAX调用,我尝试使用javascript客户端读取响应时返回的cookie,但是徒劳无功.

1.第一次尝试:

- 服务器端(由express提供的node.js):

  response.header('Access-Control-Allow-Origin', '*');
  response.header('Access-Control-Allow-Headers', 'X-Requested-With, X-HTTP-Method-Override, Content-Type, Accept, Set-Cookie');
  response.header('Access-Control-Expose-Headers', "Set-Cookie");

 //------SET COOKIES
  response.cookie('SessionId', GeneratorId(64), {
            maxAge:3600000,
            httpOnly:flase // i disable httpOnly ==> does not work
          });
Run Code Online (Sandbox Code Playgroud)

- 客户端 :

var xhttp=new XMLHttpRequest();
xhttp.open("POST", "http://localhost:9090/api/map", true);
xhttp,send(`{layer:1}`);
Run Code Online (Sandbox Code Playgroud)

2.第二次尝试:( withCredentials)

-服务器端 :

 //Append another response' header 
  response.header('Access-Control-Allow-Credentials','true'); 
Run Code Online (Sandbox Code Playgroud)

-客户端 :

// Before xhttp.send , I add another instruction : 
 xhttp.withCredentials=true;
Run Code Online (Sandbox Code Playgroud)

3.第三次尝试:

- 服务器端 :

//Avoid the wildcard on Access-Control-Allow-Origin =>Replace the first header by :
response.header('Access-Control-Allow-Origin', request.get('Origin'));
Run Code Online (Sandbox Code Playgroud)

- 客户端 …

javascript cookies credentials httpresponse cors

1
推荐指数
1
解决办法
4961
查看次数