Author Archives: Richard Bejtlich (noreply@blogger.com)

TaoSecurity: Ntopng on Security Onion

so16@so16:~$ mkdir git
so16@so16:~$ cd git
so16@so16:~/git$ ls
so16@so16:~/git$ wget --no-check-certificate https://github.com/branchnetconsulting/so-ntopng-installer/raw/master/install_ntopng_on_so_16
--2019-02-11 02:48:02--  https://github.com/branchnetconsulting/so-ntopng-installer/raw/master/install_ntopng_on_so_16
Resolving github.com (github.com)... 192.30.253.112, 192.30.253.113
Connecting to github.com (github.com)|192.30.253.112|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://raw.githubusercontent.com/branchnetconsulting/so-ntopng-installer/master/install_ntopng_on_so_16 [following]
--2019-02-11 02:48:02--  https://raw.githubusercontent.com/branchnetconsulting/so-ntopng-installer/master/install_ntopng_on_so_16
Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.0.133, 151.101.64.133, 151.101.128.133, ...
Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.0.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8002 (7.8K) [text/plain]
Saving to: ‘install_ntopng_on_so_16’

install_ntopng_on_so_16               100%[=========================================================================>]   7.81K  --.-KB/s    in 0s

2019-02-11 02:48:02 (37.5 MB/s) - ‘install_ntopng_on_so_16’ saved [8002/8002]

so16@so16:~/git$ chmod 700 install_ntopng_on_so_16
so16@so16:~/git$ sudo ./install_ntopng_on_so_16

*
* Starting install/upgrade of ntopng
*

gpg: keyring `/tmp/tmp06wfhwz_/secring.gpg' created
gpg: keyring `/tmp/tmp06wfhwz_/pubring.gpg' created
gpg: requesting key DE742AFA from hkp server keyserver.ubuntu.com
gpg: /tmp/tmp06wfhwz_/trustdb.gpg: trustdb created
gpg: key DE742AFA: public key "Launchpad PPA for MaxMind" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
Reading package lists... Done
Building dependency tree
Reading state information... Done
bridge-utils is already the newest version (1.5-9ubuntu1).
bridge-utils set to manually installed.
libmnl0 is already the newest version (1.0.3-5).
libnetfilter-conntrack3 is already the newest version (1.0.5-1).
libjemalloc1 is already the newest version (3.6.0-9ubuntu1).
libjemalloc1 set to manually installed.
libzmq5 is already the newest version (4.1.4-7).
libzmq5 set to manually installed.
redis-server is already the newest version (2:3.0.6-1ubuntu0.3).
redis-tools is already the newest version (2:3.0.6-1ubuntu0.3).
redis-tools set to manually installed.
The following packages were automatically installed and are no longer required:
  gir1.2-appindicator3-0.1 gir1.2-javascriptcoregtk-4.0 gir1.2-nma-1.0 gir1.2-timezonemap-1.0 gir1.2-webkit2-4.0 libtimezonemap-data libtimezonemap1
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  mmdb-bin
The following NEW packages will be installed:
  fonts-dejavu fonts-dejavu-extra libnetfilter-queue1 libpgm-5.2-0 librdkafka1 librrd4 libzstd0 ttf-dejavu ttf-dejavu-core ttf-dejavu-extra
The following packages will be upgraded:
  libmaxminddb0
1 upgraded, 10 newly installed, 0 to remove and 1 not upgraded.
Need to get 2,339 kB of archives.
After this operation, 8,766 kB of additional disk space will be used.
Get:1 http://ppa.launchpad.net/maxmind/ppa/ubuntu xenial/main amd64 libmaxminddb0 amd64 1.3.2-0+maxmind1~xenial [30.2 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 fonts-dejavu-extra all 2.35-1 [1,749 kB]
Get:3 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 fonts-dejavu all 2.35-1 [3,184 B]
Get:4 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 libnetfilter-queue1 amd64 1.0.2-2 [11.4 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 libpgm-5.2-0 amd64 5.2.122~dfsg-2 [157 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 librdkafka1 amd64 0.8.6-1.1 [87.7 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 librrd4 amd64 1.5.5-4 [180 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 libzstd0 amd64 0.5.1-1 [112 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 ttf-dejavu-core all 2.35-1 [3,038 B]
Get:10 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 ttf-dejavu-extra all 2.35-1 [3,176 B]
Get:11 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 ttf-dejavu all 2.35-1 [2,880 B]
Fetched 2,339 kB in 0s (3,828 kB/s)
Selecting previously unselected package fonts-dejavu-extra.
(Reading database ... 178067 files and directories currently installed.)
Preparing to unpack .../fonts-dejavu-extra_2.35-1_all.deb ...
Unpacking fonts-dejavu-extra (2.35-1) ...
Selecting previously unselected package fonts-dejavu.
Preparing to unpack .../fonts-dejavu_2.35-1_all.deb ...
Unpacking fonts-dejavu (2.35-1) ...
Preparing to unpack .../libmaxminddb0_1.3.2-0+maxmind1~xenial_amd64.deb ...
Unpacking libmaxminddb0:amd64 (1.3.2-0+maxmind1~xenial) over (1.0.4-2.1) ...
Selecting previously unselected package libnetfilter-queue1.
Preparing to unpack .../libnetfilter-queue1_1.0.2-2_amd64.deb ...
Unpacking libnetfilter-queue1 (1.0.2-2) ...
Selecting previously unselected package libpgm-5.2-0:amd64.
Preparing to unpack .../libpgm-5.2-0_5.2.122~dfsg-2_amd64.deb ...
Unpacking libpgm-5.2-0:amd64 (5.2.122~dfsg-2) ...
Selecting previously unselected package librdkafka1:amd64.
Preparing to unpack .../librdkafka1_0.8.6-1.1_amd64.deb ...
Unpacking librdkafka1:amd64 (0.8.6-1.1) ...
Selecting previously unselected package librrd4:amd64.
Preparing to unpack .../librrd4_1.5.5-4_amd64.deb ...
Unpacking librrd4:amd64 (1.5.5-4) ...
Selecting previously unselected package libzstd0.
Preparing to unpack .../libzstd0_0.5.1-1_amd64.deb ...
Unpacking libzstd0 (0.5.1-1) ...
Selecting previously unselected package ttf-dejavu-core.
Preparing to unpack .../ttf-dejavu-core_2.35-1_all.deb ...
Unpacking ttf-dejavu-core (2.35-1) ...
Selecting previously unselected package ttf-dejavu-extra.
Preparing to unpack .../ttf-dejavu-extra_2.35-1_all.deb ...
Unpacking ttf-dejavu-extra (2.35-1) ...
Selecting previously unselected package ttf-dejavu.
Preparing to unpack .../ttf-dejavu_2.35-1_all.deb ...
Unpacking ttf-dejavu (2.35-1) ...
Processing triggers for fontconfig (2.11.94-0ubuntu1.1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up fonts-dejavu-extra (2.35-1) ...
Setting up fonts-dejavu (2.35-1) ...
Setting up libmaxminddb0:amd64 (1.3.2-0+maxmind1~xenial) ...
Setting up libnetfilter-queue1 (1.0.2-2) ...
Setting up libpgm-5.2-0:amd64 (5.2.122~dfsg-2) ...
Setting up librdkafka1:amd64 (0.8.6-1.1) ...
Setting up librrd4:amd64 (1.5.5-4) ...
Setting up libzstd0 (0.5.1-1) ...
Setting up ttf-dejavu-core (2.35-1) ...
Setting up ttf-dejavu-extra (2.35-1) ...
Setting up ttf-dejavu (2.35-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...

*
* Downloading packages needed for ntopng installation...
*

--2019-02-11 02:48:39--  http://packages.ntop.org/apt-stable/16.04/x64/ntopng_3.8.190206-6076_amd64.deb
Resolving packages.ntop.org (packages.ntop.org)... 151.11.50.180, 2a03:b0c0:2:d0::d27:3001
Connecting to packages.ntop.org (packages.ntop.org)|151.11.50.180|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 6462068 (6.2M) [application/x-debian-package]
Saving to: ‘ntopng_3.8.190206-6076_amd64.deb’

ntopng_3.8.190206-6076_amd64.deb      100%[=========================================================================>]   6.16M  4.98MB/s    in 1.2s

2019-02-11 02:48:41 (4.98 MB/s) - ‘ntopng_3.8.190206-6076_amd64.deb’ saved [6462068/6462068]

--2019-02-11 02:48:41--  http://packages.ntop.org/apt-stable/16.04/all/ntopng-data_3.8.190206_all.deb
Reusing existing connection to packages.ntop.org:80.
HTTP request sent, awaiting response... 200 OK
Length: 21102590 (20M) [application/x-debian-package]
Saving to: ‘ntopng-data_3.8.190206_all.deb’

ntopng-data_3.8.190206_all.deb        100%[=========================================================================>]  20.12M  11.2MB/s    in 1.8s

2019-02-11 02:48:43 (11.2 MB/s) - ‘ntopng-data_3.8.190206_all.deb’ saved [21102590/21102590]

FINISHED --2019-02-11 02:48:43--
Total wall clock time: 3.4s
Downloaded: 2 files, 26M in 3.0s (8.67 MB/s)
dpkg-deb: building package 'pfring' in 'pfring-stub.deb'.
Selecting previously unselected package pfring.
(Reading database ... 178152 files and directories currently installed.)
Preparing to unpack pfring-stub.deb ...
Unpacking pfring (7.4.0-2398) ...
Setting up pfring (7.4.0-2398) ...
Selecting previously unselected package ntopng.
(Reading database ... 178152 files and directories currently installed.)
Preparing to unpack ntopng_3.8.190206-6076_amd64.deb ...
Unpacking ntopng (3.8.190206-6076) ...
Selecting previously unselected package ntopng-data.
Preparing to unpack ntopng-data_3.8.190206_all.deb ...
Unpacking ntopng-data (3.8.190206) ...
Setting up ntopng-data (3.8.190206) ...
dpkg: ntopng: dependency problems, but configuring anyway as you requested:
 ntopng depends on n2n; however:
  Package n2n is not installed.
 ntopng depends on libradcli4; however:
  Package libradcli4 is not installed.

Setting up ntopng (3.8.190206-6076) ...

Configuration file '/usr/share/ntopng/httpdocs/ssl/ntopng-cert.pem', does not exist on system.
Installing new config file as you requested.

Configuration file '/etc/ntopng/ntopng.conf', does not exist on system.
Installing new config file as you requested.
Creating ntopng group
Creating ntopng user...
Rebuilding ld cache...
(Re)Starting ntopng...
Created symlink from /etc/systemd/system/multi-user.target.wants/ntopng.service to /etc/systemd/system/ntopng.service.
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Generating /etc/ntopng/ntopng.conf for the first time.  Consult ntopng man page for customization options.
The default login credentials for ntopng are: admin/admin

*
* Adding 3000/tcp to ufw open ports.
* If this is not desired, manually delete the new ufw rules and then create an empty file '/etc/ntopng/no_touch_ufw' to prevent future ntopng installer updates from modifying ufw.
*

Rule added
Rule added (v6)
Job for ntopng.service failed because the control process exited with error code. See "systemctl status ntopng.service" and "journalctl -xe" for details.
Job for ntopng.service failed because the control process exited with error code. See "systemctl status ntopng.service" and "journalctl -xe" for details.

*
* The ntopng should now be running.  Surf to https://192.168.4.76:3000 to reach it.
*

so16@so16:~/git$ sudo systemctl status ntopng.service
● ntopng.service - ntopng high-speed web-based traffic monitoring and analysis tool
   Loaded: loaded (/etc/systemd/system/ntopng.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2019-02-11 02:48:51 UTC; 1min 1s ago
  Process: 33236 ExecStopPost=/bin/sh -c /bin/echo "$(/bin/date) ntopng StopPost" >> /var/log/ntop-systemd.log (code=exited, status=0/SUCCESS)
  Process: 33233 ExecStopPost=/bin/rm -rf /run/ntopng.conf (code=exited, status=0/SUCCESS)
  Process: 33226 ExecStartPost=/bin/sh -c /bin/echo "$(/bin/date) ntopng StartPost" >> /var/log/ntop-systemd.log (code=exited, status=0/SUCCESS)
  Process: 33225 ExecStart=/usr/local/bin/ntopng /run/ntopng.conf (code=exited, status=127)
  Process: 33214 ExecStartPre=/bin/sh -c /bin/sed "/^[ ]*-e.*$\|^[ ]*-G.*\|^[ ]*--daemon.*\|^[ ]*--pid.*/s/^/#/" /etc/ntopng/ntopng.conf > /run/ntopng.c
  Process: 33184 ExecStartPre=/bin/sh -c /usr/bin/ntopng-utils-manage-config -a check-restore  && /usr/bin/ntopng-utils-manage-config -a restore || true
  Process: 33173 ExecStartPre=/bin/sh -c /bin/echo "$(/bin/date) ntopng StartPre" >> /var/log/ntop-systemd.log (code=exited, status=0/SUCCESS)
 Main PID: 33225 (code=exited, status=127)

Feb 11 02:48:51 so16 systemd[1]: ntopng.service: Unit entered failed state.
Feb 11 02:48:51 so16 systemd[1]: ntopng.service: Failed with result 'exit-code'.
Feb 11 02:48:51 so16 systemd[1]: Stopped ntopng high-speed web-based traffic monitoring and analysis tool.
Feb 11 02:48:51 so16 systemd[1]: Starting ntopng high-speed web-based traffic monitoring and analysis tool...
Feb 11 02:48:51 so16 ntopng[33225]: /usr/local/bin/ntopng: error while loading shared libraries: libradcli.so.4: cannot open shared object file: No such
Feb 11 02:48:51 so16 systemd[1]: ntopng.service: Main process exited, code=exited, status=127/n/a
Feb 11 02:48:51 so16 systemd[1]: Failed to start ntopng high-speed web-based traffic monitoring and analysis tool.
Feb 11 02:48:51 so16 systemd[1]: ntopng.service: Unit entered failed state.
Feb 11 02:48:51 so16 systemd[1]: ntopng.service: Failed with result 'exit-code'.

so16@so16:~/git$ sudo apt-get install libradcli4
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 ntopng : Depends: n2n but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

so16@so16:~/git$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  gir1.2-appindicator3-0.1 gir1.2-javascriptcoregtk-4.0 gir1.2-nma-1.0 gir1.2-timezonemap-1.0 gir1.2-webkit2-4.0 libtimezonemap-data libtimezonemap1
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libradcli4 n2n
The following NEW packages will be installed:
  libradcli4 n2n
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 66.5 kB of archives.
After this operation, 257 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 libradcli4 amd64 1.2.4-2.1 [28.8 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu xenial/universe amd64 n2n amd64 1.3.1~svn3789-5 [37.7 kB]
Fetched 66.5 kB in 0s (339 kB/s)
Selecting previously unselected package libradcli4.
(Reading database ... 178799 files and directories currently installed.)
Preparing to unpack .../libradcli4_1.2.4-2.1_amd64.deb ...
Unpacking libradcli4 (1.2.4-2.1) ...
Selecting previously unselected package n2n.
Preparing to unpack .../n2n_1.3.1~svn3789-5_amd64.deb ...
Unpacking n2n (1.3.1~svn3789-5) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21.15) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libradcli4 (1.2.4-2.1) ...
Setting up n2n (1.3.1~svn3789-5) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for systemd (229-4ubuntu21.15) ...
Processing triggers for ureadahead (0.100.0-19) ...

so16@so16:~/git$ sudo systemctl restart ntopng.service

so16@so16:~/git$ sudo systemctl status ntopng.service
● ntopng.service - ntopng high-speed web-based traffic monitoring and analysis tool
   Loaded: loaded (/etc/systemd/system/ntopng.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-02-11 02:54:25 UTC; 3s ago
  Process: 39872 ExecStartPost=/bin/sh -c /bin/echo "$(/bin/date) ntopng StartPost" >> /var/log/ntop-systemd.log (code=exited, status=0/SUCCESS)
  Process: 39866 ExecStartPre=/bin/sh -c /bin/sed "/^[ ]*-e.*$\|^[ ]*-G.*\|^[ ]*--daemon.*\|^[ ]*--pid.*/s/^/#/" /etc/ntopng/ntopng.conf > /run/ntopng.c
  Process: 39844 ExecStartPre=/bin/sh -c /usr/bin/ntopng-utils-manage-config -a check-restore  && /usr/bin/ntopng-utils-manage-config -a restore || true
  Process: 39829 ExecStartPre=/bin/sh -c /bin/echo "$(/bin/date) ntopng StartPre" >> /var/log/ntop-systemd.log (code=exited, status=0/SUCCESS)
 Main PID: 39871 (ntopng)
    Tasks: 1
   Memory: 25.1M
      CPU: 288ms
   CGroup: /system.slice/ntopng.service
           └─39871 /usr/local/bin/ntopng /run/ntopng.conf

Feb 11 02:54:25 so16 systemd[1]: Stopped ntopng high-speed web-based traffic monitoring and analysis tool.
Feb 11 02:54:25 so16 systemd[1]: Starting ntopng high-speed web-based traffic monitoring and analysis tool...
Feb 11 02:54:25 so16 systemd[1]: Started ntopng high-speed web-based traffic monitoring and analysis tool.
Feb 11 02:54:26 so16 ntopng[39871]: 11/Feb/2019 02:54:26 [Ntop.cpp:1902] Setting local networks to 192.168.0.0/16,10.0.0.0/8,172.16.0.0/12
Feb 11 02:54:26 so16 ntopng[39871]: 11/Feb/2019 02:54:26 [Redis.cpp:127] Successfully connected to redis 127.0.0.1:6379@0
Feb 11 02:54:26 so16 ntopng[39871]: 11/Feb/2019 02:54:26 [Redis.cpp:127] Successfully connected to redis 127.0.0.1:6379@0
Feb 11 02:54:28 so16 ntopng[39871]: [PF_RING] Wrong RING version: kernel is 16, libpfring was compiled with 17

so16@so16:~/git$ sudo systemctl status ntopng.service
● ntopng.service - ntopng high-speed web-based traffic monitoring and analysis tool
   Loaded: loaded (/etc/systemd/system/ntopng.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Mon 2019-02-11 02:54:30 UTC; 5min ago
  Process: 39941 ExecStopPost=/bin/sh -c /bin/echo "$(/bin/date) ntopng StopPost" >> /var/log/ntop-systemd.log (code=exited, status=0/SUCCESS)
  Process: 39938 ExecStopPost=/bin/rm -rf /run/ntopng.conf (code=exited, status=0/SUCCESS)
  Process: 39872 ExecStartPost=/bin/sh -c /bin/echo "$(/bin/date) ntopng StartPost" >> /var/log/ntop-systemd.log (code=exited, status=0/SUCCESS)
  Process: 39871 ExecStart=/usr/local/bin/ntopng /run/ntopng.conf (code=exited, status=1/FAILURE)
  Process: 39866 ExecStartPre=/bin/sh -c /bin/sed "/^[ ]*-e.*$\|^[ ]*-G.*\|^[ ]*--daemon.*\|^[ ]*--pid.*/s/^/#/" /etc/ntopng/ntopng.conf > /run/ntopng.c
  Process: 39844 ExecStartPre=/bin/sh -c /usr/bin/ntopng-utils-manage-config -a check-restore  && /usr/bin/ntopng-utils-manage-config -a restore || true
  Process: 39829 ExecStartPre=/bin/sh -c /bin/echo "$(/bin/date) ntopng StartPre" >> /var/log/ntop-systemd.log (code=exited, status=0/SUCCESS)
 Main PID: 39871 (code=exited, status=1/FAILURE)

Feb 11 02:54:29 so16 ntopng[39871]: 11/Feb/2019 02:54:29 [PcapInterface.cpp:93] Reading packets from interface ens33...
Feb 11 02:54:29 so16 ntopng[39871]: 11/Feb/2019 02:54:29 [Ntop.cpp:1996] Registered interface ens33 [id: 0]
Feb 11 02:54:29 so16 ntopng[39871]: 11/Feb/2019 02:54:29 [main.cpp:308] PID stored in file /var/run/ntopng.pid
Feb 11 02:54:30 so16 ntopng[39871]: 11/Feb/2019 02:54:30 [Utils.cpp:592] User changed to ntopng
Feb 11 02:54:30 so16 ntopng[39871]: 11/Feb/2019 02:54:30 [HTTPserver.cpp:1199] Web server dirs [/usr/share/ntopng/httpdocs][/usr/share/ntopng/scripts]
Feb 11 02:54:30 so16 ntopng[39871]: 11/Feb/2019 02:54:30 [HTTPserver.cpp:1208] HTTPS server listening on 3000
Feb 11 02:54:30 so16 ntopng[39871]: 11/Feb/2019 02:54:30 [main.cpp:365] ERROR: Unable to write on /usr/local/ntopng as 'ntopng' [/usr/local/ntopng/.test
Feb 11 02:54:30 so16 systemd[1]: ntopng.service: Main process exited, code=exited, status=1/FAILURE
Feb 11 02:54:30 so16 systemd[1]: ntopng.service: Unit entered failed state.
Feb 11 02:54:30 so16 systemd[1]: ntopng.service: Failed with result 'exit-code'.
so16@so16:~/git$ ls -al /usr/local/ntopng
total 8
drwxr-xr-x  2 nobody root 4096 Feb 11 02:48 .
drwxr-xr-x 11 root   root 4096 Feb 11 02:48 ..
so16@so16:~/git$ sudo chown ntopng:ntopng /usr/local/ntopng
so16@so16:~/git$ ls -al /usr/local/ntopng
total 8
drwxr-xr-x  2 ntopng ntopng 4096 Feb 11 02:48 .
drwxr-xr-x 11 root   root   4096 Feb 11 02:48 ..
so16@so16:~/git$ ls -al /usr/local/ntopng/
total 8
drwxr-xr-x  2 ntopng ntopng 4096 Feb 11 02:48 .
drwxr-xr-x 11 root   root   4096 Feb 11 02:48 ..
so16@so16:~/git$ sudo systemctl restart ntopng.service
so16@so16:~/git$ sudo systemctl status ntopng.service
● ntopng.service - ntopng high-speed web-based traffic monitoring and analysis tool
   Loaded: loaded (/etc/systemd/system/ntopng.service; enabled; vendor preset: enabled)
   Active: active (running) since Mon 2019-02-11 03:03:13 UTC; 4s ago
  Process: 39941 ExecStopPost=/bin/sh -c /bin/echo "$(/bin/date) ntopng StopPost" >> /var/log/ntop-systemd.log (code=exited, status=0/SUCCESS)
  Process: 39938 ExecStopPost=/bin/rm -rf /run/ntopng.conf (code=exited, status=0/SUCCESS)
  Process: 46939 ExecStartPost=/bin/sh -c /bin/echo "$(/bin/date) ntopng StartPost" >> /var/log/ntop-systemd.log (code=exited, status=0/SUCCESS)
  Process: 46933 ExecStartPre=/bin/sh -c /bin/sed "/^[ ]*-e.*$\|^[ ]*-G.*\|^[ ]*--daemon.*\|^[ ]*--pid.*/s/^/#/" /etc/ntopng/ntopng.conf > /run/ntopng.c
  Process: 46914 ExecStartPre=/bin/sh -c /usr/bin/ntopng-utils-manage-config -a check-restore  && /usr/bin/ntopng-utils-manage-config -a restore || true
  Process: 46903 ExecStartPre=/bin/sh -c /bin/echo "$(/bin/date) ntopng StartPre" >> /var/log/ntop-systemd.log (code=exited, status=0/SUCCESS)
 Main PID: 46938 (ntopng)
    Tasks: 9
   Memory: 77.1M
      CPU: 507ms
   CGroup: /system.slice/ntopng.service
           └─46938 /usr/local/bin/ntopng /run/ntopng.conf

Feb 11 03:03:16 so16 ntopng[46938]: 11/Feb/2019 03:03:16 [PcapInterface.cpp:93] Reading packets from interface ens33...
Feb 11 03:03:16 so16 ntopng[46938]: 11/Feb/2019 03:03:16 [Ntop.cpp:1996] Registered interface ens33 [id: 0]
Feb 11 03:03:16 so16 ntopng[46938]: 11/Feb/2019 03:03:16 [main.cpp:308] PID stored in file /var/run/ntopng.pid
Feb 11 03:03:17 so16 ntopng[46938]: 11/Feb/2019 03:03:17 [Utils.cpp:592] User changed to ntopng
Feb 11 03:03:17 so16 ntopng[46938]: 11/Feb/2019 03:03:17 [HTTPserver.cpp:1199] Web server dirs [/usr/share/ntopng/httpdocs][/usr/share/ntopng/scripts]
Feb 11 03:03:17 so16 ntopng[46938]: 11/Feb/2019 03:03:17 [HTTPserver.cpp:1208] HTTPS server listening on 3000
Feb 11 03:03:17 so16 ntopng[46938]: 11/Feb/2019 03:03:17 [main.cpp:390] Working directory: /usr/local/ntopng
Feb 11 03:03:17 so16 ntopng[46938]: 11/Feb/2019 03:03:17 [main.cpp:392] Scripts/HTML pages directory: /usr/share/ntopng
Feb 11 03:03:17 so16 ntopng[46938]: 11/Feb/2019 03:03:17 [Ntop.cpp:403] Welcome to ntopng x86_64 v.3.8.190206 - (C) 1998-18 ntop.org
Feb 11 03:03:17 so16 ntopng[46938]: 11/Feb/2019 03:03:17 [Ntop.cpp:413] Built on Ubuntu 16.04.5 LTS
lines 1-26/26 (END)



TaoSecurity

TaoSecurity: Trying DetectionLab

Many security professionals run personal labs. Trying to create an environment that includes fairly modern Windows systems can be a challenge. In the age of "infrastructure as code," there should be a simpler way to deploy systems in a repeatable, virtualized way -- right?

Enter DetectionLab, a project by Chris Long. Briefly, Chris built a project that uses Packer and Vagrant to create an instrumented lab environment. Chris explained the project in late 2017 in a Medium post, which I recommend reading.

I can't even begin to describe all the functionality packed into this project. So much of it is new, but this is a great way to learn about it. In this post, I would like to show how I got a version of DetectionLab running.

My build environment included a modern laptop with 16 GB RAM and Windows 10 professional. I had already installed Virtualbox 6.0 with the appropriate VirtualBox Extension Pack. I had also enabled the native OpenSSH server and performed all DetectionLab installation functions over an OpenSSH session.

Install Chocolatey

My first step was to install Chocolatey, a package manager for Windows. I wanted to use this to install the Git client I wanted to use to clone the DetectionLab repo. Commands I typed at each stage are in bold below.

root@LAPTOP-HT4TGVCP C:\Users\root>@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "ie
x ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
Getting latest version of the Chocolatey package for download.
Getting Chocolatey from https://chocolatey.org/api/v2/package/chocolatey/0.10.11.
Downloading 7-Zip commandline tool prior to extraction.
Extracting C:\Users\root\AppData\Local\Temp\chocolatey\chocInstall\chocolatey.zip to C:\Users\root\AppData\Local\Temp\chocolatey\chocInstall...
Installing chocolatey on this machine
Creating ChocolateyInstall as an environment variable (targeting 'Machine')
  Setting ChocolateyInstall to 'C:\ProgramData\chocolatey'
WARNING: It's very likely you will need to close and reopen your shell
  before you can use choco.
Restricting write permissions to Administrators
We are setting up the Chocolatey package repository.
The packages themselves go to 'C:\ProgramData\chocolatey\lib'
  (i.e. C:\ProgramData\chocolatey\lib\yourPackageName).
A shim file for the command line goes to 'C:\ProgramData\chocolatey\bin'
  and points to an executable in 'C:\ProgramData\chocolatey\lib\yourPackageName'.

Creating Chocolatey folders if they do not already exist.

WARNING: You can safely ignore errors related to missing log files when
  upgrading from a version of Chocolatey less than 0.9.9.
  'Batch file could not be found' is also safe to ignore.
  'The system cannot find the file specified' - also safe.
chocolatey.nupkg file not installed in lib.
 Attempting to locate it from bootstrapper.
PATH environment variable does not have C:\ProgramData\chocolatey\bin in it. Adding...
WARNING: Not setting tab completion: Profile file does not exist at 'C:\Users\root\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1'.
Chocolatey (choco.exe) is now ready.
You can call choco from anywhere, command line or powershell by typing choco.
Run choco /? for a list of functions.
You may need to shut down and restart powershell and/or consoles
 first prior to using choco.
Ensuring chocolatey commands are on the path
Ensuring chocolatey.nupkg is in the lib folder

root@LAPTOP-HT4TGVCP C:\Users\root>choco
Chocolatey v0.10.11
Please run 'choco -?' or 'choco -?' for help menu.

Install Git

With Chocolatey installed, I could install Git.

root@LAPTOP-HT4TGVCP C:\Users\root>choco install git -params '"/GitAndUnixToolsOnPath"'
Chocolatey v0.10.11
Installing the following packages:
git
By installing you accept licenses for the packages.
Progress: Downloading git.install 2.20.1... 100%
Progress: Downloading chocolatey-core.extension 1.3.3... 100%
Progress: Downloading git 2.20.1... 100%

chocolatey-core.extension v1.3.3 [Approved]
chocolatey-core.extension package files install completed. Performing other installation steps.
 Installed/updated chocolatey-core extensions.
 The install of chocolatey-core.extension was successful.
  Software installed to 'C:\ProgramData\chocolatey\extensions\chocolatey-core'

git.install v2.20.1 [Approved]
git.install package files install completed. Performing other installation steps.
The package git.install wants to run 'chocolateyInstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[N]o/[P]rint): y

@{Inno Setup CodeFile: Path Option=CmdTools; PSPath=Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Git_
is1; PSParentPath=Microsoft.PowerShell.Core\Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall; PSChildName=Git_is1; PSDrive=HKLM; PS
Provider=Microsoft.PowerShell.Core\Registry}
Using Git LFS
Installing 64-bit git.install...
git.install has been installed.
git.install installed to 'C:\Program Files\Git'
  git.install can be automatically uninstalled.
Environment Vars (like PATH) have changed. Close/reopen your shell to
 see the changes (or in powershell/cmd.exe just type `refreshenv`).
 The install of git.install was successful.
  Software installed to 'C:\Program Files\Git\'

git v2.20.1 [Approved]
git package files install completed. Performing other installation steps.
 The install of git was successful.
  Software install location not explicitly set, could be in package or
  default install location if installer.

Chocolatey installed 3/3 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Clone DetectionLab

With Git installed, I can clone the DetectionLab repo from Github.

root@LAPTOP-HT4TGVCP C:\Users\root>mkdir git

root@LAPTOP-HT4TGVCP C:\Users\root>cd git

root@LAPTOP-HT4TGVCP C:\Users\root\git>mkdir detectionlab

root@LAPTOP-HT4TGVCP C:\Users\root\git>cd detectionlab

root@LAPTOP-HT4TGVCP C:\Users\root\git\detectionlab>git clone https://github.com/clong/DetectionLab.git
'git' is not recognized as an internal or external command,
operable program or batch file.

root@LAPTOP-HT4TGVCP C:\Users\root\git\detectionlab>refreshenv
Refreshing environment variables from registry for cmd.exe. Please wait...Finished..

root@LAPTOP-HT4TGVCP C:\Users\root\git\detectionlab>git clone https://github.com/clong/DetectionLab.git
Cloning into 'DetectionLab'...
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 1163 (delta 0), reused 0 (delta 0), pack-reused 1162R
Receiving objects: 100% (1163/1163), 11.81 MiB | 12.24 MiB/s, done.
Resolving deltas: 100% (568/568), done.

Install Vagrant

Before going any further, I needed to install Vagrant.

root@LAPTOP-HT4TGVCP C:\Users\root\git\detectionlab>cd ..\..\

root@LAPTOP-HT4TGVCP C:\Users\root>choco install vagrant
Chocolatey v0.10.11
Installing the following packages:
vagrant
By installing you accept licenses for the packages.
Progress: Downloading vagrant 2.2.3... 100%

vagrant v2.2.3 [Approved]
vagrant package files install completed. Performing other installation steps.
The package vagrant wants to run 'chocolateyinstall.ps1'.
Note: If you don't run this script, the installation will fail.
Note: To confirm automatically next time, use '-y' or consider:
choco feature enable -n allowGlobalConfirmation
Do you want to run the script?([Y]es/[N]o/[P]rint): y

Downloading vagrant 64 bit
  from 'https://releases.hashicorp.com/vagrant/2.2.3/vagrant_2.2.3_x86_64.msi'
Progress: 100% - Completed download of C:\Users\root\AppData\Local\Temp\chocolatey\vagrant\2.2.3\vagrant_2.2.3_x86_64.msi (229.22 MB).
Download of vagrant_2.2.3_x86_64.msi (229.22 MB) completed.
Hashes match.
Installing vagrant...
vagrant has been installed.
Repairing currently installed global plugins. This may take a few minutes...
Installed plugins successfully repaired!
  vagrant may be able to be automatically uninstalled.
Environment Vars (like PATH) have changed. Close/reopen your shell to
 see the changes (or in powershell/cmd.exe just type `refreshenv`).
 The install of vagrant was successful.
  Software installed as 'msi', install location is likely default.

Chocolatey installed 1/1 packages.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Packages requiring reboot:
 - vagrant (exit code 3010)

The recent package changes indicate a reboot is necessary.
 Please reboot at your earliest convenience.

root@LAPTOP-HT4TGVCP C:\Users\root>shutdown /r /t 0

Installing DetectionLab

Now we are finally at the point where we can install DetectionLab. Note that in my example, I downloaded boxes already built by Chris. I did not build my own, in order to save time. You can follow his instructions to build boxes yourself.

I saw an error regarding the win10 host, but that did not appear to be a real problem.

root@LAPTOP-HT4TGVCP C:\Users\root\git\detectionlab\DetectionLab>powershell
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.

PS C:\Users\root\git\detectionlab\DetectionLab> .\build.ps1 -ProviderName virtualbox -VagrantOnly
[preflight_checks] Running..
[preflight_checks] Checking if Vagrant is installed
[preflight_checks] Checking for pre-existing boxes..
[preflight_checks] Checking for vagrant instances..
[preflight_checks] Checking disk space..
[preflight_checks] Checking if vagrant-reload is installed..
The vagrant-reload plugin is required and not currently installed. This script will attempt to install it now.
Installing the 'vagrant-reload' plugin. This can take a few minutes...
Installed the plugin 'vagrant-reload (0.0.1)'!
[preflight_checks] Finished.
[download_boxes] Running..
[download_boxes] Downloading windows_10_virtualbox.box

[download_boxes] Downloading windows_2016_virtualbox.box
[download_boxes] Getting filehash for: windows_10_virtualbox.box
[download_boxes] Getting filehash for: windows_2016_virtualbox.box
[download_boxes] Checking Filehashes..
[download_boxes] Finished.
[main] Running vagrant_up_host for: logger
[vagrant_up_host] Running for logger
Attempting to bring up the logger host using Vagrant
[vagrant_up_host] Finished for logger. Got exit code: 0
[main] vagrant_up_host finished. Exitcode: 0
Good news! logger was built successfully!
[main] Finished for: logger
[main] Running vagrant_up_host for: dc
[vagrant_up_host] Running for dc
Attempting to bring up the dc host using Vagrant
[vagrant_up_host] Finished for dc. Got exit code: 0
[main] vagrant_up_host finished. Exitcode: 0
Good news! dc was built successfully!
[main] Finished for: dc
[main] Running vagrant_up_host for: wef
[vagrant_up_host] Running for wef
Attempting to bring up the wef host using Vagrant
[vagrant_up_host] Finished for wef. Got exit code: 0
[main] vagrant_up_host finished. Exitcode: 0
Good news! wef was built successfully!
[main] Finished for: wef
[main] Running vagrant_up_host for: win10
[vagrant_up_host] Running for win10
Attempting to bring up the win10 host using Vagrant
[vagrant_up_host] Finished for win10. Got exit code: 1
[main] vagrant_up_host finished. Exitcode: 1
WARNING: Something went wrong while attempting to build the win10 box.
Attempting to reload and reprovision the host...
[main] Running vagrant_reload_host for: win10
[vagrant_reload_host] Running for win10
[vagrant_reload_host] Finished for win10. Got exit code: 1
C:\Users\root\git\detectionlab\DetectionLab\build.ps1 : Failed to bring up win10 after a reload. Exiting
At line:1 char:1
+ .\build.ps1 -ProviderName virtualbox -VagrantOnly
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,build.ps1

[main] Running post_build_checks
[post_build_checks] Running Caldera Check.
[download] Running for https://192.168.38.105:8888, looking for
[download] Found at https://192.168.38.105:8888
[post_build_checks] Cladera Result: True
[post_build_checks] Running Splunk Check.
[download] Running for https://192.168.38.105:8000/en-US/account/login?return_to=%2Fen-US%2F, looking for This browser is not supported by Splunk
[download] Found This browser is not supported by Splunk at https://192.168.38.105:8000/en-US/account/login?return_to=%2Fen-US%2F
[post_build_checks] Splunk Result: True
[post_build_checks] Running Fleet Check.
[download] Running for https://192.168.38.105:8412, looking for Kolide Fleet
[download] Found Kolide Fleet at https://192.168.38.105:8412
[post_build_checks] Fleet Result: True
[post_build_checks] Running MS ATA Check.
[download] Running for https://192.168.38.103, looking for
[post_build_checks] ATA Result: True
[main] Finished post_build_checks

Checking the VMs

I used the Virtualbox command line program to check the status of the new VMs.

root@LAPTOP-HT4TGVCP c:\Program Files\Oracle\VirtualBox>VBoxManage list runningvms
"logger" {3da9fffb-4b02-4e57-a592-dd2322f14245}
"dc.windomain.local" {ef32d493-845c-45dc-aff7-3a86d9c590cd}
"wef.windomain.local" {7cd008b7-c6e0-421d-9655-8f92ec98d9d7}
"win10.windomain.local" {acf413fb-6358-44df-ab9f-cc7767ed32bd}

Interacting with Vagrant and the Logger Host

Next I decided to use Vagrant to check on the status of the boxes, and to interact with one if I could. I wanted to find the Bro and Suricata logs.

root@LAPTOP-HT4TGVCP C:\Users\root\git\detectionlab\DetectionLab>cd Vagrant

root@LAPTOP-HT4TGVCP C:\Users\root\git\detectionlab\DetectionLab\Vagrant>vagrant status
Current machine states:

logger                    running (virtualbox)
dc                        running (virtualbox)
wef                       running (virtualbox)
win10                     running (virtualbox)

This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run `vagrant status NAME`.


root@LAPTOP-HT4TGVCP C:\Users\root\git\detectionlab\DetectionLab\Vagrant>vagrant ssh logger

Welcome to Ubuntu 16.04.5 LTS (GNU/Linux 4.4.0-131-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

29 packages can be updated.
24 updates are security updates.


Last login: Sun Jan 27 19:24:05 2019 from 10.0.2.2

root@logger:~# /opt/bro/bin/broctl status
Name         Type    Host             Status    Pid    Started
manager      manager localhost        running   9848   27 Jan 17:19:15
proxy        proxy   localhost        running   9893   27 Jan 17:19:16
worker-eth1-1 worker  localhost        running   9945   27 Jan 17:19:17
worker-eth1-2 worker  localhost        running   9948   27 Jan 17:19:17

vagrant@logger:~$ ls -al /opt/bro
total 32
drwxr-xr-x 8 root root 4096 Jan 27 17:19 .
drwxr-xr-x 5 root root 4096 Jan 27 17:19 ..
drwxr-xr-x 2 root root 4096 Jan 27 17:19 bin
drwxrwsr-x 2 root bro  4096 Jan 27 17:19 etc
drwxr-xr-x 3 root root 4096 Jan 27 17:19 lib
drwxrws--- 3 root bro  4096 Jan 27 18:00 logs
drwxr-xr-x 4 root root 4096 Jan 27 17:19 share
drwxrws--- 8 root bro  4096 Jan 27 17:19 spool

vagrant@logger:~$ ls -al /opt/bro/logs
ls: cannot open directory '/opt/bro/logs': Permission denied

vagrant@logger:~$ sudo bash

root@logger:~# ls -al /opt/bro/logs/
2019-01-27/ current/

root@logger:~# ls -al /opt/bro/logs/current/
total 3664
drwxr-sr-x 2 root bro    4096 Jan 27 19:20 .
drwxrws--- 8 root bro    4096 Jan 27 17:19 ..
-rw-r--r-- 1 root bro     475 Jan 27 19:19 capture_loss.log
-rw-r--r-- 1 root bro     127 Jan 27 17:19 .cmdline
-rw-r--r-- 1 root bro   83234 Jan 27 19:30 communication.log
-rw-r--r-- 1 root bro 1430714 Jan 27 19:30 conn.log
-rw-r--r-- 1 root bro    1340 Jan 27 19:00 dce_rpc.log
-rw-r--r-- 1 root bro  185114 Jan 27 19:28 dns.log
-rw-r--r-- 1 root bro     310 Jan 27 17:19 .env_vars
-rw-r--r-- 1 root bro  139387 Jan 27 19:30 files.log
-rw-r--r-- 1 root bro  544416 Jan 27 19:30 http.log
-rw-r--r-- 1 root bro     224 Jan 27 19:05 known_services.log
-rw-r--r-- 1 root bro     956 Jan 27 19:19 notice.log
-rw-r--r-- 1 root bro       5 Jan 27 17:19 .pid
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.capture_loss
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.communication
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.conn
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.conn-summary
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.dce_rpc
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.dns
-rw-r--r-- 1 root bro      18 Jan 27 18:00 .rotated.dpd
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.files
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.http
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.kerberos
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.known_certs
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.known_hosts
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.known_services
-rw-r--r-- 1 root bro      18 Jan 27 18:00 .rotated.loaded_scripts
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.notice
-rw-r--r-- 1 root bro      18 Jan 27 18:00 .rotated.packet_filter
-rw-r--r-- 1 root bro      18 Jan 27 18:00 .rotated.reporter
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.smb_files
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.smb_mapping
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.software
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.ssl
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.stats
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.weird
-rw-r--r-- 1 root bro      18 Jan 27 19:00 .rotated.x509
-rw-r--r-- 1 root bro    1311 Jan 27 19:24 smb_mapping.log
-rw-r--r-- 1 root bro   15767 Jan 27 19:30 ssl.log
-rw-r--r-- 1 root bro      58 Jan 27 17:19 .startup
-rw-r--r-- 1 root bro   11326 Jan 27 19:30 stats.log
-rwx------ 1 root bro      18 Jan 27 17:19 .status
-rw-r--r-- 1 root bro      80 Jan 27 19:00 stderr.log
-rw-r--r-- 1 root bro     188 Jan 27 17:19 stdout.log
-rw-r--r-- 1 root bro 1141860 Jan 27 19:30 weird.log
-rw-r--r-- 1 root bro    2799 Jan 27 19:20 x509.log

root@logger:~# cd /opt/bro/logs/

root@logger:/opt/bro/logs# ls
2019-01-27  current

root@logger:/opt/bro/logs# cd current

root@logger:/opt/bro/logs/current# ls

capture_loss.log   conn.log     dns.log    http.log            notice.log     smb_mapping.log  stats.log   stdout.log  x509.log
communication.log  dce_rpc.log  files.log  known_services.log  smb_files.log  ssl.log          stderr.log  weird.log

root@logger:/opt/bro/logs/current# jq  -c . dce_rpc.log  | head

{"ts":1548615615.836272,"uid":"CEmNr31qusp3G7GFg4","id.orig_h":"192.168.38.104","id.orig_p":49758,"id.resp_h":"192.168.38.102","id.resp_p":135,"named_pipe":
"135","endpoint":"epmapper","operation":"ept_map"}
{"ts":1548615615.83961,"uid":"CJO7xe4JUo43IjGG01","id.orig_h":"192.168.38.104","id.orig_p":49759,"id.resp_h":"192.168.38.102","id.resp_p":49667,"rtt":0.0003
57,"named_pipe":"49667","endpoint":"lsarpc","operation":"LsarLookupSids3"}
{"ts":1548615615.851544,"uid":"CJO7xe4JUo43IjGG01","id.orig_h":"192.168.38.104","id.orig_p":49759,"id.resp_h":"192.168.38.102","id.resp_p":49667,"rtt":0.000
596,"named_pipe":"49667","endpoint":"lsarpc","operation":"LsarLookupSids3"}
{"ts":1548615615.835628,"uid":"CgEcizh05xJ1ricP8","id.orig_h":"192.168.38.104","id.orig_p":49758,"id.resp_h":"192.168.38.102","id.resp_p":135,"named_pipe":"
135","endpoint":"epmapper","operation":"ept_map"}
{"ts":1548615615.839587,"uid":"CVV6WZ3vgpE673rl6a","id.orig_h":"192.168.38.104","id.orig_p":49759,"id.resp_h":"192.168.38.102","id.resp_p":49667,"rtt":0.000
382,"named_pipe":"49667","endpoint":"lsarpc","operation":"LsarLookupSids3"}
{"ts":1548615615.852193,"uid":"CVV6WZ3vgpE673rl6a","id.orig_h":"192.168.38.104","id.orig_p":49759,"id.resp_h":"192.168.38.102","id.resp_p":49667,"rtt":0.000
382,"named_pipe":"49667","endpoint":"lsarpc","operation":"LsarLookupSids3"}
{"ts":1548618003.200283,"uid":"CGYDww34wYz8eCYr96","id.orig_h":"192.168.38.103","id.orig_p":63295,"id.resp_h":"192.168.38.102","id.resp_p":135,"named_pipe":
"135","endpoint":"epmapper","operation":"ept_map"}
{"ts":1548618003.200403,"uid":"CrTZMz2nCXsiY5WOF8","id.orig_h":"192.168.38.103","id.orig_p":63295,"id.resp_h":"192.168.38.102","id.resp_p":135,"named_pipe":
"135","endpoint":"epmapper","operation":"ept_map"}

root@logger:~# head /var/log/suricata/fast.log

01/27/2019-17:19:08.133030  [**] [1:2013028:4] ET POLICY curl User-Agent Outbound [**] [Classification: Attempted Information Leak] [Priority: 2] {TCP} 10.0
.2.15:51574 -> 195.135.221.134:80
01/27/2019-17:19:08.292747  [**] [1:2013504:5] ET POLICY GNU/Linux APT User-Agent Outbound likely related to package management [**] [Classification: Not Su
spicious Traffic] [Priority: 3] {TCP} 10.0.2.15:55260 -> 99.84.178.103:80
01/27/2019-17:19:08.356618  [**] [1:2013504:5] ET POLICY GNU/Linux APT User-Agent Outbound likely related to package management [**] [Classification: Not Su
spicious Traffic] [Priority: 3] {TCP} 10.0.2.15:55260 -> 99.84.178.103:80
01/27/2019-17:19:08.432477  [**] [1:2013504:5] ET POLICY GNU/Linux APT User-Agent Outbound likely related to package management [**] [Classification: Not Su
spicious Traffic] [Priority: 3] {TCP} 10.0.2.15:46630 -> 91.189.95.83:80
01/27/2019-17:19:08.448249  [**] [1:2013504:5] ET POLICY GNU/Linux APT User-Agent Outbound likely related to package management [**] [Classification: Not Su
spicious Traffic] [Priority: 3] {TCP} 10.0.2.15:53932 -> 91.189.88.161:80
...trimmed...

Docker on the Logger Host

Chris is using Docker to provide some of the Logger host functions, e.g.:

root@logger:~# docker container ls
CONTAINER ID        IMAGE                    COMMAND                   CREATED             STATUS              PORTS                              NAMES
343c18f933d9        kolide/fleet:latest      "sh -c 'echo '\\n' | …"   3 hours ago         Up 3 hours          0.0.0.0:8412->8412/tcp             kolidequic
kstart_fleet_1
513cb0d61401        mysql:5.7                "docker-entrypoint.s…"    3 hours ago         Up 3 hours          3306/tcp, 33060/tcp                kolidequic
kstart_mysql_1
b0278855b130        mailhog/mailhog:latest   "MailHog"                 3 hours ago         Up 3 hours          1025/tcp, 0.0.0.0:8025->8025/tcp   kolidequic
kstart_mailhog_1
ddcd3e59dda2        redis:3.2.4              "docker-entrypoint.s…"    3 hours ago         Up 3 hours          6379/tcp                           kolidequic
kstart_redis_1

Troubleshooting Localhost Bindings

One of the issues I encountered involved the IP addresses to which VMs bound their Virtualbox Remote Display Protocol servers. The default configuration bound them to localhost on my Windows laptop. That was ok if I was interacting with that laptop in person, but I was doing this work remotely.

I could RDP to the laptop, and then RDP from the laptop to the VMs. This works, but it was a slight hassle to log into the Windows 2016 server which required a ctrl-alt-del sequence. This is a nuanced issue that can be solved by using the on screen keyboard (osk.exe) to enter the ctrl-alt-end sequence on the remote laptop, but I wanted an easier solution.

Dustin Lee, who has done a lot of work customized DetectionLab to include Security Onion (a future post maybe?) suggested I modify the Vagrantfile with the following bolded content. This example is for the wef host in the Vagrantfile.

    cfg.vm.provider "virtualbox" do |vb, override|
      vb.gui = true
      vb.name = "wef.windomain.local"
      vb.default_nic_type = "82545EM"
      vb.customize ["modifyvm", :id, "--vrde", "on"]
      vb.customize ["modifyvm", :id, "--vrdeaddress", "0.0.0.0"]
      vb.customize ["modifyvm", :id, "--memory", 2048]
      vb.customize ["modifyvm", :id, "--cpus", 2]
      vb.customize ["modifyvm", :id, "--vram", "32"]
      vb.customize ["modifyvm", :id, "--clipboard", "bidirectional"]
      vb.customize ["setextradata", "global", "GUI/SuppressMessages", "all" ]
    end
Basically, add the bold entries wherever you see a "virtualbox" option, to enable the VRDP server binding to 0.0.0.0 (which should be all IP addresses, to include the public IP, as I want).

Before I restarted the wef host, you can see below how the VRDE server is listening only on localhost on port 5932 (in bold).

root@LAPTOP-HT4TGVCP C:\Users\root\git\detectionlab\DetectionLab\Vagrant>"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" showvminfo wef.windomain.local
| findstr /I vrde

VRDE:                        enabled (Address 127.0.0.1, Ports 5932, MultiConn: off, ReuseSingleConn: off, Authentication type: null)
...trimmed...

After changing the Vagrant file, I restarted the wef host using Vagrant.

root@LAPTOP-HT4TGVCP C:\Users\root\git\detectionlab\DetectionLab\Vagrant>vagrant reload wef
==> wef: Attempting graceful shutdown of VM...
==> wef: Clearing any previously set forwarded ports...
==> wef: Fixed port collision for 3389 => 3389. Now on port 2201.
==> wef: Fixed port collision for 22 => 2222. Now on port 2202.
==> wef: Fixed port collision for 5985 => 55985. Now on port 2203.
==> wef: Fixed port collision for 5986 => 55986. Now on port 2204.
==> wef: Clearing any previously set network interfaces...
==> wef: Preparing network interfaces based on configuration...
    wef: Adapter 1: nat
    wef: Adapter 2: hostonly
==> wef: Forwarding ports...
    wef: 3389 (guest) => 2201 (host) (adapter 1)
    wef: 22 (guest) => 2202 (host) (adapter 1)
    wef: 5985 (guest) => 2203 (host) (adapter 1)
    wef: 5986 (guest) => 2204 (host) (adapter 1)
==> wef: Running 'pre-boot' VM customizations...
==> wef: Booting VM...
==> wef: Waiting for machine to boot. This may take a few minutes...
    wef: WinRM address: 127.0.0.1:2203
    wef: WinRM username: vagrant
    wef: WinRM execution_time_limit: PT2H
    wef: WinRM transport: negotiate
==> wef: Machine booted and ready!
==> wef: Checking for guest additions in VM...
    wef: The guest additions on this VM do not match the installed version of
    wef: VirtualBox! In most cases this is fine, but in rare cases it can
    wef: prevent things such as shared folders from working properly. If you see
    wef: shared folder errors, please make sure the guest additions within the
    wef: virtual machine match the version of VirtualBox you have installed on
    wef: your host and reload your VM.
    wef:
    wef: Guest Additions Version: 5.2.16
    wef: VirtualBox Version: 6.0
==> wef: Setting hostname...
==> wef: Configuring and enabling network interfaces...
==> wef: Mounting shared folders...

    wef: /vagrant =>  

The bolded entry about port 2201 means I can log into the wef host as user vagrant / password vagrant, over RDP, directly from another computer.


After restarting the wef host, I check to see what IP address and port the RDP server is listening (in bold):


root@LAPTOP-HT4TGVCP C:\Users\root\git\detectionlab\DetectionLab\Vagrant>"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" showvminfo wef.windomain.local
| findstr /I vrde
VRDE:                        enabled (Address 0.0.0.0, Ports 5932, MultiConn: off, ReuseSingleConn: off, Authentication type: null)
...trimmed...

This should allow me to access the "screen" of the VM via port 5932 and the IP of the host laptop. Unfortunately, there is some sort of conflict, as I saw the domain controller also reserved the same port for its VRDE.

root@LAPTOP-HT4TGVCP C:\Users\root>"c:\Program Files\Oracle\VirtualBox\VBoxManage.exe" showvminfo dc.windomain.local | findstr /I vrde

VRDE:                        enabled (Address 0.0.0.0, Ports 5932, MultiConn: off, ReuseSingleConn: off, Authentication type: null)
...trimmed...

I encountered a similar issue with the domain controller also failing to resolve a conflict with the host system RDP port.

root@LAPTOP-HT4TGVCP C:\Users\root\git\detectionlab\DetectionLab\Vagrant>vagrant reload dc
==> dc: Attempting graceful shutdown of VM...
==> dc: Clearing any previously set forwarded ports...
==> dc: Fixed port collision for 22 => 2222. Now on port 2200.
==> dc: Clearing any previously set network interfaces...
==> dc: Preparing network interfaces based on configuration...
    dc: Adapter 1: nat
    dc: Adapter 2: hostonly
==> dc: Forwarding ports...
    dc: 3389 (guest) => 3389 (host) (adapter 1)
    dc: 22 (guest) => 2200 (host) (adapter 1)
    dc: 5985 (guest) => 55985 (host) (adapter 1)
    dc: 5986 (guest) => 55986 (host) (adapter 1)

I haven't solved these problems yet. I wonder if it's a result of using pre-built VMs, which use the 5.x series of Virtualbox extensions, while my Virtualbox system runs 6.0?

Summary

These are minor issues, for the result of all this work is four systems offering Windows client and server features, plus instrumentation. That could be another topic for discussion. I'm also excited by the prospect of running all of this in the cloud. Furthermore, Dustin Lee has a fork of DetectionLab that replaces some of the instrumentation with Security Onion!



TaoSecurity