EAP-Software: Why not available for Linux / as Docker image

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.
123...

EAP-Software: Why not available for Linux / as Docker image

This thread has been locked for further replies. You can start a new thread to share your ideas or ask questions.
68 Reply
Re:EAP-Software: Why not available for Linux / as Docker image
2017-07-17 20:08:53

tplink_smb wrote

Dear all members, glad to tell you that the Linux version controller has been developed and is during the uploading process, it will be online within several days.


Great! Thanks for the notification!
༺ 0100 1101 0010 10ཏ1 0010 0110 1010 1110 ༻
  0  
  0  
#12
Options
Re:EAP-Software: Why not available for Linux / as Docker image
2017-07-20 20:44:45
Hi,

Great news!
Works perfect on Debian 7

Br,
E-raser
  0  
  0  
#13
Options
Re:EAP-Software: Why not available for Linux / as Docker image
2017-07-21 09:01:47
Great!

But there is a bug in the control.sh start/stop script: it creates a logfile "stop.log" in the bin subdirectory instead of in the logs directory if the Controller is stopped. Probably unnoticed by QC because of the same reason why a similar bug in Pharos Control ( /dev/nyll instead of /dev/null in its start/stop script) did pass through: missing privilege separation.

Please, TP-Link, why can't we run this software as an unprivileged user as it is common standard in Linux? It's of course o.k. to ask for root permissions to install software, but it's definitely not so to have to run the application as the root user, especially not for a web-based service!

If I start the EAP Controller as an unprivileged user, I get the error message:

A non-root user can't receive a broadcast packet if the socket is not bound to a wildcard address; binding to a non-wildcard address (/192.168.1.25:0) anyway as requested.


Uhm, what's the point to bind to the primary IP address of the server instead of to the wildcard address, which would be possible for non-root users, too?

Is this the only place where root permissions are needed for in the EAP Controller? If so, please can you change this to bind to the wildcard address?

Anyway, I have adapted the start/stop script to my Debian Linux version. This fixes the bug mentioned above and also prepares for rudimentary privilege separation by switching to a role account ( "eapc" in the script, could be any other user ID you prefer) before starting the EAP Controller.

Until it's clear wether binding the socket is the only place which needs root permissions because of not using a wildcard address, I have uncommented the unprivileged user so that the start/stop script runs the EAP Controller as root and therefore it is fully compatible to the original script.

It also adds a restart function, fully complies to the Linux Standard Base (LSB) and removes unnecessary clutter from the original script.

Just name it control.sh and put it into the eapHome/bin subdirectory:

[CODE]
#!/bin/bash
### BEGIN INIT INFO
# Provides: eap
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# X-Interactive: true
# Short-Description: EAP Controller
# Description: Start the EAP Controller and the MongoDB server
# This script will start eap and the mongod database server.
### END INIT INFO

DESC="EAP Controller"

# Role account for privilege separation.
#
# Set to "root" if you really want to run a web-based service
# with full administrative permissions (not recommended!).
EAPC_USER=root
#EAPC_USER=eapc

EAPC_HOME="$(readlink -f $0)"
EAPC_HOME="${EAPC_HOME%/*/*}"
EAPC_LOG="$EAPC_HOME/logs"

JRE_HOME=$EAPC_HOME"/jre"
JAVA_TOOL=$EAPC_HOME/jre/bin/java
JAVA_OPTS="-Xms128m -Xmx1024m -XX:MaxHeapFreeRatio=60 -XX:MinHeapFreeRatio=30 -XX:+UseSerialGC -XX:+HeapDumpOnOutOfMemoryError"
JAVA_PATH="-cp $EAPC_HOME/lib/com.tp-link.eap.start-0.0.1-SNAPSHOT.jar:$EAPC_HOME/lib/*:$EAPC_HOME/external-lib/*"

