Month: April 2023

  • Install from scratch – licensing (2)

    ใช้ plugin ชื่อว่า WPO365 วิธีการตั้งค่าเพื่อใช้งาน single sign on ของ Microsoft365 ในการล็อคอินเข้าระบบของ WordPress

    Authentication
    1. ต้องเซ็ต HTTPS ที่เว็บให้เสร็จเรียบร้อย
    2. สำคัญ!!! จำเป็นต้องมีสิทธิ์ Global Administrator บน Azure
    3. Login เข้าเว็บ https://portal.azure.com มองหา Azure Active Directory
    4. ซ้ายมือเลื่อนหาคำว่า App registrations
    5. คลิก + New registration แล้วกรอกชื่อที่ต้องการในช่อง Name ในส่วนของ Supported account types เลือก Accounts in this organizational directory only (Prince of Songkla University only – Single tenant)
    1. เลื่อนลงมาจนเจอคำว่า Redirect URI (Optional) เลือก Web ในช่อง select platform และกรอกชื่อเว็บ https://licensing.psu.ac.th/wp-admin/ ลงไปในช่องถัดมา แล้วคลิก Register
    1. หน้าถัดไป คลิก Token configuration บนเมนูซ้ายมือ จากนั้นคลิก + Add optional claim เลือก Token Type เป็น ID และเลือกหัวข้อด้านล่าง ดังนี้ email, family_name, given_name และ upn แล้วคลิกปุ่ม Add จะมีให้ Add optional claim เพิ่ม ให้ติ๊กถูกแล้วกด Turn on the Microsoft Graph email, profile permission (required for claims to appear in token). แล้ว Add จะได้
    1. คลิก API permissions ที่เมนูซ้ายมือ แล้วคลิก + Add permission คลิก Microsoft Graph แล้วคลิก Delegated และเลือกหัวข้อดังต่อไปนี้ (พิมพ์ในช่อง Search ได้เลย) email, offline_access, openid และ profile แล้วคลิก Add permissions

    จากนั้นคลิก Grant admin consent for Prince of Songkla University แล้วคลิก Yes

    1. คลิก Certificates & Secrets ที่เมนูซ้ายมือ คลิก  + New client secret ตั้งชื่อในช่อง Description และเลือกวันหมดอายุ คลิก Add จากนั้นให้ copy ค่าของช่อง Value เก็บไว้
    1. กลับมาที่ https://licensing.psu.ac.th หลังจากติดตั้งปลักอินชื่อ WPO365 | LOGIN และเปิดใช้งาน (activate) เรียบร้อยแล้ว
    2. คลิก WPO365 ที่ด้านซ้ายมือล่างสุด เปิดใช้งาน SINGLE SIGN-ON (SSO) แล้วคลิก configure
    3. กรอกข้อมูลดังนี้
      1. Select Identity Provider (IdP) เลือก Azure AD (default)
      2. Select SSO-protocol เลือก OpenID Connect (default)
      3. Select OpenID Connect flow เลือก Auth.-code flow (recommended)
      4. Application (Client) Secret นำค่าที่ copy เก็บไว้ในข้อ 9 มาใส่ช่องนี้
      5. Directory (tenant) ID นำค่าที่ได้จากหน้า Overview ของ lsc ชื่อฟิลด์ Directory (tenant) ID
      6. Application (Client) ID นำค่าที่ได้จากหน้า Overview ของ lsc ชื่อฟิลด์ Application (client) ID
      7. Redirect URI View in Azure Portal ใส่ว่า https://licensing.psu.ac.th/
      8. Domain hint View Custom domain names ใส่ว่า psu.ac.th, email.psu.ac.th
      9. Add prompt=select_account parameter ติ๊กถูก
      10. กด Save configuration ด้านล่าง แล้วจะมีหน้า Important ขึ้นมากด Confirm
    4. คลิกแท็บ User Registeration ด้านล่างกรอกดังนี้
      1. Custom domains View Custom domain names กรอก psu.ac.th และคลิก + เพิ่มอีกช่องพิมพ์ email.psu.ac.th
      2. เลื่อนลงมาล่างสุดกด Save configuration
    5. คลิกแท็บ Plugin self-test เลื่อนลงมาด้านล่าง กด Start self-test จะถูก redirect ไปหน้า log in ของ mail ให้ Log in ตามปกติ แล้วจะเด้งกลับมาหน้าของ https://licensing.psu.ac.th หากล็อคอินไม่ผ่านให้กลับไปหน้า https://portal.azure.com คลิก App registrations แล้วเลือก lsc แล้วคลิก Authentication คลิก Add URI เพิ่ม https://licensing.psu.ac.th เข้าไปอีก 1 url กด save กลับไปล็อคอินอีกครั้งน่าจะได้แล้ว
  • Install from scratch – licensing (1)

    ติดตั้งปรับแต่ง Ubuntu 22.04 เพื่อเตรียมสำหรับติดตั้ง WordPress บน apache2 และติดตั้ง WordPress

    Host setting
    1. เครื่อง Server มี 2 ชื่อ A record เป็น server-name1.psu.ac.th Cname เป็น server-name.psu.ac.th
    2. ติดตั้ง Ubuntu 22.04 ข้ามเรื่องการติดตั้ง Ubuntu ไปนะครับ
    3. จะได้ username: group ที่สามารถเรียกใช้ sudo ได้ตั้งแต่เริ่มต้นตามที่ติดตั้ง
    4. sudo apt update && sudo apt dist-upgrade -y && sudo apt autopurge -y เพื่อปรับปรุง software ต่าง ๆ ให้เป็นรุ่นปัจจุบัน
    5. sudo reboot ในกรณีที่มี kernel ใหม่ต้องรีบูตเพื่อเปลี่ยน kernel
    6. sudo apt install mysql-server apache2 php libapache2-mod-php php-mysql php-gd php-imagick php-xml php-curl php-mbstring php-intl php-zip unzip php-apcu
    7. sudo a2enmod ssl rewrite headers
    8. เปลี่ยนเป็น user root ด้วยคำสั่ง sudo -i
    9. cd /etc/ssl/private
    10. cp /home/username/certificate/* . (ต้องได้รับไฟล์ certificate มาเรียบร้อยแล้วนะครับ ขอข้ามไปเรื่องการจัดเตรียมไฟล์ certificate) ในตัวอย่างนี้จะมีไฟล์เดียวคือ star.psu.ac.th-combined.crt
    11. openssl dhparam -out /etc/ssl/private/dhparams_4096.pem
    12. /etc/apache2/sites-available
    13. vi default-ssl.conf
    <IfModule mod_ssl.c>
    SSLUseStapling On
    SSLStaplingCache "shmcb:logs/ssl_stapling(32768)"
    <VirtualHost _default_:443>
    ServerAdmin someone@somedomain.com
    ServerName server-name1.psu.ac.th

    DocumentRoot /var/www/html

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    SSLEngine on

    SSLCertificateFile /etc/ssl/private/star.psu.ac.th-combined.crt

    SSLOpenSSLConfCmd DHParameters "/etc/ssl/private/dhparam.pem"
    SSLOpenSSLConfCmd ECDHParameters brainpoolP512r1
    SSLOpenSSLConfCmd Curves brainpoolP512r1:sect571r1:secp521r1:secp384r1

    #A+
    SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
    SSLHonorCipherOrder on
    SSLCipherSuite ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
    SSLCompression off
    #Header add Strict-Transport-Security "max-age=15768000;includeSubDomains"
    Header always set Strict-Transport-Security "max-age=63072000"

    <FilesMatch "\.(cgi|shtml|phtml|php)$">
    SSLOptions +StdEnvVars
    </FilesMatch>
    <Directory /usr/lib/cgi-bin>
    SSLOptions +StdEnvVars
    </Directory>

    </VirtualHost>
    </IfModule>
    1. vi licensing.conf
    <virtualHost *:80>
        Documentroot /var/www/html/lsc
        ServerName server-name.psu.ac.th
        ErrorLog ${APACHE_LOG_DIR}/licensing_error_log
        CustomLog ${APACHE_LOG_DIR}/licensing_access_log common
        Options -Indexes
        RewriteEngine On
        RewriteRule (.*) https://server-name.psu.ac.th
        RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) [NC]
        RewriteRule ^.* - [F]
    </virtualhost>
    1. vi licensing-ssl.conf
    <IfModule mod_ssl.c>
    SSLUseStapling On
    SSLStaplingCache "shmcb:logs/ssl_stapling(32768)"
            <VirtualHost *:443>
                    ServerAdmin someone@somedomain.com
                    ServerName server-name.psu.ac.th
                    DocumentRoot /var/www/html/lsc

                    LogLevel info
                    ErrorLog ${APACHE_LOG_DIR}/lsc-ssl-error.log
                    CustomLog ${APACHE_LOG_DIR}/lsc-ssl-access.log combined

                   SSLEngine on

                    SSLOpenSSLConfCmd DHParameters "/etc/ssl/private/dhparams_4096.pem"
                    SSLOpenSSLConfCmd ECDHParameters brainpoolP512r1
    SSLOpenSSLConfCmd Curves brainpoolP512r1:sect571r1:secp521r1:secp384r1

                    SSLCertificateFile /etc/ssl/private/star.psu.ac.th-combined.crt

    #A+
    SSLProtocol all -SSLv2 -SSLv3
    SSLHonorCipherOrder on
    SSLCipherSuite TLSv1.3 TLS_CHACHA20_POLY1305_SHA256:TLS_AES_256_GCM_SHA384
    SSLCipherSuite ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:RSA+AESGCM:RSA+AES:!aNULL:!MD5:!DSS
    SSLCompression off
    Header always set Strict-Transport-Security "max-age=63072000"

                    RewriteEngine on
                    RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK) [NC]
                    RewriteRule ^.* - [F]

                    Options -Indexes

                    <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                    SSLOptions +StdEnvVars
                    </FilesMatch>

                    <Directory /var/www/html/lsc>
                            Options FollowSymLinks
                            AllowOverride All
                    </Directory>

                    <Directory /usr/lib/cgi-bin>
                                    SSLOptions +StdEnvVars
                    </Directory>
            </VirtualHost>
    </IfModule>
    1. a2ensite licensing.conf licensing-ssl.conf default-ssl.conf
    2. a2enmod headers
    3. systemctl restart apache2
    4. mysql
    CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
    create database licensing;
    GRANT ALL PRIVILEGES ON licensing.* TO 'username'@'localhost' WITH GRANT OPTION;
    quit
    1. cd /var/www/html
    2. wget https://wordpress.org/latest.zip
    3. unzip latest.zip
    4. rm latest.zip
    5. mv wordpress lsc
    6. chmod -R username:www-data .
    7. cd lsc
    8. chmod g+w .
    9. logout
    10. จบส่วนการตั้งค่า Host เพื่อเตรียมติดตั้ง WordPress
    11. เปิด browser ไปที่เว็บ http://licensing.psu.ac.th ซึ่งจะถูก redirect ไปที่ https://licensing.psu.ac.th โดยอัตโนมัติ
    12. กรอกข้อมูลสำหรับเชื่อมต่อให้เรียบร้อย และติดตั้ง wordpress ให้เรียบร้อย
    13. กลับมาที่ console หรือ terminal
    14. cd /var/www/html/lsc
    15. chmod og-w .
    16. sudo chown username:www-data .htaccess wp-config.php
    17. chmod og-w .htacess wp-config.php
    18. vi wp-config.php เพิ่มข้อความว่า
    /** Direct install plugin **/
    define('FS_METHOD', 'direct');
    1. cd /var/www/html/lsc/wp-content
    2. mkdir uploads upgrade languages
    3. sudo chown -R username:www-data uploads upgrade languages themes plugins
    4. chmod -R g+w uploads upgrade languages themes plugins เพื่อให้สามารถติดตั้ง plugin theme และ upload ไฟล์ขึ้นเว็บได้ เมื่อติดตั้ง themes และ plugins ได้จนพอใจแล้วสั่งคำสั่งต่อไปนี้ chmod -R g-w upgrades languages themes plugins
    5. จบส่วนติดตั้ง WordPress
  • Zoom PSU (07) วิธีใช้ 3D Avatar แทนตัวเราในโปรแกรม Zoom

    สามารถใช้อวตารได้ 2 รูปแบบ คือ
    1. Animal Avatars ที่มีอยู่แล้ว เช่น แมว สุนัข จิ้งจอก กระต่าย เป็นต้น
    2. Human Avatars ที่คุณสร้างขึ้นมาใหม่โดยปรับแต่งลักษณะใบหน้า ทรงผม สีผิว รูปร่าง การแต่งตัว เสื้อ และอื่น ๆ เพื่อสร้างตัวตนเสมือนจริงของคุณ

    ขั้นตอนดังนี้

    1. เปิดโปรแกรม Zoom บน PC และลงชื่อเข้าใช้งาน

    2. คลิกรูปโปรไฟล์ >> คลิก Settting

    3. คลิก  Background & Effects >> Avatars >>เลือก Animal Avatars ที่มีอยู่แล้ว เช่น แมว สุนัข จิ้งจอก กระต่าย  >>ปิดหน้าต่าง

    4. หากต้องการสร้าง Human Avatars ของคุณขึ้นมาใหม่ ให้กด + (Create new avatar)

    5. คลิก เลือกปรับแต่งลักษณะ Skin(สีผิว) Face(ใบหน้า) Hair(ทรงผม) Lip Color(สีปาก) Clothing(เสื้อผ้า) และอื่น ๆ ตามที่เราต้องการ >> สร้างเสร็จคลิก Done

    6. คลิก … เพื่อทำการแก้ไข Avatar ที่เราสร้างขึ้นได้


    7. ระหว่างการประชุมผ่าน Zoom ยังสามารถปิดกล้อง เพื่อใช้ Avatar แทนได้ หรือหากต้องการหยุดใช้ Avatar สามารถคลิกถูกตรง Show Avatar ออกได้



    **สำหรับบุคลากรและนักศึกษา หากยังไม่มีบัญชี Zoom สามารถเข้า Sign In ด้วย SSO ตามคู่มือ คลิก
    *** อย่าลืมอัพเดท Zoom เป็นเวอร์ชั่นล่าสุด

  • Beware of open large 700+ MB PDF, SCR File

    ระวังการเปิดอ่านไฟล์ PDF, SCR ขนาดใหญ่กว่า 700 MB ด้วยอาจจะเป็น มัลแวร์ ที่สามารถสำเนาคุกกี้ในโปรแกรมเว็บเบราเซอร์ของเครื่องที่ท่านใช้งานอยู่ไปให้กับคุณแฮกเกอร์ได้

    คุณแฮกเกอร์ เมื่อได้ คุกกี้ ไปแล้วก็สามารถนำไปใช้เข้าเว็บไซต์ที่แม้จะได้มีการป้องกันด้วยระบบตรวจสอบตัวจริงหลายชั้น Multi-factor Authentication : MFA เอาไว้ ก็หลุดรอดวิธีเข้าเว็บไซต์ด้วยคุ๊กกี้นี้ไปได้อย่างง่ายดาย ทั้งนี้ด้วยช่องโหว่โปรแกรมป้องกันไวรัสจะไม่ตรวจสอบไฟล์ขนาดใหญ่กว่า 700 MB

    ก่อนคลิก คิดทบทวนกันก่อนนะครับ

    อ้างอิงจาก YouTube https://youtu.be/yXYLR8MfSz8

  • แนะนำวิธีการสร้างรูปภาพลายเซ็นสำหรับใช้บน Adobe Acrobat DC


    แนะนำ 2 วิธีการ คือ

    1) วิธีการสร้างรูปภาพลายเซ็นเป็นนามสกุล .pdf โดยใช้ Microsoft Word

    2) วิธีการสร้างรูปภาพลายเซ็นเป็นนามสกุล .pdf โดยใช้ Microsoft PowerPoint

    หมายเหตุ: รูปภาพลายเซ็นต้องเป็นนามสกุล .pdf สำหรับใช้บน Adobe Acrobat DC

    วิธีการสร้างรูปภาพลายเซ็นเป็นนามสกุล .pdf โดยใช้ Microsoft Word

    1) เตรียมรูปภาพลายเซ็น (นามสกุล .png, .jpg หรือ .jpeg) แนะนำภาพพื้นหลังสีขาว

    2) เปิดโปรแกรม Microsoft Word

    2.1) คลิก Layout

    2.2) Page Setup (คลิกเครื่องหมายลูกศร)

    2.3) ตั้งค่า Margins

    2.4) Top: 0″, Bottom: 0″, Left: 0″, Right: 0″

    2.5) Orientation: คลิก Landscape

    2.6) คลิก OK

    2.7) ตั้งค่า Paper

    Paper size คลิก Custom size Width: 6.25″ และ Height: 2.08333″ และคลิก OK

    หมายเหตุ:
    600 Pixel = 15.875 cm = 6.25 inches
    200 Pixel = 5.29167 cm = 2.08333 inches

    2.8) คลิก Insert > Pictures > This Device…

    2.9) เลือกรูปภาพที่ต้องการ จากนั้นปรับรูปภาพตามความเหมาะสม

    2.10) File > Save As

    2.11) ตั้งชื่อไฟล์ เลือก Save as type เป็น PDF

    2.12) คลิก Save

    3) ผลลัพธ์จากการสร้างรูปภาพลายเซ็น

    วิธีการสร้างรูปภาพลายเซ็นเป็นนามสกุล .pdf โดยใช้ Microsoft PowerPoint

    1) เตรียมรูปภาพลายเซ็น (นามสกุล .png, .jpg หรือ .jpeg) แนะนำภาพพื้นหลังสีขาว

    2) เปิดโปรแกรม Microsoft PowerPoint

    2.1) คลิก Design

    2.2) คลิก Slide Size

    2.3) คลิก Custom Slide Size…

    2.4) Slides sized for คลิก Custom

    Width 6.25 in และ Height 2.083 in

    2.5) Orientation > Slides คลิก Landscape

    2.6) คลิก OK

    2.7) คลิก Ensure Fit

    2.8) คลิก Insert > Pictures > This Device…

    2.9) เลือกรูปภาพที่ต้องการใช้ จากนั้นปรับรูปภาพตามความเหมาะสม

    2.10) File > Save As

    2.11) ตั้งชื่อไฟล์ เลือก Save as type เป็น PDF

    2.12) คลิก Save

    3) ผลลัพธ์จากการสร้างรูปภาพลายเซ็น

  • แนะนำวิธีการสร้าง Digital Signature บน Adobe Acrobat DC

    1) เข้าเว็บไซต์ https://passport.psu.ac.th/
    2) คลิก หัวข้อออกใบรับรองดิจิทัลส่วนบุคคล (USER CERTIFICATE AUTHORITY)

    3) ดาวน์โหลด Certificate (จะได้ไฟล์ jakkrit.ch@psu.ac.th.p12)

    4) กรอก Username และ Password (PSU Passport) และคลิก Sign in

    5) กรอก PINCODE และคลิก Authorize Application/อนุญาตให้เข้าถึง

    หมายเหตุ: ไฟล์ jakkrit.ch@psu.ac.th.p12 คือใบรับรองดิจิทัลส่วนบุคคล (Digital ID หรือ Digital Certificate)

    6) ดาวน์โหลด CA Certificate สำหรับใช้ตรวจสอบใบรับรองดิจิทัลส่วนบุคคล(TUCTrustedCert.fdf)

    หมายเหตุ: TUCTrustedCert เป็น Self Sign ที่ถูกรับรองโดยสมาคมมหาวิทยาลัยแห่งประเทศไทย (Thailand University Consortium Root CA (TUC))

    วิธีการติดตั้ง TUCTrustedCert

    1) Double Click ไฟล์ TUCTrustedCert

    2) คลิก Add Contacts to List of Trusted Identities…

    3) คลิก Check ที่ Use this certificate as a trusted root

    4) คลิก Check ที่ Certified documents

    5) คลิก Check ที่ Dynamic content

    6) คลิก Check ที่ Embedded high privilege JavaScript

    7) คลิก Check ที่ Privileged system operations (networking, printing, file access, etc.)

    8) คลิก OK

    9) คลิก OK (กรณีที่ติดตั้ง TUCTrustedCert ครั้งแรก)

    หมายเหตุ: กรณีที่มีการติดตั้ง TUCTrustedCert แล้ว

    วิธีการติดตั้ง Digital ID หรือ Digital Certificate

    ตัวอย่างไฟล์ jakkrit.ch@psu.ac.th.p12

    1) คลิก Mouse ขวา เลือก Install PFX

    2) Store Location: คลิก Current User และคลิก Next

    3) File name: คลิก Browse… ไฟล์ jakkrit.ch@psu.ac.th.p12 และคลิก Next

    4) กรอก Password (PINCODE)

    5) คลิก Check Include all extended properties

    6) คลิก Next

    7) คลิก Automatically select the certificate store based on the type of certificate

    8) คลิก Next

    9) คลิก Finish

    10) คลิก OK

    วิธีการลงลายเซ็นดิจิทัล (Digital Signature)

    1) เปิดไฟล์ PDF ที่ต้องการลงลายเซ็นดิจิทัล โดยใช้โปรแกรม Adobe Acrobat DC

    2) คลิก Tab เครื่องมือ Tools และคลิก Certificates

    3) คลิก Digitally Sign

    4) คลิก Check ที่ Do not show this message again

    5) คลิก OK

    6) ใช้ Mouse ลากบริเวณที่จะลงลายเซ็นดิจิทัล

    7) คลิก Configure Digital ID

    8) คลิก Digital ID

    9) คลิก Continue

    10) คลิก Create

    11) คลิก Draw

    12) วาดภาพลายเซ็น จากนั้นคลิก Apply

    13) คลิก Save

    14) คลิก Sign

    15) ตั้งชื่อไฟล์ และคลิก Save

    16) ผลลัพธ์จากการลงลายเซ็นดิจิทัล