最近,根据以下两个网站上的说明,我能够在Swift IOS中为XMPP流提供MD5身份验证(我使用Apple的CommonCrypto C库的CC-MD5功能进行实际散列):
http://wiki.xmpp.org/web/SASLandDIGEST-MD5
http://www.deusty.com/2007/09/example-please.html
我正在寻找关于如何使其他散列SASL认证方案工作的类似解释,特别是SCRAM-SHA1.我找到了官方的RFC5802文档,但我在理解它时遇到了很多麻烦(它也不是特定于XMPP).我将非常感谢一个简单的解释或一些特定于XMPP身份验证的简单可读代码(C,PHP,C++,Javascript,Java),它们不会将库用于除实际散列之外的任何其他内容.
我有兴趣了解这个过程,而不是想使用ios XMPP-Framework.任何帮助,将不胜感激.
我已经从fons分叉了cl-mongo(常见的lisp MongoDB库)存储库,因为它已经不再需要维护,也不支持SCRAM-SHA-1登录过程.这是我的分支:https://github.com/mprelude/cl-mongo - 主要的变化是添加了对cl-scram的依赖(我的SCRAM实现),并添加了一个bson二进制通用容器.
我仍在尝试发送初始消息,因此问题不在于密码错误,因为尚未使用.
为什么这部分身份验证失败了?如果我希望将MESSAGE中的内容传送给mongo,是否有人可以确认BINARY-MESSAGE是否应该发送给我?
这是我的调用,增加了一些调试输出:
* (asdf:load-system :cl-mongo)
T
* (cl-mongo:db.use "test")
"test"
* (cl-mongo:db.auth "aurumrw" "pencil" :mechanism :SCRAM-SHA-1)
(kv-container : #(#S(CL-MONGO::PAIR :KEY saslStart :VALUE 1)
#S(CL-MONGO::PAIR :KEY mechanism :VALUE SCRAM-SHA-1)
#S(CL-MONGO::PAIR
:KEY payload
:VALUE [CL-MONGO::BSON-BINARY-GENERIC] [binary data of type 0] ))
((CL-MONGO::BINARY-MESSAGE
. #(98 105 119 115 98 106 49 104 100 88 74 49 98 88 74 51 76 72 73 57 83 87
116 122 101 84 100 78 101 …Run Code Online (Sandbox Code Playgroud) I've been trying to add a SASL Authentication to my Kafka Brokers using SASL_PLAINTEXT SCRAM-SHA-256 for a while, but without any success. I keep getting the following error on Kafka's logfile.
ERROR [Controller id=0, targetBrokerId=0] Connection to node 0 failed authentication due to: Authentication failed due to invalid credentials with SASL mechanism SCRAM-SHA-256 (org.apache.kafka.clients.NetworkClient).
But I've been following Kafka docs on SCRAM Config to the letter and not getting anywhere near of successfully achieving this to work.
I registred an …
我编辑了pg_hba.conf:
sudo su postgres
nano /etc/postgresql/10/main/pg_hba.conf
Run Code Online (Sandbox Code Playgroud)
并添加以下行:
local all username scram-sha-256
Run Code Online (Sandbox Code Playgroud)
并且改变了这一切md5,以scram-sha-256在该文件中。
作为postgres用户,我创建了一个具有超级用户权限的新用户:
sudo su postgres
psql
CREATE USER username WITH SUPERUSER PASSWORD 'password';
Run Code Online (Sandbox Code Playgroud)
然后我重新启动了Postgres:
/etc/init.d/postgresql restart
Run Code Online (Sandbox Code Playgroud)
并尝试使用pgAdmin4登录,我在其中更改了数据库的Connection属性下的用户名。但是,无论如何,这都psql -U username testdb < ./testdb.sql不起作用:
严重:用户“用户名”的密码身份验证失败
那么如何在我的Debian9 / KDE机器上让Postgres使用scram-sha-256?早前工作时,我离开了所有md5在pg_hba.conf原样。
注意:我已经阅读了这个问题的非常好的答案,但它没有回答我的问题.
我正在尝试在Common Lisp中实现RFC 5802规定的SCRAM-SHA1身份验证标准.在生成客户端最终响应消息时,我遇到了问题.
这是函数的代码(其余函数在这里可用) - 这是尝试实现RFC的第7页所述的算法:
(defun gen-client-final-message
(&key password client-nonce client-initial-message server-response)
(check-type client-nonce string)
(check-type client-initial-message string)
(check-type server-response string)
(check-type password string)
"Takes a password, the initial client nonce, the initial client message & the server response.
Generates the final client message, and returns it along with the server signature."
(progn
(if (eq nil (parse-server-nonce :nonce client-nonce :response server-response)) NIL)
(let* ((final-message-bare (format nil "c=biws,r=~a" (parse-server-nonce :nonce client-nonce
:response server-response))) …Run Code Online (Sandbox Code Playgroud) 我尝试为我的 kafka 集群添加安全性,我遵循了文档:
我使用以下命令添加用户:
kafka-configs.sh --zookeeper zookeeper1:2181 --alter --add-config 'SCRAM-SHA-256=[password=admin-secret],SCRAM-SHA-512=[password=admin-secret]' --entity-type users --entity-name admin
Run Code Online (Sandbox Code Playgroud)
我修改server.properties:
broker.id=1
listeners=SASL_PLAINTEXT://kafka1:9092
advertised.listeners=SASL_PLAINTEXT://kafka1:9092
sasl.enabled.mechanisms=SCRAM-SHA-256
sasl.mechanism.inter.broker.protocol=SCRAM-SHA-256
security.inter.broker.protocol=SASL_PLAINTEXT
num.network.threads=3
num.io.threads=8
socket.send.buffer.bytes=102400
socket.receive.buffer.bytes=102400
socket.request.max.bytes=104857600
default.replication.factor=3
min.insync.replicas=2
log.dirs=/var/lib/kafka
num.partitions=3
num.recovery.threads.per.data.dir=1
offsets.topic.replication.factor=3
transaction.state.log.replication.factor=1
transaction.state.log.min.isr=1
log.retention.hours=168
log.segment.bytes=1073741824
log.retention.check.interval.ms=300000
zookeeper.connect=zookeeper1:2181,zookeeper2:2181,zookeeper3:2181/kafka
zookeeper.connection.timeout.ms=6000
group.initial.rebalance.delay.ms=0
Run Code Online (Sandbox Code Playgroud)
创建了 jaas 文件:
KafkaServer {
org.apache.kafka.common.security.scram.ScramLoginModule required
username="admin"
password="admin-secret"
};
Run Code Online (Sandbox Code Playgroud)
在/etc/profile.d中创建文件kafka_opts.sh:
export KAFKA_OPTS=-Djava.security.auth.login.config=/opt/kafka_2.12-2.5.0/config/kafka_server_jaas.conf
Run Code Online (Sandbox Code Playgroud)
但是当我启动kafka时,它会抛出以下错误:
[2020-05-04 10:54:08,782] INFO [Controller id=1, targetBrokerId=1] Failed authentication with kafka1/kafka1 (Authentication failed during authentication due to invalid credentials with SASL mechanism SCRAM-SHA-256) (org.apache.kafka.common.network.Selector)
Run Code Online (Sandbox Code Playgroud)
我使用每个服务器各自的IP而不是kafka1,kafka2,kafka3,zookeeper1,zookeeper2和zookeeper3,有人可以帮助我解决我的问题吗?
sasl-scram ×6
apache-kafka ×2
common-lisp ×2
cryptography ×2
bash ×1
mongodb ×1
postgresql ×1
properties ×1
sasl ×1
xmpp ×1