View | Details | Raw Unified | Return to bug 220561 | Differences between
and this patch

Collapse All | Expand All

(-)security/vuls-cve-dictionary/Makefile (+85 lines)
Line 0 Link Here
1
# $FreeBSD$
2
3
PORTNAME=	vuls-cve-dictionary
4
PORTVERSION=	0.1.1
5
DISTVERSIONPREFIX=	v
6
CATEGORIES=	security
7
8
MAINTAINER=	iscandr@gmail.com
9
COMMENT=	Build local copies of the National Vulnerabilities Database and Japan Vulnerability Notes
10
11
LICENSE=	APACHE20
12
13
USES=	go
14
15
USE_RC_SUBR=	vuls-cve-dictionary
16
17
USERS=	vuls
18
GROUPS=	vuls
19
20
USE_GITHUB=	yes
21
GH_ACCOUNT=	kotakanbe
22
GH_PROJECT=	go-cve-dictionary
23
GH_TAGNAME=	0724974
24
GH_SUBDIR=	src/github.com/${GH_ACCOUNT_DEFAULT}/${GH_PROJECT}
25
26
GH_TUPLE+=  sirupsen:logrus:v1.0.0:logrus/src/github.com/sirupsen/logrus
27
GH_TUPLE+=  asaskevich:govalidator:v6:govalidator/src/github.com/asaskevich/govalidator
28
GH_TUPLE+=  cheggaaa:pb:v2.0.4:pb/src/gopkg.in/cheggaaa/pb.v2
29
GH_TUPLE+=  go-redis:redis:v6.5.0:redis/src/github.com/go-redis/redis
30
GH_TUPLE+=  google:subcommands:ce3d4cf:subcommands/src/github.com/google/subcommands
31
GH_TUPLE+=  jinzhu:gorm:eae7f6b:gorm/src/github.com/jinzhu/gorm
32
GH_TUPLE+=  kotakanbe:logrus-prefixed-formatter:e7519b8:logrusprefixedformatter/src/github.com/kotakanbe/logrus-prefixed-formatter
33
GH_TUPLE+=  labstack:echo:bc173df:echo/src/github.com/labstack/echo
34
GH_TUPLE+=  labstack:gommon:1121fd3:gommon/src/github.com/labstack/gommon
35
GH_TUPLE+=  parnurzeal:gorequest:v0.2.15:gorequest/src/github.com/parnurzeal/gorequest
36
GH_TUPLE+=  rifflock:lfshook:1.6:lfshook/src/github.com/rifflock/lfshook
37
GH_TUPLE+=  dgrijalva:jwt-go:v3.0.0:jwtgo/src/github.com/dgrijalva/jwt-go
38
GH_TUPLE+=  go-sql-driver:mysql:v1.3:mysql/src/github.com/go-sql-driver/mysql
39
GH_TUPLE+=  jinzhu:inflection:1c35d90:inflection/src/github.com/jinzhu/inflection
40
GH_TUPLE+=  k0kubun:pp:v2.3.0:pp/src/github.com/k0kubun/pp
41
GH_TUPLE+=  lib:pq:8837942:pq/src/github.com/lib/pq
42
GH_TUPLE+=  mgutz:ansi:9520e82:ansi/src/github.com/mgutz/ansi
43
GH_TUPLE+=  pkg:errors:c605e28:pkgerrors/src/github.com/pkg/errors
44
GH_TUPLE+=  moul:http2curl:4e24498:http2curl/src/github.com/moul/http2curl
45
GH_TUPLE+=  golang:net:5f8847a:golangnet/src/golang.org/x/net
46
GH_TUPLE+=  mattn:go-colorable:v0.0.8:gocolorable/src/github.com/mattn/go-colorable
47
GH_TUPLE+=  mattn:go-runewidth:97311d9:gorunewidth/src/github.com/mattn/go-runewidth
48
GH_TUPLE+=  mattn:go-isatty:v0.0.2:goisatty/src/github.com/mattn/go-isatty
49
GH_TUPLE+=  mattn:go-sqlite3:v1.2.0:gosqlite3/src/github.com/mattn/go-sqlite3
50
GH_TUPLE+=  valyala:fasttemplate:dcecefd:fasttemplate/src/github.com/valyala/fasttemplate
51
GH_TUPLE+=  camlistore:go4:034d17a:go4syncutil/src/go4.org
52
GH_TUPLE+=  VividCortex:ewma:v1.0:ewma/src/gopkg.in/VividCortex/ewma.v1
53
GH_TUPLE+=  fatih:color:v1.5.0:colorv1/src/gopkg.in/fatih/color.v1
54
55
STRIP=		#none
56
MAKEFILE=	"GNUmakefile"
57
58
post-patch:
59
	@${REINPLACE_CMD} -e 's|Sirupsen|sirupsen|' \
