CentOS named debug logging

I need to debug my DNS and the best way to do so is via logging. Therefore:

[root@cmlin02 ~]# vi /etc/named.conf

...

logging {
  channel "default_syslog" {
    #syslog local6;
    file "/var/log/named/named.log" versions 3 size 5m;
    severity debug;
  };

  category default { default_syslog; };
  category general { default_syslog; };
  category config { default_syslog; };
  category security { default_syslog; };
  category resolver { default_syslog; };
  category xfer-in { default_syslog; };
  category xfer-out { default_syslog; };
  category notify { default_syslog; };
  category client { default_syslog; };
  category network { default_syslog; };
  category update { default_syslog; };
  #category queries { default_syslog; };
  category lame-servers { default_syslog; };
};
...
[root@cmlin02 ~]# service named restart
Stopping named: .                                          [  OK  ]
Starting named:                                            [  OK  ]
[root@cmlin02 ~]# tail -f /var/log/named/named.log 
...

Purge OpenLDAP & reimport

 

PURGE LDAP & REIMPORT

1) Export existing ldap

[root@lin02 ldap]# ldapsearch -x -b dc=domain,dc=com > /tmp/ldap_backup_20120621.ldif
…

2) Edit your export to look as you wish.
3) Remove existing db

[root@lin02 ldap]# service slapd stop
Stopping slapd: [ OK ]
[root@lin02 ldap]# rm -fr /var/lib/ldap/*

4) Import file

[root@lin02 ldap]# service ldap start
[root@lin02 ldap]# ldapadd -x -W -D cn=root,dc=domain,dc=com -f /tmp/ldap_new_20120621.ldif
Enter LDAP Password:
adding new entry "dc=domain,dc=com"

Enable debug logging in OSX

So I wanted to increase my logging while attempting to setup LDAP auth in OSX.

HOWTO: Edit /etc/syslog.conf & add
*.*     /var/log/debug.log

cmosx01:~ cmuser$ vi /etc/syslog.conf
...

*.*                     /var/log/debug.log

Now you can tail -f /var/log/debug.log & see what’s going on.

cmosx01:~ cmuser$ tail -f /var/log/debug.log 
Jun 20 13:33:22 cmosx01 sshd[9043]: USER_PROCESS: 9045 ttys001
Jun 20 13:33:32 cmosx01 su[9051]: in pam_sm_authenticate(): authentication failed
Jun 20 13:33:34 cmosx01 su[9051]: in pam_sm_authenticate(): OpenDirectory - The authtok is incorrect.
Jun 20 13:33:34 cmosx01 su[9051]: BAD SU user to root on /dev/ttys001
Jun 20 13:34:45 cmosx01 launchproxy[9053]: /usr/libexec/sshd-keygen-wrapper: Connection from: 192.168.0.32 on port: 50189
Jun 20 13:34:45 cmosx01 sshd[9055]: Connection closed by 192.168.0.32

centos /etc/resolv.conf resets itself on reboot

On centos, everytime I reboot /etc/resolv.conf resets itself. Turns out it is the PEERDNS var inside the network config.

[root@cmlin02 ~]# more /usr/share/doc/initscripts-9.03.27/sysconfig.txt
PEERDNS=yes|no

modify /etc/resolv.conf if peer uses msdns extension (PPP only) or
DNS{1,2} are set, or if using dhclient. default to “yes”.

[root@cmlin02 ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0 | grep PEERDNS
[root@cmlin02 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
...
PEERDNS=no
...

then reboot

Managing Linux Services

Red Hat / CentOS

  1. Display all the available services
    /sbin/chkconfig --list
  2. Enable the service
    /sbin/chkconfig [name] on
  3. Disable the service
    /sbin/chkconfig [name] off
  4. Start the background service
    /sbin/service [name] start
  5. Stop the background service
    /sbin/service [name] stop
  6. Restart the background service
    /sbin/service [name] restart
  7. Display the background service status
    /sbin/service [name] status

Ubuntu

  1. Display all the available services
    N/A
  2. Enable the service
    /usr/sbin/update-rc.d [name] defaults
  3. Disable the service
    /usr/sbin/update-rc.d -f [name] remove
  4. Start the background service
    /usr/sbin/service [name] start
  5. Stop the background service
    /usr/sbin/service [name] stop
  6. Restart the background service
    /usr/sbin/service [name] restart
  7. Display the background service status
    /usr/sbin/service [name] status