标签: authentication

针对特定用户的 Google 身份验证器 PAM

我当前的 sshd PAM 配置:

#%PAM-1.0
auth       include      system-auth
account    required     pam_nologin.so
account    include      system-auth
password   include      system-auth
session    optional     pam_keyinit.so force revoke
session    include      system-auth
session    required     pam_loginuid.so
Run Code Online (Sandbox Code Playgroud)

我正在添加 Google 身份验证器,但我们尚未准备好向所有用户推出它。

我相信以下内容应该需要“gauth”组中的用户使用 Google Authenticator PAM,但希望有人可以在我将自己锁定在 SSH 之外之前检查我的工作...

#%PAM-1.0
auth       include      system-auth
account    required     pam_nologin.so
account    include      system-auth
password   include      system-auth
auth [success=1 default=ignore] pam_succeed_if.so quiet user notingroup gauth
auth required pam_google_authenticator.so
session    optional     pam_keyinit.so force revoke
session    include      system-auth
session    required     pam_loginuid.so
Run Code Online (Sandbox Code Playgroud)

我是否正确理解“success=1”意味着“如果成功则跳过下一行”?

password authentication pam google-authenticator

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

记录 OpenLDAP 上的身份验证失败

我需要在 OpenLDAP 上记录身份验证失败。正确的日志级别位是什么?或者对于这样的事情还有其他配置吗?

openldap authentication

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

在 Tomcat 中禁用 OPTIONS 请求的 HTTP 身份验证

我有一个受 HTTP 基本身份验证保护的 API。

当我想针对 API 发出 AJAX 请求时,浏览器会发送一个不携带 Authorization 标头的 OPTIONS 请求,因此它会被拒绝,因此浏览器不允许我的 AJAX 调用。

我尝试将 Tomcat 配置为不验证 OPTIONS 请求,但未能使其正常工作。

如何在 Tomcat 中禁用 OPTIONS 请求的 HTTP 身份验证?

tomcat authentication ajax cors

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

mysql验证插件未加载

问题:

我在 mysql 中设置用户时遇到登录问题。老用户可以按预期登录,对于新创建的用户,我无法登录并收到错误消息。

执行的SQL:

CREATE USER 'monty'@'%' IDENTIFIED BY 'some_pass';
GRANT ALL PRIVILEGES ON somedb.* TO 'monty'@'%';
FLUSH PRIVILEGES;
Run Code Online (Sandbox Code Playgroud)

预期: 我现在希望能够从我的客户端代码中以用户 monty 身份登录(适用于现有用户)。

错误:登录失败,我的客户端代码中出现以下错误消息:

SQLSTATE[HY000] [1524] Plugin '*937217B9DD8E6E458FC3F434BB7292891****' is not loaded'
Run Code Online (Sandbox Code Playgroud)

更多细节

当我检查 mysql.user 表时,我看到插件列包含用户的哈希密码,即 937217B9DD8E6E458FC3F434BB7292891****。

因此,我假设 auth 插件存在错误,并遵循迁移指南(https://dev.mysql.com/doc/refman/5.6/en/account-upgrades.html)。

改变用户

ALTER USER 'monty'@'%' IDENTIFIED WITH mysql_native_password BY 'some_pass';
Run Code Online (Sandbox Code Playgroud)

有帮助。但是,一旦我执行flush privileges此操作,登录就会再次失败。

涉及的系统是一个从 mysql/mysql-server 构建的 docker 容器。

mysql  Ver 14.14 Distrib 5.7.11, for Linux (x86_64) using  EditLine wrapper
Run Code Online (Sandbox Code Playgroud)

名称-a:

Linux 1046ac1aaeee 4.2.0-27-generic 
#32~14.04.1-Ubuntu SMP Fri …
Run Code Online (Sandbox Code Playgroud)

mysql authentication

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

无法使用公钥私钥对登录(ssh)

我无法使用公钥私钥对登录。我确实可以使用密码访问。以下是服务器端和客户端的日志。为什么我无法登录?

type=CRYPTO_KEY_USER msg=audit(1481731455.027:102046): user pid=8859 uid=0 auid=0 ses=6158 msg='op=destroy kind=session fp=? direction=both spid=8860 suid=74 rport=59031 laddr=XX.XXX.XX.XXX lport=22  exe="/usr/sbin/sshd" hostname=? addr=YY.YYY.YY.YYY terminal=? res=success'
type=USER_ERR msg=audit(1481731455.028:102047): user pid=8859 uid=0 auid=0 ses=6158 msg='op=PAM:bad_ident acct="?" exe="/usr/sbin/sshd" hostname=YY.YYY.YY.YYY addr=YY.YYY.YY.YYY terminal=ssh res=failed'
type=CRYPTO_KEY_USER msg=audit(1481731455.028:102048): user pid=8859 uid=0 auid=0 ses=6158 msg='op=destroy kind=server fp=6f:21:ce:5c:81:10:5e:63:db:32:54:71:80:bf:99:97 direction=? spid=8859 suid=0  exe="/usr/sbin/sshd" hostname=? addr=YY.YYY.YY.YYY terminal=? res=success'
type=CRYPTO_KEY_USER msg=audit(1481731455.028:102049): user pid=8859 uid=0 auid=0 ses=6158 msg='op=destroy kind=server fp=d7:a6:59:60:99:86:45:95:69:79:bf:ea:8a:fa:0a:46 direction=? spid=8859 suid=0  exe="/usr/sbin/sshd" hostname=? addr=YY.YYY.YY.YYY terminal=? res=success'
type=USER_LOGIN msg=audit(1481731455.028:102050): user pid=8859 uid=0 auid=0 ses=6158 msg='op=login …
Run Code Online (Sandbox Code Playgroud)

linux ssh authentication rsa

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

MongoDB rs.initiate 错误:replSetInitiate 仲裁检查失败,因为并非所有提议的集合成员都做出肯定响应

我必须使用 X.509 证书启用内部身份验证来启动我自己的副本集,但我失败了。欢迎任何建议。

Debian 8.2 x64 上的 MongoDB 3.2 x64。

这是 MongoDB 大学课程“M310:MongoDB 安全性”中的一个问题。

一位导师:

您可以使用身份验证选项启动您的服务器成员,然后使用 rs.initiate,然后创建您的用户。

我有这个文件夹结构:

~
`-- shared
    `-- certs
        |-- ca.pem
        |-- client.pem
        `-- server.pem
Run Code Online (Sandbox Code Playgroud)

我创建了这个 bash 脚本来设置我的副本集:

#!/bin/bash

course="M310"
exercise="HW-1.3"
workingDir="$HOME/${course}-${exercise}"
dbDir="$workingDir/db"
logName="mongodb.log"

ports=(31130 31131 31132)
replSetName="rs1"

host=`hostname -f`
initiateStr="rs.initiate({
                 _id: '$replSetName',
                 version: 1,
                 members: [
                  { _id: 0, host: '$host:${ports[0]}' },
                  { _id: 1, host: '$host:${ports[1]}' },
                  { _id: 2, host: '$host:${ports[2]}' }
                 ]
                })"

# create working folder
mkdir -p "$workingDir/"{r0,r1,r2}

# launch …
Run Code Online (Sandbox Code Playgroud)

authentication x509 mongodb

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

LDAP:创建具有有限权限的绑定用户

我需要绑定到 OpenLDAP 服务器来对用户进行身份验证,但我不希望这个低权限或“委派管理员”能够看到比严格必要的更多的属性。

如何使用白名单减少绑定用户可以看到的属性?哪些属性是对用户进行身份验证所必需的?

例如,这个特定的绑定用户不需要查看NTPassword,我想其他属性,如主目录等。

这是我到目前为止所做的:

  1. 我已禁用匿名绑定:

    # disable anon bind
    dn: cn=config
    changetype: modify
    add: olcDisallows
    olcDisallows: bind_anon
    
    dn: cn=config
    changetype: modify
    add: olcRequires
    olcRequires: authc
    
    dn: olcDatabase={-1}frontend,cn=config
    changetype: modify
    add: olcRequires
    olcRequires: authc
    
    Run Code Online (Sandbox Code Playgroud)
  2. 我创建了一个“应用程序”OU 和一个“gitlab”用户:

    # file: applications.ldif
    dn: ou=Applications,dc=example,dc=com
    objectclass: top 
    objectClass: organizationalunit
    ou: Applications
    
    dn: cn=gitlab,ou=Applications,dc=example,dc=com
    cn: gitlab
    objectClass: simpleSecurityObject
    objectClass: organizationalRole
    userPassword: {CRYPT}.....
    
    Run Code Online (Sandbox Code Playgroud)
  3. 要创建用户,我使用了 LDAP 管理员用户:

    ldapadd -xvvv -f applications.ldif -D 'cn=admin,dc=example,dc=com' -W
    
    Run Code Online (Sandbox Code Playgroud)
  4. 为了限制“gitlab”权限,我试过这个:

    # file: give-applications-access.ldif
    dn: cn=config
    changetype: modify
    # allow …
    Run Code Online (Sandbox Code Playgroud)

openldap ldap authentication

5
推荐指数
0
解决办法
5954
查看次数

Nginx:速率限制失败基本身份验证尝试

在 Nginx(撰写本文时为 1.14.1)中给出一个简单的 HTTP 基本身份验证设置,如下所示:

server {
  ...
  location / {
    auth basic "HTTP Auth Required";
    auth basic user file "/path/to/htpasswd";
  }
}
Run Code Online (Sandbox Code Playgroud)

...如何对失败的登录尝试应用速率限制?例如,如果 30 秒内有 10 次登录尝试失败,我想阻止该源 IP 在一个小时内访问该网站。我希望利用limit_req_zone和 相关指令,但找不到一种方法来连接请求的身份验证状态。

这在 HAproxy 中相当简单,使用棒表和 ACL,使用类似以下工作示例的内容。

userlist users
  user me password s3cr3t

frontend https.local
  ...

  # Set up the stick table to track our source IPs, both IPv4 & IPv6
  stick-table  type ipv6  size 100k  expire 1h  store http_req_rate(30s)

  # Check if the user has authenticated
  acl  auth_ok  http_auth(users) …
Run Code Online (Sandbox Code Playgroud)

nginx authentication brute-force-attacks rate-limiting

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

NGINX auth_request 和 302 响应状态 = 500 无效 URL 前缀

我正在尝试使用 OAuth2 服务器(授权代码流)对 NGINX 请求进行身份验证,该服务器会将客户端重定向到登录页面。是否可以使用 auth_request 指令来实现这一点?这是我的 nginx.conf:

server {
    listen ${NGINX_PORT};

    proxy_send_timeout    600;
    proxy_connect_timeout    600;
    proxy_read_timeout    600;
    send_timeout        600;
    client_max_body_size 100m;
    absolute_redirect off;

    access_log /var/log/nginx/access.log;
    error_log /var/log/nginx/error.log warn;

    location / {
        auth_request /authn;
        gzip_static on;
        index   index.html;
        root /usr/share/nginx/html;
        try_files $uri $uri/ @index;
    }

    location @index {
        root /usr/share/nginx/html;
        add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
        expires 0;
        try_files /index.html =404;
    }

    location /api {
        set $target http://gateway:8030/api;
        proxy_pass http://gateway:8030/api;
    }
    location /authn {
        set $target http://gateway:8030/authn;
        proxy_pass http://gateway:8030/authn; …
Run Code Online (Sandbox Code Playgroud)

nginx proxy authentication redirection

5
推荐指数
0
解决办法
1763
查看次数

从多个来源/服务器发送电子邮件时 DKIM 如何工作?

因此,如果我正确理解 DKIM,它基本上是一种公钥/私钥类型的服务。但是,如果您从多个服务器/来源发送电子邮件,这如何工作?例如,我有一个拆分域,我从托管的 Exchange 服务器发送一些电子邮件(在同一域下),一些从 cPanel 共享托管帐户发送。最重要的是,我允许第三方(计费服务、营销电子邮件服务等)发送一些电子邮件,以便他们可以使用我的域发送。更糟糕的是,其中一些服务甚至不提供 DKIM 支持。我的 SPF 记录是正确的,但我也想让 DKIM 正常工作(因为 Google 现在将我的很多电子邮件标记为垃圾邮件,显然您需要启用 DKIM 才能让事情在他们结束时开始顺利进行)。任何帮助是极大的赞赏。谢谢!

PS 如果我能够在我使用的某些服务器上启用 DKIM,这样做会导致发送没有 DKIM 签名的电子邮件被标记吗?例如,入站电子邮件服务器是否总是会在我的域中查询 DKIM 公钥,然后如果他们在标题中找不到 DKIM 签名,则该电子邮件可能会被标记或丢弃?

email spam authentication spf dkim

5
推荐指数
2
解决办法
2858
查看次数