forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
361 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
test: | ||
go test ./... | ||
|
||
# Build templates for all supported operating systems. | ||
build: | ||
GOOS=linux GOARCH=amd64 go build -o debian/velociraptor/usr/lib/velociraptor/velociraptor ./bin/ | ||
zip -r templates/velociraptor_linux_amd64.zip debian/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
velociraptor (0.1.0-1) unstable; urgency=low | ||
|
||
* Initial release | ||
|
||
-- velociraptor <support@velocidex.com> Sat, 19 May 2018 09:51:10 +0000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Source: velociraptor | ||
Section: misc | ||
Priority: extra | ||
Maintainer: Velocidex Innovations <support@velocidex.com> | ||
Build-Depends: debhelper (>= 7.0.0) | ||
Standards-Version: 3.9.2 | ||
Homepage: https://gitlab.com/velocidex/velociraptor | ||
|
||
Package: velociraptor | ||
Architecture: any | ||
Depends: lsb-base (>= 3.2-14) | ||
Description: Velociraptor Response Client | ||
The Velociraptor Response Client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
Format: http://dep.debian.net/deps/dep5 | ||
Upstream-Name: velociraptor | ||
Source: https://gitlab.com/velocidex/velociraptor | ||
|
||
Files: * | ||
Copyright: 2018 Velocidex Innovations | ||
License: Apache-2.0 | ||
|
||
Files: debian/* | ||
Copyright: 2018 Velocidex Innovations | ||
License: Apache-2.0 | ||
|
||
License: Apache-2.0 | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
. | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
. | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
. | ||
On Debian systems, the complete text of the Apache version 2.0 license | ||
can be found in "/usr/share/common-licenses/Apache-2.0". |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/make -f | ||
# -*- makefile -*- | ||
# Sample debian/rules that uses debhelper. | ||
# This file was originally written by Joey Hess and Craig Small. | ||
# As a special exception, when this file is copied by dh-make into a | ||
# dh-make output file, you may use that output file without restriction. | ||
# This special exception was added by Craig Small in version 0.37 of dh-make. | ||
|
||
# Uncomment this to turn on verbose mode. | ||
# export DH_VERBOSE=1 | ||
|
||
%: | ||
dh $@ | ||
|
||
override_dh_clean: | ||
# Nothing to do here, directory is already wiped and set up. | ||
|
||
override_dh_build: | ||
# Nothing to do here, directory is already wiped and set up. | ||
|
||
override_dh_prep: | ||
# Nothing to do here, directory is already wiped and set up. | ||
|
||
override_dh_link: | ||
dh_link "/usr/lib/velociraptor/velociraptor" "/usr/sbin/velociraptor" | ||
dh_link "/usr/lib/velociraptor/nanny.sh" "/usr/sbin/velociraptor.nanny" | ||
|
||
override_dh_builddeb: | ||
# Older distros don't support xz so we use gzip instead. | ||
dh_builddeb -- -Zgzip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
#! /bin/sh | ||
### BEGIN INIT INFO | ||
# Provides: velociraptor_client | ||
# Required-Start: $network $named $local_fs $syslog | ||
# Required-Stop: $network $named $local_fs $syslog | ||
# Should-Start: | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Description: velociraptor linux amd64 | ||
### END INIT INFO | ||
|
||
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" | ||
DESC="velociraptor linux amd64" | ||
NAME="velociraptor-client" | ||
DAEMON="/usr/sbin/velociraptor" | ||
DAEMON_ARGS="client" | ||
PIDFILE="/var/run/${NAME}.pid" | ||
SCRIPTNAME="/etc/init.d/${NAME}" | ||
|
||
[ -x "${DAEMON}" ] || exit 0 | ||
|
||
. /lib/init/vars.sh | ||
|
||
# Define various helper functions, needs lsb-base >= 3.2-14 | ||
. /lib/lsb/init-functions | ||
|
||
# If upstart or systemd is here, exit and let it handle everything. | ||
# The init_is_upstart requires lsb-base >= 4.1+Debian3, but we want to be able | ||
# to run on older systems, so if it isn't present we do the check ourselves. | ||
if type init_is_upstart >/dev/null 2>&1; then | ||
log_daemon_msg "Upstart is present and should be used instead, doing nothing." | ||
init_is_upstart && exit 0 | ||
elif [ -x /sbin/initctl ] && /sbin/initctl version | /bin/grep -q upstart; then | ||
log_daemon_msg "Upstart is present and should be used instead, doing nothing." | ||
exit 0 | ||
elif [ -x /bin/systemctl ]; then | ||
log_daemon_msg "Systemd is present and should be used instead, doing nothing." | ||
exit 0 | ||
fi | ||
|
||
# Parentheses are escaped since they confuse config_lib.InterpolateValue | ||
|
||
do_start() { | ||
start-stop-daemon --start \ | ||
--quiet \ | ||
--test \ | ||
--make-pidfile \ | ||
--pidfile ${PIDFILE} \ | ||
--startas ${DAEMON} -- ${DAEMON_ARGS} || return 1 | ||
|
||
start-stop-daemon --start \ | ||
--quiet \ | ||
--background \ | ||
--make-pidfile \ | ||
--pidfile ${PIDFILE} \ | ||
--startas ${DAEMON} -- ${DAEMON_ARGS} || return 2 | ||
} | ||
|
||
do_stop() { | ||
start-stop-daemon --stop \ | ||
--quiet \ | ||
--oknodo \ | ||
--retry=TERM/30/KILL/5 \ | ||
--pidfile ${PIDFILE} | ||
|
||
RETVAL="$?" | ||
|
||
[ "${RETVAL}" = 2 ] && return 2 | ||
|
||
rm -f ${PIDFILE} | ||
|
||
return "${RETVAL}" | ||
} | ||
|
||
do_reload() { | ||
start-stop-daemon --stop \ | ||
--quiet \ | ||
--pidfile ${PIDFILE} \ | ||
--signal HUP | ||
|
||
return 0 | ||
} | ||
|
||
case "$1" in | ||
start) | ||
[ "${VERBOSE}" != no ] && log_daemon_msg "Starting ${DESC}" "${NAME}" | ||
|
||
do_start | ||
|
||
case "$?" in | ||
0|1) | ||
[ "${VERBOSE}" != no ] && log_end_msg 0 | ||
;; | ||
|
||
2) | ||
[ "${VERBOSE}" != no ] && log_end_msg 1 | ||
;; | ||
esac | ||
;; | ||
|
||
stop) | ||
[ "${VERBOSE}" != no ] && log_daemon_msg "Stopping ${DESC}" "${NAME}" | ||
|
||
do_stop | ||
|
||
case "$?" in | ||
0|1) | ||
[ "${VERBOSE}" != no ] && log_end_msg 0 | ||
;; | ||
|
||
2) | ||
[ "${VERBOSE}" != no ] && log_end_msg 1 | ||
;; | ||
esac | ||
;; | ||
|
||
status) | ||
status_of_proc -p "${PIDFILE}" "${DAEMON}" "${NAME}" && exit 0 || exit $? | ||
;; | ||
|
||
reload|force-reload) | ||
log_daemon_msg "Reloading ${DESC}" "${NAME}" | ||
|
||
do_reload | ||
|
||
log_end_msg $? | ||
;; | ||
|
||
restart) | ||
log_daemon_msg "Restarting ${DESC}" "${NAME}" | ||
|
||
do_stop | ||
|
||
case "$?" in | ||
0|1) | ||
sleep 1 | ||
|
||
do_start | ||
|
||
case "$?" in | ||
0) | ||
log_end_msg 0 | ||
;; | ||
|
||
1|2) | ||
log_end_msg 1 | ||
;; | ||
esac | ||
;; | ||
|
||
2) | ||
log_end_msg 1 | ||
;; | ||
esac | ||
;; | ||
|
||
*) | ||
echo "Usage: ${SCRIPTNAME} {start|stop|status|restart|force-reload|reload}" >&2 | ||
|
||
exit 3 | ||
;; | ||
esac | ||
|
||
: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
NANNY="/usr/lib/velociraptor/nanny.sh" | ||
DAEMON="/usr/lib/velociraptor/velociraptor" | ||
DAEMON_ARGS="" | ||
|
||
# This package is designed to work on systems with init.d, upstart, and systemd. | ||
case "$1" in | ||
configure) | ||
/bin/chmod +x "${NANNY}" | ||
|
||
if [ -x /sbin/initctl ] && /sbin/initctl version | /bin/grep -q upstart; then | ||
# Early versions of upstart didn't support restarting a service that | ||
# wasn't already running: | ||
# https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/430883 | ||
/usr/sbin/service velociraptor stop 2>/dev/null || true | ||
/usr/sbin/service velociraptor start 2>/dev/null | ||
elif [ -x /bin/systemctl ]; then | ||
# Systemd | ||
/bin/systemctl enable velociraptor | ||
/bin/systemctl restart velociraptor | ||
elif [ -x "/etc/init.d/velociraptor" ]; then | ||
update-rc.d velociraptor defaults >/dev/null | ||
invoke-rc.d velociraptor start || exit $? | ||
fi | ||
;; | ||
|
||
abort-upgrade|abort-remove|abort-deconfigure) | ||
;; | ||
|
||
*) | ||
echo "postinst called with unknown argument \`$1'" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/sh | ||
|
||
# Remove broken upstart init script links if this is an upgrade and they link to | ||
# upstart-job. This fixes a problem where init scripts were wrongly linked to | ||
# upstart-job, like this: | ||
# | ||
# /etc/init.d/[clientname] -> /lib/init/upstart-job | ||
|
||
# If this fires, it will trigger a dpkg 'config changed' prompt. This prompt can | ||
# be avoided by using one of the dpkg --force-conf* options, --force-confnew is | ||
# ideal but --force-confold will just leave the /etc/init.d/[clientname] script | ||
# missing, which is OK on upstart systems. | ||
|
||
set -e | ||
|
||
case "$1" in | ||
upgrade) | ||
if [ "$(readlink /etc/init.d/velociraptor)" = "/lib/init/upstart-job" ]; then | ||
# On precise+ we have dpkg-maintscript-helper, so use it. | ||
if which dpkg-maintscript-helper >/dev/null 2>&1 && dpkg-maintscript-helper supports rm_conffile; then | ||
dpkg-maintscript-helper rm_conffile /etc/init.d/velociraptor 3081~ velociraptor -- "$@" | ||
update-rc.d velociraptor remove | ||
else | ||
rm -f /etc/init.d/velociraptor | ||
update-rc.d velociraptor remove | ||
fi | ||
fi | ||
;; | ||
|
||
*) | ||
;; | ||
esac | ||
|
||
#DEBHELPER# | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[Unit] | ||
Description=Velociraptor linux amd64 | ||
After=syslog.target network.target | ||
|
||
[Service] | ||
Type=simple | ||
Restart=always | ||
RestartSec=120 | ||
LimitNOFILE=20000 | ||
Environment=LANG=en_US.UTF-8 | ||
ExecStart=/usr/sbin/velociraptor client | ||
|
||
[Install] | ||
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
misc:Depends=lsb-base (>= 4.1+Debian11ubuntu7) | ||
misc:Pre-Depends= | ||
shlibs:Depends=libc6 (>= 2.3.2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# velociraptor linux amd64 client upstart file | ||
|
||
limit nofile 20000 20000 | ||
|
||
kill timeout 300 | ||
|
||
start on startup | ||
start on runlevel [2345] | ||
stop on runlevel [016] | ||
|
||
respawn | ||
|
||
env LANG=en_US.UTF-8 | ||
|
||
script | ||
DAEMON="/usr/sbin/velociraptor.nanny" | ||
DAEMON_ARGS="/usr/sbin/velociraptor client" | ||
|
||
[ -x "${DAEMON}" ] || exit 0 | ||
|
||
exec ${DAEMON} ${DAEMON_ARGS} | ||
|
||
end script |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* |