Aws-iot-device-sdk-python-v2: AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE على 1.0.6 (awscrt 0.5.13)

تم إنشاؤها على ١٥ أبريل ٢٠٢٠  ·  17تعليقات  ·  مصدر: aws/aws-iot-device-sdk-python-v2

صف الخلل
بعد ترقية التثبيت الخاص بي إلى awsiotsdk-1.0.6 ، توقف عن العمل مع awscrt حيث فشل في الإذن بخلفية aws. قد يكون متصلاً بترقية awscrt إلى 0.5.13.

رقم إصدار SDK
awsiotsdk-1.0.6

النظام الأساسي / نظام التشغيل / الجهاز
rpi3b +

للتكاثر (السلوك الملحوظ)
قم بترقية awsiotsdk إلى الإصدار 1.0.6 .

سلوك متوقع
يجب أن يعمل كما هو متوقع.

السجلات / الإخراج

Apr 15 06:55:01 raspberrypi python3[581]: Connecting to something-east-1.amazonaws.com with client ID 'foo-bar-baz'...
Apr 15 06:55:01 raspberrypi python3[581]: Traceback (most recent call last):
Apr 15 06:55:01 raspberrypi python3[581]:   File "app.py", line 86, in <module>
Apr 15 06:55:01 raspberrypi python3[581]:     connect_future.result()
Apr 15 06:55:01 raspberrypi python3[581]:   File "/usr/lib/python3.7/concurrent/futures/_base.py", line 432, in result
Apr 15 06:55:01 raspberrypi python3[581]:     return self.__get_result()
Apr 15 06:55:01 raspberrypi python3[581]:   File "/usr/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
Apr 15 06:55:01 raspberrypi python3[581]:     raise self._exception
Apr 15 06:55:01 raspberrypi python3[581]: awscrt.exceptions.AwsCrtError: AwsCrtError(name='AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE', message='TLS (SSL) negotiation failed', code=1029)
Apr 15 06:55:01 raspberrypi systemd[1]: app.service: Main process exited, code=exited, status=1/FAILURE
guidance

التعليق الأكثر فائدة

JonathanHenson كنت أستخدم نقطة النهاية القديمة ( <endpoint-id>.iot.us-east-1.amazonaws.com ) ، انتقلت إلى ATS واحد ( <endpoint-id>-ats.iot.us-east-1.amazonaws.com ) وهي تعمل الآن. شكرا لمساعدتك!

ال 17 كومينتر

لقد واجهت نفس المشكلة.

ركض عبر مشاركتك أثناء البحث عن مشكلة مماثلة مع CPPv2 SDK والتي أعتقد أنها تستند إلى نفس الوظائف الأساسية. لقد اكتشفت أن CPPv2 SDK كان يحاول التحقق من صحة سلسلة الثقة الكاملة ، وليس فقط شهادة المرجع المصدق (CA) التي قدمتها - ولكن سلسلة الثقة الكاملة لم تكن موجودة على جهازي. من خلال نسخ /etc/ssl/certs/ca-certificates.crt من جهاز Ubuntu الخاص بي إلى جهازي وتمريره إلى طريقة Aws :: Iot :: MqttClientConnectionConfigBuilder :: WithCertificateAuthority () ، تمكنت من توفير مخزن ثقة كامل يعمل . لست متأكدًا مما هو مكافئ Python لهذه الطريقة ، ولكن يجب أن يكون موجودًا - على أمل أن يساعدك هذا التلميح!

تحديث: في الإصدار الأخير من C ++ SDK ، أرى أيضًا أن S2N (مكدس AWS TLS) سيختار ECDSA للتوقيع ، وهو غير مدعوم في إصدار إصدار قاعدة التعليمات البرمجية.

تبدو نصيحة jsakwa سليمة.
هل يمكنك تشغيل samples/pubsub.py مع --root-ca set؟ عادةً ما تقوم بتمرير ملف Amazon Root CA 1 المتاح هنا

graebm ، لم أحصل على عرض النطاق الترددي لاختبار أجهزة الصراف الآلي. هل تعمل من أجلك؟ إذا نجح الأمر ، فسيكون ذلك غير طبيعي لأن المستندات تنص بوضوح على أنه يجب استخدام المفتاح إذا لم يكن جذر الثقة مثبتًا على جهازك بالفعل وكان موجودًا لي (يعمل بعد الرجوع إلى إصدار سابق).

graebm لقد اختبرت للتو مرة أخرى. الإصدار 1.0.5 يعمل بشكل جيد. تحدث المشكلة عند استخدام الإصدار 1.0.6. أنا أستخدم شهادة موقعة مع المرجع المصدق الذي ذكرته (وليس الشهادة المهملة).

تم إجراء هذا الاختبار باستخدام pubsub.py مع --root-ca في حاوية Docker.

هذا مقتطف من إخراج التصحيح:

(...)

[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfc006320: Scheduling attempt_connection task for immediate execution
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfc006320: Running attempt_connection task with <Running> status
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: initializing with domain 1 and type 0
Unsupported setsockopt level=1 optname=16384
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: setting socket options to: keep-alive 0, keep idle 0, keep-alive interval 0, keep-alive probe count 0.
[WARN ] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: setsockopt() for NO_SIGNAL failed with errno 92. If you are having SIGPIPE signals thrown, you may want to install a signal trap in your application layer.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: beginning connect.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: connecting to endpoint [redacted]:443.
[ERROR] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: connect failed with error code 99.
[INFO ] [2020-04-25T22:14:14Z] [fdeff460] [dns] - id=0xff2df650: recording failure for record [redacted] for [redacted].iot.us-east-1.amazonaws.com, moving to bad list
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [dns] - static: purging address [redacted] for host [redacted].iot.us-east-1.amazonaws.com from the cache due to cache eviction or shutdown
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: is still open, closing...
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: closing
[ERROR] [2020-04-25T22:14:14Z] [fdeff460] [channel-bootstrap] - id=0xff3109a0: failed to create socket with error 1055
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfc006450: Scheduling attempt_connection task for immediate execution
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfc006450: Running attempt_connection task with <Running> status
Unsupported setsockopt level=1 optname=16384
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: initializing with domain 0 and type 0
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: setting socket options to: keep-alive 0, keep idle 0, keep-alive interval 0, keep-alive probe count 0.
[WARN ] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: setsockopt() for NO_SIGNAL failed with errno 92. If you are having SIGPIPE signals thrown, you may want to install a signal trap in your application layer.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: beginning connect.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: connecting to endpoint [redacted]:443.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd503440: Scheduling (null) task for future execution at time 3166071860135
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd503488: Scheduling epoll_event_loop_unsubscribe_cleanup task for immediate execution
[INFO ] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: connection success
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: local endpoint 172.17.0.2:58438
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: assigning to event loop 0xff281f60
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [channel-bootstrap] - id=0xff3109a0: client connection on socket 0xfd502a50 completed with error 0.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [channel] - id=0xfd504088: Beginning creation and setup of new channel.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd503c48: Scheduling on_channel_setup_complete task for immediate execution
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd503488: Running epoll_event_loop_unsubscribe_cleanup task with <Running> status
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd503c48: Running on_channel_setup_complete task with <Running> status
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [channel] - id=0xfd504088: setup complete, notifying caller.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [channel] - id=0xfd504088: no message pool is currently stored in the event-loop local storage, adding 0xfd504740 with max message size 16384, message count 4, with 4 small blocks of 128 bytes.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [channel-bootstrap] - id=0xff3109a0: channel 0xfd504088 setup succeeded: bootstrapping.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [socket-handler] - id=0xfd514e68: Socket handler created with max_read_size of 16384
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd515038: Scheduling tls_timeout task for future execution at time 3165183175311
[WARN ] [2020-04-25T22:14:14Z] [fdeff460] [tls-handler] - id=0xfd515020: negotiation failed with error Invalid signature algorithm (Error encountered in /tmp/pip-wheel-tiv_gdev/awscrt/aws-common-runtime/s2n/tls/s2n_client_cert_verify.c line 96)
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [channel-bootstrap] - id=0xff3109a0: tls negotiation result 1029 on channel 0xfd504088
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd5041c8: Scheduling channel_shutdown task for immediate execution
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [channel] - id=0xfd504088: Channel shutdown is already pending, not scheduling another.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd5041c8: Running channel_shutdown task with <Running> status
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [channel] - id=0xfd504088: beginning shutdown process
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [channel] - id=0xfd504088: handler 0xfd514e68 shutdown in read dir completed.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [tls-handler] - id=0xfd515020: Shutting down read direction with error code 1029
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [channel] - id=0xfd504088: handler 0xfd515020 shutdown in read dir completed.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd5040a0: Scheduling (null) task for immediate execution
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd5040a0: Running (null) task with <Running> status
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [tls-handler] - id=0xfd515020: Shutting down write direction
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [channel] - id=0xfd504088: handler 0xfd515020 shutdown in write dir completed.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [socket] - id=0xfd502a50 fd=6: closing
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd503c00: Scheduling epoll_event_loop_unsubscribe_cleanup task for immediate execution
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd514ec8: Scheduling socket_handler_close task for immediate execution
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd503c00: Running epoll_event_loop_unsubscribe_cleanup task with <Running> status
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd514ec8: Running socket_handler_close task with <Running> status
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [channel] - id=0xfd504088: handler 0xfd514e68 shutdown in write dir completed.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd5040a0: Scheduling (null) task for immediate execution
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd5040a0: Running (null) task with <Running> status
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [channel] - id=0xfd504088: during shutdown, canceling task 0xfd515038
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [task-scheduler] - id=0xfd515038: Running tls_timeout task with <Canceled> status
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [channel-bootstrap] - id=0xff3109a0: channel 0xfd504088 shutdown with error 1029.
[DEBUG] [2020-04-25T22:14:14Z] [fdeff460] [channel] - id=0xfd504088: destroying channel.
Traceback (most recent call last):
  File "/opt/controller/pubsub.py", line 141, in <module>
    connect_future.result()
  File "/usr/local/lib/python3.7/concurrent/futures/_base.py", line 435, in result
    return self.__get_result()
  File "/usr/local/lib/python3.7/concurrent/futures/_base.py", line 384, in __get_result
    raise self._exception
awscrt.exceptions.AwsCrtError: AwsCrtError(name='AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE', message='TLS (SSL) negotiation failed', code=1029)
[DEBUG] [2020-04-25T22:14:14Z] [ff37c010] [mqtt-client] - id=0xff3408e0: user called disconnect.
[ERROR] [2020-04-25T22:14:14Z] [ff37c010] [mqtt-client] - id=0xff3408e0: Connection is not open, and may not be closed
[DEBUG] [2020-04-25T22:14:14Z] [ff37c010] [mqtt-client] - id=0xff3408e0: Destroying connection
[DEBUG] [2020-04-25T22:14:14Z] [ff37c010] [mqtt-topic-tree] - tree=0xff340960: Cleaning up topic tree
[DEBUG] [2020-04-25T22:14:14Z] [ff37c010] [mqtt-client] - client=0xfe8bff28: Cleaning up MQTT client
[DEBUG] [2020-04-25T22:14:14Z] [ff37c010] [channel-bootstrap] - id=0xff3109a0: releasing bootstrap reference
[DEBUG] [2020-04-25T22:14:14Z] [ff37c010] [channel-bootstrap] - id=0xff3109a0: destroying

حسنًا .... لقد قمنا بتحديث تفضيلات التشفير مؤخرًا. هل هناك أي فرصة للحصول على التقاط سمكة القرش السلكية لمصافحة TLS ونشر رسائل الترحيب الخاصة بالعميل والخادم؟

ياJonathanHensongraebm إذا كان هذا هو باستخدام نفس كومة S2N مثل SDK CPPv2، لاحظت أنه في أحدث نسخة SDK v1.5.5 على نظام بلدي، وهذا فشل أيضا لأن يعلن عن جهاز الدعم لECDSA، ولكن كومة S2N يدعم فقط RSA ، وأثناء التفاوض يتم اختيار ECDSA. يبدو سجل adolfogc هو نفسه سجل لي أثناء وضع الفشل المحدد.

حاولت سحب إصدار S2N على المستوى الرئيسي ، والذي من المفترض أن يدعم ECDSA ، ولكن على الأقل على نظامي فشل هذا أيضًا ، لأنه سيحاول بطريقة ما استخدام مفتاح ECDSA من رمز RSA. كنت أخطط لإصلاح ذلك وإرسال طلب سحب إلى S2N ، لكنني لم أتمكن من الوصول إليه.

أنا أستخدم حاليًا الإصدار 1.5.1 من CPPv2 SDK والذي يتفاوض دائمًا لاستخدام RSA أثناء خطوة التحدي

حسنًا ، أنا أعلم أين أنظر الآن ، لكن هل هناك أي فرصة يمكن أن تحصل فيها على التقاط المصافحة لي حتى أتمكن من النظر إلى جانب s2n هذا؟

مرحبًا JonathanHenson ، هل يكفي ما يلي؟

مرحبا بالعميل:
image

مرحبًا بالخادم:
image

مصافحة:

image

هل تم إرسال التنبيه من العميل أو الخادم؟
يبدو أيضًا أن SNI فارغ؟ سيؤدي ذلك أيضًا إلى فشل المفاوضات. ما الذي تقوم بتعيينه لاسم الخادم؟

JonathanHenson كنت أستخدم نقطة النهاية القديمة ( <endpoint-id>.iot.us-east-1.amazonaws.com ) ، انتقلت إلى ATS واحد ( <endpoint-id>-ats.iot.us-east-1.amazonaws.com ) وهي تعمل الآن. شكرا لمساعدتك!

وفقًا لـ https://aws.amazon.com/blogs/iot/aws-iot-core-ats-endpoints/ يجب أن ننتقل إلى -ats أسرع وقت ممكن ، adolfogc ،

mkozjak فعلت وتم حل المشكلة

شكرًا لك ماريو على مشاركة رابط هذا المنشور هنا. مرة أخرى: https://aws.amazon.com/blogs/iot/aws-iot-core-ats-endpoints/

لن يعمل التكوين الافتراضي لأجهزة SDK لجهاز V2 بعد الآن مع نقاط النهاية القديمة بخلاف ATS. قم بتشغيل aws --region <region> iot describe-endpoint --endpoint-type "iot:Data-ATS" للحصول على نقطة نهاية ATS.

كنت أعاني من فشل دائم في تفاوض TLS ، عند استخدام aws iot python sdk v2 ، على الرغم من استخدام نقطة نهاية .ats ، ولكن كما هو مقترح في مدونة aws ، تمكنت من حل المشكلة عن طريق تبديل شهادة الجذر إلى شهادة AmazonRootCA1 من a شهادة G2-RootCA1.

أهلا،
لقد علقت مع هذا الخطأ لمدة ساعتين عند الترحيل من sdk القديم إلى الإصدار 2 (v1.5.0) حتى أنني حاولت في بيئة متعددة سواء Windows10 أو Ubuntu18 أو MacOS.

مثال sdk القديم basicPubSub.py يعمل فقط مع المفتاح والشهادة والجذر CA1 الخاص بي
لكن مثال sdk الجديد pubsub.py فقط لا يعمل مع نفس المفاتيح والسياسة

[ERROR] [2020-09-25T11:11:31Z] [00004ed8] [socket] - id=000001A7825DF580 handle=0000000000000320: connect completion triggered with error -1073741305
[ERROR] [2020-09-25T11:11:31Z] [00004ed8] [socket] - id=000001A7825DF580 handle=0000000000000320: connection error with code 1055
[INFO] [2020-09-25T11:11:31Z] [00004ed8] [dns] - id=000001A7802A2780: recording failure for record xxx for xxx-ats.iot.ap-southeast-1.amazonaws.com, moving to bad list
[ERROR] [2020-09-25T11:11:31Z] [00004ed8] [tls-handler] - id=000001A782BE3580: Error during negotiation. SECURITY_STATUS is -2146892953
[ERROR] [2020-09-25T11:11:31Z] [00004ed8] [socket] - id=000001A7825E0C00 handle=000000000000032C: WriteFile() failed with error 64

لا بد لي من إدخال المنفذ حتى يعمل ، آمل أن يساعدك أيضًا.

mqtt_connection_builder.mtls_from_path(
            ...
            port=8883)

يعتبر،
جاستن

آسف لأنك تواجه مشكلة جاستن. هل جربت نموذج سياسة pubsub الوارد في التمهيدي للعينات؟

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:Publish", "iot:Receive" ], "Resource": [ "arn:aws:iot:region:account:topic/test/topic" ] }, { "Effect": "Allow", "Action": [ "iot:Subscribe" ], "Resource": [ "arn:aws:iot:region:account:topicfilter/test/topic" ] }, { "Effect": "Allow", "Action": [ "iot:Connect" ], "Resource": [ "arn:aws:iot:region:account:client/test-*" ] } ] }

إذا لم يفلح ذلك ، فلا تتردد في فتح مشكلة جديدة إذا كنت لا تزال تواجه صعوبات. لا يمكننا ضمان رؤية الرسائل المتعلقة بالمشكلات المغلقة.

هل كانت هذه الصفحة مفيدة؟
0 / 5 - 0 التقييمات

القضايا ذات الصلة

supertick picture supertick  ·  7تعليقات

victorct-pronto picture victorct-pronto  ·  3تعليقات

mkozjak picture mkozjak  ·  8تعليقات

Sanrro10 picture Sanrro10  ·  16تعليقات

satay99 picture satay99  ·  6تعليقات