LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 07-01-2023, 07:37 PM   #1
camerabambai
Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 408

Rep: Reputation: 54
What's wrong with my configuration on nagios and kerberos?


I want to setup a service to check the kdc with nagios.
With my kdc (samba4) I create the user using this script

Code:
 #!/bin/bash
    
    USER=nagioskerberos
    DOMAIN=myhost.priv
    SERVICE=nagioskerberos
    FQDN=nagios1.myhost.priv
    
    samba-tool user delete $USER
    samba-tool user create $USER --random-password
    samba-tool user setexpiry $USER --noexpiry
    net ads enctypes set $USER 16
    samba-tool spn add $SERVICE/$FQDN $USER
    samba-tool domain exportkeytab $USER.keytab --principal=$SERVICE/$FQDN
then I copy the keytab on nagios server and restart service

Code:
    scp nagioskerberos.keytab nagios1:
    ssh nagios1
    systemctl restart nagios
the permissions are ok

Code:
ls -lhd /etc/nagios/nagios.*tab
    -rw------- 1 nagios nagios 101 Jul  2 02:25 /etc/nagios/nagios.keytab
the keys seems ok

Code:
klist -ke /etc/nagios/nagios.keytab 
    Keytab name: FILE:/etc/nagios/nagios.keytab
    KVNO Principal
    ---- --------------------------------------------------------------------------
       2 nagioskerberos/nagios1.myhost.priv@MYHOST.PRIV (aes256-cts-hmac-sha1-96)
But when I try to check...

Code:
    ./check_kdc -k /etc/nagios/nagios.keytab  -p nagioskerberos/nagios1.myhost.priv@MYHOST.PRIV -H samba4 -P 88
    CRITICAL Getting Kerberos ticket: kinit: Client 'nagioskerberos/nagios1.myhost.priv@MYHOST.PRIV' not found in Kerberos database while getting initial credentials (credentials for nagioskerberos/nagios1.myhost.priv@MYHOST.PRIV from /etc/nagios/nagios.keytab)
Why?

This is the krb5.conf for server samba4 and server nagios

Code:
 [libdefaults]
    	default_realm = MYHOST.PRIV
    	dns_lookup_realm = true
    	dns_lookup_kdc = true
    	default_tgs_enctypes = aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96
        default_tkt_enctypes = aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96
        permitted_encryptes = aes256-cts-hmac-sha1-96 aes128-cts-hmac-sha1-96
 
Old 07-01-2023, 07:55 PM   #2
camerabambai
Member
 
Registered: Mar 2010
Distribution: Slackware
Posts: 408

Original Poster
Rep: Reputation: 54
Solution found.

First I change my script

from

Code:
    net ads enctypes set $USER 16
to

Code:
    net ads enctypes set $USER 24
I recreate the user.

BEFORE export the tab and copy I did this

Code:
    samba-tool user edit nagioskerberos
modify this line

Code:
    userPrincipalName: nagioskerberos/nagios1.myhost.priv@MYHOST.PRIV
exit..

Copy the keytab, restart nagios and...

Code:
./check_kdc -k /etc/nagios/nagios.keytab -p nagioskerberos/nagios1.myhost.priv@MYHOST.PRIV -H samba4 -P 88
    OK
 
  


Reply

Tags
kerberos, nagios



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Nagios and Oreon (Nagios web front end) installation and Configuration LXer Syndicated Linux News 1 05-31-2016 07:26 AM
Nagios with Kerberos authentication issue dcato Linux - Newbie 1 12-20-2012 11:07 AM
nagios not working (http://localhost/nagios or http://ip/nagios) 404 error connect2janu Linux - Server 1 11-18-2012 02:06 AM
ssh and kerberos error: Server not found in Kerberos database Felipe Linux - Server 1 01-17-2011 03:12 AM
LXer: Nagios 2.5 and Oreon 1.3 (Nagios web front end) installation with screenshots LXer Syndicated Linux News 0 08-11-2006 05:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration