voipmeister.com voip stuff matters and more

Mac file server on CentOS 5

Completely off topic for this site, but for my own future reference: how to build a Mac file server on a CentOS 5 machine

First you need to enable the EPEL repo as per instructions here: http://fedoraproject.org/wiki/EPEL

Then, we need to install atalk and avahi:

yum install netatalk avahi

Open the file /etc/atalk/AppleVolumes.default and add the following lines (replace USERNAME with the linux username(s) you wish to grant access to):

~/ "$u" allow:USERNAME cnidscheme:cdb
/home/USERNAME/TimeMachine TimeMachine allow:USERNAME cnidscheme:cdb options:usedots

The TimeMachine share will be visible once you login with the linux username and password. You can configure the share in Time Machine with a small change on the Apple machine. Open the file /etc/atalk/afpd.conf and add the following line:

g- -transall -uamlist uams_randnum.so,uams_dhx.so,uams_dhx2.so -nosavepassword -advertise_ssh

Create /etc/avahi/services/afpd.service and paste the data below in this file:

<?xml version="1.0" standalone='no'?><!--*-nxml-*-->
<!DOCTYPE service-group SYSTEM "avahi-service.dtd">
<service-group>
<name replace-wildcards="yes">%h</name>
<service>
<type>_afpovertcp._tcp</type>
<port>548</port>
</service>
<service>
<type>_device-info._tcp</type>
<port>0</port>
<txt-record>model=Xserve</txt-record>
</service>
</service-group>

Finally, restart the services:

service avahi-daemon restart 
service atalk restart

The new server should pop up in the finder window on your Mac. To be able to configure network shares in Time Machine, you need to run this command (not as root), it is a single line:

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

Edit on 2011-10-08

If you are unable to (re)start avahi-deamon AND you see this line in /var/log/messages:

dbus_bus_request_name(): Connection ":1.4" is not allowed to own the service "org.freedesktop.Avahi" due to security policies in the configuration file

Then you need to issue: service messagebus restart

Edit on 2011-10-14

Upgrading to Mac OS X Lion breaks this functionality if you don’t use a modified netatalk configuration. The error message shown in Lion’s Finder is:

"The version of the server you are trying to connect to is not supported. Please contact your system administrator to resolve the problem."

The problem is that the original netatalk EPEL rpm misses the configuration for DHX2. I was running Centos 5.7 i386 and obtained an updated rpm here: Fedora Build Netatalk RPM

Perl woes

Today I was working on a backup solution for multiple linux hosts. My intention was to install BackupPC, which requires some Perl modules. I used this command to interactively install perl modules:

perl -MCPAN -e shell

The first time you invoke this command, you’ll go through the setup procedure. In my case, installation of Compress-Raw-Zlib-2.033 failed at the make stage. Looks like I forgot to install make prior to going through the setup procedure. On top of that, the perl installation might not detect when it is installed later on. Here’s how to configure the path to make:

[root@srv-test build]# perl -MCPAN -e shell CPAN
cpan> o conf make /usr/bin/make
cpan> o conf commit
Tags: Linux, perl

Listening ports on Windows

Here’s how to find which ports are listening on a Windows host:

C:\>netstat -an |find /i "listening"
TCP    0.0.0.0:135            0.0.0.0:0              LISTENING
TCP    0.0.0.0:445            0.0.0.0:0              LISTENING
TCP    0.0.0.0:1559           0.0.0.0:0              LISTENING
TCP    0.0.0.0:8081           0.0.0.0:0              LISTENING
TCP    0.0.0.0:59021          0.0.0.0:0              LISTENING
TCP    127.0.0.1:1159         0.0.0.0:0              LISTENING
TCP    127.0.0.1:5152         0.0.0.0:0              LISTENING
TCP    127.0.0.1:5354         0.0.0.0:0              LISTENING
TCP    127.0.0.1:27015        0.0.0.0:0              LISTENING
TCP    127.0.0.1:62514        0.0.0.0:0              LISTENING

Using mutt on Mac OS X

Not kind of a VoIP related post, mainly posted for reference.

It is possible to use mutt on Mac OS X, You have 2 choices:

  1. Install mutt via macports
  2. Compile it yourself

Since I like to know what’s going on, I like compiling it from source. That’s what’s going to be described here. We will also look at macports to satisfy build dependencies, specifically for BerkeleyDB, which is used for the header cache. Furthermore, we’ll have a look at some nifty programs to interact with mutt.

1. Install macports

The macports project lives at http://www.macports.org, so head over there (more specific, go to http://www.macports.org/install.php to learn how to install macports on your Mac). Basically, you need to download a dmg image and mount it, after which you can install macports. After installation, the port binary lives in:

/opt/local/bin

For me, this location was added to the PATH variable after restarting (IIRC).

2. Install BerkelyDB

Next is the installation of BerkeleyDB for the header cache of mutt (which is supposed to speed up things a lot). Start the port binary as root, and install BerkeleyDB 4.7:

sudo /opt/local/bin/port
Password:
MacPorts 1.9.2
Entering interactive mode... ("help" for help, "quit" to quit)
[mutt/mutt-1.5.20] >install db47

If all went well, you’ll end up with BerkeleyDB 4.7 living in /opt/local. On to the compiling of mutt.

3. Download and extract mutt (side bar optional)

Download and extract mutt as follows:

curl -O ftp://ftp.mutt.org/mutt/devel/mutt-1.5.20.tar.gz
tar -zxpf mutt-1.5.20.tar.gz
cd mutt-1.5.20

While in the mutt directory, download and apply the sidebar patch if desired (OPTIONAL):

curl -O http://lunar-linux.org/~tchan/mutt/patch-1.5.20.sidebar.20090619.txt
patch -p1 <patch-1.5.20.sidebar.20090619.txt

Next, we need to tweak the configure script a bit, or you’ll end up with:

configure: error: You need Tokyo Cabinet, QDBM, GDBM or Berkeley DB4 for hcache

There are various suggestions to resolve this issue. None of the ones I found worked. What did work, was the tweak below (the tweak is necessary because the configure script doesn’t look for BerkeleyDB versions higher than 4.6):

vim configure

then, search for

BDB_VERSIONS="db-4 db4 db-4.6 db4.6 db46 db-4.5 db4.5 db45 db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db ''"

and replace it with:

BDB_VERSIONS="db-4.7 db4.7 db47 db-4 db4 db-4.6 db4.6 db46 db-4.5 db4.5 db45 db-4.4 db4.4 db44 db-4.3 db4.3 db43 db-4.2 db4.2 db42 db-4.1 db4.1 db41 db ''"

Please not the 4.7 variations at the beginning of the array. Now you can start compiling:

./configure --prefix=/sw --with-curses --with-regex --enable-locales-fix   --enable-pop --enable-imap --enable-smtp --with-sasl=/sw --enable-hcache --with-ssl --mandir=/sw/share/man
make
sudo make install

The software will be installed in /sw. Optionally, you may want to include this in your path or symlink from /usr/bin to binaries in /sw/bin.

References

Thanks to linsec.ca for the idea: http://linsec.ca/Using_mutt_on_OS_X

Retrieve core dumps via the CLI on CUCM

If Alert Central in the Real Time Monitoring Tool shows that there are core dumps, you can list them via the CLI.

admin:utils core list

    Size         Date            Core File Name
=================================================================
298200 KB   2010-11-24 17:36:51   core.13869.11.cef.1290616611
admin:

This is the equivalent of:

admin:file list activelog /core
<dir>   analyze
core.13869.11.cef.1290616611
dir count = 1, file count = 1
admin:

The latter has the advantage that you know the absolute path, which you need when you want to retrieve the file.

The file can be retrieved via the RTMT as well as via the CLI. All you need is an SFTP server on which you have write access, in this case I used a CentOS server running openssh. Here it goes:

admin:file get activelog /core/core.13869.11.cef.1290616611
Please wait while the system is gathering files info ...done.
Sub-directories were not traversed.
Number of files affected: 1
Total size in Bytes: 305356800
Total size in Kbytes: 298200.0
Would you like to proceed [y/n]? y
SFTP server IP: 10.133.133.133
SFTP server port [22]:
User ID: root
Password: ***********

Download directory: /root

The authenticity of host '10.133.133.133 (10.133.133.133)' can't be established.
RSA key fingerprint is 5b:8b:28:78:86:3d:9c:48:c9:2b:5e:42:e9:dd:bc:1d.
Are you sure you want to continue connecting (yes/no)? yes
.
Transfer completed.
admin:

Please not that the RSA key needs to be stored only once, it is presented upon the first connection you make with the SFTP server.