60
		${WRKSRC}/log/log.go \
61
		${WRKSRC}/src/github.com/kotakanbe/logrus-prefixed-formatter/formatter.go \
62
		${WRKSRC}/src/github.com/rifflock/lfshook/lfshook.go
63
	@${REINPLACE_CMD} -e 's|github.com/cheggaaa/pb|gopkg.in/cheggaaa/pb.v2|' \
64
		${WRKSRC}/db/rdb.go \
65
		${WRKSRC}/db/redis.go \
66
		${WRKSRC}/jvn/jvn.go \
67
		${WRKSRC}/nvd/nvd.go
68
	@${REINPLACE_CMD} -e 's|gopkg.in/mattn/go-runewidth.v0|github.com/mattn/go-runewidth|' \
69
		${WRKSRC}/src/gopkg.in/cheggaaa/pb.v2/util.go
70
	@${REINPLACE_CMD} -e 's|gopkg.in/mattn/go-colorable.v0|github.com/mattn/go-colorable|' \
71
		${WRKSRC}/src/gopkg.in/cheggaaa/pb.v2/pb.go
72
	@${REINPLACE_CMD} -e 's|gopkg.in/mattn/go-isatty.v0|github.com/mattn/go-isatty|' \
73
		${WRKSRC}/src/gopkg.in/cheggaaa/pb.v2/pb.go
74
75
do-build:
76
	@cd ${GO_WRKSRC} && \
77
		${SETENV} ${BUILD_ENV} GOPATH=${WRKSRC} \
78
		go build -v -x -ldflags "-X main.version=${PORTVERSION}" \
79
		-o ${STAGEDIR}${PREFIX}/bin/${PORTNAME}
80
81
do-install:
82
	${MKDIR} ${STAGEDIR}/var/db/vuls
83
	${MKDIR} ${STAGEDIR}/var/log/vuls
84
85
.include <bsd.port.mk>
(-)security/vuls-cve-dictionary/distinfo (+59 lines)
Line 0 Link Here
1
TIMESTAMP = 1499419115
2
SHA256 (kotakanbe-go-cve-dictionary-v0.1.1-0724974_GH0.tar.gz) = dd52f37af45c81e55a6eaca766040762bbc0cc67fc31c674c9a7c19e8c9a7ad5
3
SIZE (kotakanbe-go-cve-dictionary-v0.1.1-0724974_GH0.tar.gz) = 25111
4
SHA256 (sirupsen-logrus-v1.0.0_GH0.tar.gz) = de40c5f36b126217234cf5d40def87ce26789ce95c8f887b229b9f2ea1e3ed6b
5
SIZE (sirupsen-logrus-v1.0.0_GH0.tar.gz) = 27996
6
SHA256 (asaskevich-govalidator-v6_GH0.tar.gz) = 17ee798f3758885e6ed6f1cfc81033c3aca4c15a9d2b3856a01e648ffb46f0a0
7
SIZE (asaskevich-govalidator-v6_GH0.tar.gz) = 39610
8
SHA256 (cheggaaa-pb-v2.0.4_GH0.tar.gz) = 21388e5df7bed43ae2b8157a4e17b85ef416ca4925723ddc182f43e3fc719225
9
SIZE (cheggaaa-pb-v2.0.4_GH0.tar.gz) = 17205
10
SHA256 (go-redis-redis-v6.5.0_GH0.tar.gz) = 992b27dee80639c3605b99525adf76e5e76e4d1acd7e1e97476c5d0446e0d0b8
11
SIZE (go-redis-redis-v6.5.0_GH0.tar.gz) = 72475
12
SHA256 (google-subcommands-ce3d4cf_GH0.tar.gz) = 660c4a27138acf9f40eb5b69d8f8401521626bd29235f6472f1b1ac457ab4c99
13
SIZE (google-subcommands-ce3d4cf_GH0.tar.gz) = 8551
14
SHA256 (jinzhu-gorm-eae7f6b_GH0.tar.gz) = aff8d777868e65751deadff1353949cdc1c8c0680e4f687c2fa9311fdb6dfe74
15
SIZE (jinzhu-gorm-eae7f6b_GH0.tar.gz) = 79432
16
SHA256 (kotakanbe-logrus-prefixed-formatter-e7519b8_GH0.tar.gz) = e14b91af06bc0a752c97519dff4accf4a03547cbb9dd2ba197a9420fb3f14303
17
SIZE (kotakanbe-logrus-prefixed-formatter-e7519b8_GH0.tar.gz) = 3862
18
SHA256 (labstack-echo-bc173df_GH0.tar.gz) = 130084d65a0fd9fbeba6f2f88b7f6ef0dcf0d42d988b7720a9e158a16afa23f7
19
SIZE (labstack-echo-bc173df_GH0.tar.gz) = 322895
20
SHA256 (labstack-gommon-1121fd3_GH0.tar.gz) = b2799817a7225c50d37549db05b981cfa416ea7e3ee54aeb53187c3a29f83805
21
SIZE (labstack-gommon-1121fd3_GH0.tar.gz) = 10176
22
SHA256 (parnurzeal-gorequest-v0.2.15_GH0.tar.gz) = 776fbd9a5ebe79e6e1091cae47d5ace67f7bf49a224a35f2c84e27f3f464817f
23
SIZE (parnurzeal-gorequest-v0.2.15_GH0.tar.gz) = 25591
24
SHA256 (rifflock-lfshook-1.6_GH0.tar.gz) = 64f6a7b085bbceec503f311d9f130436457b996f7260dad7db6638ceb19d9f45
25
SIZE (rifflock-lfshook-1.6_GH0.tar.gz) = 3515
26
SHA256 (dgrijalva-jwt-go-v3.0.0_GH0.tar.gz) = af12bdfbfb897c4a5c86aeffd11cab35ee18ab0180b1a6e22e1a1a61d9f70543
27
SIZE (dgrijalva-jwt-go-v3.0.0_GH0.tar.gz) = 33451
28
SHA256 (go-sql-driver-mysql-v1.3_GH0.tar.gz) = 410bcaca471ea38892101464cc8b4a9cf63a9c7f94fce8728243829e36cd865b
29
SIZE (go-sql-driver-mysql-v1.3_GH0.tar.gz) = 59830
30
SHA256 (jinzhu-inflection-1c35d90_GH0.tar.gz) = 9403d9051e6fb253555c83261ce4c9ff9cb0210a4f326b8568b18d3e1bfbed24
31
SIZE (jinzhu-inflection-1c35d90_GH0.tar.gz) = 4499
32
SHA256 (k0kubun-pp-v2.3.0_GH0.tar.gz) = e411569ac6fe6413b24b63765fd9d6b7cbb03d162068c31186db947aeaf4b0b8
33
SIZE (k0kubun-pp-v2.3.0_GH0.tar.gz) = 8778
34
SHA256 (lib-pq-8837942_GH0.tar.gz) = a7b8aec65325b03799c5336af3ace1a04ade723a30c9abe927f2b16ffbc61385
35
SIZE (lib-pq-8837942_GH0.tar.gz) = 85539
36
SHA256 (mgutz-ansi-9520e82_GH0.tar.gz) = eed589c0869270ea90e776fa623a0a29a5973f2acc86fbf305573b4861887140
37
SIZE (mgutz-ansi-9520e82_GH0.tar.gz) = 4870
38
SHA256 (pkg-errors-c605e28_GH0.tar.gz) = 06fa83babc1d9aa80b0decb6d36504090bbde8a38d9a722a1f7a26616590a0d0
39
SIZE (pkg-errors-c605e28_GH0.tar.gz) = 11476
40
SHA256 (moul-http2curl-4e24498_GH0.tar.gz) = 48957974315c9689a27e4a65315d4eb0e94cb04e266a59f813ad9e1b99df8e66
41
SIZE (moul-http2curl-4e24498_GH0.tar.gz) = 100177
42
SHA256 (golang-net-5f8847a_GH0.tar.gz) = 55a46531c8c0fb60ae7566cae1c59681c9869e5df1c4a9a8304448afef65164a
43
SIZE (golang-net-5f8847a_GH0.tar.gz) = 909712
44
SHA256 (mattn-go-colorable-v0.0.8_GH0.tar.gz) = 4f7b0196c6d7a7be96ba394c94860384b537cec6e0da57951bccda0d42c1c23c
45
SIZE (mattn-go-colorable-v0.0.8_GH0.tar.gz) = 7526
46
SHA256 (mattn-go-runewidth-97311d9_GH0.tar.gz) = 8330497728f75464111ee7145fc97cfa588cb0d6561b3af5447aa05d489bca85
47
SIZE (mattn-go-runewidth-97311d9_GH0.tar.gz) = 22384
48
SHA256 (mattn-go-isatty-v0.0.2_GH0.tar.gz) = c0681d72b185a8d4aa8f6a557d181bf25c6e3e7f3874711de507e550b25408bf
49
SIZE (mattn-go-isatty-v0.0.2_GH0.tar.gz) = 3258
50
SHA256 (mattn-go-sqlite3-v1.2.0_GH0.tar.gz) = ec21a30c397d0d3153d54b3aa71065481dd9702819006fb8bc0443a6ab47caa8
51
SIZE (mattn-go-sqlite3-v1.2.0_GH0.tar.gz) = 1998473
52
SHA256 (valyala-fasttemplate-dcecefd_GH0.tar.gz) = ba29e16f9b2d6425f500b40747b139c6ce88cdd26b60dcf5967fe9e6cf5f3eb7
53
SIZE (valyala-fasttemplate-dcecefd_GH0.tar.gz) = 11627
54
SHA256 (camlistore-go4-034d17a_GH0.tar.gz) = 1c9111f937747660e5cee7c6c435d010011d6fe506df5603b88cce4dd102f39c
55
SIZE (camlistore-go4-034d17a_GH0.tar.gz) = 78850
56
SHA256 (VividCortex-ewma-v1.0_GH0.tar.gz) = 7e62b9cc28b336f2496aa98da60f3a8ba6a1f0112f0493c60959e9bcc25709f3
57
SIZE (VividCortex-ewma-v1.0_GH0.tar.gz) = 3609
58
SHA256 (fatih-color-v1.5.0_GH0.tar.gz) = f22564848cd7d24022413c719bbc9c35d014ba7d19ee802b29ba5a93016d3250
59
SIZE (fatih-color-v1.5.0_GH0.tar.gz) = 586937
(-)security/vuls-cve-dictionary/files/patch-commands_fetchjvn.go (+29 lines)
Line 0 Link Here
1
--- commands/fetchjvn.go.orig	2017-07-08 14:49:54 UTC
2
+++ commands/fetchjvn.go
3
@@ -3,7 +3,6 @@ package commands
4
 import (
5
 	"context"
6
 	"flag"
7
-	"os"
8
 	"strconv"
9
 	"time"
10
 
11
@@ -45,7 +44,7 @@ func (*FetchJvnCmd) Usage() string {
12
 		[-latest]
13
 		[-last2y]
14
 		[-years] 1998 1999 ...
15
-		[-dbpath=$PWD/cve.sqlite3 or connection string]
16
+		[-dbpath=/var/db/vuls/cve.sqlite3 or connection string]
17
 		[-dbtype=mysql|postgres|sqlite3|redis]
18
 		[-http-proxy=http://192.168.0.1:8080]
19
 		[-debug]
20
@@ -65,8 +64,7 @@ func (p *FetchJvnCmd) SetFlags(f *flag.F
21
 	defaultLogDir := util.GetDefaultLogDir()
22
 	f.StringVar(&p.logDir, "log-dir", defaultLogDir, "/path/to/log")
23
 
24
-	pwd := os.Getenv("PWD")
25
-	f.StringVar(&p.dbpath, "dbpath", pwd+"/cve.sqlite3",
26
+	f.StringVar(&p.dbpath, "dbpath", "/var/db/vuls/cve.sqlite3",
27
 		"/path/to/sqlite3 or SQL connection string")
28
 
29
 	f.StringVar(&p.dbtype, "dbtype", "sqlite3",
(-)security/vuls-cve-dictionary/files/patch-commands_fetchnvd.go (+20 lines)
Line 0 Link Here
1
--- commands/fetchnvd.go.orig	2017-07-08 14:50:40 UTC
2
+++ commands/fetchnvd.go
3
@@ -3,7 +3,6 @@ package commands
4
 import (
5
 	"context"
6
 	"flag"
7
-	"os"
8
 	"strconv"
9
 	"time"
10
 
11
@@ -65,8 +64,7 @@ func (p *FetchNvdCmd) SetFlags(f *flag.F
12
 	defaultLogDir := util.GetDefaultLogDir()
13
 	f.StringVar(&p.logDir, "log-dir", defaultLogDir, "/path/to/log")
14
 
15
-	pwd := os.Getenv("PWD")
16
-	f.StringVar(&p.dbpath, "dbpath", pwd+"/cve.sqlite3",
17
+	f.StringVar(&p.dbpath, "dbpath", "/var/db/vuls/cve.sqlite3",
18
 		"/path/to/sqlite3 or SQL connection string")
19
 
20
 	f.StringVar(&p.dbtype, "dbtype", "sqlite3",
(-)security/vuls-cve-dictionary/files/patch-commands_server.go (+29 lines)
Line 0 Link Here
1
--- commands/server.go.orig	2017-06-26 10:39:59 UTC
2
+++ commands/server.go
3
@@ -3,7 +3,6 @@ package commands
4
 import (
5
 	"context"
6
 	"flag"
7
-	"os"
8
 
9
 	"github.com/google/subcommands"
10
 	c "github.com/kotakanbe/go-cve-dictionary/config"
11
@@ -37,7 +36,7 @@ func (*ServerCmd) Usage() string {
12
 	server
13
 		[-bind=127.0.0.1]
14
 		[-port=8000]
15
-		[-dbpath=$PWD/cve.sqlite3 or connection string]
16
+		[-dbpath=/var/db/vuls/cve.sqlite3 or connection string]
17
 		[-dbtype=mysql|postgres|sqlite3|redis]
18
 		[-debug]
19
 		[-debug-sql]
20
@@ -56,8 +55,7 @@ func (p *ServerCmd) SetFlags(f *flag.Fla
21
 	defaultLogDir := util.GetDefaultLogDir()
22
 	f.StringVar(&p.logDir, "log-dir", defaultLogDir, "/path/to/log")
23
 
24
-	pwd := os.Getenv("PWD")
25
-	f.StringVar(&p.dbpath, "dbpath", pwd+"/cve.sqlite3",
26
+	f.StringVar(&p.dbpath, "dbpath", "/var/db/vuls/cve.sqlite3",
27
 		"/path/to/sqlite3 or SQL connection string")
28
 
29
 	f.StringVar(&p.dbtype, "dbtype", "sqlite3",
(-)security/vuls-cve-dictionary/files/vuls-cve-dictionary.in (+64 lines)
Line 0 Link Here
1
#!/bin/sh
2
3
# PROVIDE: vuls-cve-dictionary
4
# REQUIRE: LOGIN
5
# KEYWORD: shutdown
6
#
7
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
8
# to enable this service:
9
#
10
# vuls_cve_dictionary_enable (bool):     Set to NO by default
11
#                                        Set it to YES to enable the CVE server
12
# vuls_cve_dictionary_user (string):     Set user to run vuls_cve_dictionary
13
#                                        Default is "vuls"
14
# vuls_cve_dictionary_group (string):    Set group to run vuls_cve_dictionary
15
#                                        Default is "vuls"
16
# vuls_cve_dictionary_db_path (string):  Set database path
17
#                                        Default is "/var/db/vuls/cve.sqlite3"
18
# vuls_cve_dictionary_db_type (string):  Set database type
19
#                                        Default is "sqlite3"
20
# vuls_cve_dictionary_log_file (string): Set file that vuls_cve_dictionary will log to
21
#                                        Default is "/var/log/vuls/vuls_cve_dictionary.log"
22
# vuls_cve_dictionary_args (string):     Set additional command line arguments
23
#                                        Default is ""
24
25
. /etc/rc.subr
26
27
name=vuls_cve_dictionary
28
rcvar=vuls_cve_dictionary_enable
29
30
load_rc_config $name
31
32
: ${vuls_cve_dictionary_enable:="NO"}
33
: ${vuls_cve_dictionary_user:="vuls"}
34
: ${vuls_cve_dictionary_group:="vuls"}
35
: ${vuls_cve_dictionary_db_path:="/var/db/vuls/cve.sqlite3"}
36
: ${vuls_cve_dictionary_db_type:="sqlite3"}
37
: ${vuls_cve_dictionary_log_file:="/var/log/vuls/vuls_cve_dictionary.log"}
38
: ${vuls_cve_dictionary_args:=""}
39
40
pidfile=/var/run/vuls_cve_dictionary.pid
41
command="/usr/sbin/daemon"
42
procname="%%PREFIX%%/bin/vuls-cve-dictionary"
43
44
command_args="-p ${pidfile} /usr/bin/env ${procname} server \
45
                -dbpath=${vuls_cve_dictionary_db_path} \
46
                -dbtype=${vuls_cve_dictionary_db_type} \
47
                ${vuls_cve_dictionary_args} >> ${vuls_cve_dictionary_log_file} 2>&1"
48
49
start_precmd=vuls_cve_dictionary_startprecmd
50
51
vuls_cve_dictionary_startprecmd()
52
{
53
    if [ ! -e ${pidfile} ]; then
54
        install -o ${vuls_cve_dictionary_user} -g ${vuls_cve_dictionary_group} \
55
            -m 640 /dev/null ${pidfile};
56
    fi
57
    if [ ! -f "${vuls_cve_dictionary_log_file}" ]; then
58
        install -o ${vuls_cve_dictionary_user} -g ${vuls_cve_dictionary_group} \
59
            -m 640 /dev/null ${vuls_cve_dictionary_log_file};
60
    fi
61
}
62
63
load_rc_config $name
64
run_rc_command "$1"
(-)security/vuls-cve-dictionary/pkg-descr (+7 lines)
Line 0 Link Here
1
vuls-cve-dictionary builds a a local copy of the National Vulnerabilities
2
Database(NVD) and Japan Vulnerability Notes(JVN). NVD and JVN contain security
3
vulnerabilities according to their CVE identifiers including exhaustive
4
information and a risk score. The local copy is generated in sqlite format.
5
A server is included for easy querying.
6
7
WWW: https://github.com/kotakanbe/go-cve-dictionary/
(-)security/vuls-cve-dictionary/pkg-message (+7 lines)
Line 0 Link Here
1
===============================================================================
2
Download CVEs:
3
4
for i in `seq 2002 $(date +"%Y")`; \
5
    do vuls-cve-dictionary fetchnvd -years $i; \
6
    done
7
===============================================================================
(-)security/vuls-cve-dictionary/pkg-plist (+3 lines)
Line 0 Link Here
1
bin/%%GO_PKGNAME%%
2
@dir(vuls,vuls,0775) /var/db/vuls
3
@dir(vuls,vuls,0775) /var/log/vuls

Return to bug 220561