If you like BoxMatrix then please contribute Supportdata, Supportdata2, Firmware and/or Hardware (get in touch).
My metamonk@yahoo.com is not reachable by me since years. Please use hippie2000@webnmail.de instead.
Property:scgi server (avmcmd)
BoxMatrix >> Shell-Commands >> scgi_server (avmcmd) | @ BoxMatrix - IRC-Chat - Translate: de es fr it nl pl |
News | Selectors | Models | Accessories | Components | Environment | Config | Commands | System | Webif | Software | Develop | Lexicon | Community | Project | Media |
Startup-Scr | Hotplug-Scr | BusyBox-Cmds | Bash-Cmds | AVM-Cmds | Chipset-Cmds | Linux-Cmds | Shared-Libs | Kernel-Mods | Research |
Name-Collision - multiple objects in this wiki use the name scgi_server!
|
AVM-Command
Command: | scgi_server (avmcmd) - type Exec | Wiki | Freetz | IPPF | whmf | AVM | Web |
Location: | Shell-Commands >> AVM-Commands - Origin: AVM | ||||||
Path: | Release: /usr/bin Lab+Rel: /usr/bin | ||||||
Properties: | Size: 41.4k - 65.6k - Firmware: 7.39 - 8.00 | ||||||
Function: | SCGI application server implementing the REST-API. |
Goto: Lua-Land - Source - Dependencies - Model-Matrix - Symbols - SMW-Browser
Details
scgi_server is a daemon to speed up execution of CGI programs using the SCGI protocol, which is similar to FastCGI.
Both are designed to speed up programs executed by a Webserver by loading the CGI once when the server is started.
This avoids the loading of dependencies, compilation, execution and initialisation overhead per click, since it just happens
once at server startup. HTTP requests just call an already loaded dispatcher function. The CGI behaves like a Webserver.
While other solutions are more flexible scgi_server just supports one port (default Port-8187-tcp), one scripting language (Lua)
and one single script (default api.lua). This script must provide 2 functions to work:
cgi_load_callback
- called once when the server is startedcgi_start_callback
- called for each incoming HTTP request
AVM uses SCGI to speed up the new REST-API which consists of a range of RESTAPI-Scripts served via HTTP on Port-8187-tcp.
Currently it is only usable from localhost and IPv4, but it is prepared for usage from LAN and from the Internet. 7530 fw 7.50:
root@fritz1:/var/media/ftp# netstat -tap | grep scgi_server tcp 0 0 localhost:8187 0.0.0.0:* LISTEN 925/scgi_server
The REST-API uses normal HTTP and the request methods GET, POST, PUT and DELETE. The request URL is construted like this:
http://localhost:8187/api/v0/<endpoint>[/<string>[/<string>[/<string>]]]?sid=<sid>[&<arg>=<val>]
The API still is unfinished that's why its version is v0
. An <endpoint>
is a function block for a specific topic.
In current implementation the request URI can have up to 3 <string>
levels.
Access requires a session id which is passed in <sid>
, same principle as used for the Webinterface.
Since the API is mainly used from withing Lua-Scripts of the Webinterface the <sid>
is just forwarded.
An <endpoint>
can either be a builtin of api.lua or an <endpoint>_rest.lua
module.
Besides this a selected subset of UI-Modules is accessible as <endpoint>
s.
The API has a sophisticated security management. Each <endpoint>
can have different access requirements.
Permissions are inherited from the Box-Users management, results appear in the rights ui-module for the current <sid>
.
By default an <endpoint>
is denied, and whitelisted by a per <endpoint>
access mask assigned in security.lua.
This mask may be one or more of App, BoxAdmin, Dial, HomeAuto. NAS, Phone
, as known from the Box-Users.
fw 7.39 help:
root@fritz:/var/mod/root# scgi_server -? usage: scgi_server [options] options: -? - print this help -d - Start as scgi server. (NOTSET) -s - Stop the scgi server. (NOTSET) -p INTEGER - Set the port (scgi mode only). (8187) -m STRING - Set the main lua script. ("/usr/rest_api/api.lua") -a - Server allows all HTTP methods. (NOTSET) -v INTEGER - Set lua verbose level (0 ERROR-msg only, 1 += DEBUG-msg, 2+= INFO-msg). (0) -c - Enable C DEBUG-messages. (NOTSET) scgi_server
- Lexicon: REST, API, SCGI
- Commands: scgi_server
- Ports: Port-8187-tcp
- UI-Mods: webui
- API-Root: api.lua
- Includes: api_generic.lua, rest_config.lua, security.lua, espresso.lua, rest_api_const.lua, response.lua, error.lua
- Includes: avmluamessages.lua, uimod.lua, api_generic_filter.lua, resource.lua, datatype.lua, plugin_common.lua
- Modules: storagenasrights_rest.lua, webusb_rest.lua
- Modules: calllog_rest.lua, faxjournal_rest.lua, phonebook_rest.lua, smarthome_rest.lua, boxnotify_rest.lua
- Develop: obl_fboxname.lua, dev_debug.lua, landevice.lua, query_tree.lua, fake_modules.lua, obl.lua
- Common: array.lua, common.lua, func.lua, math.lua, string.lua, table.lua, typecheck.lua, validcheck.lua
- Plugins: configflags.lua, eventlog.lua, info.lua, monitor.lua, phonebook.lua, smarthome.lua, timermix.lua
- Misc-Plugins: misc.lua, boxname.lua, configuration.lua, handsets.lua, update_status.lua, wan_status.lua
- Setup-Plugins: setup.lua
Lua-Land
The REST-API consists of a range of Lua-Scripts located in /usr/rest_api
. AVM calls it Lua-Land
.
The main script which is loaded by the server is api.lua
. The remaining scripts are loaded by dependency.
See the RESTAPI-Scripts section.
Source
The names of source files compiled into an executable often help to understand function blocks (and show gaps in the docs).
fw 7.39 source files:
$ strings /usr/bin/scgi_server | grep -e '\.c$' -e '\.cpp$' ar7/ctlmgr/src/luacgi/scgi_server.c ar7/ctlmgr/src/luacgi/scgi_server_base.c ar7/ctlmgr/src/luacgi/scgi_server_utils.c ar7/ctlmgr/src/luacgi/escape_lua.c ar7/ctlmgr/src/luacgi/lua_json.c
Dependencies
Daily updated index of all dependencies of this command. Last update: 2025-01-21 07:43 GMT.
A *
in the Mod
column marks info from Supportdata-Probes, which will always stay incomplete.
Relation | Typ | Object | Mod | Firmware | Info | Origin |
---|---|---|---|---|---|---|
Started by | serv | scgi_server.service | 32 | 7.39 - 8.00 | supervisor service for scgi_server. | AVM |
Runs as | proc | scgi_server (process) | 16* | 7.39 - 8.00 | Process running scgi_server | AVM |
Serving | port | Port-8187-tcp | 16* | 7.39 - 8.00 | Box REST-API provided by scgi_server. | AVM |
Depends on | lib | ld.so | 12 | 7.39 - 8.00 | Dynamic linker / loader | Linux |
Depends on | lib | libar7cfg.so | 33 | 7.39 - 8.00 | TFFS-Configuration API to ar7.cfg and many more. | AVM |
Depends on | lib | libavmauth.so | 33 | 7.39 - 8.00 | Fritzbox authentification helpers | AVM |
Depends on | lib | libavmcipher.so | 33 | 7.39 - 8.00 | AES / DES / Rijndael encryption / decryption. | AVM |
Depends on | lib | libavmcrypto.so | 33 | 7.39 - 8.00 | JWE encryption / decryption / key generator | AVM |
Depends on | lib | libavmcsock.so | 33 | 7.39 - 8.00 | Networking, I/O and helper functions | AVM |
Depends on | lib | libavmfbconf.so | 30 | 7.39 - 7.81 | API to hardcoded fbconf.cfg | AVM |
Depends on | lib | libavmfbstate.so | 33 | 7.39 - 8.00 | IPC fritzbox state notification | AVM |
Depends on | lib | libavmhmac.so | 33 | 7.39 - 8.00 | HMAC / SHA / MD5 hashing. | AVM |
Depends on | lib | libavmluautils.so | 33 | 7.39 - 8.00 | Utility Lua-Library | AVM |
Depends on | lib | libavmrrdstate.so | 21 | 7.90 - 8.00 | API wrapping rrdinfo | AVM |
Depends on | lib | libavmrrdtoolapi.so | 21 | 7.90 - 8.00 | API wrapping rrdtool | AVM |
Depends on | lib | libavmwdt.so | 22 | 7.61 - 8.00 | AVM-Watchdogs management API | AVM |
Depends on | lib | libboxenv.so | 21 | 7.90 - 8.00 | API to the rc.conf enhanced Config-Environment | AVM |
Depends on | lib | libboxlib.so | 33 | 7.39 - 8.00 | Box status, logging and statistics functions | AVM |
Depends on | lib | libc.so | 33 | 7.39 - 8.00 | Standard C library | Linux |
Depends on | lib | libcm.so | 33 | 7.39 - 8.00 | ctlmgr / cm_logic messaging API | AVM |
Depends on | lib | libcore.so | 22 | 7.61 - 8.00 | Gathers the MAC addresses of the device and maintains its device mode. | AVM |
Depends on | lib | libcrypto.so | 33 | 7.39 - 8.00 | OpenSSL general crypto and X.509 library | Linux |
Depends on | lib | libdl.so | 5 | 7.39 - 8.00 | Dynamic linking library | Linux |
Depends on | lib | libdputil.so | 33 | 7.39 - 8.00 | DataPipe / packet utilities | AVM |
Depends on | lib | libewnwjson.so | 33 | 7.39 - 8.00 | JSON helper functions | AVM |
Depends on | lib | libewnwlinux.so | 33 | 7.39 - 8.00 | Linux networking functions | AVM |
Depends on | lib | libewnwnet.so | 33 | 7.39 - 8.00 | Internet helper functions | AVM |
Depends on | lib | libfbconf.so | 22 | 7.61 - 8.00 | API to hardcoded fbconf.cfg | AVM |
Depends on | lib | libjuisclient.so | 33 | 7.39 - 8.00 | Update-Search - second generation - JUIS | AVM |
Depends on | lib | liblocalize.so | 21 | 7.90 - 8.00 | Charset conversion helper functions | AVM |
Depends on | lib | liblua.so | 33 | 7.39 - 8.00 | Lua 5.1.4 interpreter library | Linux |
Depends on | lib | libm.so | 5 | 7.39 - 8.00 | C math library | Linux |
Depends on | lib | libmonitorapi.so | 21 | 7.90 - 8.00 | TODO | AVM |
Depends on | lib | liboauth2.so | 33 | 7.39 - 8.00 | OAuth v2.0 authentificator | Linux |
Depends on | lib | libpthread.so | 5 | 7.39 - 8.00 | POSIX threading library | Linux |
Depends on | lib | librrd.so | 21 | 7.90 - 8.00 | RRDtool core API | RRDtool |
Depends on | lib | librt.so | 5 | 7.39 - 8.00 | POSIX realtime extensions library | Linux |
Depends on | lib | libslab_c++.so | 21 | 7.90 - 8.00 | C++ slab allocator | AVM |
Depends on | lib | libsvctl.so | 33 | 7.39 - 8.00 | supervisor notification library | AVM |
Depends on | lib | libtiinterpreter.so | 33 | 7.39 - 8.00 | Preprocessor for SSI-Files by TI. | AVM |
Depends on | lib | libwdt.so | 30 | 7.39 - 7.81 | AVM-Watchdogs management API | AVM |
Depends on | lib | libwebkpiclient.so | 32 | 7.39 - 8.00 | KPI sensor for system parts which use HTTP / HTTPS | AVM |
Depends on | lib | libwebsrv.so | 33 | 7.39 - 8.00 | HTTP / HTTPS webserver and tools. | AVM |
Depends on | lib | libyajl.so | 33 | 7.39 - 8.00 | Event-driven JSON parser | Linux |
Depends on | lib | libz.so | 33 | 7.39 - 8.00 | Zlib compressor / decompressor | Linux |
45 dependencies for this command |
Model-Matrix
Daily updated index of the presence, path and size of this command for each model. Last update: 2025-01-21 05:39 GMT.
Showing all models using this command. Click any column header (click-wait-click) to sort the list by the respective data.
The (main/scrpn/boot/arm/prx/atom/rtl)
label in the Model
column shows which CPU is meant for Multi-Linux models.
Note that this list is merged from Firmware-Probes of all known AVM firmware for a model, including Recovery.exe and Labor-Files.
Model | Firmware | Path | Size |
---|---|---|---|
FRITZ!Box 4040 | 7.39 - 8.00 | /usr/bin | 41.5k - 45.6k |
FRITZ!Box 4050 | 7.58 - 7.90 | /usr/bin | 41.5k - 45.5k |
FRITZ!Box 4060 | 7.39 - 7.90 | /usr/bin | 41.5k - 45.5k |
FRITZ!Box 5530 Fiber (main) | 7.39 - 8.00 | /usr/bin | 49.0k - 57.4k |
FRITZ!Box 5590 Fiber (main) | 7.39 - 8.00 | /usr/bin | 41.5k - 45.5k |
FRITZ!Box 5690 Pro (main) | 7.62 | /usr/bin | 41.5k |
FRITZ!Box 6490 Cable (atom) | 7.39 - 7.51 | /usr/bin | 41.4k - 49.4k |
FRITZ!Box 6590 Cable (atom) | 7.39 - 7.51 | /usr/bin | 41.4k - 49.4k |
FRITZ!Box 6591 Cable (atom) | 7.39 - 8.00 | /usr/bin | 49.6k - 65.6k |
FRITZ!Box 6660 Cable (atom) | 7.39 - 8.00 | /usr/bin | 49.6k - 65.6k |
FRITZ!Box 6670 Cable (atom) | 7.61 - 7.90 | /usr/bin | 49.7k - 53.8k |
FRITZ!Box 6690 Cable (atom) | 7.39 - 7.90 | /usr/bin | 49.6k - 65.6k |
FRITZ!Box 6820 LTE v1 (main) | 7.51 - 7.59 | /usr/bin | 53.1k - 53.2k |
FRITZ!Box 6820 LTE v2 (main) | 7.51 - 7.59 | /usr/bin | 53.1k - 53.2k |
FRITZ!Box 6820 LTE v3 (main) | 7.51 - 7.57 | /usr/bin | 53.1k - 53.2k |
FRITZ!Box 6820 LTE v4 | 7.59 | /usr/bin | 53.2k |
FRITZ!Box 6850 LTE | 7.39 - 7.90 | /usr/bin | 41.5k - 49.0k |
FRITZ!Box 6850 5G | 7.39 - 7.90 | /usr/bin | 41.5k - 45.6k |
FRITZ!Box 6890 LTE (main) | 7.39 - 7.57 | /usr/bin | 49.0k - 57.4k |
FRITZ!Box 6890 LTE v1 (main) | 7.39 - 7.57 | /usr/bin | 49.0k - 57.4k |
FRITZ!Box 6890 LTE v2 (main) | 7.39 - 7.57 | /usr/bin | 49.0k - 57.4k |
FRITZ!Box 7490 (main) | 7.51 | /usr/bin | 53.1k |
FRITZ!Box 7510 | 7.39 - 8.00 | /usr/bin | 41.5k - 45.5k |
FRITZ!Box 7520 | 7.39 - 8.00 | /usr/bin | 41.5k - 45.6k |
FRITZ!Box 7520 v2 (main) | 7.39 - 8.00 | /usr/bin | 41.5k - 45.6k |
FRITZ!Box 7530 | 7.39 - 8.00 | /usr/bin | 41.5k - 45.6k |
FRITZ!Box 7530 AX | 7.39 - 8.00 | /usr/bin | 41.6k - 49.8k |
FRITZ!Box 7583 (main) | 7.50 - 7.59 | /usr/bin | 49.0k |
FRITZ!Box 7583 VDSL (main) | 7.59 - 8.00 | /usr/bin | 49.0k - 57.4k |
FRITZ!Box 7590 (main) | 7.39 - 8.00 | /usr/bin | 49.0k - 57.4k |
FRITZ!Box 7590 AX (main) | 7.39 - 8.00 | /usr/bin | 49.0k - 57.4k |
FRITZ!Box 7690 | 7.61 - 7.90 | /usr/bin | 41.5k - 45.5k |
FRITZ!Repeater 2400 | 7.39 | /usr/bin | 49.5k |
33 models use this command |
Symbols
Daily updated index of all symbols of this command. Last update: 2025-01-21 07:43 GMT.
Firmware | Symbol |
---|---|
7.39 - 8.00 | GetSessionId |
7.39 - 8.00 | IsAccessWithoutSidApi |
7.39 - 8.00 | OutputHTTPHeader |
7.39 - 8.00 | SetSessionId |
7.39 | escape_init |
7.39 - 7.59 | fork_server_start |
7.39 - 8.00 | is_logged_in |
7.39 - 8.00 | is_loginbutton_needed |
7.39 - 8.00 | login |
7.39 - 8.00 | login_from_addr |
7.39 - 8.00 | main |
7.39 - 8.00 | scgi_request_alloc |
7.39 - 8.00 | scgi_request_free |
7.39 - 8.00 | scgi_server_exit_lua_stack |
7.39 - 8.00 | scgi_server_init_lua_stack |
7.39 - 8.00 | scgi_server_load |
7.39 - 8.00 | scgi_server_load_request_vars |
7.39 - 8.00 | scgi_server_start |
7.39 - 8.00 | scgi_supportdata |
7.39 - 8.00 | set_no_sidrenew |
20 symbols for this command |