--- /dev/null
+# Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
+#
+# 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
+
+MACRO(ADD_OSQUERY_LIBRARY IS_CORE TARGET)
+ ADD_LIBRARY(${TARGET} OBJECT ${ARGN})
+
+ IF(${IS_CORE})
+ LIST(APPEND ${TARGET_OSQUERY_LIB}_SRCS $<TARGET_OBJECTS:${TARGET}>)
+ SET(${TARGET_OSQUERY_LIB}_SRCS ${${TARGET_OSQUERY_LIB}_SRCS} PARENT_SCOPE)
+ ELSE()
+ LIST(APPEND ${TARGET_OSQUERY_LIB_ADDITIONAL}_SRCS $<TARGET_OBJECTS:${TARGET}>)
+ SET(${TARGET_OSQUERY_LIB_ADDITIONAL}_SRCS ${${TARGET_OSQUERY_LIB_ADDITIONAL}_SRCS} PARENT_SCOPE)
+ ENDIF()
+ENDMACRO(ADD_OSQUERY_LIBRARY TARGET)
+
+MACRO(ADD_OSQUERY_TEST IS_CORE)
+ LIST(APPEND ${TARGET_OSQUERY_TEST}_SRCS ${ARGN})
+ SET(${TARGET_OSQUERY_TEST}_SRCS ${${TARGET_OSQUERY_TEST}_SRCS} PARENT_SCOPE)
+ENDMACRO(ADD_OSQUERY_TEST)
+
+MACRO(TARGET_OSQUERY_LINK_WHOLE TARGET LIBRARY)
+ TARGET_LINK_LIBRARIES(${TARGET} "-Wl,-whole-archive")
+ TARGET_LINK_LIBRARIES(${TARGET} ${LIBRARY})
+ TARGET_LINK_LIBRARIES(${TARGET} "-Wl,-no-whole-archive")
+ENDMACRO(TARGET_OSQUERY_LINK_WHOLE)
+
+MACRO(ADD_OSQUERY_MODULE TARGET)
+ ADD_LIBRARY(${TARGET} SHARED ${ARGN})
+ TARGET_LINK_LIBRARIES(${TARGET} dl)
+ ADD_DEPENDENCIES(${TARGET} ${TARGET_OSQUERY_LIB} glog)
+ SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS "-fPIC")
+ SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME ${TARGET})
+ENDMACRO(ADD_OSQUERY_MODULE)
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}")
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/api")
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include")
-INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/sqlite3")
-INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/tsqb")
+INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/tools/sqlite3")
+INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/osquery/tizen/tsqb")
INCLUDE_DIRECTORIES("/usr/local/include")
ENABLE_TESTING()
+INCLUDE(CMake/Macro.cmake)
INCLUDE(CMake/Thrift.cmake)
# Make sure the generated paths exist
EXECUTE_PROCESS(COMMAND mkdir -p "${CMAKE_BINARY_DIR}/generated")
ADD_SUBDIRECTORY(osquery)
-ADD_SUBDIRECTORY(sqlite3)
-ADD_SUBDIRECTORY(tsqb) # Type-safe query builder
+ADD_SUBDIRECTORY(tools/sqlite3)
SET(TARGET_OSQUERY_SHELL osqueryi)
SET(TARGET_OSQUERY_DAEMON osqueryd)
+SET(${TARGET_OSQUERY_LIB}_SRCS "")
+SET(${TARGET_OSQUERY_LIB_ADDITIONAL}_SRCS "")
+SET(${TARGET_OSQUERY_TEST}_SRCS "")
+
SET(${TARGET_OSQUERY_LIB}_DEP glog
gflags
pthread
systemd
udev
ip4tc)
-SET(${TARGET_OSQUERY_LIB}_SRCS "")
-SET(${TARGET_OSQUERY_LIB_ADDITIONAL}_SRCS "")
-SET(${TARGET_OSQUERY_TEST}_SRCS "")
SET(OSQUERY_CODEGEN_PATH "${CMAKE_SOURCE_DIR}/tools/codegen")
SET(OSQUERY_TABLES_PATH "${CMAKE_SOURCE_DIR}")
SET(OSQUERY_GENERATED_PATH "${CMAKE_BINARY_DIR}/generated")
-ADD_DEFINITIONS("-DOSQUERY_BUILD_VERSION=${OSQUERY_BUILD_VERSION}")
-
-MACRO(ADD_OSQUERY_LIBRARY IS_CORE TARGET)
- ADD_LIBRARY(${TARGET} OBJECT ${ARGN})
-
- IF(${IS_CORE})
- LIST(APPEND ${TARGET_OSQUERY_LIB}_SRCS $<TARGET_OBJECTS:${TARGET}>)
- SET(${TARGET_OSQUERY_LIB}_SRCS ${${TARGET_OSQUERY_LIB}_SRCS} PARENT_SCOPE)
- ELSE()
- LIST(APPEND ${TARGET_OSQUERY_LIB_ADDITIONAL}_SRCS $<TARGET_OBJECTS:${TARGET}>)
- SET(${TARGET_OSQUERY_LIB_ADDITIONAL}_SRCS ${${TARGET_OSQUERY_LIB_ADDITIONAL}_SRCS} PARENT_SCOPE)
- ENDIF()
-ENDMACRO(ADD_OSQUERY_LIBRARY TARGET)
-
-MACRO(ADD_OSQUERY_TEST IS_CORE)
- LIST(APPEND ${TARGET_OSQUERY_TEST}_SRCS ${ARGN})
- SET(${TARGET_OSQUERY_TEST}_SRCS ${${TARGET_OSQUERY_TEST}_SRCS} PARENT_SCOPE)
-ENDMACRO(ADD_OSQUERY_TEST)
-
-MACRO(TARGET_OSQUERY_LINK_WHOLE TARGET LIBRARY)
- TARGET_LINK_LIBRARIES(${TARGET} "-Wl,-whole-archive")
- TARGET_LINK_LIBRARIES(${TARGET} ${LIBRARY})
- TARGET_LINK_LIBRARIES(${TARGET} "-Wl,-no-whole-archive")
-ENDMACRO(TARGET_OSQUERY_LINK_WHOLE)
-
-MACRO(ADD_OSQUERY_MODULE TARGET)
- ADD_LIBRARY(${TARGET} SHARED ${ARGN})
- TARGET_LINK_LIBRARIES(${TARGET} dl)
- ADD_DEPENDENCIES(${TARGET} ${TARGET_OSQUERY_LIB} glog)
- SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS "-fPIC")
- SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME ${TARGET})
-ENDMACRO(ADD_OSQUERY_MODULE)
-
-ADD_SUBDIRECTORY(core)
-ADD_SUBDIRECTORY(config)
-ADD_SUBDIRECTORY(dispatcher)
-ADD_SUBDIRECTORY(distributed)
-ADD_SUBDIRECTORY(devtools)
-ADD_SUBDIRECTORY(database)
-ADD_SUBDIRECTORY(events)
-ADD_SUBDIRECTORY(extensions)
-ADD_SUBDIRECTORY(filesystem)
-ADD_SUBDIRECTORY(logger)
-ADD_SUBDIRECTORY(registry)
-ADD_SUBDIRECTORY(sql)
-ADD_SUBDIRECTORY(tables)
-
-# tizen feature
-ADD_SUBDIRECTORY(manager)
-ADD_SUBDIRECTORY(notification)
-ADD_SUBDIRECTORY(property)
-
## Table generation #############################################################
FILE(GLOB TABLE_FILES "${CMAKE_SOURCE_DIR}/specs/*.table")
FILE(GLOB TABLE_FILES_LINUX "${CMAKE_SOURCE_DIR}/specs/linux/*.table")
${GENERATED_TABLES}
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
+## Library-obj generation ###########################################################
+ADD_SUBDIRECTORY(core)
+ADD_SUBDIRECTORY(config)
+ADD_SUBDIRECTORY(dispatcher)
+ADD_SUBDIRECTORY(distributed)
+ADD_SUBDIRECTORY(devtools)
+ADD_SUBDIRECTORY(database)
+ADD_SUBDIRECTORY(events)
+ADD_SUBDIRECTORY(extensions)
+ADD_SUBDIRECTORY(filesystem)
+ADD_SUBDIRECTORY(logger)
+ADD_SUBDIRECTORY(registry)
+ADD_SUBDIRECTORY(sql)
+ADD_SUBDIRECTORY(tables)
+
+ADD_SUBDIRECTORY(tizen)
+
## Library generation ###########################################################
# TODO(sangwan.kwon): Change amalgation files to additional
# static_lib should include every object file in the archive in the link
+++ /dev/null
-# Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
-#
-# 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
-
-ADD_OSQUERY_LIBRARY(TRUE osquery_manager manager.cpp
- manager_impl.cpp)
-
-FILE(GLOB OSQUERY_MANAGER_TESTS "tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_MANAGER_TESTS})
+++ /dev/null
-# Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
-#
-# 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
-
-ADD_OSQUERY_LIBRARY(TRUE osquery_notification notification.cpp)
-
-FILE(GLOB OSQUERY_NOTIFICATION_TESTS "tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_NOTIFICATION_TESTS})
# See the License for the specific language governing permissions and
# limitations under the License
-ADD_OSQUERY_LIBRARY(TRUE osquery_property property.cpp)
+ADD_OSQUERY_LIBRARY(TRUE osquery_property property/property.cpp)
-FILE(GLOB OSQUERY_PROPERTY_TESTS "tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${OSQUERY_PROPERTY_TESTS})
+ADD_OSQUERY_LIBRARY(TRUE osquery_manager manager/manager.cpp
+ manager/manager_impl.cpp)
+
+ADD_OSQUERY_LIBRARY(TRUE osquery_notification notification/notification.cpp)
+
+FILE(GLOB OSQUERY_TIZEN_TESTS "*/tests/*.cpp")
+ADD_OSQUERY_TEST(TRUE ${OSQUERY_TIZEN_TESTS})
+++ /dev/null
-#!/usr/bin/env bash
-
-# Copyright (c) 2014, Facebook, Inc.
-# All rights reserved.
-#
-# This source code is licensed under the BSD-style license found in the
-# LICENSE file in the root directory of this source tree. An additional grant
-# of patent rights can be found in the PATENTS file in the same directory.
-
-set -e
-
-SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
-SOURCE_DIR="$SCRIPT_DIR/../.."
-BUILD_DIR="$SOURCE_DIR/build/linux"
-export PATH="$PATH:/usr/local/bin"
-
-source $SCRIPT_DIR/../lib.sh
-
-PACKAGE_VERSION=`git describe --tags HEAD`
-DESCRIPTION="osquery is an operating system instrumentation toolchain."
-if [[ $PACKAGE_VERSION == *"-"* ]]; then
- PACKAGE_NAME="osquery-latest"
-else
- PACKAGE_NAME="osquery"
-fi
-OUTPUT_PKG_PATH="$BUILD_DIR/$PACKAGE_NAME-$PACKAGE_VERSION."
-
-# Config files
-INITD_SRC="$SCRIPT_DIR/osqueryd.initd"
-INITD_DST="/etc/init.d/osqueryd"
-
-CTL_SRC="$SCRIPT_DIR/osqueryctl"
-
-OSQUERY_EXAMPLE_CONFIG_SRC="$SCRIPT_DIR/osquery.example.conf"
-OSQUERY_EXAMPLE_CONFIG_DST="/usr/share/osquery/osquery.example.conf"
-OSQUERY_LOG_DIR="/var/log/osquery/"
-OSQUERY_VAR_DIR="/var/osquery"
-OSQUERY_ETC_DIR="/etc/osquery"
-
-WORKING_DIR=/tmp/osquery_packaging
-INSTALL_PREFIX=$WORKING_DIR/prefix
-
-function usage() {
- fatal "Usage: $0 -t deb|rpm -d DEPENDENCY_LIST
-
- This will generate an Linux package with:
- (1) An example config /var/osquery/osquery.example.config
- (2) An init.d script /etc/init.d/osqueryd
- (3) The osquery toolset /usr/bin/osquery*"
-}
-
-function parse_args() {
- while [ "$1" != "" ]; do
- case $1 in
- -t | --type ) shift
- PACKAGE_TYPE=$1
- ;;
- -d | --dependencies ) shift
- PACKAGE_DEPENDENCIES="${@}"
- ;;
- -h | --help ) usage
- ;;
- esac
- shift
- done
-}
-
-function check_parsed_args() {
- if [[ $PACKAGE_TYPE = "" ]]; then
- usage
- fi
-
- OUTPUT_PKG_PATH=$OUTPUT_PKG_PATH$PACKAGE_TYPE
-}
-
-function main() {
- parse_args $@
- check_parsed_args
-
- platform OS
-
- rm -rf $WORKING_DIR
- rm -f $OUTPUT_PKG_PATH
- mkdir -p $INSTALL_PREFIX
-
- log "copying osquery binaries"
- BINARY_INSTALL_DIR="$INSTALL_PREFIX/usr/bin/"
- mkdir -p $BINARY_INSTALL_DIR
- cp "$BUILD_DIR/osquery/osqueryi" $BINARY_INSTALL_DIR
- cp "$BUILD_DIR/osquery/osqueryd" $BINARY_INSTALL_DIR
- strip $BINARY_INSTALL_DIR/*
- cp "$CTL_SRC" $BINARY_INSTALL_DIR
-
- # Create the prefix log dir and copy source configs
- log "copying osquery configurations"
- mkdir -p $INSTALL_PREFIX/$OSQUERY_VAR_DIR
- mkdir -p $INSTALL_PREFIX/$OSQUERY_LOG_DIR
- mkdir -p $INSTALL_PREFIX/$OSQUERY_ETC_DIR
- mkdir -p `dirname $INSTALL_PREFIX$OSQUERY_EXAMPLE_CONFIG_DST`
- cp $OSQUERY_EXAMPLE_CONFIG_SRC $INSTALL_PREFIX$OSQUERY_EXAMPLE_CONFIG_DST
-
- mkdir -p `dirname $INSTALL_PREFIX$INITD_DST`
- cp $INITD_SRC $INSTALL_PREFIX$INITD_DST
-
- log "creating package"
- IFS=',' read -a deps <<< "$PACKAGE_DEPENDENCIES"
- PACKAGE_DEPENDENCIES=
- for element in "${deps[@]}"
- do
- element=`echo $element | sed 's/ *$//'`
- PACKAGE_DEPENDENCIES="$PACKAGE_DEPENDENCIES -d \"$element\""
- done
-
- CMD="fpm -s dir -t $PACKAGE_TYPE \
- -n $PACKAGE_NAME -v $PACKAGE_VERSION \
- $PACKAGE_DEPENDENCIES \
- -p $OUTPUT_PKG_PATH \
- --url http://osquery.io \
- -m osquery@osquery.io \
- --vendor Facebook \
- --license BSD \
- --description \"$DESCRIPTION\" \
- \"$INSTALL_PREFIX/=/\""
- eval "$CMD"
- log "package created at $OUTPUT_PKG_PATH"
-}
-
-main $@
+++ /dev/null
-{
- /* Configure the daemon below */
- "options": {
- // Select the osquery config plugin.
- "config_plugin": "filesystem",
-
- // Select the osquery logging plugin.
- "logger_plugin": "filesystem",
-
- // The log directory stores info, warning, and errors.
- // If the daemon uses the 'filesystem' logging retriever then the log_dir
- // will also contain the query results.
- //"osquery_log_dir": "/var/log/osquery",
-
- // Set 'disable_logging' to true to prevent writing any info, warning, error
- // logs. If a logging plugin is selected it will still write query results.
- //"disable_logging": "false",
-
- // Query differential results are logged as change-events to assist log
- // aggregation operations like searching and transactons.
- // Set 'log_results_events' to log differentials as transactions.
- //"log_result_events": "true",
-
- // Splay the scheduled interval for queries.
- // This is very helpful to prevent system performance impact when scheduling
- // large numbers of queries that run a smaller or similar intervals.
- //"schedule_splay_percent": "10",
-
- // Use the system hostname as an identifier for results.
- // If hostnames change with DHCP a more static option is 'uuid'.
- //"host_identifier": "hostname",
-
- // Write the pid of the osqueryd process to a pidfile/mutex.
- //"pidfile": "/var/osquery/osquery.pidfile",
-
- // Clear events from the osquery backing store after a number of seconds.
- "event_pubsub_expiry": "86000",
-
- // A filesystem path for disk-based backing storage used for events and
- // and query results differentials. See also 'use_in_memory_database'.
- //"db_path": "/var/osquery/osquery.db",
-
- // If using a third-party backing store you may want to run completely in
- // memory. Currently rocksdb must use disk-based storage.
- //"use_in_memory_database": "false",
-
- // Comma-delimited list of table names to be disabled.
- // This allows osquery to be launched without certain tables.
- //"disable_tables": "foo_bar,time",
-
- // Enable debug or verbose debug output when logging.
- "debug": "false",
- "verbose_debug": "false",
-
- // The number of threads for concurrent query schedule execution.
- "worker_threads": "4"
- },
-
- /* Define a schedule of queries */
- "scheduledQueries": [
- // This is a simple example query that outputs information about osquery.
- {
- // More complicated queries benefit from a name such as 'my_processes'.
- "name": "info",
- // The exact query to run, include a semi-colon.
- "query": "SELECT * FROM osquery_info;",
- // The interval in seconds to run this query, not an exact interval.
- "interval": 3600
- }
- ]
-}
+++ /dev/null
-#!/bin/bash
-
-ensure_root() {
- if [ $UID -ne 0 ]; then
- echo "User has insufficient privileges. $0 must be run as root."
- exit 4
- fi
-}
-ensure_root
-
-check_config() {
- if [ ! -e $REAL_CONFIG_PATH ] ; then
- echo "No osquery config file found at $REAL_CONFIG_PATH."
- echo "See '$EXAMPLE_CONFIG_PATH' for an example config."
- exit 4
- fi
-}
-
-# Use this function to detect the operating system that this
-platform() {
- local __resultvar=$1
- if [[ -f "/etc/redhat-release" ]]; then
- eval $__resultvar="centos"
- elif [[ -f "/etc/lsb-release" ]]; then
- eval $__resultvar="ubuntu"
- else
- eval $__resultvar=`uname -s | tr '[:upper:]' '[:lower:]'`
- fi
-}
-
-platform OS
-
-if [ $OS = "darwin" ]; then
- REAL_CONFIG_PATH="/var/osquery/osquery.conf"
- EXAMPLE_CONFIG_PATH="/var/osquery/osquery.example.conf"
- PIDFILE="/var/osquery/osquery.pid"
- LOCKFILE="/var/osquery/osquery.lock"
- EXEC="/usr/local/bin/osqueryd"
- PLIST_DOMAIN="com.facebook.osqueryd"
- PLIST_PATH="/Library/LaunchDaemons/$PLIST_DOMAIN.plist"
- LAUNCHCTL_LIST=`launchctl list | grep com.facebook.osqueryd`
- LAUNCHCTL_LIST_PID=`echo $LAUNCHCTL_LIST | awk '{ print $1 }'`
-else
- INIT_SCRIPT_PATH="/etc/init.d/osqueryd"
- if [ ! -e $INIT_SCRIPT_PATH ]; then
- echo "Cannot find the init.d script at $INIT_SCRIPT_PATH"
- exit 6
- fi
-
- REAL_CONFIG_PATH="/etc/osquery/osquery.conf"
- EXAMPLE_CONFIG_PATH="/usr/share/osquery/osquery.example.conf"
- PIDFILE="/var/run/osquery.pid"
- LOCKFILE="/var/lock/subsys/osqueryd"
- EXEC="/usr/bin/osqueryd"
-fi
-PROG="osqueryd"
-
-exec_with_env() {
- REAL_CONFIG_PATH=$REAL_CONFIG_PATH \
- EXAMPLE_CONFIG_PATH=$EXAMPLE_CONFIG_PATH \
- PIDFILE=$PIDFILE \
- LOCKFILE=$LOCKFILE \
- EXEC=$EXEC \
- PROG=$PROG \
- $1
- return $?
-}
-
-start() {
- check_config
- if [ $OS = "darwin" ]; then
- launchctl start $PLIST_PATH
- else
- exec_with_env "service osqueryd start"
- fi
-}
-
-stop() {
- if [ $OS = "darwin" ]; then
- launchctl stop $PLIST_PATH
- else
- exec_with_env "service osqueryd stop"
- fi
-}
-
-restart() {
- stop
- start
-}
-
-status() {
- if [ $OS = "darwin" ]; then
- if [[ "$LAUNCHCTL_LIST" = "" || "$LAUNCHCTL_LIST_PID" = "-" ]]; then
- echo "$PLIST_DOMAIN is not running"
- else
- echo "$PLIST_DOMAIN is running. pid: $LAUNCHCTL_LIST_PID"
- fi
- else
- exec_with_env "service osqueryd status"
- fi
-}
-
-case "$1" in
- start)
- $1
- ;;
- stop)
- $1
- ;;
- restart)
- $1
- ;;
- status)
- $1
- ;;
- config-check)
- $EXEC --config_path=$REAL_CONFIG_PATH --config_check
- ;;
- *)
- echo $"Usage: $0 {start|stop|status|restart}"
- exit 2
-
-esac
-exit $?
+++ /dev/null
-#!/bin/sh
-#
-# osqueryd Start/Stop the osquery daemon.
-#
-# chkconfig: 3345 90 60
-# Description:
-# With osquery, you can use SQL to query low-level
-# operating system information. Under the hood, instead
-# of querying static tables, these queries dynamically execute
-# high-performance native code. The results of the
-# SQL query are transparently returned to you quickly and easily
-#
-### BEGIN INIT INFO
-# Provides: osquery osqueryd
-# Required-Start: $local_fs $syslog
-# Required-Stop: $local_fs $syslog
-# Default-Start: 3345
-# Default-Stop: 90
-# Short-Description: run osqueryd daemon
-# Description:
-# With osquery, you can use SQL to query low-level
-# operating system information. Under the hood, instead
-# of querying static tables, these queries dynamically execute
-# high-performance native code. The results of the
-# SQL query are transparently returned to you quickly and easily
-#
-#
-### END INIT INFO
-
-if [ -z $RETVAL ]; then RETVAL=0; fi
-if [ -z $PROG ]; then PROG="osqueryd"; fi
-if [ -z $EXEC ]; then EXEC=/usr/bin/osqueryd; fi
-if [ -z $REAL_CONFIG_PATH ]; then REAL_CONFIG_PATH=/etc/osquery/osquery.conf; fi
-if [ -z $LOCKFILE ]; then LOCKFILE=/var/lock/osqueryd; fi
-if [ -z $PIDFILE ]; then PIDFILE=/var/run/osquery.pid; fi
-if [ -z $UID ]; then UID=$(id -u); fi
-
-if [ $UID -eq 0 ] && [ -e /etc/sysconfig/$PROG ]; then
- . /etc/sysconfig/$PROG
-fi
-
-if [ -e /etc/init.d/functions ]; then
- . /etc/init.d/functions
-fi
-
-if [ ! -e $REAL_CONFIG_PATH ] ; then
- echo "No osquery config file found at $REAL_CONFIG_PATH"
- echo "See '/usr/share/osquery/osquery.example.conf' for an example config."
- exit 1
-fi
-
-ensure_root() {
- if [ $UID -ne 0 ] ; then
- echo "User has insufficient privilege."
- exit 1
- fi
-}
-
-start() {
- ensure_root
-
- if [ -f $PIDFILE ]; then
- PID=$(cat $PIDFILE)
- PROCNAME=$(ps -p $PID -o comm\=)
- if [ "$PROCNAME" = "$PROG" ]; then
- return 0
- else
- # osqueryd pidfile exists but it's not running
- rm $PIDFILE
- fi
- fi
-
- $PROG --config_path=$REAL_CONFIG_PATH \
- --pidfile=$PIDFILE \
- --daemonize=true
- return $?
-}
-
-stop() {
- ensure_root
-
- if [ ! -f $PIDFILE ] ; then
- return 0
- else
- PID=$(cat $PIDFILE)
- pkill -P $PID && kill -9 $PID
- rm -f $PIDFILE
- fi
-}
-
-restart() {
- stop
- start
-}
-
-status() {
- if [ ! -f $PIDFILE ] ; then
- echo "$PROG is not running. no pidfile found."
- else
- PID=$(cat $PIDFILE)
- PROCNAME=$(ps -p $PID -o comm\=)
- if [ "$PROCNAME" = "$PROG" ]; then
- echo "$PROG is already running: $PID"
- return 0
- else
- # osqueryd pidfile exists but it's not running
- echo "$PROG is not running but a stale pidfile was found."
- fi
- fi
-}
-
-case "$1" in
- start)
- $1
- ;;
- stop)
- $1
- ;;
- restart)
- $1
- ;;
- status)
- $1
- ;;
- *)
- echo "Usage: $0 {start|stop|status|restart}"
- exit 2
-esac
-exit $?
+++ /dev/null
- #!/usr/bin/env bash
-
-# Copyright (c) 2014, Facebook, Inc.
-# All rights reserved.
-#
-# This source code is licensed under the BSD-style license found in the
-# LICENSE file in the root directory of this source tree. An additional grant
-# of patent rights can be found in the PATENTS file in the same directory.
-
-set -e
-
-if [ "$#" -ne 1 ]; then
- echo "Usage: $0 BUILD_DIR"
- exit 1
-fi
-
-BUILD_DIR=$1
-SYNC_DIR="$BUILD_DIR/sync"
-VERSION=`git describe --tags HEAD --always`
-
-if [ -f "$BUILD_DIR/generated" ]; then
- echo "Error: $BUILD_DIR/generated not found."
- echo "Run 'make sdk' first"
- exit 1
-fi
-
-mkdir -p "$SYNC_DIR"
-rm -rf "$SYNC_DIR/osquery*"
-mkdir -p "$SYNC_DIR/osquery/generated"
-
-# merge the headers with the implementation files
-cp -R osquery "$SYNC_DIR"
-cp -R include/osquery "$SYNC_DIR"
-for file in $BUILD_DIR/generated/*.cpp; do
- cp "$file" "$SYNC_DIR/osquery/generated/";
-done
-cp osquery.thrift "$SYNC_DIR/osquery/extensions"
-rm -rf "$SYNC_DIR/osquery/examples"
-
-# delete all of the old CMake files
-find "$SYNC_DIR" -type f -name "CMakeLists.txt" -exec rm -f {} \;
-
-# make the targets file
-mkdir -p "$SYNC_DIR/code-analysis"
-(cd "$SYNC_DIR/code-analysis" && SDK=True cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ../../../../)
-python tools/codegen/gentargets.py -v $VERSION --sdk $VERSION \
- -i "$SYNC_DIR/code-analysis/compile_commands.json" >$SYNC_DIR/osquery/TARGETS
-
-# wrap it up in a tarball
-(cd "$SYNC_DIR" && tar -zcf osquery-sync-$VERSION.tar.gz osquery)
-echo "Generated $SYNC_DIR/osquery-sync-$VERSION.tar.gz"
+++ /dev/null
-# Copyright (c) 2019 Samsung Electronics Co., Ltd All Rights Reserved
-#
-# 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
-
-FILE(GLOB TSQB_TESTS "tests/*.cpp")
-ADD_OSQUERY_TEST(TRUE ${TSQB_TESTS})