Pejman Moghadam / Slackware

Slackware 13.1 - Installing dante socks server (with epkg)

Public domain


Installation - epkg

su - install
cd /usr/src/
wget ftp://ftp.inet.no/pub/socks/dante-1.2.2.tar.gz
tar xf dante-1.2.2.tar.gz
cd dante-1.2.2
./configure && make
make install DESTDIR=/usr/local/encap/dante-1.2.2
cd /usr/local/encap/dante-1.2.2
mv usr/local/share/man/ usr/
cd /usr/local/encap/
mkencap dante-1.2.2
logout
cd /usr/local/encap/
epkg dante-1.2.2

/etc/sockd.conf

logoutput: /var/log/sockd.log
internal: eth0 port = 1080
external: 172.16.20.1
method: none
clientmethod: none
user.privileged: sockd
user.notprivileged: sockd
user.libwrap: libwrap
#compatibility: sameport
#compatibility: reuseaddr
timeout.negotiate:60
timeout.io:86400

client pass {
  from: 172.16.20.0/24 port 1024-65535 to: 0.0.0.0/0
  log: connect disconnect
}

client pass {
  from: 192.168.0.0/24 port 1024-65535 to: 0.0.0.0/0
  log: connect disconnect
}

client pass {
  from: 10.0.0.0/24 port 1024-65535 to: 0.0.0.0/0
  log: connect disconnect
}

client block {
  from: 0.0.0.0/0 to: 0.0.0.0/0
  log: connect error
}

block {
  from: 0.0.0.0/0 to: 127.0.0.0/8
  log: connect error
}

pass {
  from: 0.0.0.0/0 to: 0.0.0.0/0 port gt 1023
  command: bind
  log: connect disconnect
}

pass {
  from: 0.0.0.0/0 to: 0.0.0.0/0
  command: connect udpassociate
  log: connect disconnect
}

pass {
  from: 0.0.0.0/0 to: 0.0.0.0/0
  command: bindreply udpreply
  log: connect error
}

block {
  from: 0.0.0.0/0 to: 0.0.0.0/0
  log: connect error
}

/etc/rc.d/rc.dante

#!/bin/sh
#
# /etc/rc.d/rc.dante
#

TIMEOUT=5
SOCKD="/usr/local/sbin/sockd"
PIDFILE="/var/run/sockd.pid"
LOGFILE="/var/log/sockd.log"
DANTELEADER=$(  ps axww | \
                grep ${SOCKD} | \
                grep -v grep | \
                awk '{print $3$1}' | \
                grep '^[SRDI]s' | \
                sed 's/^[SRDI]s//'  )  2>/dev/null

if [ -f ${PIDFILE} ]; then
  DANTEPID=$(cat ${PIDFILE}) 2>/dev/null
else
  DANTEPID=""
fi

start()
{
  if [ "${DANTELEADER}" != "" ]
  then
    echo "Dante is already running (pid = ${DANTELEADER})"
  else
    echo "Starting Dante SOCKS server"
    ${SOCKD} -D
  fi
}

stop()
{
  if [ "${DANTELEADER}" != "" ]
  then
    echo "Stopping Dante SOCKS server"
    kill -TERM "${DANTELEADER}"
    rm -f ${PIDFILE}
    DANTELEADER=""
    sleep ${TIMEOUT}
  fi
}

case "$1" in
  'start')
    start
    ;;

  'stop')
    stop
    ;;

  'restart')
    stop
    start
    ;;

  'rotate')
    echo -n "Rotating Dante log file ${LOGFILE} . . ."
    sleep 5
    DAY=`date +%a`
    cp "${LOGFILE}" "${LOGFILE}.${DAY}"
    echo > "${LOGFILE}"
    echo "Ok"
    ;;

  *)
    echo "usage $0 start|stop|restart|rotate"
    ;;

esac

/etc/rc.d/rc.local

# Start Dante SOCKS server:
if [ -x /etc/rc.d/rc.dante ]; then
  /etc/rc.d/rc.dante start
fi

/etc/rc.d/rc.local_shutdown

# Stop Dante SOCKS server:
if [ -x /etc/rc.d/rc.dante ]; then
  /etc/rc.d/rc.dante stop
fi

crontab -e

# Dante log rotation progress
00 0 * * * /etc/rc.d/rc.dante rotate

First time lunch

chmod +x /etc/rc.d/rc.local_shutdown
groupadd sockd
useradd -g sockd sockd
groupadd libwrap
useradd -g libwrap libwrap
touch /var/run/sockd.pid
chown sockd:sockd /var/run/sockd.pid
chmod +x /etc/rc.d/rc.dante
/etc/rc.d/rc.dante start

BY: Pejman Moghadam
TAG: dante, socks, epkg
DATE: 2010-10-29 00:06:28


Pejman Moghadam / Slackware [ TXT ]