This commit is contained in:
Yury Martynov 2019-06-07 10:24:44 +03:00
parent d833c51ff6
commit a1168b09e1
No known key found for this signature in database
GPG key ID: EBE62DD0CCEAE19E
5 changed files with 141 additions and 0 deletions

View file

@ -0,0 +1,3 @@
DIST github.com-BurntSushi-toml-v0.3.0.tar.gz 41554 BLAKE2B 2af83c65e70addb9d95a242c3ad7748d6d273578564009bd29fecf8537194e965f29d5087975792e60c39f250e3bafe313ce313305ef481ca6f05b81b4f33aa6 SHA512 3f3cc441787c41029c4b4944e6437919abbd31d3d53b361ce22f6237d76655357936bab90ee8f3340ea9550cbe90f3a369b3209321e8bb6bbeca0892babca6fe
DIST github.com-abbot-go-http-auth-v0.4.0.tar.gz 15315 BLAKE2B 59e1036c7fa35fe17a6c239d43a11f3cbc040504a9fecf1ae1ee0adc5f81ebd3c8a9dca3528700a0ba47a710ed84024059b86de42ff67dea5a31addac7679149 SHA512 e707c45621b7ec5781f8da82c19c8c406a90c90d1e26f0658cf0c7cce02a66d3db90984355348145e8fea7d528d269f44f13e211f441f6995433129fb5915ec7
DIST vulsrepo-20190412.tar.gz 7026796 BLAKE2B ac886ee36f927566095accb9e30a15e54ee3d25bee2fc779e9d233e765618bbc4b24425caab613d79219e9d6524d4b1372939b5f626f52a737ce65e5c003ec35 SHA512 863e2eade042ec6d785f47a58405cae003da5e6ab28852e933a2828b83abaa87542686e756a84a7cddb8c8ae32ca41a67b4911a8892a82f58beda0e86b47c67a

View file

@ -0,0 +1,12 @@
[Server]
rootPath = "/var/lib/vuls/vulsrepo"
resultsPath = "/var/lib/vuls/results"
serverPort = "5111"
# serverIP = "127.0.0.1"
# serverSSL = "yes"
# serverCert = "cert.pem"
# serverKey = "key.pem"
#[Auth]
# authFilePath = "/var/lib/vuls/vulsrepo/.htdigest"
# realm = "vulsrepo_local"

View file

@ -0,0 +1,41 @@
#!/sbin/openrc-run
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
VULSREPO_LOGFILE="${VULSREPO_LOGFILE:-/var/log/vulsrepo-server.log}"
USER="vuls"
GROUP="vuls"
description="A vulsrepo-server daemon"
command="/usr/bin/vulsrepo-server"
command_background="true"
command_user="${USER}:${GROUP}"
pidfile="/run/${RC_SVCNAME}.pid"
start_stop_daemon_args="--quiet -1 ${VULSREPO_LOGFILE} -2 ${VULSREPO_LOGFILE}"
retry="TERM/25/KILL/5"
extra_commands="checkconfig"
depend() {
need net
}
checkconfig() {
if ! [ -f "/etc/vulsrepo/vulsrepo-config.toml" ]; then
eerror "You need an \"/etc/vulsrepo/vulsrepo-config.toml\" file to run ${RC_SVCNAME}"
return 1
fi
if ! [ -f "${VULSREPO_LOGFILE}" ]; then
touch "${VULSREPO_LOGFILE}" > /dev/null 2>&1 \
&& chmod 0640 "${VULSREPO_LOGFILE}" > /dev/null 2>&1 \
&& chown ${USER}:${GROUP} "${VULSREPO_LOGFILE}" > /dev/null 2>&1 \
|| eerror "Failed to create: ${VULSREPO_LOGFILE}"
fi
}
start_pre() {
checkconfig || return 1
}
# vim: set ft=gentoo-init-d ts=4 :

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>email@linxon.ru</email>
<name>Yury Martynov</name>
</maintainer>
</pkgmetadata>

View file

@ -0,0 +1,77 @@
# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# FIXME:
# https://github.com/usiusi360/vulsrepo/issues/75
# https://github.com/usiusi360/vulsrepo/issues/69
# https://github.com/usiusi360/vulsrepo/issues/64
EAPI=7
EGO_PN="github.com/usiusi360/vulsrepo"
EGO_VENDOR=(
"github.com/BurntSushi/toml v0.3.0"
"github.com/abbot/go-http-auth v0.4.0"
)
inherit golang-vcs-snapshot user
DESCRIPTION="VulsRepo is visualized based on the json report output in vuls"
HOMEPAGE="https://vuls.io https://github.com/usiusi360/vulsrepo"
HASH_COMMIT="310e6fef185581ac1f75dfe55b84fd378b7437b7" # 20190412
SRC_URI="https://github.com/usiusi360/vulsrepo/archive/${HASH_COMMIT}.tar.gz -> ${P}.tar.gz
${EGO_VENDOR_URI}"
KEYWORDS="~amd64"
LICENSE="MIT"
SLOT=0
RDEPEND="app-admin/vuls"
DEPEND="${RDEPEND}
dev-go/go-crypto:=
dev-go/go-net:=
>=dev-lang/go-1.12"
pkg_setup() {
enewgroup vuls
enewuser vuls -1 -1 /dev/null vuls
}
src_prepare() {
sed -e "/fpath, _ := (os.Executable())/d" \
-e "s:filepath.Dir(fpath)+\"/vulsrepo-config.toml\":\"/etc/${PN}/vulsrepo-config.toml\":" \
-i src/"${EGO_PN}"/server/main.go || die
default
}
src_compile() {
cd src/"${EGO_PN}"/server || die
GOPATH="${WORKDIR}/${P}:$(get_golibdir_gopath)" \
go build -v -work -x -ldflags="-s -w" -o vulsrepo-server || die
}
src_install() {
cd src/"${EGO_PN}" || die
insinto "/etc/${PN}"
doins "${FILESDIR}"/vulsrepo-config.toml.sample
insinto "/var/lib/vuls/${PN}"
doins -r plugins dist index.html
fowners -R vuls:vuls "/var/lib/vuls" "/etc/${PN}"
fperms 0750 "/var/lib/vuls" "/etc/${PN}"
dobin server/vulsrepo-server
newinitd "${FILESDIR}"/vulsrepo-server.initd vulsrepo-server
dodoc README.md "${FILESDIR}"/vulsrepo-config.toml.sample
}
pkg_postinst() {
einfo "\nSee documentation: https://vuls.io/docs/en/vulsrepo.html\n"
}