المحتويات
نبذة
Let's Encrypt هي مرجع مصدق مفتوح وآلي يستخدم امتداد ACME (بيئة إدارة الشهادات التلقائيةبروتوكول لتوفير شهادات TLS / SSL مجانية لأي عميل متوافق. يمكن استخدام هذه الشهادات لتشفير الاتصال بين خوادم الويب والمستخدمين.
سيناقش هذا البرنامج التعليمي بإيجاز المراجع المصدقة وكيف يعمل تكامل Zevenet مع Let's Encrypt ، ثم راجع كيفية استخدام Zevenet لـ certbot (عميل ACME) من أجل إجراء الاتصال مع دعونا نشفر البنية التحتية.
Zevenet Load Balancer 6.0.3 أو إصدار أعلى يتضمن غلاف certbot صغير يسمى letsencryptz من أجل استخدام وظيفة Certbot webroot ، تشرح الأسطر التالية كيفية عمل هذا المجمع ، يرجى أخذ كل ذلك في الاعتبار لجعله يعمل في بيئات الإنتاج.
كيف يتم عمل التشفير؟
بوصف وصفًا موجزًا لوظائف webroot ، يعمل المكون الإضافي webroot عن طريق إنشاء ملف مؤقت لكل مجال من المجالات المطلوبة في مسار ملف Zevenet /usr/local/zevenet/app/letsencryptz/webroot/.well-known/acme-challenge/. ثم يقوم خادم التحقق من صحة Let's Encrypt بإجراء طلبات HTTP للتحقق من أن DNS لكل مجال مطلوب يحل إلى الخادم الذي يقوم بتشغيل برنامج Litencryptz المجمع ويمكن الوصول إلى الملف المؤقت لأغراض التحقق ، ويصف المخطط التالي مثالًا حقيقيًا:
في الرسم البياني السابق ، يوجد موازن تحميل Zevenet Load وراء جهاز توجيه / جدار حماية بعنوان IP عام 185.79.20.147 (على سبيل المثال) ، يتم فرز حركة مرور HTTP و HTTPS إلى موازن التحميل الداخلي باستخدام VIP 192.168.101.31 (كمثال) ، حيث تم تكوين موازن التحميل باستخدام 2 من المزارع المختلفة:
اسم مزرعة HTTPS استضافة الموقع بواسطة 192.168.101.31:443. هذه المزرعة هي المسؤولة عن تقديم استضافة المواقع ، ويتم نشر خوادم الويب المختلفة جنبا إلى جنب مع هذا إلى الإنترنت. فمثلا، test1.zevenet.es, test2.zevenet.es, test3.zevenet.es يتم اختبار صفحات الويب المنشورة على هذه الخدمة الافتراضية وغيرها.
اسم مزرعة HTTP WebhostingRedirect بواسطة 192.168.101.31:80. لا يتم استخدام هذه المزرعة إلا لأغراض إعادة التوجيه ، فهي تفرض جميع حركات المرور من HTTP إلى HTTPS.
يصف الرسم التخطيطي السابق طلب شهادة SSL Let's Encrypt للمجال test1.zevenet.es كما يلي:
1. يتم إرسال طلب الشهادة من موازن التحميل نفسه إلى البنية التحتية Let's Encrypt.
2. لنقوم بتشفير اكتشاف طلب شهادة SSL الجديد لـ test1.zevenet.es
3. لنقم بتشفير تشغيل تحليل DNS IP للمضيف المطلوب: test1.zevenet.es التحقق من أن النتيجة هي عنوان IP العام ، ونفس عنوان IP الأصلي الذي بدأ الطلب.
4. في هذه المرحلة ، دعنا نعلن عن تشفير letsencryptz البرنامج النصي (webroot cerbot) الذي يحتاجه لإنشاء ملف مع HASH في المسار العام http://test1.zevenet.es/.well-know/acme-challenge/ (80 TCP Port) ، دليل محلي /usr/local/zevenet/app/letsencryptz/webroot/.well-known/acme-challenge/. ثم، letsencryptz يقوم بتكوين خدمة زمنية حتى يمكن الوصول إلى هذا الملف من الإنترنت (المزرعة WebhostingRedirect سوف يتم تعديلها لهذا الغرض. إذا لم يكن هناك مزرعة تكوين بالفعل letsencryptz سيخلق واحدة الزمانية في هذا VIP والميناء).
6. في أقرب وقت letsencryptz يؤكد إنشاء الخدمة المؤقتة ، تتحقق خوادم Lets Encrypt من أنه قد تم إنشاء ملف التحقق من الصحة الزمني HASH المحتوى صحيح.
7. أخيرًا ، دعونا نشفر الخوادم ترد على الطلب الأول بالشهادة التي تم إنشاؤها بالفعل لـ اسم شائع (CN) test1.zevenet.es.
8. سوف Zevenet تخزين الشهادة التي تم إنشاؤها بالفعل في المسار المحلي / البيرة / المحلية / zevenet / التكوين / وهو جاهز للتكوين في المزرعة استضافة الموقع.
في هذه المرحلة ، سيتم استخدام شهادة Let's Encrypt الجديدة لخدمة HTTPS الافتراضية.
لنقم بتشفير أوامر الأتمتة
كما هو موضح ، و letsencryptz سيقوم البرنامج النصي بأتمتة الإجراءات المطلوبة لإدارة شهادات SSL مثل إنشاء أو تجديد أو إتلاف أو قائمة ، من بين أمور أخرى. تجد أدناه الأوامر المتاحة.
root@zva6k:~# letsencryptz letsencryptz description: letsencryptz is a let's encrypt (certbot) wrapper with minimal parameters ready to manage Let's Encrypt certificates for ZEVENET https profiles. Take into account that this wrapper uses certbot webroot feature so the public Let's encrypt architecture requires to connect with a local Virtual IP and port (TCP 80 by default) in order to do a request validation for the requested domain, so as soon as the "obtain" param is used, this script will configure an HTTP farm which will be accessed by Let's encrypt for verification purpose, this configuration is done automatically by this script itself, only ensure that the used Virtual IP and HTTP port 80 is not used by any another load balanced farm, and also ensure that the DNS resolution for the requested domain is reachable from let's encrypt system. usage: /usr/local/zevenet/bin/letsencryptz <action> <commands> action: --obtain | --destroy | --renew | --list | --listconf | --help --obtain: Request new Certificates using webroot cert-bot module. commands: --vip <Virtual IP> --farm <Farm Name> --domain <domain1> --domain <domain2> --domain <domainN> --test --vip: The Virtual IP already configured were to publish a temporal web server, this will be connected by let's encrypt public servers to verify the certificate request. The Virtual IP has to be free on the 80 port in order to be bound by a local process, if it isn't free then use --farm instead. --farm: The farm name which configures a temporal Service called "letsencryptz", if no farm is used a temporal farm called "letsencryptZevenet" will be configured in the selected Virtual IP. --domain: The domain which requests the Certificate for, i.e. www.mycompany.com. --test: Optional parameter, if used the certificate is requested for test purpose. --destroy: Revoke and delete the indicated Certificate Name, the action is rejected if the given certificate is in use by a farm. commands: --certname <Certificate Name> --certname: Certificate Name, this value can be obtained from the action --list. --renew: Renew the certificates near to expiry, no commands needed commands: --test --forcerestart --vip <Virtual IP> --farm <Farm Name> --test: Optional parameter, if used a dry-run is executed, the renew of the certificates is simulated. --forcerestart: Optional parameter, if used the farms that are using the renewed certificates will be restarted in order to apply the changes. --vip: The Virtual IP already configured where to publish a temporal web server, this will be connected by let's encrypt public servers to verify the certificate renew. The Virtual IP has to be free on the 80 port in order to be bound by a local process, if it isn't free then use --farm instead. --farm: The farm name which configures a temporal Service called "letsencryptz", if no farm is used a temporal farm called "letsencryptZevenet" will be configured in the selected Virtual IP. --list: List all the local certificates managed by let's encrypt and the status, no commands needed. --listconf: List the Zevenet let's encrypt configuration module (check global.conf file), no commands needed. --help: Obtain this help.
سيستغرق الأمر بعض الوقت في المرة الأولى التي يتم فيها تنفيذ letencryptz لأن النظام سيقوم تلقائيًا بتثبيت التبعيات التي لم يتم حلها ، كما يتم إجراء مراجعة التكوين قبل البدء في استخدامه ، ويطلب Let's Encrypt حساب بريد إلكتروني أو أغراض الاتصال المتعلقة بالشهادات ، سيتم استخدام حساب البريد الإلكتروني هذا إلى جانب أي إجراء يتم اتخاذه ضد نظام Let's Encrypt ، ويمكن تكوين هذا البريد الإلكتروني في ملف التكوين الرئيسي /usr/local/zevenet/config/global.conf، التوجيه $ le_email.
بعض أمثلة الاستخدام موضحة أدناه.
Zevenet دعونا نشفر إنشاء الشهادة
يطلب هذا الأمر شهادة جديدة للمجال test2.zevenet.es. ضع في اعتبارك أن الشخص المهم المعين سيكون داخليًا ، ويجب أن تنتقل حركة المرور من IP العام إلى IP الداخلي. إذا لم تتمكن Let's Encrypt من الوصول إلى هذه الخدمة ، فسيتم رفض الطلب.
root@zva6k:~# letsencryptz --obtain --vip 192.168.101.31 --domain test2.zevenet.es WARNING: No farm name specified, a temporal farm with name letsencryptZevenet will be created in VIP 192.168.101.31 port 80. Configuring farm for let's encrypt Certificate Name verification Obtaining Certificate for domains test2.zevenet.es... Saving debug log to /var/log/letsencrypt/letsencrypt.log Plugins selected: Authenticator webroot, Installer None Obtaining a new certificate Non-standard path(s), might not work with crontab installed by your operating system package manager Certificate Request for the domain(s) test2.zevenet.es OK Created Certificate name test2.zevenet.es in PEM format ready for HTTPS profile Destroying webroot configuration for the farm letsencryptZevenet Deleting already configuration for letsencryptZevenet, service letsencryptz Restarting farms using renewed certificates:
Zevenet دعونا نشفر قائمة الشهادات
سيعرض تنفيذ هذا الأمر الشهادات الحالية التي يديرها نظام Zevenet Let's Encrypt.
root@zva6k:~# letsencryptz --list Listing all available certificates for the current configuration in config dir /usr/local/zevenet/config/letsencrypt/ Saving debug log to /var/log/letsencrypt/letsencrypt.log Certificate Name: test1.zevenet.es Domain(s): test1.zevenet.es Expiry Date: 2019-09-19 10:48:02+00:00 (VALID: 77 days) Pem Certificate file: /usr/local/zevenet/config/test1_zevenet_es.pem Certificate Name: test3.zevenet.es Domain(s): test3.zevenet.es Expiry Date: 2019-09-26 06:32:52+00:00 (VALID: 83 days) Pem Certificate file: /usr/local/zevenet/config/test3_zevenet_es.pem
تأخذ في الاعتبار الميدان اسم الشهادة، سيتم التعرف على هذا الحقل بواسطة مجمّع letsencryptz باسم - اسم الشهادة.
Zevenet Let's Encrypt تجديد الشهادة
يتحقق الأمر السابق مما إذا كانت أي شهادة تم إنشاؤها بالفعل تتطلب التجديد ، وفي هذه الحالة سيتم التجديد تلقائيًا. ضع في اعتبارك أنه إذا كانت الشهادة المجددة قيد الاستخدام ، فستكون هناك حاجة لإعادة تشغيل المزرعة لتطبيق التغيير ، يرجى استخدام الخيار -اعادة بدء اجبارى إذا كنت تريد letsencryptz إعادة تشغيل جميع المزارع المطلوبة لتطبيق التغييرات.
root@zva6k:~# letsencryptz --renew --vip 192.168.101.31 Renewing all the required certificates Saving debug log to /var/log/letsencrypt/letsencrypt.log Cert not yet due for renewal Cert not yet due for renewal
Zevenet دعونا نشفر حذف الشهادة
يلغي هذا الأمر ويحذف الشهادة المحددة. في حالة اكتشاف النظام أن الشهادة المحددة قيد الاستخدام حاليًا من قبل أي مزرعة HTTPS ، سيتم رفض الإجراء ، في المثال أعلاه يتم رفض إجراء الحذف لأن الشهادة قيد الاستخدام من قبل المزرعة testhttps.
root@zva6k:~# letsencryptz --destroy --certname test3.zevenet.es Revoking and deleting certificate(s) test3.zevenet.es for the current configuration... This file can't be deleted because is used by the farm(s): testhttps
بمجرد أن يتم تعيين الشهادة من المزرعة ، سيتم تنفيذ الإجراء:
root@zva6k:~# letsencryptz --destroy --certname test3.zevenet.es Revoking and deleting certificate(s) test3.zevenet.es for the current configuration... Saving debug log to /var/log/letsencrypt/letsencrypt.log Deleted certificate(s) test3.zevenet.es in path /usr/local/zevenet/config/test3_zevenet_es.pem
ترحيل دعونا نشفر الشهادات إلى Zevenet
Zevenet Load balancer يحفظ جميع ملفات التكوين من certbot في المسار المحلي / البيرة / المحلية / zevenet / التكوين / letsencrypt /. من أجل نقل ملفات تكوين certbot الموجودة لديك (بشكل افتراضي في / الخ / letsencrypt) من خادم آخر إلى Zevenet ، ما عليك سوى إنشاء ملف tarball (ملف tar.gz) من دليل التكوين الحالي في الخادم الخاص بك وإلغاء ضغط المحتوى في مسار تكوين Zevenet Let's Encrypt. أخيرًا ، فكر في تعديل المتغير $ le_email في الملف global.conf إلى نفس البريد الإلكتروني المستخدم في الطلبات السابقة.
دعونا نشفر الشهادات العنقودية الدعم
البرنامج الإضافي Zevenet Let's Encrypt مدعوم تمامًا بخدمة Zevenet Cluster. يتم حفظ جميع إجراءات Let's Encrypt في ملف تكوين منسوخ بواسطة Zevenet Cluster Service ، لذلك يتم تنفيذ أي إجراء في MASTER سيتم تكرار العقدة إلى شريحة العقدة تلقائيا ، ولكن أي إجراء تنفيذها في شريحة سيتم تجاهل العقدة المرتبطة بـ Let's Encrypt لتجنب أي إلغاء التزامن.
لنقم بتشفير الشهادات للتجديد التلقائي
يمكن تكوين المكون الإضافي Zevenet Let's Encrypt من أجل التحقق يوميًا مما إذا كانت بعض الشهادات تحتاج إلى تجديد ، في حالة تجديد النظام تلقائيًا لشهادة معينة وهي قيد الاستخدام من قبل بعض المزارع ، فسيتم إعادة تشغيل المزرعة تلقائيًا من أجل تطبيق تغيير الشهادة.
لتكوين التجديد التلقائي ، يرجى القيام بما يلي:
قم بإنشاء ملف cron التالي /etc/cron.d/letsencryptz مع المحتوى التالي:
root@zva6k:~# cat /etc/cron.d/letsencryptz 00 00 * * * root /usr/local/zevenet/bin/letsencryptz --renew --forcerestart --vip 192.168.101.31
باستخدام هذا التكوين ، سيتم تنفيذ فحص التجديد يوميًا في الساعة 00:00 (منتصف الليل). وسيتم استخدام VIP 192.168.101.31 في المنفذ 80 لغرض التحقق من Let's Encrypt System.
المحلية
بعض المراجع المستخدمة في هذه المقالة هي: