Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
83
Issues
83
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
a268d82d
Commit
a268d82d
authored
Jul 18, 2018
by
Adam Wujek
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[FEATURE: 1583] disable web interface via dot-config
Signed-off-by:
Adam Wujek
<
adam.wujek@cern.ch
>
parent
74a34027
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
53 additions
and
2 deletions
+53
-2
Kconfig
Kconfig
+6
-0
wrs-user-manual.in
doc/wrs-user-manual.in
+3
-0
lighttpd.sh
userspace/rootfs_override/etc/init.d/lighttpd.sh
+33
-1
wrsBootStatusGroup.c
userspace/snmpd/wrsBootStatusGroup.c
+11
-1
No files found.
Kconfig
View file @
a268d82d
...
@@ -920,6 +920,12 @@ config CUSTOM_BOOT_SCRIPT_SOURCE_REMOTE_URL
...
@@ -920,6 +920,12 @@ config CUSTOM_BOOT_SCRIPT_SOURCE_REMOTE_URL
endmenu
endmenu
config HTTPD_DISABLE
bool "Disable web interface"
default n
help
Disable web interface.
menu "Developer options"
menu "Developer options"
config MONIT_DISABLE
config MONIT_DISABLE
bool "Disable monit"
bool "Disable monit"
...
...
doc/wrs-user-manual.in
View file @
a268d82d
...
@@ -926,6 +926,9 @@ appropriate way, before the respective service is started.
...
@@ -926,6 +926,9 @@ appropriate way, before the respective service is started.
up a batch of switches with different configurations (similar to the
up a batch of switches with different configurations (similar to the
@t
{
CONFIG
_
DOTCONF
_
URL
}
, please refer to @ref
{
The Configuration File
}
).
@t
{
CONFIG
_
DOTCONF
_
URL
}
, please refer to @ref
{
The Configuration File
}
).
@item CONFIG
_
HTTPD
_
DISABLE
Disable web interface on a switch.
@item CONFIG
_
MONIT
_
DISABLE
@item CONFIG
_
MONIT
_
DISABLE
Disable monitoring of running processes by @i
{
Monit
}
. @i
{
Monit
}
by
Disable monitoring of running processes by @i
{
Monit
}
. @i
{
Monit
}
by
...
...
userspace/rootfs_override/etc/init.d/lighttpd.sh
View file @
a268d82d
...
@@ -2,6 +2,9 @@
...
@@ -2,6 +2,9 @@
#
#
# Starts lighttpd daemon.
# Starts lighttpd daemon.
#
#
MONIT
=
/usr/bin/monit
dotconfig
=
/wr/etc/dot-config
start_counter
()
{
start_counter
()
{
# increase boot counter
# increase boot counter
...
@@ -17,6 +20,25 @@ start_counter() {
...
@@ -17,6 +20,25 @@ start_counter() {
start
()
{
start
()
{
echo
-n
"Starting lighttpd daemon: "
echo
-n
"Starting lighttpd daemon: "
if
[
-f
$dotconfig
]
;
then
.
$dotconfig
else
echo
"
$0
unable to source dot-config (
$dotconfig
)!"
fi
if
[
"
$CONFIG_HTTPD_DISABLE
"
=
"y"
]
;
then
echo
"web interface disabled in dot-config!"
if
[
"
$1
"
!=
"force"
]
;
then
# Unmonitor web server (lighttpd), ignore all printouts
# from monit.
# Run in background since monit may wait for a timeout.
$MONIT
unmonitor lighttpd &>/dev/null &
exit
0
fi
echo
-n
"Force start of lighttpd: "
fi
# note start-stop-daemon does not create pidfile, only check if pid is
# note start-stop-daemon does not create pidfile, only check if pid is
# running
# running
start-stop-daemon
-q
-p
/var/run/lighttpd.pid
-S
\
start-stop-daemon
-q
-p
/var/run/lighttpd.pid
-S
\
...
@@ -30,6 +52,15 @@ start() {
...
@@ -30,6 +52,15 @@ start() {
else
else
echo
"Failed"
echo
"Failed"
fi
fi
# check whether the process was monitored
$MONIT
summary 2>&1 |
grep
lighttpd |
grep
"Not monitored"
&> /dev/null
if
[
$?
-eq
0
]
;
then
echo
"web interface was not monitored, enabling monitoring"
# the process was not monitored, enable monitoring
# this will generate extra log entries from monit
$MONIT
monitor lighttpd
fi
}
}
stop
()
{
stop
()
{
...
@@ -60,7 +91,8 @@ case "$1" in
...
@@ -60,7 +91,8 @@ case "$1" in
restart
restart
;;
;;
*
)
*
)
echo
$"Usage:
$0
{start|stop|restart}"
echo
"Usage:
$0
{start <force>|stop|restart}"
echo
" start force -- enable web interface even it is disabled in the dot-config"
exit
1
exit
1
esac
esac
...
...
userspace/snmpd/wrsBootStatusGroup.c
View file @
a268d82d
...
@@ -93,6 +93,7 @@ struct wrs_usd_item {
...
@@ -93,6 +93,7 @@ struct wrs_usd_item {
uint32_t
cnt
;
/* number of processes found */
uint32_t
cnt
;
/* number of processes found */
};
};
#define UDI_HTTP 4
/* index of web server in userspace_daemons array */
#define UDI_MONIT 5
/* index of MONIT in userspace_daemons array */
#define UDI_MONIT 5
/* index of MONIT in userspace_daemons array */
/* user space daemon list */
/* user space daemon list */
/* - key contain process name reported by ps command
/* - key contain process name reported by ps command
...
@@ -107,7 +108,8 @@ static struct wrs_usd_item userspace_daemons[] = {
...
@@ -107,7 +108,8 @@ static struct wrs_usd_item userspace_daemons[] = {
[
1
]
=
{
"/wr/bin/wrsw_hal"
,
2
},
/* two wrsw_hal instances */
[
1
]
=
{
"/wr/bin/wrsw_hal"
,
2
},
/* two wrsw_hal instances */
[
2
]
=
{
"/wr/bin/wrsw_rtud"
,
1
},
[
2
]
=
{
"/wr/bin/wrsw_rtud"
,
1
},
[
3
]
=
{
"/wr/bin/ppsi"
,
1
},
[
3
]
=
{
"/wr/bin/ppsi"
,
1
},
[
4
]
=
{
"/usr/sbin/lighttpd"
,
1
},
[
UDI_HTTP
]
=
{
"/usr/sbin/lighttpd"
,
1
},
/* web interface can be
* disabled in dot-config */
[
UDI_MONIT
]
=
{
"/usr/bin/monit"
,
1
},
/* Monit can be disabled in
[
UDI_MONIT
]
=
{
"/usr/bin/monit"
,
1
},
/* Monit can be disabled in
* dot-config */
* dot-config */
[
6
]
=
{
"/usr/sbin/snmpd"
,
1
},
[
6
]
=
{
"/usr/sbin/snmpd"
,
1
},
...
@@ -475,6 +477,14 @@ static void update_daemon_expectancy(struct wrs_usd_item *daemon_array)
...
@@ -475,6 +477,14 @@ static void update_daemon_expectancy(struct wrs_usd_item *daemon_array)
snmp_log
(
LOG_INFO
,
"SNMP: Info wrsBootUserspaceDaemonsMissing:"
snmp_log
(
LOG_INFO
,
"SNMP: Info wrsBootUserspaceDaemonsMissing:"
" CONFIG_MONIT_DISABLE=y in dot-config
\n
"
);
" CONFIG_MONIT_DISABLE=y in dot-config
\n
"
);
}
}
tmp
=
libwr_cfg_get
(
"HTTPD_DISABLE"
);
if
(
tmp
&&
!
strcmp
(
tmp
,
"y"
))
{
/* SNMP should not expect lighttpd (web server) to be running*/
daemon_array
[
UDI_HTTP
].
exp
=
0
;
snmp_log
(
LOG_INFO
,
"SNMP: Info wrsBootUserspaceDaemonsMissing:"
" CONFIG_HTTPD_DISABLE=y in dot-config
\n
"
);
}
}
}
/* check if daemons from userspace_daemons array are running */
/* check if daemons from userspace_daemons array are running */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment