smartdns icon indicating copy to clipboard operation
smartdns copied to clipboard

SmartDNS UI界面体验

Open pymumu opened this issue 9 months ago • 170 comments

增加了一个SmartDNS UI,有兴趣的朋友可以下载体验。 UI目前尚处于起步阶段,只有查看类的基本功能,后续会有空再补充其他功能。

重要:因是体验版本,不保证数据的可靠性,以及后续的兼容性,请勿日常使用。

Image

下载: https://github.com/pymumu/smartdns/releases/tag/Release47.1

使用指导: https://pymumu.github.io/smartdns/config/dashboard/

默认用户名密码为:admin/password

pymumu avatar Feb 22 '25 13:02 pymumu

Will testing it! Looks very nice!

rapdodge avatar Feb 22 '25 14:02 rapdodge

Already using it for 1 days on my secondary dns at my home.

Image

I have no complaints. The main widget works as expected, the query logs are working as expected too.

I love the "upstream servers" page, since the data is very insightful, so I could check the working dns, and not.

Image

And I was not expecting terminal inside the dashboard!

Themes are working as expected. Again, I have no complaints.

Wish to see the implementation of dashboard to be merged into master.

Maybe my suggestions it's gonna are just make the dashboard files are inside 1 separate folder from the main config

So, the directory list would be like this:

/etc/smartdns/
|-- dashboard
|   `-- (all files that related to SmartDNS Dashboard)
|-- dashboard.conf
|-- smartdns.conf

That directory list like that would make the files more organised.

Much thanks,

rapdodge avatar Feb 23 '25 16:02 rapdodge

尽快合并到master tree

openips avatar Feb 25 '25 11:02 openips

赞 大佬 终于憋出了个大招

lalasou avatar Feb 27 '25 16:02 lalasou

希望快速更新
终于可以不用套adg了

lalasou avatar Feb 28 '25 11:02 lalasou

luci可以用么~

cutbuzz avatar Mar 06 '25 15:03 cutbuzz

Debian12通过服务运行后,没发现 6080 端口

[Unit]
Description=SmartDNS UI Server
After=network.target
StartLimitBurst=0
StartLimitIntervalSec=60

[Service]
Type=forking
PIDFile=/var/run/smartdns.pid
ExecStart=/root/smartdns/run-smartdns -p /var/run/smartdns.pid $SMART_DNS_OPTS
Restart=always
RestartSec=2
TimeoutStopSec=15
WorkingDirectory=/root/smartdns

[Install]
WantedBy=multi-user.target
Alias=smartdns-ui.service
root@SmartDNS:~# ss -tuln
Netid           State            Recv-Q           Send-Q                     Local Address:Port                      Peer Address:Port          Process           
udp             UNCONN           0                0                                0.0.0.0:5353                           0.0.0.0:*                               
udp             UNCONN           0                0                                0.0.0.0:47136                          0.0.0.0:*                               
udp             UNCONN           0                0                                      *:53                                   *:*                               
udp             UNCONN           0                0                                   [::]:42538                             [::]:*                               
udp             UNCONN           0                0                                   [::]:5353                              [::]:*                               
tcp             LISTEN           0                100                            127.0.0.1:25                             0.0.0.0:*                               
tcp             LISTEN           0                100                                [::1]:25                                [::]:*                               
tcp             LISTEN           0                4096                                   *:22                                   *:*                               
root@SmartDNS:~# 

dtapps avatar Mar 13 '25 10:03 dtapps

配置plugin加载ui插件

pymumu avatar Mar 14 '25 00:03 pymumu

配置plugin加载ui插件

Image

Image openwrt报错,系统日志说要动态版本???

xiandu999-yu avatar Mar 19 '25 00:03 xiandu999-yu

插件功能只有动态编译链接c库的才能支持

pymumu avatar Mar 19 '25 04:03 pymumu

插件功能只有动态编译链接c库的才能支持

[2025-03-19 20:35:24,713][ERROR][ dns_plugin.c:181 ] load plugin /etc/smartdns/plugin/libsmartdns_ui.so failed: Error relocating /etc/smartdns/plugin/libsmartdns_ui.so: __res_init: symbol not found

xiandu999-yu avatar Mar 19 '25 11:03 xiandu999-yu

也很奇怪啊 动态编译提示 Unable to find libclang: "the libclang shared library at /usr/lib/llvm18/lib/libclang.so.18.1.8 could not be opened: Dynamic loading not supported"

PikuZheng avatar Mar 19 '25 12:03 PikuZheng

插件功能只有动态编译链接c库的才能支持

[2025-03-19 20:35:24,713][ERROR][ dns_plugin.c:181 ] load plugin /etc/smartdns/plugin/libsmartdns_ui.so failed: Error relocating /etc/smartdns/plugin/libsmartdns_ui.so: __res_init: symbol not found

有可能你编译c部分和编译rust部分用的编译器不同

pymumu avatar Mar 19 '25 12:03 pymumu

也很奇怪啊 动态编译提示 Unable to find libclang: "the libclang shared library at /usr/lib/llvm18/lib/libclang.so.18.1.8 could not be opened: Dynamic loading not supported"

c库部分是不能静态编译的

pymumu avatar Mar 19 '25 12:03 pymumu

也很奇怪啊 动态编译提示 Unable to find libclang: "the libclang shared library at /usr/lib/llvm18/lib/libclang.so.18.1.8 could not be opened: Dynamic loading not supported"

c库部分是不能静态编译的

算了,不执着这个了...

xiandu999-yu avatar Mar 19 '25 13:03 xiandu999-yu

https://github.com/user-attachments/files/19333093/smartdns-with-webui.tar.gz

用这个脚本编译

pymumu avatar Mar 19 '25 14:03 pymumu

姑且把容器跑起来了。tag 是 pikuzheng/smartdns:ui 或 pikuzheng/smartdns:ui-版本号。基于alpine,提供armv6/armv7/arm64/x64。已经更新openssl3.4.1,支持quic上游(DOQ) 启用插件的话,修改配置文件增加以下几行

plugin /usr/lib/libsmartdns_ui.so
smartdns-ui.www-root /wwwroot
smartdns-ui.ip http://0.0.0.0:6080
data-dir /etc/smartdns

~解压本issue 1楼的tar.gz文件(任选一个)中的www文件夹保存到smartdns-ui.www-root的值对应的路径。~ 其中前两行已经在容器内置,不需要修改。 data-dir的值改为你自己保存数据库的路径(sqlite3数据库)。 ip建议不要改。端口可以改(注意在创建容器时增加对应端口映射)。

面板登陆用户名和密码为admin password,默认已经填写好。

Image

~理论上编译出来的smartdns和libsmartdns_ui.so可以直接拿到openwrt用。未测试。~ 拿到openwrt用需要容器内的 /usr/sbin/smartdns /usr/lib/libcrypto.so /usr/lib/libssl.so /usr/lib/libsmartdns_ui.so 四个文件以及 /wwwroot 文件夹。上次借了个红米ax86s(arm64)试了能运行。反正放进去覆盖原版就行了,你们应该不需要ipk吧 :)

PikuZheng avatar Mar 20 '25 10:03 PikuZheng

libsmartdns_ui.so编译不出来 openwrt下没办法用

openips avatar Mar 20 '25 12:03 openips

Debian系统可以使用服务方式启动

[Unit]
Description=SmartDNS Server
After=network.target
StartLimitBurst=0
StartLimitIntervalSec=60

[Service]
Type=forking
PIDFile=/root/smartdns/smartdns.pid
ExecStart=/root/smartdns/ld-linux.so --library-path /root/smartdns /root/smartdns/smartdns -c /root/smartdns/smartdns.conf -p /root/smartdns/smartdns.pid
Restart=always
RestartSec=2
TimeoutStopSec=15

[Install]
WantedBy=multi-user.target
Alias=smartdns.service

smartdns.conf

# 数据目录
data-dir /root/smartdns/db

# 启用 UI 插件
plugin /root/smartdns/libsmartdns_ui.so

# 设置 SmartDNS UI 的根目录
smartdns-ui.www-root /root/smartdns/www

详细教程可以参考 Debian安装SmartDNS带UI界面版本

dtapps avatar Mar 20 '25 14:03 dtapps

https://github.com/user-attachments/files/19333093/smartdns-with-webui.tar.gz

Compile with this script

Could you please help me, I encounter error

cp: cannot stat '/root/smartdns-with-webui/smartdns-webui/out': No such file or directory

https://pastebin.com/raw/JHtbqvQP

And the root directory "there's build.sh and run-smartdns doesn't have anything except files that extracted

rapdodge avatar Mar 20 '25 18:03 rapdodge

for debian,ubuntu,just run

make WITH_UI=1 install -j

that build script is for cross-compile

pymumu avatar Mar 20 '25 22:03 pymumu

for debian,ubuntu,just run

make WITH_UI=1 install -j

that build script is for cross-compile

Ok, it's successfully compiled

https://pastebin.com/raw/gHsADGvC

But I don't know why the wwwroot isn't there

root@debian-dns:~# ls /usr/lib/smartdns/
libsmartdns_ui.so
root@debian-dns:~# ls /usr/share/smartdns/wwwroot
ls: cannot access '/usr/share/smartdns/wwwroot': No such file or directory
root@debian-dns:~#

Is there any additional command to compile the wwwroot too?

rapdodge avatar Mar 21 '25 00:03 rapdodge

clone smartdns-webui repo, run

npm run build

copy out to /usr/share/smartdns/wwwroot

pymumu avatar Mar 21 '25 01:03 pymumu

clone smartdns-webui repo, run

npm run build

copy out to /usr/share/smartdns/wwwroot

Ok. I got it. And is that possible to compiling with ui, but pre-packaged .deb ?

I mean the lib.so, not the html

rapdodge avatar Mar 21 '25 01:03 rapdodge

  • 我这里有构建一个 Ubuntu 作为基础镜像自用的容器。构建时间可以很快。

  • https://github.com/yanhao98/smartdns/actions/workflows/CI.yaml

Image

这个是自用的,我自己只是为了构建出来能使用就可以了。提供一些信息给在折腾的伙伴。


  • aarch64-linux

    # docker run --quiet -it --pull always --rm ghcr.io/yanhao98/smartdns:master ldd /usr/sbin/smartdns
    	linux-vdso.so.1 (0x0000ffffb20c8000)
    	libssl.so.3 => /lib/aarch64-linux-gnu/libssl.so.3 (0x0000ffffb1d70000)
    	libcrypto.so.3 => /lib/aarch64-linux-gnu/libcrypto.so.3 (0x0000ffffb1820000)
    	libm.so.6 => /lib/aarch64-linux-gnu/libm.so.6 (0x0000ffffb1770000)
    	libgcc_s.so.1 => /lib/aarch64-linux-gnu/libgcc_s.so.1 (0x0000ffffb1730000)
    	libc.so.6 => /lib/aarch64-linux-gnu/libc.so.6 (0x0000ffffb1570000)
    	/lib/ld-linux-aarch64.so.1 (0x0000ffffb2080000)
    	libz.so.1 => /lib/aarch64-linux-gnu/libz.so.1 (0x0000ffffb1530000)
    	libzstd.so.1 => /lib/aarch64-linux-gnu/libzstd.so.1 (0x0000ffffb1470000)
    
    # docker run --quiet -it --pull always --rm ghcr.io/yanhao98/smartdns:master /usr/sbin/smartdns -v
    smartdns 1.20250321-0703 (ea3400f-dirty)
    
  • x86_64-linux

    # docker run --quiet -it --pull always --rm ghcr.io/yanhao98/smartdns:master ldd /usr/sbin/smartdns
            linux-vdso.so.1 (0x00007fff103bb000)
            libssl.so.3 => /lib/x86_64-linux-gnu/libssl.so.3 (0x00007fcaa7e57000)
            libcrypto.so.3 => /lib/x86_64-linux-gnu/libcrypto.so.3 (0x00007fcaa78fb000)
            libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fcaa780e000)
            libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fcaa77e0000)
            libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fcaa75c0000)
            libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fcaa75a0000)
            libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007fcaa74e2000)
            /lib64/ld-linux-x86-64.so.2 (0x00007fcaa8125000)
    
    # docker run --quiet -it --pull always --rm ghcr.io/yanhao98/smartdns:master /usr/sbin/smartdns -v
    smartdns 1.20250321-0703 (ea3400f-dirty)
    

问题2: 不能在 Debian 容器运行

因为镜像默认的 GLIBC版本 比构建(GitHub Actions的runner)的机器低。

smartdns: /lib/aarch64-linux-gnu/libc.so.6: version `GLIBC_2.38' not found (required by smartdns)
  • Debian 镜像的 GLIBC版本
# docker run --rm -it debian ldd --version
ldd (Debian GLIBC 2.36-9+deb12u10) 2.36
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
  • Ubuntu 镜像的 GLIBC版本
# docker run --rm -it ubuntu ldd --version
ldd (Ubuntu GLIBC 2.39-0ubuntu8.3) 2.39
Copyright (C) 2024 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

yanhao98 avatar Mar 21 '25 07:03 yanhao98

hi I installed smartdns on centos 7.0 and I want to configure webui but I didn't find any documentation for it. I did the following according to the comments above, what else do I need to do to use ui?

Image

Image

Image

Cason-z avatar Mar 28 '25 03:03 Cason-z

hi I installed smartdns on centos 7.0 and I want to configure webui but I didn't find any documentation for it. I did the following according to the comments above, what else do I need to do to use ui?

Since it is highly dependent on the operating environment, it is a little complicated. If there are no issues with the environment and binary files, you need to add the following codes to the configuration file:

plugin /usr/lib/libsmartdns_ui.so
smartdns-ui.www-root /wwwroot
smartdns-ui.ip http://0.0.0.0:6080
data-dir /etc/smartdns

obviously, plugin is the location of file libsmartdns_ui.so. smartdns-ui.www-root is the location of web files (compile from project smartdns-webui). port and data-dir are up to you. hope everything goes well for you

PikuZheng avatar Mar 29 '25 02:03 PikuZheng

强烈支持!!!

  • 建议前后端分离
  • 配置支持是否开启开启dashboard的api及secret简单鉴权(请求头X-SMARTDNS-SECRET=${secret})
  • 前端环境变量指定api地址及secret

oneisall8955 avatar Mar 31 '25 06:03 oneisall8955

增加了一个SmartDNS UI,有兴趣的朋友可以下载体验。 UI目前尚处于起步阶段,只有查看类的基本功能,后续会有空再补充其他功能。

重要:因是体验版本,不保证数据的可靠性,以及后续的兼容性,请勿日常使用。

Image [smartdns-with-webui-x86_64.tar.gz](https://github.com/user-attachments/files/18922855/smartdns-with-webui-x86_64.tar.gz) [smartdns-with-webui-aarch64.tar.gz](https://github.com/user-attachments/files/18922865/smartdns-with-webui-aarch64.tar.gz)

因采用整体打包的方式,通过执行run-smartdns运行,参数不变。 启动服务后,端口为6080

这个2台smartdns分别在2台服务器上,支持ui独立部署采集这2台的smartdns的信息的,相当于汇总后端2台的DNS日志信息不?

maojianyou avatar Apr 02 '25 13:04 maojianyou

功能还是太少了

javycoder avatar Apr 08 '25 09:04 javycoder