Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ntopng #3856

Merged
merged 9 commits into from
Apr 7, 2020
Merged

Add ntopng #3856

merged 9 commits into from
Apr 7, 2020

Conversation

hgy59
Copy link
Contributor

@hgy59 hgy59 commented Jan 18, 2020

Motivation: Revival of the oldest PR at this time
Linked issues: closes #1683

Since I did not succeed to rebase the existing PR #1683, I created a new branch and merged the basic work of @cytec.

Checklist

  • Build rule all-supported completed successfully (except ppc853x due DSM<6)
  • (n/a) Package upgrade completed successfully
  • New installation of package completed successfully

Updates related to #1683

  • Update ntopng to version 3.8.1 (of December 2019)
  • implement DSM 6 service setup (indeed DSM <= 5.2 is not supported)
  • move data dir to {pkg}/var/data
  • move ntopng.conf to {pkg}/etc and document most of the options
  • add new dependencies (lua, libxml2, curl, glib)
  • add nDPI module (from ntop.org)
  • update rrdtool (add new modules: pango, cairo, pixman; groff, urw-base35-fonts, uchardet)
  • add libmaxminddb
  • add libmysqlclient (mysql-connector-c)
  • add native modules libmysqlclient and ghostscript
  • update libpcap
  • update libsodium
  • update geoip
  • remove unused module cross/termcap from repo
  • update ntopng icon
  • add initial GeoLite2 content files (further updates are not available anymore without API key)
  • add patches (by sed) to set synology specific infos into generated code
  • add (former empty) module cross/libcap (incl. patches for older kernel, workaroud for cross compile)

Remarks

  • It was some work to get it all cross compiled. Especially the cross/libcap
  • cross/libcap is required to add network discovery capabilities and for the special code that changes the owner of the pid file during startup.
  • This service must be started as root (see src/conf/privilege) and on startup it changes the owner of the pid- and other files (to sc-ntopng) before starting in the background. Therefor the generic start-stop-status does not work and I had to create a custom one (that I derived from the ntop init.d sample for debian/centos).
  • Just while developing this module, the download of geoip database (by MaxMind) got restricted to registered users with an API key. I integrated the latests public version to have (at least) outdated geo information available (for some hints on how to update see ntop issue #3182 and Important Geolocation Changes in ntop Products)
  • As I successfully run this package on DS218+ (x64) and DS115j (armada370) I have enough courage to do remove the BETA flag.
  • This is the Community Edition of ntopng and (AFAIK) not capable to support Professional and Enterprise Licenses - available only for binary packages from ntop.org.

Comment on lines +2 to +5
"defaults":{
"run-as": "package"
},
"username": "sc-ntopng",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would set defaults to "run-as : root" and probably discard "username" if there is no interest to have such a package specific user either for service execution or package file ownership.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the service start needs to be done as root. So as root the ownership of some files (pid, ...) is set to sc-ntopng and the service itself is run as this package specific user.
So we definitifly need the package user.
And the package needs libcap (that makes this possible as far as I understand)
[Libcap implements the user-space interfaces to the POSIX 1003.1e capabilities available in Linux kernels. These capabilities are a partitioning of the all powerful root privilege into a set of distinct privileges. ]

Copy link
Contributor

@ymartin59 ymartin59 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A large PR with many dependencies for such a "simple" service.
Some minor improvements requests (as usual)
Great job.

cross/json-c/patches/remove-variable-size.patch Outdated Show resolved Hide resolved
Comment on lines 25 to 26
.PHONY: libcap_install_target
libcap_install_target:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer without _target suffix, it is obviously a make target.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I was used to take the original with pkg_name as prefix, since there is not such an example in the wiki page (except for POST_STRIP -> extra_install).
I will use here your preference....

cross/libmysqlclient/Makefile Outdated Show resolved Hide resolved
LICENSE =

GNU_CONFIGURE = 1
PRE_CONFIGURE_TARGET = myPreConf
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proposal: jsonc_pre_configure

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

taken untouched from cytex...

cross/ndpi/Makefile Outdated Show resolved Hide resolved
cross/urw-base35-fonts/Makefile Outdated Show resolved Hide resolved
cross/urw-base35-fonts/Makefile Outdated Show resolved Hide resolved
COMMENT = MySQL C API (libmysqlclient)
LICENSE = GNU GPLv2

CONFIGURE_TARGET = mysql-connector-c_configure_target
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without _target

native/libmysqlclient/Makefile Outdated Show resolved Hide resolved
spk/ntopng/Makefile Show resolved Hide resolved
Comment on lines 1 to 2
PKG_NAME = json-c
PKG_VERS = 0.12-20140410
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Notice a more recent version is available and expected for introduction from another PR #3873
https://github.com/SynoCommunity/spksrc/blob/364de55b69714ed8c806caa38953064b5e7efe55/cross/json-c/Makefile

Copy link
Contributor

@ymartin59 ymartin59 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May you please update cross/json-c to align version with PR for ffpmeg

REQUIRED_DSM = 6.1

MAINTAINER = hgy59
DESCRIPTION = ntopng is the next generation version of the original ntop, a network traffic probe that monitors network usage. ntopng is based on libpcap and it has been written in a portable way in order to virtually run on every Unix platform, MacOSX and on Windows as well.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth to mention it is "Community Edition", like in your PR description?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description on ntop.org says:

Available Versions
ntopng comes in three versions, Community, Professional (Small Business Edition) and Enterprise. The Community version is free to use and opensource (code can be found on Github). The Professional and Enterprise offer some extra features that are particularly useful for SMEs or larger organizations. Features are highlighted in the following table.

So IMO it is not needed to explicitly declare this package as "Community Edition", since only this is opensource.

When I was developping the package, the german magazin c't had a series about ntopng, and for raspberry pi there are Pro-Versions for Embedded ARM available (payable).

@ymartin59
Copy link
Contributor

@hgy59 Do you consider this as tested enough to be published (even after json-c update)?

@hgy59
Copy link
Contributor Author

hgy59 commented Mar 14, 2020

@ymartin59 yes, I tested it with DS218+ (x64) after json-c update.

Comment on lines 1 to 3
PKG_NAME = libmysqlclient
PKG_REAL_NAME = mysql-connector-c
PKG_VERS = 6.1.6
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason why cross/libmysqlclient and native/libmysqlclient does not compile same version? If none, I expect here 6.1.11

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is a mistake of mine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hgy59 May you please fix version so that I may publish

@hgy59
Copy link
Contributor Author

hgy59 commented Apr 5, 2020

@ymartin59 sorry, forgot to commit my changes made three weeks ago.

cytec and others added 9 commits April 7, 2020 20:43
- update ntopng to version 3.8.1
- implement DSM 6 service setup (indeed DSM <= 5.2 is not supported anymore)
- move data dir to {pkg}/var/data
- move ntopng.conf to {pkg}/etc
- add new dependencies (lua, libxml2, curl, glib)
- add nDPI module (from ntop.org too)
- update rrdtool (add new modules: pango, cairo, pixman; groff, urw-base35-fonts, uchardet)
- add libmaxminddb
- add libmysqlclient (mysql-connector-c)
- add native modules libmysqlclient and ghostscript
- update libpcap
- update libsodium
- update geoip
- remove unused module cross/termcap from repo
- remove empty module cross/libcap (maybe we need it later)
- update ntopng icon
- add initial GeoLite2 content files (further updates are not available anymore without API key)
- add patches (by sed) to set synology specific infos into generated code
- ntopng needs libcap for some network discovery functions
- without linking to libcap the pid file is not created on the initial start
- service start would work only after manually killing the initial process
- use custom start-stop-status.sh script with SSS_SCRIPT
- generic service-setup does not work for background-service changing pid-file owner on start
@ymartin59
Copy link
Contributor

@hgy59 I see in application features "Lua scripting". We have already Lua here, but I wonder it is available in "community edition"...

@ymartin59 ymartin59 merged commit dc27c24 into SynoCommunity:master Apr 7, 2020
@ymartin59
Copy link
Contributor

Package published

@hgy59 hgy59 deleted the cytec-ntop branch April 9, 2020 23:39
@djmax9999
Copy link

Hi, is there any chance to get NTOPNG updated to Version 4.0 ? It would be great, because there are several nice features added to Version 4.0x.
Or is there any documentation how to get it cross compiled by myself ?
I am using a DS216j.
Thanks so far....

@hgy59
Copy link
Contributor Author

hgy59 commented May 12, 2020

@djmax9999 there is already issue #3984 that requests such an update.
Unfortunately it is not just update and deploy. My first try failed already for building the updated cross/ndpi...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants