ports/security/go-cve-dictionary/files/go-cve-dictionary.in
Richard Gallamore fda3db8dd1 This is tool to build a local copy of the National Vulnerabilities Database(NVD)
and the Japan Vulnerability Notes (JVN). NVD and JVN contain security
vulnerabilities according to their CVE identifiers, including exhaustive
information and a risk score. The local copy is generated in sqlite format, and
the tool has a server mode for easy querying.

WWW: https://github.com/kotakanbe/go-cve-dictionary/

PR:		220561
Submitted by:	Alexandru Ciobanu <iscandr@gmail.com> (maintainer)
Reviewed by:	matthew (mentor), koobs, mat
Approved by:	matthew (mentor)
Differential Revision:	https://reviews.freebsd.org/D11745
2017-07-28 18:22:22 +00:00

64 lines
2.3 KiB
Bash

#!/bin/sh
# PROVIDE: %%PORTNAME%%
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
#
# go_cve_dictionary_enable (bool): Set to NO by default
# Set it to YES to enable the CVE server
# go_cve_dictionary_user (string): Set user to run go_cve_dictionary
# Default is "%%USERS%%"
# go_cve_dictionary_group (string): Set group to run go_cve_dictionary
# Default is "%%GROUPS%%"
# go_cve_dictionary_db_path (string): Set database path
# Default is "/var/db/vuls/cve.sqlite3"
# go_cve_dictionary_db_type (string): Set database type
# Default is "sqlite3"
# go_cve_dictionary_log_file (string): Set file that go_cve_dictionary will log to
# Default is "/var/log/vuls/go_cve_dictionary.log"
# go_cve_dictionary_args (string): Set additional command line arguments
# Default is ""
. /etc/rc.subr
name=go_cve_dictionary
rcvar=go_cve_dictionary_enable
load_rc_config $name
: ${go_cve_dictionary_enable:="NO"}
: ${go_cve_dictionary_user:="%%USERS%%"}
: ${go_cve_dictionary_group:="%%GROUPS%%"}
: ${go_cve_dictionary_db_path:="/var/db/vuls/cve.sqlite3"}
: ${go_cve_dictionary_db_type:="sqlite3"}
: ${go_cve_dictionary_log_file:="/var/log/vuls/go_cve_dictionary.log"}
: ${go_cve_dictionary_args:=""}
pidfile=/var/run/go_cve_dictionary.pid
command="/usr/sbin/daemon"
procname="%%PREFIX%%/bin/%%PORTNAME%%"
command_args="-p ${pidfile} /usr/bin/env ${procname} server \
-dbpath=${go_cve_dictionary_db_path} \
-dbtype=${go_cve_dictionary_db_type} \
${go_cve_dictionary_args} >> ${go_cve_dictionary_log_file} 2>&1"
start_precmd=go_cve_dictionary_startprecmd
go_cve_dictionary_startprecmd()
{
if [ ! -e ${pidfile} ]; then
install -o ${go_cve_dictionary_user} -g ${go_cve_dictionary_group} \
-m 640 /dev/null ${pidfile};
fi
if [ ! -f "${go_cve_dictionary_log_file}" ]; then
install -o ${go_cve_dictionary_user} -g ${go_cve_dictionary_group} \
-m 640 /dev/null ${go_cve_dictionary_log_file};
fi
}
load_rc_config $name
run_rc_command "$1"