
برامج مثال بلغات Go وJava وNode وPerl وPython وRuby وRust وcurl تختبر ما إذا كان مخزن الثقة TLS يرفض الاتصالات بمواقع eMudhra CA المعروفة بأنها ضارة.
https://emudhra.we-have-a-problem.com/
بالتأكيد، متصفحاتك تفعل الشيء الصحيح، لكن TLS يحدث في أماكن أكثر بقليل من المتصفح فقط. لذا تحتاج إلى فحص جميع الأماكن التي قد تختبئ فيها حزمة. يا لها من مشقة!
ليس لدي حل لك، آسف. لكن إذا كنت تريد فقط التحقق مما إذا كانت لغة معينة تفعل الشيء الصحيح بشكل افتراضي، فإليك بعض برامج الأمثلة البسيطة. كل واحد منها سيعيد بصمت لا شيء (لأن هذه هي طريقة Unix) إذا كان كل شيء على ما يرام، وسيبلغ عن خطأ إذا تمكن من الاتصال بالمواقع السيئة المعروفة.
ستستخدم الأداة ما هو الافتراضي للإطار/اللغة المعنية، لكن يمكنك أيضًا تحديد حزمة بديلة للفحص مقابلها. إذا كانت تعرف كيف، فستعرض أي حزمة / مسار استخدمته.
$ go run emudhra.go
$ go run emudhra.go /tmp/cert.pem.bad
BAD: successful connection to https://dv-g3b-aaa-emudhra.we-have-a-problem.com/
BAD: successful connection to https://dv-g3b-emudhra.we-have-a-problem.com/
exit status 2
$
$ java emudhra.java
Using CA file: /opt/homebrew/Cellar/openjdk/23.0.2/libexec/openjdk.jdk/Contents/Home/lib/security/cacerts
BAD: successful connection to https://dv-g3b-aaa-emudhra.we-have-a-problem.com/
BAD: successful connection to https://dv-g3b-emudhra.we-have-a-problem.com/
$ java emudhra.java /etc/ssl/cert.pem
Using CA file: /etc/ssl/cert.pem
$
فكّر في إضافة الشهادات الوسيطة إلى
blocked.certs كما هو موضح
هنا.
$ node emudhra.js
$ node emudhra.js /tmp/cert.pem.bad
BAD: successful connection to https://dv-g3b-aaa-emudhra.we-have-a-problem.com/
BAD: successful connection to https://dv-g3b-emudhra.we-have-a-problem.com/
$
$ perl emudhra.pl
Using SSL_ca_file: /private/etc/ssl/cert.pem
$ perl emudhra.pl /tmp/cert.pem.bad
Using SSL_ca_file: /tmp/cert.pem.bad
BAD: successful connection to https://dv-g3b-aaa-emudhra.we-have-a-problem.com/
BAD: successful connection to https://dv-g3b-emudhra.we-have-a-problem.com/
$
$ python3 emudhra.py
Using CA file: /opt/homebrew/etc/openssl@4/cert.pem
$ python3 emudhra.py /tmp/cert.pem.bad
Using CA file: /tmp/cert.pem.bad
BAD: successful connection to https://dv-g3b-aaa-emudhra.we-have-a-problem.com/
BAD: successful connection to https://dv-g3b-emudhra.we-have-a-problem.com/
$
$ ruby emudhra.rb
Using CA file: /usr/lib/ssl/cert.pem
$ ruby emudhra.rb /tmp/cert.pem.bad
Using CA file: /tmp/cert.pem.bad
BAD: successful connection to https://dv-g3b-aaa-emudhra.we-have-a-problem.com/
BAD: successful connection to https://dv-g3b-emudhra.we-have-a-problem.com/
$
$ sh emudhra.sh
Used CA file: /etc/ssl/certs/ca-certificates.crt
$ sh emudhra.sh
/tmp/cert.pem.bad
Used CA file: /tmp/cert.pem.bad
BAD: successful connection to https://dv-g3b-aaa-emudhra.we-have-a-problem.com/
BAD: successful connection to https://dv-g3b-emudhra.we-have-a-problem.com/
$
ملاحظة: على macOS، يمكنك أن تطلب من curl(1) استخدام
الواجهة الخلفية الأصلية، والتي ترفض بعد ذلك الاتصال في
جميع الحالات:
$ CURL_SSL_BACKEND=secure-transport sh emudhra.sh /tmp/cert.pem.bad
Used CA file:
$
$ cd rs
$ cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.35s
Running `target/debug/rs`
$ cargo run -- /tmp/cert.pem.bad
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.17s
Running `target/debug/rs /tmp/cert.pem.bad`
$
في مكان ما ضمن تبعياته، يقوم Rust بفحص قائمة الحظر الفعلي على الشهادات الوسيطة المخترقة، لذلك حتى مع حزمة تثق بجذر eMudhra، فإنه يفشل في الاتصال.