From 1de9061b8b4f8ba36f935c7c27196286e7b5323d Mon Sep 17 00:00:00 2001 From: remi Date: Thu, 12 Sep 2019 21:21:25 +0000 Subject: [PATCH] Update netshot to version 0.14.0. The port now depends exclusively on Java 1.8. Netshot uses nashorn which was deprecated after Java 1.8. It might work with later Java versions but this has not been tested yet. inputs and OK stehn@ --- sysutils/netshot/Makefile | 8 ++-- sysutils/netshot/distinfo | 4 +- sysutils/netshot/patches/patch-netshot_conf | 19 ++++++--- sysutils/netshot/pkg/PLIST | 13 ++++-- sysutils/netshot/pkg/README | 46 +++++++++++++++++++++ 5 files changed, 74 insertions(+), 16 deletions(-) create mode 100644 sysutils/netshot/pkg/README diff --git a/sysutils/netshot/Makefile b/sysutils/netshot/Makefile index f347047b615..f21e2246a06 100644 --- a/sysutils/netshot/Makefile +++ b/sysutils/netshot/Makefile @@ -1,9 +1,8 @@ -# $OpenBSD: Makefile,v 1.6 2019/07/12 21:15:36 sthen Exp $ +# $OpenBSD: Makefile,v 1.7 2019/09/12 21:21:25 remi Exp $ COMMENT = config backup and policy check for network devices -V = 0.11.0 -REVISION = 1 +V = 0.14.0 DISTNAME = netshot_${V} PKGNAME = ${DISTNAME:S/_/-/} WRKDIST = ${WRKDIR} @@ -22,7 +21,8 @@ MASTER_SITES = https://github.com/netfishers-onl/Netshot/releases/download/v${V EXTRACT_SUFX = .zip MODULES = java -MODJAVA_VER = 1.8+ +# when changing MODJAVA_VER: adpat jdk path in README +MODJAVA_VER = 1.8 RUN_DEPENDS = java/javaPathHelper diff --git a/sysutils/netshot/distinfo b/sysutils/netshot/distinfo index cfb8734af47..78d0a603c29 100644 --- a/sysutils/netshot/distinfo +++ b/sysutils/netshot/distinfo @@ -1,2 +1,2 @@ -SHA256 (netshot_0.11.0.zip) = 00N9CByc4inEaWctvmG6IRBZKf95vJrhTJ0Gu5NDfhY= -SIZE (netshot_0.11.0.zip) = 45555732 +SHA256 (netshot_0.14.0.zip) = 7HX9oTy/mWagcSvTPsgekNX7WTelHS7eu1lNUbNdOO8= +SIZE (netshot_0.14.0.zip) = 45721309 diff --git a/sysutils/netshot/patches/patch-netshot_conf b/sysutils/netshot/patches/patch-netshot_conf index 17fdc261576..e43bc76bc51 100644 --- a/sysutils/netshot/patches/patch-netshot_conf +++ b/sysutils/netshot/patches/patch-netshot_conf @@ -1,4 +1,4 @@ -$OpenBSD: patch-netshot_conf,v 1.2 2019/02/08 21:33:40 remi Exp $ +$OpenBSD: patch-netshot_conf,v 1.3 2019/09/12 21:21:25 remi Exp $ Index: netshot.conf --- netshot.conf.orig @@ -20,16 +20,23 @@ Index: netshot.conf # REST -netshot.http.ssl.keystore.file = /usr/local/netshot/netshot.jks -+netshot.http.ssl.keystore.file = ${PREFIX}/netshot/netshot.jks ++netshot.http.ssl.keystore.file = ${SYSCONFDIR}/netshot.jks netshot.http.ssl.keystore.pass = password #netshot.http.baseurl = https://localhost netshot.http.baseurl = https://0.0.0.0 -@@ -35,7 +35,7 @@ netshot.snmptrap.community = Netsh01 - # General settings - netshot.snapshots.auto.interval = 15 +@@ -38,12 +38,12 @@ netshot.snapshots.auto.interval = 15 + # Allow a trap received from any IP of a device to trigger an automatic snapshot netshot.snapshots.auto.anyip = true + # After a snapshot, dump the last configuration to a file in this directory +-#netshot.snapshots.dump = /usr/local/netshot/dumps ++#netshot.snapshots.dump = ${VARBASE}/netshot/dumps + # Where to store the binary snapshot files +-netshot.snapshots.binary.path = /var/local/netshot ++netshot.snapshots.binary.path = ${VARBASE}/netshot + + # Where to look for additional drivers -netshot.drivers.path = /usr/local/netshot/drivers +netshot.drivers.path = ${PREFIX}/netshot/drivers + # Authentication - netshot.aaa.maxidletime = 1800 diff --git a/sysutils/netshot/pkg/PLIST b/sysutils/netshot/pkg/PLIST index 11ed27bdb0e..07f7924c207 100644 --- a/sysutils/netshot/pkg/PLIST +++ b/sysutils/netshot/pkg/PLIST @@ -1,23 +1,28 @@ -@comment $OpenBSD: PLIST,v 1.1.1.1 2018/08/28 11:25:53 remi Exp $ +@comment $OpenBSD: PLIST,v 1.2 2019/09/12 21:21:25 remi Exp $ @newgroup _netshot:817 @newuser _netshot:817:_netshot:daemon:Netshot Account:/nonexistent:/sbin/nologin @rcscript ${RCDIR}/netshot netshot/ -@sample netshot/drivers/ +netshot/drivers/ netshot/netshot.jar share/doc/netshot/ share/doc/netshot/COPYING -share/doc/netshot/INSTALL.Debian-Ubuntu-Mint.txt -share/doc/netshot/INSTALL.Redhat-CentOS.txt share/doc/netshot/LICENSE.txt share/doc/netshot/README.txt share/doc/netshot/UPDATE.txt share/doc/netshot/VERSION.txt +share/doc/pkg-readmes/${PKGSTEM} share/examples/netshot/ share/examples/netshot/netshot.conf @mode 0640 @group _netshot @sample ${SYSCONFDIR}/netshot.conf +@extra ${SYSCONFDIR}/netshot.jks @mode 0750 @owner _netshot @sample ${VARBASE}/log/netshot/ +@sample ${VARBASE}/netshot/ +@sample ${VARBASE}/netshot/dumps/ +@extraunexec rm -rf netshot/drivers/* +@extraunexec rm -rf ${VARBASE}/netshot/dumps/* +@extraunexec rm -rf ${VARBASE}/netshot/!(dumps) diff --git a/sysutils/netshot/pkg/README b/sysutils/netshot/pkg/README new file mode 100644 index 00000000000..6ba30ad7fba --- /dev/null +++ b/sysutils/netshot/pkg/README @@ -0,0 +1,46 @@ +$OpenBSD: README,v 1.1 2019/09/12 21:21:25 remi Exp $ + ++----------------------------------------------------------------------- +| Running ${PKGSTEM} on OpenBSD ++----------------------------------------------------------------------- + +Netshot requires a database which might be on the same server as Netshot +or remote. It supports PostgreSQL and MySQL/MariaDB. Below example uses +MariaDB on the same host. + +- Install the package mariadb-server. + See ${LOCALBASE}/share/doc/pkg-readmes/mariadb-server for the first + steps after the installation. + +- Create a database and a database user (change the password!): + $ mysql -u root + > CREATE DATABASE netshot01 CHARACTER SET utf8 + DEFAULT COLLATE utf8_general_ci; + > GRANT ALL PRIVILEGES ON netshot01.* + TO 'netshot'@'localhost' IDENTIFIED BY 'password'; + > quit + +- Check the database connection config in ${SYSCONFDIR}/netshot.conf. + Should netshot not start but log "The server time zone value 'CEST' is + unreconized or represents more than one time zone" the connect string + might be modified to look like this: + netshot.db.url = jdbc:mysql://localhost/netshot01?serverTimezone=UTC + +- Create a TLS certificate in a Java keystore: + # ${LOCALBASE}/jdk-1.8.0/bin/keytool -genkey -keyalg RSA -alias selfsigned \ + -keystore ${SYSCONFDIR}/netshot.jks -storepass password -validity 3600 \ + -keysize 4096 + # chmod 640 ${SYSCONFDIR}/netshot.jks + # chgrp _netshot ${SYSCONFDIR}/netshot.jks + +- Enable and start Netshot to create the database tables. + # rcctl enable netshot; rcctl start netshot + +- Add an initial application user to the database: + $ mysql -u root + > USE netshot01; + > INSERT INTO user (level, local, username, hashed_password) + VALUES (1000, 1, 'netshot', '7htrot2BNjUV/g57h/HJ/C1N0Fqrj+QQ'); + +- Access Netshot with a browser on https://localhost:8443. + (username 'netshot' with password 'netshot')