=====Für eine Oracle System Umgebung Foreman 3.5 auf Oracle Linux 8 als Repository Proxy und Konfigurationswerkzeug aufsetzen===== ** 01.2022** === Übersicht Foreman ==== Standardfunktionen von Foreman: * Erkennung, Bereitstellung und Upgrade von Servern * Erstellen und Verwalten von Instanzen in Virtualisierungsumgebungen / in privaten bzw. öffentlichen Clouds * Installation von Betriebssystemen über PXE, lokale Medien oder aus Vorlagen / Images * Übersicht und Verwaltung aller Server im System * Auditierung historische Änderungen für Audits und Fehlersuche * Web-Benutzeroberfläche, JSON REST API und CLI für Linux * Kann nach Bedarf über eine Plugin-Architektur erweitert werden Für unseren Einsatzzweck als Proxy Funktionalität für RPM Repositories mit Lizenz-Verwaltung z.B. für Redhat muss die Katello Option zum Foreman bei der Installation gleich mit ausgewählt werden. Nachträglich lässt sich das nicht mehr hinzufügen. == Ablauf Installation == Voraussetzung: Der Server muss die folgenden Repos erreichen können: * https://yum.puppet.com/ * https://yum.theforeman.org/ * http://yum.puppetlabs.com/ D.h. falls eine Applikation FW bzw. ein URL Filter im Proxy im Einsatz ist, diese URL's freischalten lassen. Ablauf: * Oracle Linux 8 Umgebung bereitstellen wie [[linux:linux_8_system_grundeinstellungen_oracle_datenbank_rac|Ein Oracle Linux 8 Basis System als Grundlagen für eine Oracle Clusterware und Datenbank Installation vorbereiten]] * Umgebung für Foreman optimieren * Puppet / Foreman Repository integrieren * Foreman Installer mit den notwendigen Parametern aufrufen * Benutzer einrichten * Den ersten Host registrieren * Die PRM Repositories einbinden ---- ====Linux Server Umgebung für Foreman optimieren==== Zeitdienst kontrollieren, Uhrzeit muss über aller verwalteten Server korrekt sein! Bei Bedarf Crony einrichten! Namensauflösung muss perfekt über einen DNS Server funktionieren! Der Server muss sich auch selber auflösen können und unter dem Namen von allen System erreichbar sein! ping -c 2 $(hostname -f) ===Ruby== Ruby auf dem System konfigurieren: dnf module reset ruby dnf -y module enable ruby:2.7 dnf install ruby -y ===Firewall=== Ports freischalten: # firewall-cmd \ --add-port="53/udp" --add-port="53/tcp" \ --add-port="67/udp" \ --add-port="69/udp" \ --add-port="80/tcp" --add-port="443/tcp" \ --add-port="5647/tcp" \ --add-port="8000/tcp" --add-port="9090/tcp" \ --add-port="8140/tcp" firewall-cmd --reload bzw. komplett deaktiveren: systemctl stop firewalld systemctl disable firewalld ---- ====Puppet / Foreman Repository integrieren==== Konfigure Redhat Linux 8 Repos: subscription-manager repos --disable "*" subscription-manager repos --enable=rhel-8-for-x86_64-baseos-rpms \ --enable=rhel-8-for-x86_64-appstream-rpms dnf clean all Foreman und Puppet Repos hinzufügen: dnf -y install https://yum.theforeman.org/releases/3.5/el8/x86_64/foreman-release.rpm dnf -y install https://yum.theforeman.org/katello/4.7/katello/el8/x86_64/katello-repos-latest.rpm dnf -y install https://yum.puppet.com/puppet7-release-el-8.noarch.rpm dnf module enable katello:el8 pulpcore:el8 # requires module(postgresql:12) Meldung kann ignoriert werden Testen ob alle Repos erreicht werden: dnf clean all dnf install unzip == Problem Curl error (60): Peer certificate cannot be authenticated with given CA certificates for SSL certificate problem: self signed certificate in certificate chain== SSL Verifzierung für dnf temopräre über "**sslverify=0**" in der dns Konfiuration **/etc/dnf/dnf.conf** ausschalten falls hinter einem SSL Proxy: vi /etc/dnf/dnf.conf sslverify=0 Allerdings hat das nicht in meinen Fall geholfen am Ende die Datei zu laden, es blieb nicht anders übrig als die Daten über die URL https://yum.puppet.com/puppet7-release-el-8.noarch.rpm direkt zu holen: curl --insecure https://yum.puppet.com/puppet7-release-el-8.noarch.rpm dnf -y install puppet7-release-el-8.noarch.rpm bzw. von andern Host holen und dann einspielen. == Problem repository are already installed but they are not correct for this package ..== Darauf achten das die Katello und Forman Repo auch von der geleichen Version sind! Auf die Reihenfolge der Aufrufe achten! ---- ==== Foreman Installation ==== Da wir Foremann als Proxy zu Redhat für die RPM Verteilung und Lizenzverwaltung einsetzten wollen, muss auch das Katello plug-in Gleich zu Begin installiert werden. Nachträglich ist das nicht möglich! Umgebung aktualisieren: dnf update Installer installieren: dnf -y install foreman-installer-katello Installation aufrufen (mit --tuning development da meine VM nur 16GB Ram hat!) : foreman-installer --help foreman-installer --full-help foreman-installer -i # oder foreman-installer --scenario katello \ --foreman-initial-organization "GPIConsult" \ --foreman-initial-location "Rossbach" \ --foreman-initial-admin-username admin \ --foreman-initial-admin-password xxxxx \ --enable-foreman-plugin-openscap \ --enable-foreman-proxy-plugin-openscap \ --enable-foreman-plugin-ansible \ --enable-foreman-proxy-plugin-ansible \ --enable-foreman-plugin-remote-execution \ --enable-foreman-proxy-plugin-remote-execution-script \ --tuning development 2023-01-19 15:31:12 [NOTICE] [root] Loading installer configuration. This will take some time. 2023-01-19 15:31:15 [NOTICE] [root] Running installer with log based terminal output at level NOTICE. 2023-01-19 15:31:15 [NOTICE] [root] Use -l to set the terminal output log level to ERROR, WARN, NOTICE, INFO, or DEBUG. See --full-help for definitions. 2023-01-19 15:34:07 [NOTICE] [configure] Starting system configuration. 2023-01-19 15:35:57 [NOTICE] [configure] 250 configuration steps out of 1502 steps complete. 2023-01-19 15:36:38 [NOTICE] [configure] 500 configuration steps out of 1504 steps complete. 2023-01-19 15:36:49 [NOTICE] [configure] 750 configuration steps out of 1509 steps complete. 2023-01-19 15:38:16 [NOTICE] [configure] 1000 configuration steps out of 1532 steps complete. 2023-01-19 15:40:32 [NOTICE] [configure] 1250 configuration steps out of 1532 steps complete. 2023-01-19 15:42:53 [NOTICE] [configure] 1500 configuration steps out of 1532 steps complete. 2023-01-19 15:43:00 [NOTICE] [configure] System configuration has finished. Executing: foreman-rake upgrade:run WARNING: Sidekiq::Web.sessions= is no longer relevant and will be removed in Sidekiq 7.0. /usr/share/gems/gems/sidekiq-6.3.1/lib/sidekiq/web.rb:75:in `set' ============================================= Upgrade Step 1/8: katello:correct_repositories. This may take a long while. ============================================= Upgrade Step 2/8: katello:clean_backend_objects. This may take a long while. 0 orphaned consumer id(s) found in candlepin. Candlepin orphaned consumers: [] ============================================= Upgrade Step 3/8: katello:upgrades:4.0:remove_ostree_puppet_content. ============================================= Upgrade Step 4/8: katello:upgrades:4.1:sync_noarch_content. ============================================= Upgrade Step 5/8: katello:upgrades:4.1:fix_invalid_pools. I, [2023-01-19T15:43:10.385970 #16591] INFO -- : Corrected 0 invalid pools I, [2023-01-19T15:43:10.386001 #16591] INFO -- : Removed 0 orphaned pools ============================================= Upgrade Step 6/8: katello:upgrades:4.1:reupdate_content_import_export_perms. ============================================= Upgrade Step 7/8: katello:upgrades:4.2:remove_checksum_values. ============================================= Upgrade Step 8/8: katello:upgrades:4.4:publish_import_cvvs. Success! * Foreman is running at https://gpiforeman01.pipperr.local Initial credentials are admin / xxxxxxxxxxx * To install an additional Foreman proxy on separate machine continue by running: foreman-proxy-certs-generate --foreman-proxy-fqdn "$FOREMAN_PROXY" --certs-tar "/root/$FOREMAN_PROXY-certs.tar" * Foreman Proxy is running at https://gpiforeman01.pipperr.local:9090 health Check ausführen foreman-maintain health check Running ForemanMaintain::Scenario::FilteredScenario ================================================================================ Check number of fact names in database: [OK] -------------------------------------------------------------------------------- Check whether all services are running: [OK] -------------------------------------------------------------------------------- Check whether all services are running using the ping call: [OK] -------------------------------------------------------------------------------- Check for paused tasks: [OK] -------------------------------------------------------------------------------- Settings über die Console prüfen: hammer settings list --fields="Name,Value" == Problem - Umgebung zu wenig RAM === Ist die Umgebung nicht so groß mit "--tuning development" auf die kleinste Umgebung konfugrieren: Probem: Tuning profile 'default' requires at least 20 GB of memory and 4 CPU cores Lösung : --tuning development ---- ==== Repositories einbinden=== MS: * In the Foreman web UI, navigate to Content > Products. * Click Repo Discovery. * In the Repository Type field, select Yum Repositories. * In the URL to Discover field, enter the Microsoft URL https://packages.microsoft.com/rhel/8/ * Click Discover. * Select /prod repositories. * Click Create Selected. * In the Product field select New Product. * In the Name field enter desired product name. * Click Run Repository Creation. ---- ==== Client einbinden ==== === Vorbereitung Foreman Server === Activation Key erzeugen: => https://theforeman.org/plugins/katello/nightly/user_guide/activation_keys/index.html#create-an-activation-key Template und Registation Feature vom Smart Proxy aktiviert werden: foreman-installer --foreman-proxy-registration true --foreman-proxy-templates true --foreman-proxy-template-url 'http://gpiforeman01.pipperr.local' siehe https://docs.theforeman.org/3.5/Managing_Hosts/index-foreman-el.html#registering-a-host_managing-hosts Betriebsystem unter Operation System anlegen Über Host=>"Register Host" URL erzeugen, falls einigermaßen sicheres Netz mit dem Schalter "Insecure" === FW Freischaltung === Der Client benötigt die folgenden FW Freischaltungen: # firewall-cmd \ --add-port="53/udp" --add-port="53/tcp" \ --add-port="67/udp" \ --add-port="69/udp" \ --add-port="80/tcp" --add-port="443/tcp" \ --add-port="8443/tcp" \ --add-port="8140/tcp" --add-port="9090/tcp" firewall-cmd --runtime-to-permanent firewall-cmd --list-all === Client umziehen === # Remove Katello Agent systemctl stop goferd systemctl disable goferd yum -y remove remove katello-agent # Unregister old sub yum clean all subscription-manager remove --all subscription-manager unregister subscription-manager clean # URL aus der Oberfläche aufrufen curl -sS --insecure 'https://gpiforeman01.pipperr.local:9090/register?activation_keys=xxxxxxxxxxxx................... # Evlt. Repos die zu viel sind per Pool ID wieder mit remove entfernen subscription-manager remove --pool=xxxxxxxxxxxxxxxx ---- ==== Deinstallieren==== Vor der Installation einen Snapshot der Maschine erstellen! Dann das das zurückgehen auf dem Snapshot die bessere Wahl! Entfernen mit: Remove foreman yum remove foreman foreman-installer foreman-proxy foreman-installer-katello rm -rf /var/lib/foreman rm -rf /usr/share/foreman rm -rf /usr/share/foreman-proxy/logs rm -rf /etc/httpd/conf.d/foreman.conf rm -rf /etc/foreman rm -rf /etc/foreman-installer rm -rf /etc/foreman-proxy rm -rf /opt/puppetlabs/server/data/puppetserver/yaml/foreman rm -rf /run/foreman rm -rf /usr/libexec/foreman rm -rf /var/lib/selinux/targeted/active/modules/400/foreman rm -rf /var/log/foreman # Remove puppet yum remove puppet puppetmaster puppet-common puppetmaster-common puppetlabs-release rm -rf /usr/lib/ruby/vendor_ruby/puppet rm -rf /usr/share/puppet rm -rf /var/lib/puppet /etc/puppet rm -rf /etc/apache2/conf.d/puppet.conf Installation mit zurücksetzen der Daten mit " --reset-data" : foreman-installer --scenario katello \ --foreman-initial-organization "GPIConsult" \ --foreman-initial-location "Roßbach" \ --foreman-initial-admin-username admin \ --foreman-initial-admin-password xxxxxxx\ --enable-foreman-plugin-openscap \ --enable-foreman-proxy-plugin-openscap \ --enable-foreman-plugin-ansible \ --enable-foreman-proxy-plugin-ansible \ --enable-foreman-plugin-remote-execution \ --enable-foreman-proxy-plugin-remote-execution-script \ --tuning development --reset-data ===== Quellen ===== Web: * https://computingforgeeks.com/install-and-configure-foreman-on-centos-rhel-rocky/ Doku Installation: * https://theforeman.org/manuals/3.5/quickstart_guide.html * https://docs.theforeman.org/release/3.5/ * https://docs.theforeman.org/3.5/Quickstart/index-katello.html * https://theforeman.org/plugins/foreman_ansible/2.x/index.html#2.Installation * https://theforeman.org/plugins/foreman_openscap/1.0/index.html#2.Installation Anleitung: * https://theforeman.org/manuals/3.5/index.html OpenScap * https://theforeman.org/plugins/foreman_openscap/1.0/index.html * http://static.open-scap.org/ssg-guides/ssg-rhel7-guide-cis_server_l1.html