Golfreeze.packetlove.com: Life style of Golfreeze Canon400D Family kammtan.com Jazz Freebsd Unix Linux System Admin guitar Music

All about unix linux freebsd and FAQ for Packetlove.com Web hosting , Mail hosting , VoIP + IP PBX server => Os kernel การปรับแต่ง เพิ่มเติม ลงโปรแกรม บน OS และ ControlPanel Directadmin,Cloud server => Topic started by: golfreeze on สิงหาคม 25, 2016, 08:47:29 AM

Title: directadmin multiple certificate call SNI(Server Name Indication)
Post by: golfreeze on สิงหาคม 25, 2016, 08:47:29 AM
directadmin multiple certificate call SNI(Server Name Indication)
Multiple SSL Certificates on one IP

ถ้าต้องใช้งาน หลาย cert ssl ใน 1 ip บน directadmin สามารถทำได้เรียกว่า sni ก็เปิดใน directadmin.conf
แต่ os ต้องเป็น centos 6 ขึ้นไป และ openssl support sni ด้วย

ทางบริษัท Packetlove IT Services and Consulting รับimplement + จูนนิ่ง SNI (Server Name Indication) บน WebServer
ที่เป็น Nginx หรือ Apache สำหรับหน่วยงานที่ต้องการใช้
"Multiple SSL Certificate 1 Global-IP" สำหรับหลายโดเมนบนIPเดียวกัน
มาช่วยโลกประหยัด IPV4  กันครับ : )

อ่านเพิ่มเติม

http://directadmin.com/forum/showthread.php?p=184073#post184073

Default:
enable_ssl_sni=0

but if you want to allow ssl certificates to be added to shared IPs, set:
enable_ssl_sni=1


Enabling sni will simply disable the check for owned IPs when adding certificates.
DirectAdmin does not make any special changes to allow SNI to work.


Also, if a User account has more than 1 IP in his user_ip.list file, the check for the main domain for SSL will be disabled. This is because he could have 2 IPs for ssl, both valid (either owned IPs or with sni enabled) thus there isn't much point in enforcing the main domain to be the only domain for ssl under a User account.

Related apache document:
http://wiki.apache.org/httpd/NameBasedSSLVHostsWithSNI

Reported:
CentOS 5 and Debian 5 come with verisons of OpenSSL that do not support SNI.
Updating to a newer OS, like CentOS 6 would likely be required.

As of May 2015, we're guessing about 95% of client browsers support SNI.
However, this means that 5% of people who connect will get SSL errors.
The 5% would be browsers that are very old, like IE with windows XP.

Openssl version 0.9.8j should have the SNI compile flag enabled by default, but it's not guaranteed that it's actually enabled for your given libraries.
Title: Re: directadmin multiple certificate call SNI(Server Name Indication)
Post by: golfreeze on สิงหาคม 25, 2016, 08:48:31 AM
https://client.yourwebhoster.eu/knowledgebase/225/How-to-enable-SNI-Server-Name-Indication-in-DirectAdmin-SSL-for-every-domain-without-a-dedicated-IP.html
Title: Re: directadmin multiple certificate call SNI(Server Name Indication)
Post by: golfreeze on สิงหาคม 25, 2016, 09:07:46 AM
browser ที่ support sni
https://en.wikipedia.org/wiki/Server_Name_Indication
Title: Re: directadmin multiple certificate call SNI(Server Name Indication)
Post by: golfreeze on กันยายน 18, 2016, 10:55:40 PM
ต้องทำการลง let_encrypt ก่อนนะครับ
https://raymii.org/s/articles/Lets_Encrypt_Directadmin_Now_Built_In.html

ไม่ต้องทำการระบุใน directadmin.conf ถ้าใช้งาน da version ตั้งแต่ 1.501 ขึ้นไปนะครับ
เพราะเปิดมาโดย default ครับถ้ายังไม่ได้อัฟก็อัฟด้วยนะครับ
enable_ssl_sni=1

ทำการเพิ่ม configure นี้ลงใน directadmin.conf เพื่อเปิดใช้งาน letencrypt ครับ
##added by golf 18 sep 2016
letsencrypt=1
letsencrypt_multidomain_cert=2

reload directadmin 1 รอบครับ
#/etc/init.d/directadmin restart

cd /usr/local/directadmin/custombuild/
Clean up earlier updates to make sure no weird quirks show up:

 ./build clean all
Update the software list:

./build update
If you want, you can get a list of the updates available:

./build versions | grep is
Output is like this:

DirectAdmin 1.49.1 to 1.50.0 update is available.
cURL 7.46.0 to 7.47.1 update is available.
FreeType 2.6.2 to 2.6.3 update is available.
MySQL 5.6.28 to 5.6.29 update is available.
PHP 5.6 (mod_php) 5.6.24 to 5.6.26 update is available.
Apply the updates:

#./build update_versions
If you only want to update Directadmin and not the other updates you can do that with the following command:

#./build update_da
While you're applying updates, do the operating system updates as well:

#apt-get update && apt-get upgrade || yum update
#./build rewrite_confs
Title: Re: directadmin multiple certificate call SNI(Server Name Indication)
Post by: golfreeze on กันยายน 19, 2016, 12:11:07 AM
ถ้าตอนกด generate สร้าง cert จากทาง let_encrypt แล้ว error แบบว่า

Getting challenge for domain.com from acme-server...
Error: http://domain.com/.well-known/acme-c...ypt_1469871296 is not reachable. Aborting the script.
Please make sure /.well-known alias is setup in WWW server.

ให้ทำการเชคว่ามีบันทัดนี้อยู่ในไฟล์ /etc/httpd/conf/extra/httpd-alias.conf หรือเปล่า
Alias /.well-known /var/www/html/.well-known

ถ้าไม่มีการทำการเพิ่มโดย สั่ง rewrite_confs อีกหนึ่งรอบ
cd /usr/local/directadmin/custombuild
./build update
./build rewrite_confs

ถ้าเสร็จแล้ว ทำการกดสร้าง cert อีกหนึ่งรอบครับผม : )
ก็จะได้เรียบร้อย


Certificate for packetlove.com has been created successfully!

##Test URL for SNI after implementation done.
https://www.kosamettaxi.com/
https://www.khaoyaitaxi.com/
Title: Re: directadmin multiple certificate call SNI(Server Name Indication)
Post by: golfreeze on กันยายน 19, 2016, 12:13:50 AM
#reference
https://raymii.org/s/articles/Lets_Encrypt_Directadmin_Now_Built_In.html
http://forum.directadmin.com/showthread.php?t=53555
https://bjornjohansen.no/lets-encrypt-for-nginx
https://www.directadmin.com/features.php?id=1841
Title: Re: directadmin multiple certificate call SNI(Server Name Indication)
Post by: golfreeze on กันยายน 19, 2016, 08:57:38 AM
ถ้าต้องการใช้ cert สำหรับหลายๆ domain สามารถใช้เป็นประเภท ใบรับรอง Subject Alternative Name (SAN) SSL ได้
แต่ต้องเลือกเป็นรูปแบบ 5 domains , 10 domains , 15 domains
ใช้กับในลักษณะแบบนี้
aaa.com , bbb.com , abc.com , abz.com , aby.com
https://th.godaddy.com/web-security/ssl-certificate/multi-domain-san-ssl-certificate

แต่ถ้าต้องการใช้ SSL Cert กับหลายๆ sub-domain  ต้องเลือกใช้เป็นแบบ Wildcard SSL
ใช้กับในลักษณะแบบนี้
a.aaa.com , b.aaa.com , c.aaa.com , d.aaa.com , e.aaa.com
https://th.godaddy.com/web-security/ssl-certificate/wildcard-ssl-certificate
Title: Re: directadmin multiple certificate call SNI(Server Name Indication)
Post by: golfreeze on กันยายน 24, 2016, 10:10:04 PM
ถ้าท่านใช้งาน เป็น web server apache หลังจากทำการ install letencrypt แล้ว ยังเข้าเว็บด้วย https:// แล้วพบว่ายังสามารถเรียกใช้งาน cert ของ letencrypt ได้ หรือเปิดเว็บแล้วเจอ certificate ที่ยังไม่ trust

สามารถไปเชคใน configure ของ httpd.conf ใน da ของแต่ละ user ได้ดังนี้ครับ
/usr/local/directadmin/data/users/youruser/httpd.conf

#vi httpd.conf

<VirtualHost 103.xxx.yyy.zzz:443 >
        SSLEngine on
        SSLCertificateFile /usr/local/directadmin/data/users/youruser/domains/youruser.com.cert
        SSLCertificateKeyFile /usr/local/directadmin/data/users/youruser/domains/youruser.com.key
        SSLCACertificateFile /usr/local/directadmin/data/users/youruser/domains/youruser.com.cacert

ทำการปรับให้ตรงตามไฟล์ .cert , .key , .cacert ที่สร้างไว้ครับ
แล้วทำการ reload httpd 1 รอบก็จะเจอกับ certificate ที่ trust แล้วครับผม : )
Title: Re: directadmin multiple certificate call SNI(Server Name Indication)
Post by: golfreeze on มีนาคม 21, 2017, 06:39:04 PM
ถ้า configure ผ่านตัวระบบ Apache โดยไม่มี Control Panel ก็

# Ensure that Apache listens on port 443
Listen 443
   
# Listen for virtual host requests on all IP addresses
NameVirtualHost *:443

# Go ahead and accept connections for these vhosts
# from non-SNI clients
SSLStrictSNIVHostCheck off

<VirtualHost *:443>
  # Because this virtual host is defined first, it will
  # be used as the default if the hostname is not received
  # in the SSL handshake, e.g. if the browser doesn't support
  # SNI.
  DocumentRoot /www/example1
  ServerName www.example.com

  # Other directives here

</VirtualHost>

<VirtualHost *:443>
  DocumentRoot /www/example2
  ServerName www.example2.org

  # Other directives here

</VirtualHost>
Title: Re: directadmin multiple certificate call SNI(Server Name Indication)
Post by: golfreeze on ธันวาคม 27, 2019, 06:10:58 PM
ถ้าตัว cert ต้องการยืนยันไฟล์ test.txt ใน folder .well-known/acme-challenge/test.txt

cd /usr/local/directadmin/users/data/abc/
vi httpd.conf
เพิ่ม
Alias /.well-known /home/abc/public_html/.well-known

ใน tag ของกลุ่มด้านล่างครับ
<VirtualHost 103.x.2.3:80 >
Alias /.well-known /home/abc/public_html/.well-known
</VirtualHost 103.x.2.3:80 >

ทำการ restart service 1 ที ก็ได้ละครับ