# Check wether EAP Controller is running.
# Returns EXIT_SUCCESS if running, EXIT_FAILURE otherwise.
IS_RUNNING="$EAPC_HOME/bin/portt 127.0.0.1 8088 500"

# Check wether we are initially running as root so we can change privileges.
check_perms() {
[ $(id -ru) != 0 ] && { echo "You must be root to $1 the EAP Controller" 1>&2; exit 1; }
}

case "$1" in
start)
$IS_RUNNING && { echo "EAP Controller is already running." 1>&2; exit 1; }

check_perms $1

[ -e "$EAPC_LOG" ] || {
mkdir -m 755 $EAPC_LOG 2>/dev/null && chown $EAPC_USER $EAPC_LOG
}

echo -n "Starting EAP Controller " 1>&2
su $EAPC_USER -c "nohup $JAVA_TOOL -server $JAVA_OPTS $JAVA_PATH \
-Deap.home=\"$EAPC_HOME\" com.tp_link.eap.start.EapMain start >$EAPC_LOG/startup.log 2>&1 &"

let count=0
until $IS_RUNNING
do
echo -n "."
[[ count++ -gt 120 ]] && {
echo -e "\nStart failed - see '$EAPC_LOG/startup.log' for errors." 1>&2
exit 1
}
sleep 1
done
echo -e "\nEAP Controller started successfully."
echo "Direct your browser to http://127.0.0.1:8088 for access."
exit 0
;;

stop)
$IS_RUNNING || { echo "EAP Controller already stopped." 1>&2; exit 1; }

check_perms $1

echo -n "Stopping EAP Controller "
su $EAPC_USER -c "$JAVA_TOOL $JAVA_PATH \
-Deap.home=\"$EAPC_HOME\" com.tp_link.eap.start.EapMain stop >$EAPC_LOG/stop.log 2>&1 &"

let count=0
while $IS_RUNNING
do
echo -n "."; sleep 1
[[ count++ -gt 30 ]] && {
echo -e "\nCould not stop EAP Controller after 30 seconds - please try again." 1>&2
exit 1
}
done

echo -e "\nEAP Controller stopped successfully." 1>&2
exit 0
;;

restart)
check_perms $1

echo -n "Restarting EAP Controller " 1>&2
$0 stop && sleep 2 && $0 start
;;

status)
if $IS_RUNNING; then
echo "EAP Controller is running."
exit 0;
else
echo "EAP Controller is not running."
exit 1;
fi
;;

*)
echo "Usage: $0 (start|stop|restart|status)"
exit 1
;;
esac
[/CODE]

BTW: testing the shell variable UID for detecting the root user is a bug in the original script, too. Shell variables can be changed. Instead the command id -ru should be used to check for the root user as shown in the script above.
༺ 0100 1101 0010 10ཏ1 0010 0110 1010 1110 ༻
  0  
  0  
#14
Options
Re:EAP-Software: Why not available for Linux / as Docker image
2017-08-11 18:15:35
I am wondering how you got the controller running.
I've tried setting the EAPController up on Debian 9.1 as well as on Ubuntu 16.04 LTS without any luck.
The result on both OSes is exactly the same.
Logs don't show anything useful.

--- start startup.log ---
%
log4j:WARN No appenders could be found for logger (com.tp_link.eap.util.system.S
ystemUtil).
log4j:WARN Please initialize the log4j system properly.
========EAP_LINUX_MONGOD_KEY======
mongodPath = "/opt/tplink/EAPController/bin/mongod" --port 27017 --dbpath "/opt/tplink/EAPController/data/db" -pidfilepath "/opt/tplink/EAPController/data/mongo.pid" --logappend --logpath "/opt/tplink/EAPController/logs/mongod.log" --nohttpinterface --bind_ip 127.0.0.1
repairCommand = "/opt/tplink/EAPController/bin/mongod" --repair --dbpath "/opt/tplink/EAPController/data/db" --logappend --logpath "/opt/tplink/EAPController/logs/mongod.log"
"/opt/tplink/EAPController/bin/mongod" --port 27017 --dbpath "/opt/tplink/EAPController/data/db" -pidfilepath "/opt/tplink/EAPController/data/mongo.pid" --logappend --logpath "/opt/tplink/EAPController/logs/mongod.log" --nohttpinterface --bind_ip 127.0.0.1
--- end startup.log ---

When starting up mongod manually, it keeps running as expected.
When just starting the java application it starts mongod and kills it shortly after.

Debugging it by launching each component one-by-one doesn't seem to work as the java part is fiddling with everything else.

I also tried switching from the JRE coming with the package to Oracle JRE 1.8, which did not make any difference.

Adding the reference to the "log4j.properties" file to the java startup line makes the warnings disappear but also makes no difference regarding startup.

Tips anyone?

Regards
Peter
  0  
  0  
#15
Options
Re:EAP-Software: Why not available for Linux / as Docker image
2017-08-13 23:48:32
Ignore the warnings about initialization failure of log4j, it will be loaded again later on. See file server.log, it should read like this:

[CODE]
2017-08-13 17:25:03 [main] [INFO]-[ConfigurationFactory.java:39] - success to load configuration : eap.properties
2017-08-13 17:25:03 [main] [INFO]-[ConfigurationFactory.java:39] - success to load configuration : mongodb.properties
2017-08-13 17:25:03 [main] [INFO]-[ConfigurationFactory.java:39] - success to load configuration : jetty.properties
2017-08-13 17:25:03 [main] [INFO]-[ConfigurationFactory.java:39] - success to load configuration : device.properties
2017-08-13 17:25:03 [main] [INFO]-[ConfigurationFactory.java:39] - success to load configuration : log4j.properties
2017-08-13 17:25:03 [main] [INFO]-[ConfigurationFactory.java:39] - success to load configuration : netty.properties
2017-08-13 17:25:03 [main] [INFO]-[ConfigurationFactory.java:39] - success to load configuration : user.params.properties
2017-08-13 17:25:08 [main] [INFO]-[ContextHandler.java:2040] - Initializing Spring root WebApplicationContext
2017-08-13 17:25:36 [main] [INFO]-[MonitorInit.java:39] - monitor context initialing...
2017-08-13 17:25:36 [main] [INFO]-[ContextHandler.java:2040] - Initializing Spring FrameworkServlet 'springMVC'
2017-08-13 17:25:38 [main] [INFO]-[DbCompatibleServcie.java:96] - no need to compatible db.
[/CODE]

If it does not, post all logfiles here, not just startup.log. The server.log is much more meaningful than startup.log.
༺ 0100 1101 0010 10ཏ1 0010 0110 1010 1110 ༻
  0  
  0  
#16
Options
Re:EAP-Software: Why not available for Linux / as Docker image
2017-08-14 14:06:16
Hi,
the reason I did not post the other logs was that there is nothing spectacular in them.

---- start server.log ----
2017-08-11 11:59:10 [main] [INFO]-[ConfigurationFactory.java:39] - success to load configuration : eap.properties
2017-08-11 11:59:10 [main] [INFO]-[ConfigurationFactory.java:39] - success to load configuration : mongodb.properties
2017-08-11 11:59:10 [main] [INFO]-[ConfigurationFactory.java:39] - success to load configuration : jetty.properties
2017-08-11 11:59:10 [main] [INFO]-[ConfigurationFactory.java:39] - success to load configuration : netty.properties
2017-08-11 11:59:10 [main] [INFO]-[ConfigurationFactory.java:39] - success to load configuration : user.params.properties
2017-08-11 11:59:10 [main] [INFO]-[ConfigurationFactory.java:39] - success to load configuration : log4j.properties
2017-08-11 11:59:10 [main] [INFO]-[ConfigurationFactory.java:39] - success to load configuration : device.properties
---- end server.log ----

---- start mongod.log ----
***** SERVER RESTARTED *****


Fri Aug 11 11:59:10 [initandlisten] MongoDB starting : pid=10777 port=27017 dbpath=/opt/tplink/EAPController/data/db 64-bit host=eap-controller
Fri Aug 11 11:59:10 [initandlisten] db version v2.2.2, pdfile version 4.5
Fri Aug 11 11:59:10 [initandlisten] git version: d1b43b61a5308c4ad0679d34b262c5af9d664267
Fri Aug 11 11:59:10 [initandlisten] build info: Linux ip-10-2-29-40 2.6.21.7-2.ec2.v1.2.fc8xen #1 SMP Fri Nov 20 17:48:28 EST 2009 x86_64 BOOST_LIB_VERSION=1_49
Fri Aug 11 11:59:10 [initandlisten] options: { bind_ip: "127.0.0.1", dbpath: "/opt/tplink/EAPController/data/db", logappend: true, logpath: "/opt/tplink/EAPController/logs/mongod.log", nohttpinterface: tr
Fri Aug 11 11:59:10 [initandlisten] journal dir=/opt/tplink/EAPController/data/db/journal
Fri Aug 11 11:59:10 [initandlisten] recover begin
Fri Aug 11 11:59:10 [initandlisten] info no lsn file in journal/ directory
Fri Aug 11 11:59:10 [initandlisten] recover lsn: 0
Fri Aug 11 11:59:10 [initandlisten] recover /opt/tplink/EAPController/data/db/journal/j._0
Fri Aug 11 11:59:10 [initandlisten] recover cleaning up
Fri Aug 11 11:59:10 [initandlisten] removeJournalFiles
Fri Aug 11 11:59:10 [initandlisten] recover done
Fri Aug 11 11:59:10 [initandlisten] preallocating a journal file /opt/tplink/EAPController/data/db/journal/prealloc.0
Fri Aug 11 11:59:13 [initandlisten] waiting for connections on port 27017
[21~
---- end mongod.log ----

There's no sign of an error anywhere, besides the application is not starting up.

Regards
Peter

----
Edit:
This is on a fresh Debian 9.1 x64 VM - just standard system utilities and SSH, nothing else.


---
Edit 2:
When starting I get the following output on the shell:

--- start stdout ---
root@eap-controller:/opt/tplink/EAPController# tpeap start
Starting EAP Controller ...................................................................................../usr/bin/tpeap: line 79: 2580 Killed nohup $JAVA_TOOL -server -Xms128m -Xmx1024m -XX:MaxHeapFreeRatio=60 -XX:MinHeapFreeRatio=30 -XX:+UseSerialGC -XX:+HeapDumpOnOutOfMemoryError -Deap.home="${eapHome}" -cp ${eapHome}"/lib/com.tp-link.eap.start-0.0.1-SNAPSHOT.jar:"${eapHome}"/lib/*:"${eapHome}"/external-lib/*" com.tp_link.eap.start.EapMain start > ${eapHome}/logs/startup.log 2>&1
.....................................
Start failed.
--- end stdout ---

Edit 3:
As I had some spare time to play with the controller software, I've setup a VM with Debian Jessie (8.3.x) and tested if I could get it running there.
The results were exactly the same as with my other tests.
I was following the instructions to the point (well, un-tar-ing an archive isn't too complicated ...) on 3 different OSes and still no luck.
This leads me to the assumption that the currently downloadable package must be broken ( http://static.tp-link.com/EAP_Controller_v2.4.8_linux_x64.tar.gz) or I'm doing something fundamentally wrong (whatever this could be).
  0  
  0  
#17
Options
Re:EAP-Software: Why not available for Linux / as Docker image
2017-08-14 15:22:53

tplink_smb wrote

Dear all members, glad to tell you that the Linux version controller has been developed and is during the uploading process, it will be online within several days.
The software will support Ubuntu:16.04/17.04; CentOS: 7.2/7.3; Fedora: 24/25, please keep an eye on our official website.


Will there also be a support to run the controller on a synology nas ?
at home I have a DS216play ( yes I know 32bit processor. )
and I have 2 soon to be upgraded to 3 225 access points around the house.

Now since my synolgy has everything on board like radius etc, its up 24/7 and only uses 15W of power, it would be awesome if I could just have a package that I can install on the synology that would allow me to install the controller and let the synology do the work instead of my laptop or home computer.

reminds me, how come you either have a 32 bit windows controller supporting XP/vista and up.
but the linux controller is 64 bit only ?
  0  
  0  
#18
Options
Re:EAP-Software: Why not available for Linux / as Docker image
2017-08-14 20:25:19

PeterL. wrote


There's no sign of an error anywhere, besides the application is not starting up.


The app starts up indeed. But: this *()#$%^&- systemd kills the job as soon as su terminates.

See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=825394 for details.

That's is the important message from the log, which you didn't include in your first post:

[CODE]
/usr/bin/tpeap: line 79: 2580 Killed nohup $JAVA_TOOL ...
[/CODE]

This is just another catastrophic bug of systemd, which replaced the 40 years old, stable and robust initializer init, just because some people think it would be a good idea to replace the system's initializer by a monolithic monster program handling everything in order to make things better than init does, even at the risk of breaking lots of other software packages.

Find attached a version of tpeap which does not use nohup and su. This should work with your version of systemd. If I have some spare time, I probably will integrate the start/stop script in systemd, but changes are that I will drop systemd completely, since it causes lot of other troubles on our servers, too.
File:
tpeap.zipDownload
༺ 0100 1101 0010 10ཏ1 0010 0110 1010 1110 ༻
  0  
  0  
#19
Options
Re:EAP-Software: Why not available for Linux / as Docker image
2017-08-14 20:47:16
Hi,

thanks for your efforts.
Believe it or not, but it's still not working.

I already tried the init script you posted earlier in this thread as the included one looks ... unfinished (e.g unused OS detection variables).
The version attached to your last post (-su -nohup) also shows the same results.

I don't think that this has something todo with the java process backgrounding, as I get the same results when running the jar manually from the shell.
I'm currently switching back to sysv-init, to eliminate systemd from the list.

Regards
Peter


---
Edit 1:
.
With sysv-init it's still the same .
There is not change to the lines being logged to file.

When starting with the init script, the output also doesn't change (this your adapted init script):
--- start stdout ---
root@eap-controller:~# tpeap start
Starting EAP Controller .........../usr/bin/tpeap: line 41: 2425 Killed $JAVA_TOOL -server $JAVA_OPTS $JAVA_PATH -Deap.home="$EAPC_HOME" com.tp_link.eap.start.EapMain start > $EAPC_LOG/startup.log 2>&1
...............................................................................................................
Start failed - see '/opt/tplink/EAPController/logs/startup.log' for errors.
--- end stdout ---
  0  
  0  
#20
Options
Re:EAP-Software: Why not available for Linux / as Docker image
2017-08-14 21:04:50

PeterL. wrote


Believe it or not, but it's still not working.


I have no reason to not believe you. :)

Did the "kill" message disappear now? And did you test the original script control.sh, too?

Not sure wether you can go back to SysV init on Debian 9. According to Debian's last announcements they planned Debian 8 to be the last version which allows SysV init. There is already a fork of Debian called Devuan, which will support the SysV init in future versions, too - there is more work to do than just to replace systemd by init, thanks to the non-modular, Windows-like concept of having systemd take over every OS functionality it can.

It would not make me wonder if systemd will soon be able to brew coffee, too, but then will require to patch your coffee machine in order to heat up the water. :D
༺ 0100 1101 0010 10ཏ1 0010 0110 1010 1110 ༻
  0  
  0  
#21
Options
Related Articles