DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2008-12-21 20:54:10

humble
New member
Registered: 2008-12-10
Posts: 2

Postfix + Procmail on DNS-323 funplug package

I wanted a small smtp mailserver, but couldn't find any ready made package from fonz. Asked him on IRC and he suggested postfix. With few hurdles finally made it work.

The package is available here http://www.mediafire.com/?3f2e1tdjxxu

The package assumes the following

groupadd -g 1001 postdrop
useradd -u 1000 postfix

I guess Postfix uses /bin/find and it fails for some reason I couldn't find. So I soft linked

mv /bin/find /bin/find.org
ln -s /ffp/bin/find /bin/find

The package won't work out of the box as it requires some configuration changes /ffp/etc/postfix/main.cf

If somebody wants to compile from source, please follow the steps below.

# ffp find
mv /bin/find /bin/find.org
ln -s /ffp/bin/find /bin/find

#Install following fun plug packages from fonz site
#gcc, db42, make, kernel-headers-2.6.9.1-2, binutils-2.18.50.0.1-4, perl-5.10-2

# Berkeley db soft link
mkdir /usr/include
mkdir /usr/lib
ln -s /mnt/HD_a2/ffp/include/db.h /usr/include/db.h
ln -s /ffp/lib/libdb.so /usr/lib/libdb.so
ln -s /ffp/lib/libdb-4.2.so /usr/lib/libdb-4.2.so

# Disable NIS since it doesn't compile as it requires somd dependency and not required as well
# found this tip through gentoo
sed -i -e "s|#define HAS_NIS|//#define HAS_NIS|g" src/util/sys_defs.h

make makefiles CCARGS='-DDEF_CONFIG_DIR=\"/ffp/etc/postfix\" -DDEF_COMMAND_DIR=\"/ffp/sbin\" -DDEF_DAEMON_DIR=\"/ffp/usr/libexec/postfix\" -DDEF_DATA_DIR=\"/ffp/var/lib/postfix\" -DDEF_MAILQ_PATH=\"/ffp/bin/mailq\" -DDEF_HTML_DIR=\"no\" -DDEF_MANPAGE_DIR=\"/ffp/share/man\" -DDEF_NEWALIAS_PATH=\"/ffp/bin/newaliases\" -DDEF_QUEUE_DIR=\"/ffp/var/spool/postfix\" -DDEF_README_DIR=\"no\" -DDEF_SENDMAIL_PATH=\"/ffp/sbin/sendmail\"'

make

# if you see some messages like below, don't worry, they are just directives
#gcc  -Wmissing-prototypes -Wformat -g -o -I.  -I../../Include -DLINUX2 -c ...

make install

groupadd -g 1001 postdrop
useradd -u 1000 postfix

chown -R postfix /ffp/var/spool/postfix
chgrp -R postdrop /ffp/var/spool/postfix
chown root /ffp/var/spool/postfix

chgrp postdrop /ffp/sbin/postqueue /ffp/sbin/postdrop
chmod 777 /ffp/sbin/postqueue /ffp/sbin/postdrop
chmod g+s /ffp/sbin/postdrop /ffp/sbin/postqueue

vi /ffp/etc/postfix/aliases
postmap /ffp/etc/postfix/aliases
ln -s /ffp/etc/postfix/aliases.db /etc/aliases.db

touch /ffp/etc/postfix/relay_recipients
postmap /ffp/etc/postfix/relay_recipients

postfix check  # shouldn't give any error message

Hope this will be useful for somebody.

Offline

 

#2 2009-01-11 14:17:53

Vinnux
New member
Registered: 2009-01-11
Posts: 3

Re: Postfix + Procmail on DNS-323 funplug package

I can confirm that the above installation works.
I have managed to setup my CH3SNAS as a backup mailserver for all of my domains.

Offline

 

#3 2009-01-28 21:05:36

madpenguin
Member
Registered: 2008-12-25
Posts: 77

Re: Postfix + Procmail on DNS-323 funplug package

I cleaned this up a tad and made a build script if anyone is interested. Fixed all the symlinking to host issues and added auto detection for ssl/cyrus/pcre/ldap support. Sending mail in the clear isn't such a hot thing to do... I might tweak it a little more depending on any issues I hit down the road but it should be done for the most part.

if your using the busybox wget, remove the -N switch. The rest _should_ build fine on a stock funplug.

After building/installing, edit your aliases file and then run:
postfix set-permissions
postalias /ffp/etc/postfix/aliases # NOT postmap!
postfix check

Ofcourse the configuration process can involve a lot more than that but that's the general idea.

http://www.jaguarlinux.com/pub/DNS-323/postfix.build

Code:

#!/ffp/bin/bash
#
# postfix build script for funplug
#
# I'm not renaming any binaries or manpages so watch
# out for conflicts if you install sendmail...

set -e
CWD=`pwd`
PKGNAME=postfix
PKG=$CWD/package-$PKGNAME
VERSION=2.5.6
BUILD=1
TAG=jag
PKGDIR=/ffp/var/cache/packages
URL=ftp://postfix.cloud9.net/official
CLEANUP=yes

# Make the package directory if not found:
if [ ! -d $PKGDIR ]; then
   mkdir -p $PKGDIR
fi

# Grab the source:
( mkdir -p source && cd source
  wget -N $URL/$PKGNAME-$VERSION.tar.gz )

rm -rf $PKG
mkdir -p $PKG

# Go ahead and create this here but it would probably
# be better off in a startup or post-install script
# Same goes for "postfix {set-permissions,upgrade-configuration}
if ! grep postdrop /etc/group > /dev/null 2>&1 ; then
  groupadd -g 40 -r postdrop
  mark=1
fi
if ! grep postfix /etc/group > /dev/null 2>&1 ; then
  groupadd -g 41 -r postfix
  mark=1
fi
if ! grep mail /etc/group > /dev/null 2>&1 ; then
  groupadd -g 42 -r mail
  mark=1
fi
if ! grep postfix /etc/passwd > /dev/null 2>&1 ; then
  # Ignore /ffp/etc/default/useradd output about GID
  useradd -d /ffp/var/spool/postfix -s /bin/false -g postfix -G mail -r -u 41 postfix
  mark=1
fi
[[ $mark == 1 ]] && store-passwd.sh

echo
echo "$PKGNAME-$VERSION source is now extracting..."
rm -rf $PKGNAME-$VERSION
tar xf $CWD/source/$PKGNAME-$VERSION.tar.gz
cd $PKGNAME-$VERSION
chown -R root:root .
# Berkley DB
[[ -f /ffp/include/db.h ]] && \
   sed -i "s@usr/include/db/@ffp/include/@" makedefs && \
   sed -i "s@I/usr/include/db@I/ffp/include -L/ffp/lib@" makedefs
# Uclibc
[[ ! -f /ffp/lib/libnss_nis.a ]] && \
   sed -i -e "s|#define HAS_NIS|//#define HAS_NIS|g" src/util/sys_defs.h
# Openldap
[[ -L /ffp/lib/libldap.so ]] && \
   EXTRAARGS="-DHAS_LDAP -DLDAP_DEPRECATED=1" && \
   EXTRALIBS="-lldap -llber"
# Openssl (EXTRALIBS are from fonz's openssl.pc (micro=h))
[[ -L /ffp/lib/libssl.so ]] && \
   EXTRAARGS="$EXTRAARGS -DUSE_TLS" && \
   EXTRALIBS="$EXTRALIBS -lssl -lcrypto -ldl -lz"
# pcre
[[ -f /ffp/include/pcre.h ]] && \
   EXTRAARGS="$EXTRAARGS -DHAS_PCRE" && \
   EXTRALIBS="$EXTRALIBS -lpcre"
# cyrus-sasl (v2 only for this script)
[[ -L /ffp/lib/libsasl2.so ]] && \
   EXTRAARGS="$EXTRAARGS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I/ffp/include/sasl" && \
   EXTRALIBS="$EXTRALIBS -L/ffp/lib/sasl2 -lsasl2"
# Now append it all to makedefs
sed -i "s@ffp/lib@ffp/lib $EXTRAARGS@" makedefs

# Change some things around:
sed -i 's@^#alias_maps = hash:/etc/aliases$@alias_maps = hash:/ffp/etc/postfix/aliases@' conf/main.cf
sed -i 's@^#alias_database = hash:/etc/aliases$@alias_database = hash:/ffp/etc/postfix/aliases@' conf/main.cf
sed -i 's@etc/postfix/relay_recipients@ffp/etc/postfix/relay_recipients@' conf/main.cf

# Change the PATH: (busybox sucks)
sed -i 's@^PATH.*$@PATH=/ffp/sbin:/usr/sbin:/sbin:/ffp/bin:/usr/bin:/bin@' \
   conf/post-install
sed -i '/^umask 022/a\PATH=/ffp/sbin:/usr/sbin:/sbin:/ffp/bin:/usr/bin:/bin' \
   conf/postfix-script

CCARGS='-DDEF_CONFIG_DIR=\"/ffp/etc/postfix\" -DDEF_COMMAND_DIR=\"/ffp/sbin\" -DDEF_DAEMON_DIR=\"/ffp/libexec/postfix\" -DDEF_DATA_DIR=\"/ffp/var/lib/postfix\" -DDEF_MAILQ_PATH=\"/ffp/bin/mailq\" -DDEF_HTML_DIR=\"/ffp/share/doc/postfix/html\" -DDEF_MANPAGE_DIR=\"/ffp/share/man\" -DDEF_NEWALIAS_PATH=\"/ffp/bin/newaliases\" -DDEF_QUEUE_DIR=\"/ffp/var/spool/postfix\" -DDEF_README_DIR=\"/ffp/share/doc/postfix/README\" -DDEF_SENDMAIL_PATH=\"/ffp/sbin/sendmail\"' \
AUXLIBS="$EXTRALIBS" \
make -f Makefile.init makefiles
make OPT="-march=armv5te -O2"
sh postfix-install -non-interactive \
    install_root=$PKG \
    mail_owner=postfix \
    setgid_group=postdrop

# Strip:
( cd $PKG
  find . | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
  find . | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null )

# Build the package:
cd $PKG
tar czf $PKGDIR/$PKGNAME-$VERSION-$BUILD$TAG.tgz *
echo && echo "Your package is in $PKGDIR" && echo

# Clean up:
[[ $CLEANUP == yes ]] && \
   rm -rf $CWD/$PKGNAME-$VERSION $CWD/package-$PKGNAME

exit 1

Last edited by madpenguin (2009-01-28 21:14:37)

Offline

 

#4 2009-11-11 04:18:47

jamesc
New member
Registered: 2009-11-11
Posts: 2

Re: Postfix + Procmail on DNS-323 funplug package

The original postfix package is no longer available on mediafire.  Does anyone have it?  I can host it.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB