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

(RFC) WebUI mod #1467

Open
wants to merge 29 commits into
base: develop
Choose a base branch
from
Open

Conversation

michaelortmann
Copy link
Member

@michaelortmann michaelortmann commented Aug 31, 2023

Found by: michaelortmann
Patch by: michaelortmann
Fixes:

One-line summary:
WebUI mod adds webinterface to eggdrop

Additional description (if needed):
Screenshot desktop firefox: https://imgur.com/a/WONc3dR
Screenshot iOS safari: https://imgur.com/a/AQwxNgs (the imgur content detection/warning, is ridiculous ;)
Reuses eggdrops telnet interface
Adds minimal http/websocket
Work in progress, but already working for me
Eggdrops make install doesnt automatically copy from module to text directory, so you have to cp src/mod/webui.mod/webui.html ~/eggdrop/text/ manually for now
Add to config:

loadmodule webui
listen +8080 webui

Yes, the + means it already supports https

Test cases demonstrating functionality (if applicable):
Tested with destop firefox and desktop chromium and iOS safari

@vanosg
Copy link
Member

vanosg commented May 15, 2024

18:05:47] Telnet connection: localhost/46032
[18:05:47] TLS: handshake successful. Secure connection established.
[18:05:47] TLS: peer did not present a certificate
[18:05:47] Denied telnet: *, No Access

Thread 1 "eggdrop" received signal SIGSEGV, Segmentation fault.
0x00007ffff7d81aca in ?? () from /lib/x86_64-linux-gnu/libssl.so.3
(gdb) bt
#0  0x00007ffff7d81aca in ?? () from /lib/x86_64-linux-gnu/libssl.so.3
#1  0x00007ffff7d81cb7 in SSL_read () from /lib/x86_64-linux-gnu/libssl.so.3
#2  0x00007ffff76b33b5 in webui_http_activity (idx=7, 
    buf=0x7fffffffbde1 "P/7Es4T4NIGlFL7i8kbrrw==\r\nConnection: keep-alive, Upgrade\r\nCookie: csrftoken=JEqDnapUmFU1zeZwSab3r0uzcb885hlU; sessionid=kexs0xja1ymwhumezcss3p4doaabi42s; messages=W1siX19qc2", len=511) at .././webui.mod/webui.c:333

and a second one with debug enabled

<snip web code>
[18:11:59] flags 1026
[18:11:59] webui: webui_http_activity(): idx 6 len 511
[18:11:59] webui: http()
[18:11:59] webui: GET /w
[18:11:59] webui: server requests websocket upgrade
[18:11:59] webui: tputs(): >>>HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: ljLkHJvOkjthVo/X5aPf0zQd3MM=

<<< 129
[18:11:59] webui: unset flag SOCK_BINARY sock 18

[18:11:59] webui: set flag SOCK_WS socklist 6 idx 6 sock 18 status 0

[18:11:59] webui: found (webui) dcc

[18:11:59] Denied telnet: *, No Access
[18:11:59] Received close notify warning during write
[18:11:59] webui: CHANGEOVER -> idx 6 sock -1


Thread 1 "eggdrop" received signal SIGSEGV, Segmentation fault.
0x00007ffff7d81aca in ?? () from /lib/x86_64-linux-gnu/libssl.so.3
(gdb) bt
#0  0x00007ffff7d81aca in ?? () from /lib/x86_64-linux-gnu/libssl.so.3
#1  0x00007ffff7d81cb7 in SSL_read () from /lib/x86_64-linux-gnu/libssl.so.3
#2  0x00007ffff76b33b5 in webui_http_activity (idx=6, 
    buf=0x7fffffffbde1 "iqubpCvpepPdkRKCJVsTIw==\r\nConnection: keep-alive, Upgrade\r\nCookie: csrftoken=JEqDnapUmFU1zeZwSab3r0uzcb885hlU; sessionid=kexs0xja1ymwhumezcss3p4doaabi42s; messages=W1siX19qc2", len=511) at .././webui.mod/webui.c:333
#3  0x00005555555a9f49 in mainloop (toplevel=1) at ./main.c:853

and a third non-crash, but still can't connect over a TLS port with https:

</html>
<<< 1539
[18:40:41] webui: SSL_read(): len 188
[18:40:41] webui: webui_http_activity(): user 0.108ms sys 0.100ms
[18:40:41] net: connect! sock 7
[18:40:41] sockread sock 7 return 4 >><< 0 binary? 0
[18:40:41] flags 4
[New Thread 0x7ffff6dff640 (LWP 2121829)]
[18:40:41] dcc_telnet_hostresolved()
[Thread 0x7ffff6dff640 (LWP 2121829) exited]
[18:40:41] Telnet connection: localhost/48796
[18:40:41] TLS: attempting SSL negotiation...
[18:40:41] TLS: state change: before SSL initialization
[18:40:41] TLS: state change: before SSL initialization
[18:40:41] TLS: awaiting more reads
[18:40:41] TLS: handshake in progress
[18:40:41] webui_dcc_telnet_hostresolved(6)
[18:40:41] TLS: state change: before SSL initialization
[18:40:41] TLS: alert during write: fatal (internal error).
[18:40:41] TLS: awaiting more writes
[18:40:41] net: sockread(): SSL_read() error = error:0A000115:SSL routines::session id context uninitialized (1)
[18:40:41] net: eof!(read) socket 11
[18:40:41] webui: webui_http_eof() idx 6 sock 11

@michaelortmann
Copy link
Member Author

michaelortmann commented May 27, 2024

@vanosg: The crash should be fixed now.

@vanosg
Copy link
Member

vanosg commented Jul 29, 2024

One more-
/home/runner/work/eggdrop/eggdrop/eggdrop/src/tls.c:233: undefined reference to `SSL_CTX_get0_certificate'
in OpenSSL 0.9.8

@michaelortmann
Copy link
Member Author

One more- /home/runner/work/eggdrop/eggdrop/eggdrop/src/tls.c:233: undefined reference to `SSL_CTX_get0_certificate' in OpenSSL 0.9.8

Yes, this is an unfinised block of code, waiting for #1411. Once #1411 is merged ill finish it. Until then, for now, i added an ifdef around it.

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.

2 participants