Showing posts with label Red Hat Enterprise Linux 7. Show all posts
Showing posts with label Red Hat Enterprise Linux 7. Show all posts

Tuesday, March 22, 2016

How to Restrict ssh Access

How to Restrict SSH Access for User1

  1. Modify /etc/security/access.conf and add the following line at bottom of file
    1. - :User1:ALL EXCEPT server1.example.com server1 server2.example.com LOCAL
  2. Verify these configuration are set in /etc/ssh/sshd_config
    1. UsePAM yes
    2. PasswordAuthentication yes
    3. ChallengeResponseAuthentication no
  3. Verify or modify /etc/ssh/sshd_config and remove tomcat from DenyUsers if listed
    1. DenyUsers UserX UserY UserZ
    2. NOTE: (Only need to modify sshd in pam.d)
    3. Modify /etc/pam.d/login and add this line before account system-auth line
    4. account    required     pam_access.so
  4. Modify /etc/pam.d/sshd and add this line before “account include password-auth”
    1. account    required     pam_access.so
    2. Restart sshd
    3. Service sshd restart
  5. Set temp password for user1
    1.  # passwd user1
  6. Test login from server1 and server2
  7.  Should be able to login with the password.
    1.  a. [user1@server1 ~]$ ssh user1@server2
  8. Test login from some other linux box and this should fail.
    1. [serverX@web]$ ssh user1@server1
    2. Kernel \\r on an \\m
    3. user1@server2 password:
    4. Connection closed by server


Thursday, July 16, 2015

How to Install Atomic Host on vSphere

RHEL Atomic Host Reference
  • https://access.redhat.com/articles/rhel-atomic-install-vmware#iso
  • https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Installation_Guide/sect-atomic-virtualization-vmware.html
How to Install Atomic Host on Vsphere

  1. right click on Cluster (choose your cluster)
  2. choose 'Deploy OVF Template'
  3. On Deploy OVF Template page
  4.     - Local File - location of \*.ova file
  5. review details > next
  6. Select Name and Folder - assign name and put in correct Folder
  7. select Storage >  (some datastore)  > next
  8. select network >  (some network)
  9. Add CD and mount the atomic0-cidata.iso that you create and upload to datastore (I had to create this iso, with 2 files, meta-data and user-data.
  10. We can create additional iso images, because this will use my hostname. AtomicHostX1
  11. the login is 'cloud-user' password = 'myatomic'

Register Atomic Host with Subscription Manager

  1. # subscription-manager register --force
  2. Validate subscription
    1. -bash-4.2# subscription-manager list

Thursday, March 5, 2015

How to Configure Satellite for IPA Authentication

This page contains links and information about the configuration and How to Configure Satellite for IPA Authentication​
Requirements
  • Admin group to map for Satellite Admins
  • Config channel group for other users
How to Configure Satellite
  1. Install the following packages:
    1. yum install ipa-client ipa-admintools sssd sssd-dbus mod_auth_kerb mod_authnz_pam mod_lookup_identity mod_intercept_form_submit -y​
  2. Check selinux status (Selinux must be enforcing and can be in permissive mode) by default we turn selinux off. Changing this will require a reboot to relabel all the files with selinux contexts.
    • ​[tuser@client.mydom.com ~]$ getenforce
      Disabled
    • ]$ sestatus
      SELinux status:      disabled​

  3. Since it shows Disabled, we need to change Selinux to Enforcing, then permissive.
    • ​cd /etc/sysconfig and edit selinux file
    • change SELINUX=disabled to SELINUX=enforcing
    • reboot
    • login and change again from enforcing to permissive
      • ​cd /etc/sysconfig and edit selinux file
      • change SELINUX=enforcing​ to SELINUX=permissive​
    • OR do this
      •  # setenforce 0
        [root@client.mydom.com ~]# getenforce
        Permissive
  4. ​​​Verify it's enabled and in enforcing mode
    1. ​[root@Satellite.mydom.com rhn]# getenforce
      Permissive

    2. [root@satellite.mydom.com rhn]# sestatus
      SELinux status:                 enabled
      SELinuxfs mount:                /selinux
      Current mode:                   permissive
      Mode from config file:          permissive
      Policy version:                 24
      Policy from config file:        targeted

  5. If you try to run the spacewalk setup ipa command below and selinux is not configured properly you will see this error:
    1. [root@satellie.mydom.com sysconfig]# spacewalk-setup-ipa-authentication
      Enabling authentication against [ipa.mydom.com].
      Keytab: [/etc/httpd/conf/http.keytab] already exists, will not refetch.
              Use [klist -kt /etc/httpd/conf/http.keytab] to verify its content.
      PAM service: File [/etc/pam.d/spacewalk], will not overwrite.
      Packages: all needed packages are already installed.
      getsebool:  SELinux is disabled
            Maybe you need to upgrade selinux-policy?


  6. Once selinux ​ is configured properly we can proceed with IPA Configuration.

  7. Make sure you have a ticket,  run kinit ​admin
  8. ​​Now that everything is read, run the following command to configure ipa
    1. [root@satellite.mydom.com ~]# spacewalk-setup-ipa-authentication
    2. Enabling authentication against [ipa.mydom.com].
      Keytab: [/etc/httpd/conf/http.keytab] already exists, will not refetch.
              Use [klist -kt /etc/httpd/conf/http.keytab] to verify its content.
      PAM service: File [/etc/pam.d/spacewalk], will not overwrite.
      Packages: all needed packages are already installed.
      Turning SELinux boolean [httpd_dbus_sssd] on ...
              ... done.
      Turning SELinux boolean [allow_httpd_mod_auth_pam] on ...
              ... done.
      Configuring Apache modules.
      ** /etc/tomcat6/server.xml has been backed up to server.xml-swsave.ipa
      Stopping sssd:                                             [  OK  ]
      Starting sssd:                                             [  OK  ]
      Stopping tomcat6:                                          [  OK  ]
      Starting tomcat6:                                          [  OK  ]
      Stopping httpd:                                            [  OK  ]
      Starting httpd:                                            [  OK  ]
      Waiting for tomcat to be ready ...
      Authentication against [ipa.mydom.com] sucessfully enabled.
      As admin, at Admin > Users > External Authentication, select
                Default organization to autopopulate new users into.


  9. Once IPA Configuration is completed, login to satellite webUI as satadm and configured External Authentication for Admin Group
    • ​The unix/linux group admins will be used to allow team login and permissions to Satellite WebUI
  10. Go to Admin > Users > External Authentication > Configuration
    1. Select 'myOrg' for Default Orginization and click Update
  11. Click on Group Role Mapping tab and then click on  + Create External Group
    1. External Group Name:  Enter the external group admins
    2. Administrative Roles:    Select Organization Administrator
    3. Click Create  to save.
  12. Logout then login with your TID account that is member of admins group. Your login should succeed.

Wednesday, September 24, 2014

How to Update Client Hostname in Satellite

This page contains information about the How to Update Client Hostname in Satellite. When a hostname of a machine under a satellite is changed, the changes do not reflect in the satellite. - Deleting the machine with the old hostname and adding the system again fixes this issue, but doing this deletes all history and settings associated with the machine.
After changing the hostname of a satellite client run the following commands below to update and 'refresh' satellite.

  • Hostnames can be refreshed from within the satellite GUI by going to the Systems tab, clicking on the system, clicking the hardware sub-tab underneath the system name in the details page, and using the "Schedule hardware refresh" button at the top right.
  • This will refresh the hardware, usually immediately.
  • Also change the 'System Name'
  • Under Details >> Properties in the WebUI there is a "System Name" field . Edit these 'properties' to change to new/changed hostname
  • Run 'rhn-profile-sync -vv' on the client

Friday, August 8, 2014

How to Install Red Hat Subscription Manager from ISO

     Mount sam iso to server
  •    # mount -o loop sam.iso /mnt

     Install the packages with enhanced reporting option

  •       # cd /mnt
  •       #  ./install_packages --enhanced_reporting


Set OpenJDK – Java
  •          # yum install -y java-1.7.0-openjdk.x86_64
  •          # alternatives --config java

Run katello-configure
  •     # katello-configure --deployment=sam --org=Unigroup --user-pass=redhat

Check katello startup
  •          # chkconfig --list katello

Configure Mongod to start
  •          # chkconfig –list mongod
  •          # chckonfig mongod on
  •          # service mongod start

Start up katello
  •         # service katello start

Login to SAM URL
  •          http://localhost/sam

Tuesday, May 6, 2014

Configure Multiple Couchbase Instances

Reference



To get 2.5.0 with multiple instances run rpm2cpio as this

  •  rpm2cpio couchbase-server-enterprise_2.5.0_x86_64.rpm | cpio --extract --make-directories --no-absolute-filenames
  • Copy the extracted directory to /opt/couchbaseX

Create each instance here.


  • Instance 1 = /opt/couchbase and is default install and default files
  • Instance 2 = /opt/couchbaseX


Modified the following files

  • /etc/init.d/couchbase-server to /etc/init.d/couchbase-serverX linked to /opt/couchbaseX/bin/couchbase-server
  • /opt/couchbaseX/bin/couchbase-server and change the paths inside this file
  • /opt/couchbaseX/etc/couchbase/static_config and change paths to /opt/couchbaseX and add user-defined ports
  • /opt/couchbaseX/etc/couchbase_init.d file and change paths to /opt/couchbaseX

Change the ROOTDIR variable in this directory  /opt/couchbaseX/lib/erlang/bin for ‘erl’ and ‘start’ files.

  • erl:ROOTDIR=/opt/couchbaseb/lib/erlang
  • start:ROOTDIR=/opt/couchbaseb/lib/erlang
Start
  • cd /opt/couchbaseX/bin/
  • ./couchbase-server start

Friday, May 2, 2014

HTTP Status Codes

I can't always remember all the HTTP status Codes. I'm creating this blog post just to remember what they are. 



1xx: Informational - Request received, continuing process
2xx: Success - The action was successfully received, understood, and accepted
3xx: Redirection - Further action must be taken in order to complete the request
4xx: Client Error - The request contains bad syntax or cannot be fulfilled
5xx: Server Error - The server failed to fulfill an apparently valid request


While many of these are common (404, 200, 403) many are not and hard to remember. This list is modified from the wc3 and the wikipedia.


1xx informational

100
Client should continue with request

101
Server is switching protocols

102
Server has received and is processing the request

103
Resume aborted PUT or POST requests

122
URI is longer than a maximum of 2083 characters

2xx success

200
standard response for successful HTTP requests

201
request has been fulfilled; new resource created

202
Request accepted, processing pending

203
Request processed, information may be from another source

204
Request processed, no content returned

205
Request processed, no content returned, reset document view

206
Partial resource return due to request header

207
XML, can contain multiple separate responses

208
results previously returned

226
request fulfilled, response is instance-manipulations

3xx redirection

300
multiple options for the resource delivered

301
this and all future requests directed to the given URI

302
temporary response to request found via alternative URI

303
permanent response to request found via alternative URI

304
resource has not been modified since last requested

305
content located elsewhere, retrieve from there

306
subsequent requests should use the specified proxy

307
connect again to different URI as provided

308
connect again to a different URI using the same method

4xx client error

400
request cannot be fulfilled due to bad syntax

401
Authentication is possible but has failed

402
Payment required, reserved for future use

403
Server refuses to respond to request

404
Requested resource could not be found

405
Request method not supported by that resource

406
Content not acceptable according to the Accept headers

407
client must first authenticate itself with the proxy

408
server timed out waiting for the request

409
request could not be processed because of conflict

410
resource is no longer available and will not be available again

411
request did not specify the length of its content

412
server does not meet request preconditions

413
request is larger than the server is willing or able to process

414
URI provided was too long for the server to process

415
server does not support media type

416
Client has asked for unprovidable portion of the file

417
Server cannot meet requirements of Expect request-header field

420
Twitter rate limiting

422
Request unable to be followed due to semantic errors

