Welcome to Centmin Mod Community
Become a Member

Security OpenSSL September 26, 2016: OpenSSL 1.0.2j Security Update & Centmin Mod Nginx Recompile

Discussion in 'CentOS, Redhat & Oracle Linux News' started by eva2000, Sep 27, 2016.

  1. eva2000

    eva2000 Administrator Staff Member

    55,811
    12,273
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,859
    Local Time:
    7:13 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+

    OpenSSL 1.0.2j Release Information



    OpenSSL folks are releasing OpenSSL 1.1.0b and 1.0.2j security updates on September 26, 2016 https://www.openssl.org/news/secadv/20160926.txt. Centmin Mod 123.08stable only supports OpenSSL 1.0.2j for Nginx SSL. Centmin Mod 123.09beta01 supports both OpenSSL 1.1.0b and 1.0.2j for Nginx SSL. Example for updating Centmin Mod Nginx with OpenSSL 1.0.2j can be seen here.

    OpenSSL Security Vulnerabilitys Fixed include:
    • Fix Use After Free for large message sizes (CVE-2016-6309)
    • Missing CRL sanity check (CVE-2016-7052)

    Notes:


    • Prior to Feb 25th, 2016, Centmin Mod Nginx from 1.2.3-eva2000.08 (123.08stable) onwards by default are compiled against LibreSSL 2.2 instead of OpenSSL 1.0.2j, so generally don't need updating for Centmin Mod Nginx side. But CentOS system OpenSSL may need updates.
    • After Feb 25th, 2016, Centmin Mod 123.08stable version of Nginx has switched back to being compiled against OpenSSL 1.0.2+ for out of box defaults due to Nginx 1.9.12 compatibility issues with LibreSSL. While 123.09beta01 has switched back to LibreSSL 2.4 branch.

    Centmin Mod LEMP Upgrade OpenSSL 1.0.2j



    For Centmin Mod LEMP stack 1.2.3-eva2000.08 stable and higher, there's 2 parts to updating OpenSSL - system YUM package back ported update + Nginx OpenSSL static compilation for front facing Nginx server and https/SSL.

    For Centmin Mod 1.2.3-eva2000.08 stable (123.08stable) and higher (including betas) you need to do 2 updates:
    1. System OpenSSL update for CentOS
    2. Nginx recompile with OPENSSL_VER='1.0.2j' variable set. Check your updated Centmin Mod centmin.sh to see if OPENSSL_VER='1.0.2j' is set. If not set, then you need to manually update and edit your server copy of by setting OPENSSL_VERSION='1.0.2j' in your persistent config file (create it if it doesn't exist) at /etc/centminmod/custom_config.inc and add to it
      Code (Text):
      OPENSSL_VERSION='1.0.2j'
    Centmin Mod Nginx doesn't use system OpenSSL and is compiled statically - check command below will return blank/nothing for Centmin Mod Nginx. There's a reason why Centmin Mod Nginx is compiled against a statically linked OpenSSL version.

    Code (Text):
     ldd `which nginx` | grep ssl


    will come back empty for Centmin Mod Nginx based servers.

    System OpenSSL update for CentOS



    Usually Redhat and CentOS back port patches so you will see something like OpenSSL 1.0.1e-XX where XX is incremented version number with fixed patches. Will update this post once Redhat/CentOS have an updated YUM package.

    Also sometimes Redhat or CentOS system versions won't be affected by the OpenSSL source listed bugs/security issues. You have to read each CVE* listing on Red Hat and CentOS bug trackers to see if they apply or not.

    CentOS/Redhat system OpenSSL updates

    CentOS 7
    Code (Text):
    TBA
    


    CentOS 6
    Code (Text):
    openssl 1.0.1e-48.el6_8.3


    For CentOS 7
    Code (Text):
    rpm -qa --changelog openssl | head -n8
    TBA
    


    For CentOS 6

    CentOS system openssl update seems to be out for CentOS 6 - not yet for CentOS 7
    Code (Text):
    rpm -ql --changelog openssl | head -n13
    * Thu Sep 22 2016 Tomáš Mráz <tmraz@redhat.com> 1.0.1e-48.3
    - fix CVE-2016-2177 - possible integer overflow
    - fix CVE-2016-2178 - non-constant time DSA operations
    - fix CVE-2016-2179 - further DoS issues in DTLS
    - fix CVE-2016-2180 - OOB read in TS_OBJ_print_bio()
    - fix CVE-2016-2181 - DTLS1 replay protection and unprocessed records issue
    - fix CVE-2016-2182 - possible buffer overflow in BN_bn2dec()
    - fix CVE-2016-6302 - insufficient TLS session ticket HMAC length check
    - fix CVE-2016-6304 - unbound memory growth with OCSP status request
    - fix CVE-2016-6306 - certificate message OOB reads
    - mitigate CVE-2016-2183 - degrade all 64bit block ciphers and RC4 to
      112 bit effective strength
    - replace expired testing certificates


    For auto daily updates check out yum-cron for auto updates.

    Code (Text):
    yum list updates -q | grep openssl
    


    Code (Text):
    rpm -qa --changelog openssl | head -n11
    



    To update
    Code (Text):
    yum -y update

    Note: after system update you need to reboot your server to ensure all services which use OpenSSL also use the updated version.

    Nginx recompile with OPENSSL_VER='1.0.2j'



    • Prior to Feb 25th, 2016, Centmin Mod Nginx from 1.2.3-eva2000.08 (123.08stable) onwards by default are compiled against LibreSSL 2.2 instead of OpenSSL 1.0.2j, so generally don't need updating for Centmin Mod Nginx side. But CentOS system OpenSSL may need updates.
    • After Feb 25th, 2016, Centmin Mod 123.08stable version of Nginx has switched back to being compiled against OpenSSL 1.0.2+ for out of box defaults due to Nginx 1.9.12 compatibility issues with LibreSSL. While 123.09beta01 has switched back to LibreSSL 2.3 branch.
    To update if you are using OpenSSL and not the prior default Centmin Mod Nginx LibreSSL, edit your centmin.sh file variable for OPENSSL_VERSION. There's 2 ways to do that:
    1. Best way is to use centmin.sh menu option 23 submenu option 2 for auto updating Centmin Mod code as outlined at centminmod.com/upgrade.html and at https://community.centminmod.com/threads/new-08-beta-menu-option-updating-centmin-mod-via-git.3084/. If Centmin Mod code has been updated, that method will auto update centmin.sh to latest version which already has OPENSSL_VERSION='1.0.2j' set. After updating via git centmin.sh menu option 23 submenu options, verify in centmin.sh that OPENSSL_VERSION='1.0.2j' is set.
    2. If you do not have centmin.sh menu option 23 submenu option 1 for git environment setup or if centmin.sh doesn't have OPENSSL_VERSION='1.0.2j' set, then you need to manually update and edit your server copy of by setting OPENSSL_VERSION='1.0.2j' in your persistent config file (create it if it doesn't exist) at /etc/centminmod/custom_config.inc and add to it
      Code (Text):
      OPENSSL_VERSION='1.0.2j'
      Then run centmin.sh menu option 4 to recompile Nginx. When prompted select yes or no from YUM checks, select NO (really system OpenSSL update step above wouldn't be needed if you select yes to YUM checks here ;) ). Then when prompted specify Nginx version = 1.11.4 or newer. Let Nginx recompile run to completion, it should say Nginx installed successfully. Check if Nginx compiled against 1.0.2j using Nginx -V command
    You can tell if your Centmin Mod Nginx is using OpenSSL or LibreSSL via output of SSH command
    Code (Text):
    nginx -V


    If using LibreSSL, built with line will list such
    Code (Text):
    nginx -V
    nginx version: nginx/1.11.4
    built by clang 3.4.2 (tags/RELEASE_34/dot2-final)
    built with LibreSSL 2.4.2


    If using OpenSSL, built with line will list such
    Code (Text):
    nginx -V
    nginx version: nginx/1.11.4
    built by clang 3.4.2 (tags/RELEASE_34/dot2-final)
    built with OpenSSL 1.0.2j  26 Sep 2016
    
     
    Last edited: Sep 29, 2016
  2. eva2000

    eva2000 Administrator Staff Member

    55,811
    12,273
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,859
    Local Time:
    7:13 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    As Centmin Mod Nginx defaults to LibreSSL for SSL, if you want to use OpenSSL 1.0.2j with Nginx SSL, need to set in persistent config file at /etc/centminmod/custom_config.inc the following variable
    Code (Text):
    LIBRESSL_SWITCH='n'
    

    Then run centmin.sh menu option 4 to recompile Nginx.

    So update your Centmin Mod code as outlined at Upgrade Centmin Mod - CentminMod.com LEMP Nginx web stack for CentOS via centmin.sh menu option 23 submenu option 2 first
    Code (Text):
    --------------------------------------------------------
         Centmin Mod Menu 123.09beta01 centminmod.com 
    --------------------------------------------------------
    1).  Centmin Install
    2).  Add Nginx vhost domain
    3).  NSD setup domain name DNS
    4).  Nginx Upgrade / Downgrade
    5).  PHP Upgrade / Downgrade
    6).  XCache Re-install
    7).  APC Cache Re-install
    8).  XCache Install
    9).  APC Cache Install
    10). Memcached Server Re-install
    11). MariaDB 5.2/5.5 & 10.x Upgrade Sub-Menu
    12). Zend OpCache Install/Re-install
    13). Install/Reinstall Redis PHP Extension
    14). SELinux disable
    15). Install/Reinstall ImagicK PHP Extension
    16). Change SSHD Port Number
    17). Multi-thread compression: pigz,pbzip2,lbzip2...
    18). Suhosin PHP Extension install
    19). Install FFMPEG and FFMPEG PHP Extension
    20). NSD Install/Re-Install
    21). Update - Nginx + PHP-FPM + Siege
    22). Add Wordpress Nginx vhost + Cache Plugin
    23). Update Centmin Mod Code Base
    24). Exit
    --------------------------------------------------------
    Enter option [ 1 - 24 ] 23
    --------------------------------------------------------
    

    centmin.sh menu option 23 submenu option 2
    Code (Text):
    
    --------------------------------------------------------
            Centmin Mod Updater Sub-Menu           
    --------------------------------------------------------
    1). Setup Centmin Mod Github Environment
    2). Update Centmin Mod Current Branch
    3). Update Centmin Mod Newer Branch
    4). Exit
    --------------------------------------------------------
    Enter option [ 1 - 4 ] 2
    --------------------------------------------------------
    

    select 4 to exit out of submenu, select 24 to exit out of centmin.sh, then re-cd into /usr/local/src/centminmod and re-run centmin.sh menu option 4
    Code (Text):
    cd /usr/local/src/centminmod
    ./centmin.sh
    


    Or if you don't want to use centmin.sh menu option 23, you can do straight git pull update via
    Code (Text):
    cd /usr/local/src/centminmod
    git stash
    git pull
    ./centmin.sh
    


    FYI, this forum is now using Nginx 1.11.4 + OpenSSL 1.0.2j via LIBRESSL_SWITCH='n' based centmin.sh menu option 4 recompile

    Code (Text):
    --------------------------------------------------------
         Centmin Mod Menu 123.09beta01 centminmod.com 
    --------------------------------------------------------
    1).  Centmin Install
    2).  Add Nginx vhost domain
    3).  NSD setup domain name DNS
    4).  Nginx Upgrade / Downgrade
    5).  PHP Upgrade / Downgrade
    6).  XCache Re-install
    7).  APC Cache Re-install
    8).  XCache Install
    9).  APC Cache Install
    10). Memcached Server Re-install
    11). MariaDB 5.2/5.5 & 10.x Upgrade Sub-Menu
    12). Zend OpCache Install/Re-install
    13). Install/Reinstall Redis PHP Extension
    14). SELinux disable
    15). Install/Reinstall ImagicK PHP Extension
    16). Change SSHD Port Number
    17). Multi-thread compression: pigz,pbzip2,lbzip2...
    18). Suhosin PHP Extension install
    19). Install FFMPEG and FFMPEG PHP Extension
    20). NSD Install/Re-Install
    21). Update - Nginx + PHP-FPM + Siege
    22). Add Wordpress Nginx vhost + Cache Plugin
    23). Update Centmin Mod Code Base
    24). Exit
    --------------------------------------------------------
    Enter option [ 1 - 24 ] 4
    --------------------------------------------------------
    

    Code (Text):
    Do you want to run YUM install checks ?  [y/n]
    
    This will increase your upgrade duration time wise.
    Check the change log centminmod.com/changelog.html
    to see if any Nginx or PHP related new additions
    which require checking YUM prequisites are met.
    If no new additions made, you can skip the
    YUM install check to speed up upgrade time.
    
     [y/n]: n
    

    Code (Text):
    Nginx Upgrade - Would you like to continue? [y/n] y
    
    Install which version of Nginx? (version i.e. type 1.11.4): 1.11.4


    End result
    If your nginx -v output shows built with LibreSSL instead, then this OpenSSL 1.0.2j update doesn't apply to you. I'd expect LibreSSL 2.4.3 release soon for similar security fixes as right now LibreSSL 2.4.2 is latest still.
     
  3. SneakyDave

    SneakyDave Member

    84
    14
    8
    Jul 24, 2014
    Ratings:
    +22
    Local Time:
    4:13 AM
    1.0.15
    I noticed that I don't have a LibreSSL configuration set to "no" so that is what I must be using, but I noticed that I do have openssl 1.0.1e-48.el6_8.1 installed via yum.

    Is it smart to disable it until the newest version is in the repository?


    Well, it appears I was wrong, my nginx is compiled with openssl, after verifying with "nginx -V". Thanks for the information.
     
  4. eva2000

    eva2000 Administrator Staff Member

    55,811
    12,273
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,859
    Local Time:
    7:13 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    Centmin Mod Nginx doesn't use system OpenSSL and is compiled statically. Check via command to see if Nginx uses LibreSSL or OpenSSL built with line
    Code (Text):
    nginx -V

    The main vulnerability in fixed in OpenSSL 1.0.1i and 1.0.2j is related to OCSP stapling for SSL and Centmin Mod Nginx HTTPS uses either static compiled OpenSSL or LibreSSL and not system OpenSSL. You can't disable or remove system YUM OpenSSL without breaking your server. But it isn't used for OCSP stapling unless a server installed app is configured to use it i.e. if you have non-Centmin Mod yum install nginx then system OpenSSL would be using it for Nginx HTTP instead of Centmin Mod Nginx which doesn't use system OpenSSL.
     
  5. SneakyDave

    SneakyDave Member

    84
    14
    8
    Jul 24, 2014
    Ratings:
    +22
    Local Time:
    4:13 AM
    1.0.15
    This is what I have:
    Code:
    [root@dev etc]# nginx -V
    nginx version: nginx/1.11.1
    built by clang 3.4.2 (tags/RELEASE_34/dot2-final)
    built with OpenSSL 1.0.2h  3 May 2016
    TLS SNI support enabled
    configure arguments: --with-ld-opt='-ljemalloc -Wl,-z,relro' --with-cc-opt='-m64 -mtune=native -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wno-sign-compare -Wno-string-plus-int -Wno-deprecated-declarations -Wno-unused-parameter -Wno-unused-const-variable -Wno-conditional-uninitialized -Wno-mismatched-tags -Wno-c++11-extensions -Wno-sometimes-uninitialized -Wno-parentheses-equality -Wno-tautological-compare -Wno-self-assign -Wno-deprecated-register -Wno-deprecated -Wno-invalid-source-encoding -Wno-pointer-sign -Wno-parentheses -Wno-enum-conversion' --sbin-path=/usr/local/sbin/nginx --conf-path=/usr/local/nginx/conf/nginx.conf --with-http_ssl_module --with-http_v2_module --with-http_gzip_static_module --with-http_stub_status_module --with-http_sub_module --with-http_addition_module --with-http_image_filter_module --with-http_secure_link_module --with-http_realip_module --with-http_geoip_module --with-openssl-opt=enable-tlsext --add-module=../ngx-fancyindex-ngx-fancyindex --add-module=../ngx_cache_purge-2.3 --add-module=../nginx-accesskey-2.0.3 --add-module=../nginx-http-concat-master --add-module=../openresty-memc-nginx-module-4f6f78f --add-module=../openresty-srcache-nginx-module-ffa9ab7 --add-module=../ngx_devel_kit-0.2.19 --add-module=../set-misc-nginx-module-0.29 --add-module=../echo-nginx-module-0.58 --add-module=../redis2-nginx-module-0.12 --add-module=../ngx_http_redis-0.3.7 --add-module=../nginx_upstream_check_module-0.3.0 --add-module=../nginx-module-vts --add-module=../headers-more-nginx-module-0.28 --with-openssl=../openssl-1.0.2h --with-libatomic --with-pcre=../pcre-8.38 --with-pcre-jit
     
  6. eva2000

    eva2000 Administrator Staff Member

    55,811
    12,273
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,859
    Local Time:
    7:13 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    then just follow above 1st post to update to OpenSSL 1.0.2j and recompile Nginx 1.11.4 newest version :D

    example in 2nd post of this thread
     
  7. eva2000

    eva2000 Administrator Staff Member

    55,811
    12,273
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,859
    Local Time:
    7:13 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
  8. eva2000

    eva2000 Administrator Staff Member

    55,811
    12,273
    113
    May 24, 2014
    Brisbane, Australia
    Ratings:
    +18,859
    Local Time:
    7:13 PM
    Nginx 1.27.x
    MariaDB 10.x/11.4+
    CentOS system openssl update seems to be out for CentOS 6 - not yet for CentOS 7
    Code (Text):
    rpm -ql --changelog openssl | head -n13
    * Thu Sep 22 2016 Tomáš Mráz <tmraz@redhat.com> 1.0.1e-48.3
    - fix CVE-2016-2177 - possible integer overflow
    - fix CVE-2016-2178 - non-constant time DSA operations
    - fix CVE-2016-2179 - further DoS issues in DTLS
    - fix CVE-2016-2180 - OOB read in TS_OBJ_print_bio()
    - fix CVE-2016-2181 - DTLS1 replay protection and unprocessed records issue
    - fix CVE-2016-2182 - possible buffer overflow in BN_bn2dec()
    - fix CVE-2016-6302 - insufficient TLS session ticket HMAC length check
    - fix CVE-2016-6304 - unbound memory growth with OCSP status request
    - fix CVE-2016-6306 - certificate message OOB reads
    - mitigate CVE-2016-2183 - degrade all 64bit block ciphers and RC4 to
      112 bit effective strength
    - replace expired testing certificates