I tried to register a newly installed Red Hat Enterprise Linux 7 server with the subscription-manager command but got the following error:
subscription-manager register
  
Username: xxx
  
Password: xxx
  
Unable to verify server's identity: certificate verify failed
In the rhsm.log file there is the same error with a bit of more details but unfortunately nothing to point me in the right direction:
cat /var/log/rhsm/rhsm.log
  
[DEBUG] subscription-manager @connection.py:450 - Making request: GET https://subscription.rhn.redhat.com:443/subscription/users/xxx/owners
  
[ERROR] subscription-manager @managercli.py:156 - Error during registration: certificate verify failed
  
[ERROR] subscription-manager @managercli.py:157 - certificate verify failed
After some searching, I came across a Red Hat Solution, which mentions to check the current time.
Indeed, after having fixed the time, the registration worked:
date --set="13 JAN 2015 12:20:15"
subscription-manager register
  
Username: xxx
  
Password: xxx
  
The system has been registered with ID: xxx
thanos from wrote on Nov 17th, 2020:
Thank you very much for all your quick replies. I will follow your last advice with the hope finding a way to resolve this issue and finally can use the yum. Thanks again!
ck from Switzerland wrote on Nov 17th, 2020:
As I do not have a CentOS 8 and time to play with this, I simply suggest that you restore your yum configs to a previous state if you have a backup. You may also want to re-create the base repository entry (see how do I install the stock CentOS repositories on stackexchange how to do this. In general subscription-manager may have caused a mixup in the repo lists. Not sure and not able to verify. That is all I provide as advice.
thanos from wrote on Nov 17th, 2020:
oh, I was on a completely wrong way. Thanks again for your help. As I can see after your help there is subscription-manager for centos too and I followed the instructions to install it. 
When I type: sudo yum repolist here is my output:
[user@thanos ~]$ sudo yum repolist
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
repo id                                            repo name
AppStream                                          CentOS-8 - AppStream
BaseOS                                             CentOS-8 - Base
PowerTools                                         CentOS-8 - PowerTools
epel                                               Extra Packages for Enterprise Linux 8 - x86_64
epel-modular                                       Extra Packages for Enterprise Linux Modular 8 - x86_64
extras                                             CentOS-8 - Extras
getpagespeed-extras                                GetPageSpeed packages for Enterprise Linux 8 - x86_64
getpagespeed-extras-noarch                         GetPageSpeed packages for Enterprise Linux 8 - noarch
rpmfusion-free-updates                             RPM Fusion for EL 8 - Free - Updates
And when I type: ls yum.repos.d 
CentOS-AppStream.repo   CentOS-Devel.repo      CentOS-PowerTools.repo                     epel-playground.repo       fedora-rpmfusion.repo
CentOS-Base.repo        CentOS-Extras.repo     CentOS-Sources.repo                        epel.repo                  fedora-russian.repo
CentOS-centosplus.repo  CentOS-fasttrack.repo  CentOS-Vault.repo                          epel-testing-modular.repo  getpagespeed-extras.repo
CentOS-CR.repo          CentOS-HA.repo         dgoodwin-subscription-manager-epel-8.repo  epel-testing.repo          rpmfusion-free-updates.repo
CentOS-Debuginfo.repo   CentOS-Media.repo      epel-modular.repo                          fedora.repo                rpmfusion-free-updates-testing.repo
Now since the command "subscription-manager register" is the same, how do I say to my system to use the one I downloaded and not the rhel one? 
Thank you very much for your support.
ck from Switzerland wrote on Nov 17th, 2020:
thanos, this subscription-manager is for RHEL systems only. Even though the command may be available in CentOS systems, it will not do anything helpful. See is subscription manager available for CentOS? on Serverfault. If your yum packet manager is not working there must be something wrong configured with it. Check the repo list (usually in /etc/yum.repos.d) and other yum settings (in /etc/yum.conf and /etc/yum/*). Maybe you also have an proxy for outgoing http/https connections and the 401 is coming from the proxy. In this case you need to configure yum to use the proxy.
thanos from wrote on Nov 17th, 2020:
Yes, you did read this right I have install CentOS 8 release: 8.2.2004 and when I am trying to download using yum or even dnf I get noticed that my machine isn't registered and that I can do it using subscription manager. Then I found your post and I did apply it to my system but still can't complete the subscription. So now I am sure that time is correct on my system and the message I am getting on rhsm.log is: 'HTTP error (401 - Unauthorized): Service not available, please try again later. Do you have any idea about how to face this? Thanks a lot for your quick replies.
ck from Switzerland wrote on Nov 17th, 2020:
thanos, did I read this right that you try to do this on a CentOS 8 (not RHEL8)? Maybe this causes this, as the Red Hat Subscription Manager detects that this is not a valid RHEL Linux?
ck from Switzerland wrote on Nov 16th, 2020:
Sorry thanos, I am currently not using any RHEL 8 system so I cannot help.
thanos from wrote on Nov 16th, 2020:
Hi, your post is very helpful. I am facing the same problem on centos8 and after I change the rhsm.conf due to wrong time, I am not seeing that message (certificate verify failed) but I am seeing this message now:
HTTP error (401 - Unauthorized): Service not available, please try again later
Could you help me with this?  thanks in advance.
Todd E from Taiwan wrote on May 11th, 2015:
thanks so much for your post! I couldn't figure this one out. I wish Redhat was a bit more insightful.
AWS Android Ansible Apache Apple Atlassian BSD Backup Bash Bluecoat CMS Chef Cloud Coding Consul Containers CouchDB DB DNS Databases Docker ELK Elasticsearch Filebeat FreeBSD Galera Git GlusterFS Grafana Graphics HAProxy HTML Hacks Hardware Icinga Influx Internet Java KVM Kibana Kodi Kubernetes LVM LXC Linux Logstash Mac Macintosh Mail MariaDB Minio MongoDB Monitoring Multimedia MySQL NFS Nagios Network Nginx OSSEC OTRS Observability Office OpenSearch PHP Perl Personal PostgreSQL PowerDNS Proxmox Proxy Python Rancher Rant Redis Roundcube SSL Samba Seafile Security Shell SmartOS Solaris Surveillance Systemd TLS Tomcat Ubuntu Unix VMware Varnish Virtualization Windows Wireless Wordpress Wyse ZFS Zoneminder Linux