423
Resource that is being accessed is locked

424
Request failed due to failure of a previous request

426
Client should switch to a different protocol

428
origin server requires the request to be conditional

429
user has sent too many requests in a given amount of time

431
server is unwilling to process the request

444
server returns no information and closes the connection

449
request should be retried after performing action

450
Windows Parental Controls blocking access to webpage

451
The server cannot reach the client's mailbox.

499
connection closed by client while HTTP server is processing

5xx server error

500
generic error message

501
server does not recognise method or lacks ability to fulfill

502
server received an invalid response from upstream server

503
server is currently unavailable

504
gateway did not receive response from upstream server

505
server does not support the HTTP protocol version

506
Content negotiation for the request results in a circular reference

507
Server is unable to store the representation

508
Server detected an infinite loop while processing the request

509
Bandwidth limit exceeded

510
Further extensions to the request are required

511
Client needs to authenticate to gain network access

598
network read timeout behind the proxy

599
network connect timeout behind the proxy


Wednesday, April 30, 2014

I passed Red Hat's Exam 436 today, Certificate of Expertise in Clustering and Storage Management.  Now on to my RHCDS and hope to pass the Satellite exam next. I really enjoy taking Red Hat exams as they are a great challenge since they are all hands on and you have to configure everything. I highly recommend any one interested in learning more about Linux and any of Red Hat products to take their training classes and/or take their exams.






Monday, February 10, 2014

New Red Hat Overview of RHN Satellite

Red Hat has recently released a new overview of RHN Satellite 5.6. The overview discusses getting started with Red Hat Satellite Server 5.6, new features such as PosgreSQL support, provisioning and auditing improvements and API information. Please read the full article located here https://access.redhat.com/site/articles/708153  (please note a Red Hat login is required.)

Friday, February 7, 2014

RHEL's New and Improved Installation Experience.

Red Hat Enterprise Blog has a new post today about the new and improved installation experience. Please see the post at this page http://rhelblog.redhat.com/2014/02/07/anaconda/

For a RHEL 7 Beta Install Guide see my post here "How to Install Red Hat Enterprise Linux Beta 7"


Thursday, January 30, 2014

How to Install RHN Satellite Server



This document will explain how to install, build, and configure a Red Hat Satellite Server.  This document will also explain many of the requirements for Satellite and options for installations, channels, kickstart profiles, etc...  
Section I: Installation 
1.  Follow the RHN Satellite Installation Guide on Redhat Portal. 
2.  Build VM with necessary requirements. 
1.      Choose Stand Alone DB vs Embedded DB (same machine) 
2.      For Stand Alone RHN Satellite only support Oracle 10g
 
3.  Download the ISO Image for installing RHEL 6 from RHN  
4.  Download the ISO Image for RHN Satellite 5.4 from RHN 
2.      While still logged into the RHN website, download the Channel Content ISOs to be served by your Satellite
 
5.  Install Red Hat Enterprise Linux and then RHN Satellite on the Satellite machine. 
1.      Recommended - 5gb + for OS 
2.      30gb per Channel in /var/satellite 
3.      12gb for DB in /rhnsat
 
6.  Mount the RHN Satellite ISO through VMware then mount it in satellite server 
1.      [root@mysat /]# mount /dev/cdrom /media 
2.      [root@mysat media]# ./install.pl 
3.      * Starting the Red Hat Network Satellite installer.
* Performing pre-install checks.
* Pre-install checks complete.  Beginning installation.
* RHN Registration.
RHN Username? todd.walters
RHN Password?
HTTP Proxy Hostname?
RHN Profile Name [mysat.mydom.com]?
* Checking for uninstalled prerequisites.
** Checking if yum is available ...
There are some packages from Red Hat Enterprise Linux that are not part
of the @base group that Satellite will require to be installed on this
system. The installer will try resolve the dependencies automatically.
However, you may want to install these prerequisites manually.
Do you want the installer to resolve dependencies [y/N]? y
* Applying updates.
* Installing RHN packages.

 


You should have the following technical documents in hand for use in roughly this order:  
1.   The RHN Satellite Installation Guide — This guide, which you are now reading, provides the essential steps necessary to get an RHN Satellite up and running.  
2.   The RHN Client Configuration Guide — This guide explains how to configure the systems to be served by an RHN Proxy Server or RHN Satellite. (This will also likely require referencing The RHN Reference Guide, which contains steps for registering and updating systems.)  
3.   The RHN Channel Management Guide — This guide identifies in great detail the recommended methods for building custom packages, creating custom channels, and managing private Errata.  
4.   The RHN Reference Guide — This guide describes how to create RHN accounts, register and update systems, and use the RHN website to its utmost potential. This guide will probably come in handy throughout the installation and configuration process.  
How to Install RHN Satellite Server 
Requirements 
·         Call RHN and Request Satellite Certificate (for Satellite 5.4) 
·         At least 120gb DiskSpace 
·         4-8gb RAM & 2CPU 
·         Access to RHN Customer Portal to Download the ISO’s. 
Configure /etc/hosts properly 
Hostname:           satserv  satserv.mydomain.com 
Proposed DNS:  satellite.mydomain.com 
VmWare:              Red Hat Primary Cluster 
IP Address:           192.168.4.180.  
Netmask:              255.255.252.0
Gateway:              192.168.4.1



more /etc/resolv.conf
nameserver      192.168.3.26
nameserver      192.168.4.25
nameserver      192.168.3.26

domain  mydomain.com 
[root@satserv ~]# pvs  
  PV         VG    Fmt  Attr PSize   PFree  
  /dev/sda2  satvg lvm2 a--  119.80g 50.80g  
Logical Volume Layout  
[root@satserv ~]# lvs  
  LV       VG    Attr     LSize  Pool Origin Data%  Move Log Copy%  Convert  
 optLV    satvg -wi-ao--  2.00g  
 rhnLV    satvg -wi-ao-- 10.00g  
 rootLV   satvg -wi-ao--  5.00g  
 satdbLV  satvg -wi-a--- 14.00g  
 swapLV   satvg -wi-ao--  4.00g  
 tmpLV    satvg -wi-ao--  2.00g  
 usrLV    satvg -wi-ao--  3.00g  
 varLV    satvg -wi-ao--  3.00g  
 varsatLV satvg -wi-ao-- 40. 
  
  
Logical Volume 
Mount Point 
Description 
optLV 
/opt 
Oracle db config files 
rhnLV 
/var/rhn/cache 
Cache for satellite (rec 10gb) 
rootLV 
/ 
Root Filesystem 
satdbLV 
/rhnsat 
Embedded DB (rec 12gb) 
swapLV 
Swap 
4gb 
tmpLV 
/tmp 
2gb 
usrLV 
/usr 
3gb 
varLV 
/var 
3gb 
varsatLV 
/var/satellite 
40gb (rec 30gb/per channel) 
  
FileSystem Layout 
[root@satserv /]# df -h 
Filesystem                                             Size        Used      Avail      Use%     Mounted on 
/dev/mapper/satvg-rootLV              5.0G      350M      4.4G       8%         / 
tmpfs                                                     1.9G        0             1.9G       0%          /dev/shm 
/dev/sda1                                             194M   32M         153M     18%        /boot 
/dev/mapper/satvg-optLV             2.0G         68M       1.9G       4%          /opt 
/dev/mapper/satvg-tmpLV            2.0G         68M        1.9G        4%        /tmp 
/dev/mapper/satvg-usrLV              3.0G        1.3G       1.6G       47%        /usr 
/dev/mapper/satvg-varLV              3.0G         110M    2.7G       4%          /var 
/dev/mapper/satvg-rhnLV              9.9G        151M     9.2G       2%          /var/cache/rhn 
/dev/mapper/satvg-varsatLV          40G        176M     38G        1%          /var/satellite 
/dev/mapper/satvg-satdbLV           14G        35M       14G        1%          /rhnsat 
  
[root@satserv /]# cat /etc/resolv.conf 
# Generated by NetworkManager 
search mydomain.com 
nameserver 192.168.4.1 
Create Local Admin Group 
# groupadd -g 1500 GroupAdmin

Create User Accounts & Add to Admin Group

[root@satserv /]# useradd -u 500 –G 1500 -d /home/twalters -c "Todd Walters " twalters

Modify /etc/sudoers
# User Privilege section
 # Add Local Admins

%AdminGroup  ALL=(ALL) NOPASSWD: ALL
  
Configure Initial Password 
# useradd –u 2001 -c 'John Doe' –d /home/jdoe jdoe  
# passwd jdoe  
Changing password for user jdoe.  
New password:  
Retype new password:  
passwd: all authentication tokens updated successfully.  
·         # chage -d 0 jdoe
  
·         When the user jdoe logs onto the system the first time, the user is prompted to change their password: 

Turn IPTables Off 
·         [root@satserv ~]# chkconfig iptables off 
·         # service iptables stop

Set SELinux to Disabled 
·         Change SELINUX=disabled  in /etc/sysconfig/selinux 
Begin RHN Satellite installation  
Copy myco.cert to /root  
Import GPG Key 
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Mount the RHN Satellite ISO to /dev/cdrom /media and change directory to /media and run install.pl

 * Starting the Red Hat Network Satellite installer.
 * Performing pre-install checks.
 * Pre-install checks complete.  Beginning installation.
 * RHN Registration.
 RHN Username? satadmin
 RHN Password?
 HTTP Proxy Hostname?
 RHN Profile Name [satserv.mydomain.com]?
 * Checking for uninstalled prerequisites.
 ** Checking if yum is available ...

There are some packages from Red Hat Enterprise Linux that are not part
 of the @base group that Satellite will require to be installed on this
 system. The installer will try resolve the dependencies automatically.
 However, you may want to install these prerequisites manually.
 Do you want the installer to resolve dependencies [y/N]? y
 * Applying updates.
 * Installing RHN packages.
 …continuing…

 Where is your satellite certificate file? /root/myco.cert

** Loading RHN Satellite Certificate.
** Verifying certificate locally.
** Activating RHN Satellite.
* Enabling Monitoring.
 * Configuring apache SSL virtual host.  

Should setup configure apache's default ssl server for you (saves original ssl.conf) [Y]?
** /etc/httpd/conf.d/ssl.conf has been backed up to ssl.conf-swsave
* Configuring tomcat.
** /etc/tomcat6/tomcat6.conf has been backed up to tomcat6.conf-swsave
 ** /etc/tomcat6/server.xml has been backed up to server.xml-swsave
 ** /etc/tomcat6/web.xml has been backed up to web.xml-swsave
 * Configuring jabberd.
 * Creating SSL certificates.
 CA certificate password?
 Re-enter CA certificate password?
 Organization? myco
 Organization Unit [satserv.mydomain.com]?
 Email Address [Todd_Walters@mydomain.com]?
 City? Anytown
 State? USA
 Country code (Examples: "US", "JP", "IN", or type "?" to see a list)? US
 ** SSL: Generating CA certificate.
 ** SSL: Deploying CA certificate.
 ** SSL: Generating server certificate.
 ** SSL: Storing SSL certificates.
 * Deploying configuration files.
 * Update configuration in database.
 * Setting up Cobbler..
 Cobbler requires tftp and xinetd services be turned on for PXE provisioning functionality. Enable these services [Y/n]? y
 * Restarting services.
 Installation complete.
 Visit https://satserv.mydomain.com to create the RHN Satellite administrator account.
 You have new mail in /var/spool/mail/root
   
Login to FQDN URL for Satellite
Complete ‘final’ configuration – Create Admin login

  Satellite Admin Account = satadmin
 
Go to RHN Satellite Configuration - General Configuration and verify the configuration
  
Yum install screen
 
Continue on to SatellitePost Installation Configuration document 
·         Cobbler INFO 
o    copy pxelinux.0 file from /usr/share/syslinux/ to /var/lib/tftpboot.
 
o    If you run cobbler get-loaders
Install syslinux rpm 
§  yum install syslinux.x86_64 
o    # cp -ruv /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/