2009-11-19 15:24:57 +00:00
|
|
|
#!/bin/sh
|
2016-01-17 06:32:35 +00:00
|
|
|
AUTHBIND_ENABLED=no
|
2016-09-18 11:54:23 +00:00
|
|
|
COWRIEDIR=$(dirname $0)
|
2016-10-24 11:21:32 +00:00
|
|
|
PIDFILE="var/run/cowrie.pid"
|
2016-09-18 11:54:23 +00:00
|
|
|
export PYTHONPATH=${PYTHONPATH}:${COWRIEDIR}
|
2016-12-20 07:15:28 +00:00
|
|
|
#Change the below to -n to disable daemonizing (for instance when using supervisor)
|
|
|
|
DAEMONIZE=""
|
2009-11-19 15:24:57 +00:00
|
|
|
|
2014-08-11 17:39:26 +00:00
|
|
|
set -e
|
2016-09-18 11:54:23 +00:00
|
|
|
cd ${COWRIEDIR}
|
2014-06-10 07:09:44 +00:00
|
|
|
|
2014-08-11 17:39:26 +00:00
|
|
|
if [ "$1" != "" ]
|
|
|
|
then
|
|
|
|
VENV="$1"
|
|
|
|
|
|
|
|
if [ ! -d "$VENV" ]
|
|
|
|
then
|
|
|
|
echo "The specified virtualenv \"$VENV\" was not found!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ ! -f "$VENV/bin/activate" ]
|
|
|
|
then
|
|
|
|
echo "The specified virtualenv \"$VENV\" was not found!"
|
|
|
|
exit 2
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Activating virtualenv \"$VENV\""
|
|
|
|
. $VENV/bin/activate
|
|
|
|
fi
|
|
|
|
|
2016-12-20 07:15:28 +00:00
|
|
|
echo "Starting cowrie with extra arguments [$XARGS $DAEMONIZE] ..."
|
2016-01-18 01:26:48 +00:00
|
|
|
if [ $AUTHBIND_ENABLED = "no" ]
|
2016-01-17 06:32:35 +00:00
|
|
|
then
|
2016-12-20 07:15:28 +00:00
|
|
|
twistd $XARGS $DAEMONIZE -l log/cowrie.log --umask 0077 --pidfile ${PIDFILE} cowrie
|
2016-01-17 06:32:35 +00:00
|
|
|
else
|
2016-12-20 07:18:24 +00:00
|
|
|
authbind --deep twistd $DAEMONIZE $XARGS -l log/cowrie.log --umask 0077 --pidfile ${PIDFILE} cowrie
|
2016-01-17 06:32:35 +00:00
|
|
|
fi
|