תוכן עניינים:
- תנאים מוקדמים
- התקן את Certbot
- צור קבוצת Dh (דיפי-הלמן) חזקה
- קבלת אישור בואו להצפין SSL
- חידוש אוטומטי של בואו להצפין אישור SSL
- סיכום
Let's Encrypt היא רשות אישורים חינמית, אוטומטית ופתוחה שפותחה על ידי קבוצת אבטחת האינטרנט לאינטרנט (ISRG) המספקת תעודות SSL בחינם.
אישורים שהונפקו על ידי Let's Encrypt הם מהימנים על ידי כל הדפדפנים הגדולים ותקפים למשך 90 יום מתאריך ההנפקה.
מדריך זה מסביר כיצד להתקין אישור SSL SSL בחינם ב- CentOS 8 המריץ את Apache כשרת אינטרנט. אנו נשתמש בכלי certbot כדי להשיג ולחדש את האישורים.
תנאים מוקדמים
ודא כי מתקיימים התנאים המוקדמים הבאים לפני שתמשיך:
- ציין שם דומיין שמצביע על IP השרת הציבורי שלך. אנו נשתמש ב-
example.com
Apache מותקן ופועל בשרת שלך עם מארח וירטואלי שמוגדר לתחום שלך. היציאות 80 ו- 443 פתוחות בחומת האש שלך.
התקן את החבילות הבאות הדרושות לשרת אינטרנט מוצפן SSL:
sudo dnf install mod_ssl openssl
כאשר חבילת mod_ssl מותקנת, עליה ליצור מפתח ובקבצי אישור עם חתימה עצמית עבור localhost. אם הקבצים לא נוצרים אוטומטית, באפשרותך ליצור אותם באמצעות הפקודה
openssl
:
sudo openssl req -newkey rsa:4096 -x509 -sha256 -days 3650 -nodes \
-out /etc/pki/tls/certs/localhost.crt \
-keyout /etc/pki/tls/private/localhost.key
התקן את Certbot
Certbot הוא כלי שורת פקודה חינמי המפשט את התהליך לקבלת וחידוש Let's Encrypt SSL של תעודות והפעלת HTTPS אוטומטית בשרת שלך.
חבילת certbot אינה כלולה במאגרי CentOS 8 הסטנדרטיים, אך ניתן להוריד אותה מאתר הספק.
הפעל את הפקודה הבאה של
wget
כמשתמש שורש או sudo כדי להוריד את סקריפט certbot לספרייה
/usr/local/bin
:
sudo wget -P /usr/local/bin
לאחר השלמת ההורדה, הפוך את הקובץ להפעלה:
sudo chmod +x /usr/local/bin/certbot-auto
צור קבוצת Dh (דיפי-הלמן) חזקה
החלפת מפתחות Diffie – Hellman (DH) היא שיטה להחלפה מאובטחת של מפתחות קריפטוגרפיים דרך ערוץ תקשורת לא מאובטח. צור מערכת חדשה של פרמטרים DH של 2048 ביט לחיזוק האבטחה:
sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048
אתה יכול לשנות את הגודל של עד 4096 סיביות, אך הדור עשוי לארוך יותר מ- 30 דקות, תלוי באנטרופיה של המערכת.
קבלת אישור בואו להצפין SSL
כדי להשיג אישור SSL עבור התחום אנו נשתמש בתוסף Webroot שעובד על ידי יצירת קובץ זמני לאימות הדומיין המבוקש בספרייה
${webroot-path}/.well-known/acme-challenge
. שרת בואו להצפין מבצע בקשות HTTP לקובץ הזמני כדי לאמת כי הדומיין המבוקש פותר לשרת בו פועל certbot.
כדי להפוך את ההתקנה לפשוטה יותר, אנו
/var/lib/letsencrypt
כל בקשות ה- HTTP עבור.
.well-known/acme-challenge
לספרייה אחת,
/var/lib/letsencrypt
.
הפעל את הפקודות הבאות כדי ליצור את הספרייה ולהפיכתה לשרת Apache.
sudo mkdir -p /var/lib/letsencrypt/.well-known
sudo chgrp apache /var/lib/letsencrypt
sudo chmod g+s /var/lib/letsencrypt
כדי להימנע משכפול קוד ולהפוך את התצורה לתחזוקה יותר, צור את שני קטעי התצורה הבאים:
/etc/httpd/conf.d/letsencrypt.conf
Alias /.well-known/acme-challenge/ "/var/lib/letsencrypt/.well-known/acme-challenge/" AllowOverride None Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec Require method GET POST OPTIONS
Alias /.well-known/acme-challenge/ "/var/lib/letsencrypt/.well-known/acme-challenge/" AllowOverride None Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec Require method GET POST OPTIONS
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM # Requires Apache 2.4.36 & OpenSSL 1.1.1 SSLProtocol -all +TLSv1.3 +TLSv1.2 SSLOpenSSLConfCmd Curves X25519:secp521r1:secp384r1:prime256v1 # Older versions # SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1 SSLHonorCipherOrder On Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload" Header always set X-Frame-Options DENY Header always set X-Content-Type-Options nosniff # Requires Apache >= 2.4 SSLCompression off SSLUseStapling on SSLStaplingCache "shmcb:logs/stapling-cache(150000)" # Requires Apache >= 2.4.11 SSLSessionTickets Off SSLOpenSSLConfCmd DHParameters "/etc/ssl/certs/dhparam.pem"
הקטע שלמעלה משתמש בשבבים המומלצים על ידי Cipherli.st. זה מאפשר סיכות OCSP, HTTP אבטחת תעבורה קפדנית (HSTS), מפתח Dh ואכיפה של מעט כותרות HTTP ממוקדות אבטחה.
טען מחדש את תצורת Apache כדי שינויים ייכנסו לתוקף:
sudo systemctl reload
עכשיו אתה יכול להריץ סקריפט certbot עם התוסף webroot ולאחזר את קבצי אישור ה- SSL:
sudo /usr/local/bin/certbot-auto certonly --agree-tos --email [email protected] --webroot -w /var/lib/letsencrypt/ -d example.com -d www.example.com
בהצלחה, certbot ידפיס את ההודעה הבאה:
IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/example.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/example.com/privkey.pem Your cert will expire on 2020-01-26. To obtain a new or tweaked version of this certificate in the future, simply run certbot-auto again. To non-interactively renew *all* of your certificates, run "certbot-auto renew" - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF:
כעת, כשהכל מוגדר, ערוך את תצורת המארח הווירטואלי של הדומיין שלך באופן הבא:
/etc/httpd/conf.d/example.com.conf
ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ ServerName example.com ServerAlias www.example.com Protocols h2 http:/1.1 Redirect permanent / https://example.com/ DocumentRoot /var/www/example.com/public_html ErrorLog /var/log/httpd/example.com-error.log CustomLog /var/log/httpd/example.com-access.log combined SSLEngine On SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem # Other Apache Configuration
ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ ServerName example.com ServerAlias www.example.com Protocols h2 http:/1.1 Redirect permanent / https://example.com/ DocumentRoot /var/www/example.com/public_html ErrorLog /var/log/httpd/example.com-error.log CustomLog /var/log/httpd/example.com-access.log combined SSLEngine On SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem # Other Apache Configuration
ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ ServerName example.com ServerAlias www.example.com Protocols h2 http:/1.1 Redirect permanent / https://example.com/ DocumentRoot /var/www/example.com/public_html ErrorLog /var/log/httpd/example.com-error.log CustomLog /var/log/httpd/example.com-access.log combined SSLEngine On SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem # Other Apache Configuration
ServerName example.com ServerAlias www.example.com Redirect permanent / https://example.com/ ServerName example.com ServerAlias www.example.com Protocols h2 http:/1.1 Redirect permanent / https://example.com/ DocumentRoot /var/www/example.com/public_html ErrorLog /var/log/httpd/example.com-error.log CustomLog /var/log/httpd/example.com-access.log combined SSLEngine On SSLCertificateFile /etc/letsencrypt/live/example.com/fullchain.pem SSLCertificateKeyFile /etc/letsencrypt/live/example.com/privkey.pem # Other Apache Configuration
התצורה שלמעלה מכריחה HTTPS ומפנה מחדש מ- www לגירסה שאינה www. זה גם מאפשר HTTP / 2, מה שיהפוך את האתרים שלך למהירים וחזקים יותר. אל תהסס להתאים את התצורה בהתאם לצרכים שלך.
הפעל מחדש את שירות Apache:
sudo systemctl restart
כעת תוכל לפתוח את האתר שלך באמצעות
https://
ותבחין בסמל נעילה ירוקה.
חידוש אוטומטי של בואו להצפין אישור SSL
תעודות בואו להצפין תקפות למשך 90 יום. כדי לחדש אוטומטית את האישורים לפני שפג תוקפם, ניצור עבודת תופת שתפעל פעמיים ביום ונחדש אוטומטית כל אישור 30 יום לפני פקיעתו.
הפעל את הפקודה הבאה כדי ליצור cronjob חדש שיחדש את האישור ולהפעיל מחדש את Apache:
echo "0 0, 12 * * * root python3 -c 'import random; import time; time.sleep(random.random() * 3600)' && /usr/local/bin/certbot-auto -q renew --renew-hook \"systemctl reload httpd\"" | sudo tee -a /etc/crontab > /dev/null
כדי לבדוק את תהליך החידוש, השתמש בפקודה certbot ואחריהם מתג ההפעלה
--dry-run
:
sudo /usr/local/bin/certbot-auto renew --dry-run
אם אין שגיאות, פירוש הדבר שתהליך החידוש היה מוצלח.
סיכום
במדריך זה דיברנו על אופן השימוש ב- Encrypt client certbot לקוח ב- CentOS כדי להשיג אישורי SSL לדומיינים שלך. הראית לך כיצד להגדיר את אפאצ'י להשתמש בתעודות ולהגדיר מציצה לחידוש אישורים אוטומטית.
למידע נוסף על סקריפט Certbot, בקר בתיעוד Certbot.
בואו להצפין את certbot sslאבטחה, אבטחה, אבטחה יותר

חדשות אבטחה נשלט השבוע, וזה יהיה ללא ספק יהיה גם בשבוע הבא, כמו גם עם Black Hat ו Defcon ...
Microsoft פרסמה פתרון אבטחה מאובטח עבור Internet Explorer כאמצעי סטארגאפ, עד שהחברה מפרסמת עדכון אבטחה מלא עבור דפדפן האינטרנט שלה ביום שישי. הפתרון החדש "Fix it" מסייע בהגנה על המשתמשים ב- Internet Explorer 6, 7, 8 ו- 9 מתוך בעיית שחיתות בזיכרון שנחשפה לאחרונה, אשר מספר מומחי אבטחה ראו בשימוש פעיל. הפגיעויות עלולות לאפשר לפורץ לקבל גישה מרחוק למערכת שלך עם אותן הרשאות משתמש, כולל היכולת להתקין או להסיר תוכניות, לשנות קבצים וליצור חשבונות משתמש חדשים.

[קשורים:
אבטחה מאובטחת עם בואו להצפין ב- debian 9

מדריך זה ינחה אותך בתהליך של קבלת בואו להצפין בחינם באמצעות כלי certbot בכלי Debian 9. אנו נראה גם כיצד להגדיר את אפאצ'י לשימוש בתעודת ה- SSL החדשה ולאפשר HTTP / 2