diff --git a/cpulimit/Makefile b/cpulimit/Makefile new file mode 100644 index 000000000..eb259812d --- /dev/null +++ b/cpulimit/Makefile @@ -0,0 +1,35 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=cpulimit +PKG_VERSION:=0.3.2 +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/denji/cpulimit/tar.gz/$(PKG_VERSION)? +PKG_HASH:=0c61d394407fdd0547b53e6435ecb817d2e3ba914b48aa9f48ccf42c8278d3a6 + +PKG_BUILD_PARALLEL:=1 +PKG_LICENSE_FILES:=LICENSE + +MAKE_PATH:=src + +include $(INCLUDE_DIR)/package.mk + +define Package/cpulimit + SECTION:=utils + CATEGORY:=Utilities + TITLE:=CPU usage limiter + URL:=https://github.com/denji/cpulimit +endef + +define Package/cpulimit/description + Cpulimit is a tool which limits the CPU usage of a process + (expressed in percentage, not in CPU time). +endef + +define Package/cpulimit/install + $(INSTALL_DIR) $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/cpulimit $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,cpulimit)) diff --git a/dnsproxy/Makefile b/dnsproxy/Makefile new file mode 100644 index 000000000..4ca48088a --- /dev/null +++ b/dnsproxy/Makefile @@ -0,0 +1,59 @@ +# SPDX-License-Identifier: GPL-3.0-only +# +# Copyright (C) 2021 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +PKG_NAME:=dnsproxy +PKG_VERSION:=0.46.5 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/AdguardTeam/dnsproxy/tar.gz/v$(PKG_VERSION)? +PKG_HASH:=604b7e78956ec6d6421807e30ff44d87d85f10203b3d68d397af34ca2013e696 + +PKG_MAINTAINER:=Tianling Shen +PKG_LICENSE:=Apache-2.0 +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_DEPENDS:=golang/host +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +GO_PKG:=github.com/AdguardTeam/dnsproxy +GO_PKG_LDFLAGS_X:=main.VersionString=v$(PKG_VERSION) + +include $(INCLUDE_DIR)/package.mk +include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk + +define Package/dnsproxy + SECTION:=net + CATEGORY:=Network + SUBMENU:=IP Addresses and Names + TITLE:=Simple DNS proxy with DoH, DoT, DoQ and DNSCrypt support + URL:=https://github.com/AdguardTeam/dnsproxy + DEPENDS:=$(GO_ARCH_DEPENDS) +ca-bundle + USERID:=dnsproxy=411:dnsproxy=411 +endef + +define Package/dnsproxy/description + A simple DNS proxy server that supports all existing DNS protocols including + DNS-over-TLS, DNS-over-HTTPS, DNSCrypt, and DNS-over-QUIC.Moreover, it can + work as a DNS-over-HTTPS, DNS-over-TLS or DNS-over-QUIC server. +endef + +define Package/dnsproxy/install + $(call GoPackage/Package/Install/Bin,$(1)) + + $(INSTALL_DIR) $(1)/etc/config/ + $(INSTALL_CONF) $(CURDIR)/files/dnsproxy.config $(1)/etc/config/dnsproxy + $(INSTALL_DIR) $(1)/etc/init.d/ + $(INSTALL_BIN) $(CURDIR)/files/dnsproxy.init $(1)/etc/init.d/dnsproxy +endef + +define Package/dnsproxy/conffiles +/etc/config/dnsproxy +endef + +$(eval $(call GoBinPackage,dnsproxy)) +$(eval $(call BuildPackage,dnsproxy)) diff --git a/dnsproxy/files/dnsproxy.config b/dnsproxy/files/dnsproxy.config new file mode 100644 index 000000000..a9fa02028 --- /dev/null +++ b/dnsproxy/files/dnsproxy.config @@ -0,0 +1,41 @@ + +# For documents, please see https://github.com/AdguardTeam/dnsproxy#usage + +config dnsproxy 'global' + option enabled '0' + option listen_addr '127.0.0.1' + option listen_port '5353' + option log_file '' + option all_servers '0' + option fastest_addr '0' + option insecure '0' + option ipv6_disabled '0' + option max_go_routines '' + option rate_limit '' + option refuse_any '0' + option udp_buf_size '' + option verbose '0' + +config dnsproxy 'bogus_nxdomain' + list ip_addr '' + +config dnsproxy 'cache' + option enabled '0' + option cache_optimistic '0' + option size '65535' + option min_ttl '' + option max_ttl '' + +config dnsproxy 'dns64' + option enabled '0' + option dns64_prefix '64:ff9b::' + +config dnsproxy 'edns' + option enabled '0' + option edns_addr '' + +config dnsproxy 'servers' + list bootstrap 'tls://8.8.8.8' + list fallback 'tls://9.9.9.9' + list upstream 'tls://1.1.1.1' + diff --git a/dnsproxy/files/dnsproxy.init b/dnsproxy/files/dnsproxy.init new file mode 100644 index 000000000..1514ee152 --- /dev/null +++ b/dnsproxy/files/dnsproxy.init @@ -0,0 +1,115 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2021 Tianling Shen + +USE_PROCD=1 +START=90 + +CONF="dnsproxy" +PROG="/usr/bin/dnsproxy" + +is_enabled() { + local enabled + config_get enabled "$1" "$2" "0" + if [ "$enabled" -eq "1" ]; then + return 0 + else + return 1 + fi +} + +is_empty() { + local empty + config_get empty "$1" "$2" $3 + if [ -z "$empty" ]; then + return 0 + else + return 1 + fi +} + +append_param() { + procd_append_param command "$1" $2 +} + +append_param_arg() { + local value + config_get value "$1" "$2" $4 + [ -n "$value" ] && append_param "$3" "$value" +} + +append_param_bool() { + is_enabled "$1" "$2" && append_param "--${2//_/-}" +} + +load_config_arg() { + append_param_bool "$1" "all_servers" + append_param_bool "$1" "fastest_addr" + append_param_bool "$1" "insecure" + append_param_bool "$1" "ipv6_disabled" + append_param_bool "$1" "refuse_any" + append_param_bool "$1" "verbose" +} + +load_config_list() { + is_empty "bogus_nxdomain" "ip_addr" || config_list_foreach "bogus_nxdomain" "ip_addr" "append_param '--bogus-nxdomain'" + + for i in "bootstrap" "fallback" "upstream"; do + is_empty "servers" "$i" || config_list_foreach "servers" "$i" "append_param '--$i'" + done +} + +load_config_param() { + append_param_arg "global" "listen_addr" "--listen" "127.0.0.1" + append_param_arg "global" "listen_port" "--port" "5353" + append_param_arg "global" "log_file" "--output" + append_param_arg "global" "max_go_routines" "--max-go-routines" + append_param_arg "global" "rate_limit" "--ratelimit" + append_param_arg "global" "udp_buf_size" "--udp-buf-size" + + is_enabled "cache" "enabled" && { + append_param "--cache" + append_param_bool "cache" "cache_optimistic" + append_param_arg "cache" "size" "--cache-size" + append_param_arg "cache" "min_ttl" "--cache-min-ttl" + append_param_arg "cache" "max_ttl" "--cache-max-ttl" + } + + is_enabled "dns64" "enabled" && { + append_param "--dns64" + append_param_arg "dns64" "dns64_prefix" "--dns64-prefix" + } + + is_enabled "edns" "enabled" && { + append_param "--edns" + append_param_arg "edns" "edns_addr" "--edns-addr" + } +} + +start_service() { + config_load "$CONF" + + is_enabled "global" "enabled" || return 1 + + procd_open_instance "$CONF" + procd_set_param command "$PROG" + + load_config_arg "global" + load_config_list + load_config_param + + procd_set_param respawn + procd_set_param stdout 1 + procd_set_param stderr 1 + procd_set_param user dnsproxy + + procd_close_instance +} + +reload_service() { + stop + start +} + +service_triggers() { + procd_add_reload_trigger "$CONF" +} diff --git a/dnsproxy/test.sh b/dnsproxy/test.sh new file mode 100644 index 000000000..60e06a25d --- /dev/null +++ b/dnsproxy/test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +dnsproxy --version | grep "$PKG_VERSION" diff --git a/gowebdav/Makefile b/gowebdav/Makefile new file mode 100644 index 000000000..5f71d93f0 --- /dev/null +++ b/gowebdav/Makefile @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: GPL-3.0-only +# +# Copyright (C) 2021-2023 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +PKG_NAME:=gowebdav +PKG_VERSION:=0.0.5 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/1715173329/gowebdav/tar.gz/v$(PKG_VERSION)? +PKG_HASH:=ee0ac5a52a3b7a1e1c687b850c3f7b55e10bbdc88da0b6b1dd8b790fc53d10c6 + +PKG_MAINTAINER:=Tianling Shen + +PKG_BUILD_DEPENDS:=golang/host +PKG_BUILD_PARALLEL:=1 +PKG_USE_MIPS16:=0 + +GO_PKG:=github.com/1715173329/gowebdav + +include $(INCLUDE_DIR)/package.mk +include $(TOPDIR)/feeds/packages/lang/golang/golang-package.mk + +define Package/gowebdav + SECTION:=net + CATEGORY:=Network + SUBMENU:=File Transfer + TITLE:=A simple WebDav server written in Go + URL:=https://github.com/1715173329/gowebdav + DEPENDS:=$(GO_ARCH_DEPENDS) +endef + +define Package/gowebdav/conffiles +/etc/config/gowebdav +endef + +define Package/gowebdav/install + $(call GoPackage/Package/Install/Bin,$(1)) + + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_CONF) $(CURDIR)/files/gowebdav.config $(1)/etc/config/gowebdav + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(CURDIR)/files/gowebdav.init $(1)/etc/init.d/gowebdav + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_BIN) $(CURDIR)/files/gowebdav-migrate-config.sh $(1)/etc/uci-defaults/90-gowebdav-migrate-config +endef + +$(eval $(call GoBinPackage,gowebdav)) +$(eval $(call BuildPackage,gowebdav)) diff --git a/gowebdav/files/gowebdav-migrate-config.sh b/gowebdav/files/gowebdav-migrate-config.sh new file mode 100644 index 000000000..3d8de7c35 --- /dev/null +++ b/gowebdav/files/gowebdav-migrate-config.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +. /lib/functions.sh + +config_load "gowebdav" +config_get enable "config" "enable" +[ -z "$enable" ] || uci -q rename "gowebdav.config.enable"="enabled" + +config_get root_dir "config" "root_dir" +[ -z "$root_dir" ] || uci -q rename "gowebdav.config.root_dir"="mount_dir" + +config_get allow_wan "config" "allow_wan" +[ -z "$allow_wan" ] || uci -q rename "gowebdav.config.allow_wan"="public_access" + +config_get enable_auth "config" "enable_auth" +config_get username "config" "username" +[ -z "$enable_auth" -a -n "$username" ] && uci -q set "gowebdav.config.enable_auth"="1" + +config_get use_https "config" "use_https" +[ -z "$use_https" ] || uci -q rename "gowebdav.config.use_https"="enable_https" + +[ -z "$(uci -q changes "gowebdav")" ] || uci -q commit "gowebdav" + +exit 0 diff --git a/gowebdav/files/gowebdav.config b/gowebdav/files/gowebdav.config new file mode 100644 index 000000000..d8aa19bbf --- /dev/null +++ b/gowebdav/files/gowebdav.config @@ -0,0 +1,14 @@ + +config gowebdav 'config' + option enabled '0' + option listen_port '6086' + option mount_dir '/mnt' + option read_only '0' + option public_access '0' + option enable_auth '0' + option username '' + option password '' + option enable_https '0' + option cert_cer '' + option cert_key '' + diff --git a/gowebdav/files/gowebdav.init b/gowebdav/files/gowebdav.init new file mode 100644 index 000000000..a01ac4462 --- /dev/null +++ b/gowebdav/files/gowebdav.init @@ -0,0 +1,97 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2021-2023 ImmortalWrt.org + +START=99 +USE_PROCD=1 + +CONF="gowebdav" +PROG="/usr/bin/gowebdav" + +start_service() { + config_load "$CONF" + + local enabled + config_get_bool enabled "config" "enabled" "0" + [ "$enabled" -eq "1" ] || return 1 + + local listen_port mount_dir read_only public_access + local enable_auth username password + local enable_https cert_cer cert_key + + config_get listen_port "config" "listen_port" "6086" + config_get mount_dir "config" "mount_dir" "/mnt" + config_get_bool read_only "config" "read_only" "0" + config_get_bool public_access "config" "public_access" "0" + + config_get_bool enable_auth "config" "enable_auth" "0" + config_get username "config" "username" + config_get password "config" "password" + + config_get_bool enable_https "config" "enable_https" "0" + config_get cert_cer "config" "cert_cer" + config_get cert_key "config" "cert_key" + + [ -d "$mount_dir" ] || mkdir -p "$mount_dir" + + procd_open_instance + procd_set_param command "$PROG" + procd_append_param command -dir "$mount_dir" + procd_append_param command -http ":$listen_port" + [ "$read_only" -eq "0" ] || procd_append_param command -read-only + + if [ "$enable_auth" -eq "1" ]; then + if [ -z "$username" ] || [ -z "$password" ]; then + logger -p daemon.err -t "$CONF" "Authentication enabled with empty username or password!" + return 1 + fi + + procd_append_param command -user "$username" + procd_append_param command -password "$password" + fi + + if [ "$enable_https" -eq "1" ]; then + if [ -z "$cert_cer" ] || [ -z "$cert_key" ]; then + logger -p daemon.err -t "$CONF" "HTTPS enabled with empty certificate!" + return 1 + fi + + procd_append_param command -https-mode + procd_append_param command -https-cert-file "$cert_cer" + procd_append_param command -https-key-file "$cert_key" + fi + + procd_set_param limits core="unlimited" + procd_set_param limits nofile="1000000 1000000" + procd_set_param respawn + procd_set_param stdout 1 + procd_set_param stderr 1 + + if [ "$public_access" -eq "1" ]; then + procd_open_data + json_add_array firewall + json_add_object "" + json_add_string type rule + json_add_string name "Allow-access-GoWebDav-at-$listen_port" + json_add_string src "*" + json_add_string dest_port "$listen_port" + json_add_string proto tcp + json_add_string target ACCEPT + json_close_object + json_close_array + procd_close_data + fi + + procd_close_instance +} + +service_started() { + procd_set_config_changed firewall +} + +service_stopped() { + procd_set_config_changed firewall +} + +service_triggers() { + procd_add_reload_trigger "$CONF" +} diff --git a/haproxy/Makefile b/haproxy/Makefile new file mode 100644 index 000000000..1c0d8fde1 --- /dev/null +++ b/haproxy/Makefile @@ -0,0 +1,146 @@ +# +# Copyright (C) 2010-2016 OpenWrt.org +# Copyright (C) 2009-2016 Thomas Heil +# Copyright (C) 2018 Christian Lachner +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=haproxy +PKG_VERSION:=2.6.6 +PKG_RELEASE:=104 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://www.haproxy.org/download/2.6/src +PKG_HASH:=d0c80c90c04ae79598b58b9749d53787f00f7b515175e7d8203f2796e6a6594d + +PKG_MAINTAINER:=Thomas Heil , \ + Christian Lachner +PKG_LICENSE:=GPL-2.0-only +PKG_LICENSE_FILES:=LICENSE +PKG_CPE_ID:=cpe:/a:haproxy:haproxy + +include $(INCLUDE_DIR)/package.mk + +define Package/haproxy/Default + SUBMENU:=Web Servers/Proxies + SECTION:=net + CATEGORY:=Network + TITLE:=TCP/HTTP Load Balancer + URL:=https://www.haproxy.org/ +endef + +define Package/haproxy/conffiles +/etc/haproxy.cfg +endef + +Package/haproxy-nossl/conffiles = $(Package/haproxy/conffiles) + +define Package/haproxy/Default/description + Open source Reliable, High Performance TCP/HTTP Load Balancer. +endef + +define Package/haproxy + $(call Package/haproxy/Default) + TITLE+=with SSL support + DEPENDS+= +libpcre +libltdl +zlib +libpthread +liblua5.3 +libopenssl +libncurses +libreadline +libatomic + VARIANT:=ssl +endef + +define Package/haproxy/description +$(call Package/haproxy/Default/description) + This package is built with SSL and LUA support. +endef + +define Package/haproxy-nossl + $(call Package/haproxy/Default) + TITLE+=without SSL support + VARIANT:=nossl + DEPENDS+= +libpcre +libltdl +zlib +libpthread +liblua5.3 +libatomic + CONFLICTS:=haproxy +endef + +define Package/haproxy-nossl/description + $(call Package/haproxy/Default/description) + This package is built without SSL support. +endef + +TARGET=linux-glibc +ENABLE_LUA:=y + +ifeq ($(CONFIG_USE_UCLIBC),y) + ADDON+=USE_BACKTRACE= + ADDON+=USE_LIBCRYPT= +endif + +ifeq ($(CONFIG_USE_MUSL),y) + TARGET=linux-musl +endif + +ifeq ($(BUILD_VARIANT),ssl) + ADDON+=USE_OPENSSL=1 + ADDON+=ADDLIB="-lcrypto -lm" +endif + +define Build/Compile + $(MAKE) TARGET=$(TARGET) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + CC="$(TARGET_CC)" \ + PCREDIR="$(STAGING_DIR)/usr/" \ + USE_LUA=1 LUA_LIB_NAME="lua5.3" LUA_INC="$(STAGING_DIR)/usr/include/lua5.3" LUA_LIB="$(STAGING_DIR)/usr/lib" \ + SMALL_OPTS="-DBUFSIZE=16384 -DMAXREWRITE=1030 -DSYSTEM_MAXCONN=165530" \ + USE_ZLIB=1 USE_PCRE=1 USE_PCRE_JIT=1 USE_PTHREAD_PSHARED=1 USE_LIBATOMIC=1 USE_PROMEX=1 \ + VERSION="$(PKG_VERSION)" SUBVERS="-$(PKG_RELEASE)" \ + VERDATE="$(shell date -d @$(SOURCE_DATE_EPOCH) '+%Y/%m/%d')" IGNOREGIT=1 \ + $(ADDON) \ + CFLAGS="$(TARGET_CFLAGS) -fno-strict-aliasing -Wdeclaration-after-statement -Wno-unused-label -Wno-sign-compare -Wno-unused-parameter -Wno-clobbered -Wno-missing-field-initializers -Wno-cast-function-type -Wno-address-of-packed-member -Wtype-limits -Wshift-negative-value -Wshift-overflow=2 -Wduplicated-cond -Wnull-dereference -fwrapv -fasynchronous-unwind-tables -Wno-null-dereference" \ + LD="$(TARGET_CC)" \ + LDFLAGS="$(TARGET_LDFLAGS)" + + $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + LD="$(TARGET_CC)" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + $(MAKE_FLAGS) \ + install + + $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \ + DESTDIR="$(PKG_INSTALL_DIR)" \ + CC="$(TARGET_CC)" \ + CFLAGS="$(TARGET_CFLAGS) -Wno-address-of-packed-member" \ + LDFLAGS="$(TARGET_LDFLAGS)" \ + admin/halog/halog +endef + +define Package/haproxy/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/haproxy $(1)/usr/sbin/ + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) ./files/haproxy.cfg $(1)/etc/ + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/haproxy.init $(1)/etc/init.d/haproxy +endef + +Package/haproxy-nossl/install = $(Package/haproxy/install) + +define Package/halog + $(call Package/haproxy) + TITLE+=halog + DEPENDS:=haproxy +endef + +define Package/halog/description + HAProxy Log Analyzer +endef + +define Package/halog/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/admin/halog/halog $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,haproxy)) +$(eval $(call BuildPackage,halog)) +$(eval $(call BuildPackage,haproxy-nossl)) diff --git a/haproxy/files/haproxy.cfg b/haproxy/files/haproxy.cfg new file mode 100644 index 000000000..ffe5949ca --- /dev/null +++ b/haproxy/files/haproxy.cfg @@ -0,0 +1,107 @@ +# Example configuration file for HAProxy 2.0, refer to the url below for +# a full documentation and examples for configuration: +# https://cbonte.github.io/haproxy-dconv/2.0/configuration.html + + +# Global parameters +global + + # Log events to a remote syslog server at given address using the + # specified facility and verbosity level. Multiple log options + # are allowed. + #log 10.0.0.1 daemon info + + # Specifiy the maximum number of allowed connections. + maxconn 32000 + + # Raise the ulimit for the maximum allowed number of open socket + # descriptors per process. This is usually at least twice the + # number of allowed connections (maxconn * 2 + nb_servers + 1) . + ulimit-n 65535 + + # Drop privileges (setuid, setgid), default is "root" on OpenWrt. + uid 0 + gid 0 + + # Perform chroot into the specified directory. + #chroot /var/run/haproxy/ + + # Daemonize on startup + daemon + + nosplice + # Enable debugging + #debug + + # Spawn given number of processes and distribute load among them, + # used for multi-core environments or to circumvent per-process + # limits like number of open file descriptors. Default is 1. + #nbproc 2 + +# Default parameters +defaults + # Default timeouts + timeout connect 5000ms + timeout client 50000ms + timeout server 50000ms + + +# Example HTTP proxy listener +listen my_http_proxy + + # Bind to port 81 and 444 on all interfaces (0.0.0.0) + bind :81,:444 + + # We're proxying HTTP here... + mode http + + # Simple HTTP round robin over two servers using the specified + # source ip 192.168.1.1 . + balance roundrobin + server server01 192.168.1.10:80 source 192.168.1.1 + server server02 192.168.1.20:80 source 192.168.1.1 + + # Serve an internal statistics page on /stats: + stats enable + stats uri /stats + + # Enable HTTP basic auth for the statistics: + stats realm HA_Stats + stats auth username:password + + +# Example SMTP proxy listener +listen my_smtp_proxy + + # Disable this instance without commenting out the section. + disabled + + # Bind to port 26 and 588 on localhost + bind 127.0.0.1:26,127.0.0.1:588 + + # This is a TCP proxy + mode tcp + + # Round robin load balancing over two servers on port 123 forcing + # the address 192.168.1.1 and port 25 as source. + balance roundrobin + #use next line for transparent proxy, so the servers can see the + #original ip-address and remove source keyword in server definition + #source 0.0.0.0 usesrc clientip + server server01 192.168.1.10:123 source 192.168.1.1:25 + server server02 192.168.1.20:123 source 192.168.1.1:25 + + +# Special health check listener for integration with external load +# balancers. +listen local_health_check + + # Listen on port 60000 + bind :60000 + + # This is a health check + mode health + + # Enable HTTP-style responses: "HTTP/1.0 200 OK" + # else just print "OK". + #option httpchk diff --git a/haproxy/files/haproxy.init b/haproxy/files/haproxy.init new file mode 100644 index 000000000..51c0ebb65 --- /dev/null +++ b/haproxy/files/haproxy.init @@ -0,0 +1,28 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2009-2019 OpenWrt.org + +START=99 +STOP=80 + +USE_PROCD=1 + +HAPROXY_BIN="/usr/sbin/haproxy" +HAPROXY_CONFIG="/etc/haproxy.cfg" + +start_service() { + procd_open_instance + procd_set_param respawn + procd_set_param file "$HAPROXY_CONFIG" + procd_set_param reload_signal USR2 + procd_set_param command $HAPROXY_BIN -q -W -db -f "$HAPROXY_CONFIG" + procd_close_instance +} + +service_triggers() { + procd_add_raw_trigger acme.renew 5000 /etc/init.d/haproxy reload +} + +extra_command "check" "Check haproxy config" +check() { + $HAPROXY_BIN -c -q -V -f $HAPROXY_CONFIG +} diff --git a/haproxy/get-latest-patches.sh b/haproxy/get-latest-patches.sh new file mode 100755 index 000000000..2d885ba93 --- /dev/null +++ b/haproxy/get-latest-patches.sh @@ -0,0 +1,27 @@ +#!/bin/sh + +CLONEURL=https://git.haproxy.org/git/haproxy-2.6.git +BASE_TAG=v2.6.6 +TMP_REPODIR=tmprepo +PATCHESDIR=patches + +if test -d "${TMP_REPODIR}"; then rm -rf "${TMP_REPODIR}"; fi + +git clone "${CLONEURL}" "${TMP_REPODIR}" + +printf "Cleaning patches\n" +find ${PATCHESDIR} -type f -name "*.patch" -exec rm -f "{}" \; + +i=0 +for cid in $(git -C "${TMP_REPODIR}" rev-list ${BASE_TAG}..HEAD | tac); do + filename="$(printf "%03d" $i)-$(git -C "${TMP_REPODIR}" log --format=%s -n 1 "$cid" | sed -e"s/[()']//g" -e's/[^_a-zA-Z0-9+-]\+/-/g' -e's/-$//').patch" + printf "Creating %s\n" "${filename}" + git -C "${TMP_REPODIR}" show "$cid" > "${PATCHESDIR}/$filename" + git add "${PATCHESDIR}/$filename" + i=$((i+1)) +done + +rm -rf "${TMP_REPODIR}" + +printf "finished\n" + diff --git a/jpcre2/Makefile b/jpcre2/Makefile new file mode 100644 index 000000000..c5d5fd8dd --- /dev/null +++ b/jpcre2/Makefile @@ -0,0 +1,43 @@ +# SPDX-License-Identifier: GPL-3.0-only +# +# Copyright (C) 2021 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +PKG_NAME:=jpcre2 +PKG_VERSION:=10.32.01 +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/jpcre2/jpcre2/tar.gz/$(PKG_VERSION)? +PKG_HASH:=668cbc6d2c0a065bb6abe8494d5a1bb3549a14cd956a44a2df9095045623ea47 + +PKG_LICENSE:=BSD 3-Clause +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Tianling Shen + +PKG_BUILD_DEPENDS:=pcre2 +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/jpcre2 + SECTION:=lib + CATEGORY:=Libraries + TITLE:=C++ wrapper for PCRE2 Library + URL:=https://github.com/jpcre2/jpcre2 + BUILDONLY:=1 +endef + +define Package/jpcre2/description + This provides some C++ wrapper classes/functions to perform regex + operations such as regex match and regex replace. +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/jpcre2.hpp $(1)/usr/include/jpcre2.hpp +endef + +$(eval $(call BuildPackage,jpcre2)) diff --git a/libcron/Makefile b/libcron/Makefile new file mode 100644 index 000000000..385d652c3 --- /dev/null +++ b/libcron/Makefile @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: GPL-3.0-only +# +# Copyright (C) 2021 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +PKG_NAME:=libcron +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/PerMalmberg/libcron.git +PKG_SOURCE_DATE:=2022-08-27 +PKG_SOURCE_VERSION:=0dd9df49d7833a2d2119e4a6ff8282df58b12d5d +PKG_MIRROR_HASH:=a18c8ea0aa53be72cb67389bcd841c6501ce9c48a2467452e94691aa741f319b + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Tianling Shen + +PKG_BUILD_PARALLEL:=1 +CMAKE_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/libcron + SECTION:=lib + CATEGORY:=Libraries + URL:=https://github.com/PerMalmberg/libcron + TITLE:=A C++ scheduling library using cron formatting + DEPENDS:=+libstdcpp +endef + +define Package/libcron/description + Libcron offers an easy to use API to add callbacks with corresponding + cron-formatted strings. +endef + +CMAKE_OPTIONS+= -DBUILD_SHARED_LIBS=ON + +define Package/libcron/install + $(INSTALL_DIR) $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblibcron.so $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,libcron)) diff --git a/lua-ipops/Makefile b/lua-ipops/Makefile new file mode 100644 index 000000000..c7c201542 --- /dev/null +++ b/lua-ipops/Makefile @@ -0,0 +1,41 @@ +# +# Copyright (C) 2017-2019 Chen Minqiang +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=lua-ipops +PKG_VERSION:=0.0.1 +PKG_RELEASE:=1 + +PKG_SOURCE_VERSION:=$(PKG_VERSION)-$(PKG_RELEASE) +PKG_MAINTAINER:=Chen Minqiang +PKG_LICENSE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk + +define Package/lua-ipops + CATEGORY:=X + SUBMENU:=Libs + DEPENDS:= + PKGARCH:=all + TITLE:=lua ipops lib +endef + +define Package/lua-ipops/install + $(INSTALL_DIR) $(1)/usr/lib/lua + $(INSTALL_DATA) ./src/ipops.lua $(1)/usr/lib/lua/ipops.lua +endef + +define Build/Prepare + true +endef + +define Build/Compile + true +endef + +$(eval $(call BuildPackage,lua-ipops)) diff --git a/lua-ipops/src/ipops.lua b/lua-ipops/src/ipops.lua new file mode 100644 index 000000000..e8721093f --- /dev/null +++ b/lua-ipops/src/ipops.lua @@ -0,0 +1,497 @@ +local function _lshift(a, i) + return math.floor(a * 2^i) +end + +local function _rshift(a, i) + return math.floor(a / 2^i) +end + +local function _band(a, b) + local r = 0 + for i = 0, 31 do + if _rshift(a, 31 - i) % 0x2 == 1 and _rshift(b, 31 - i) % 0x2 == 1 then + r = r * 2 + 1 + else + r = r * 2 + end + end + return r +end + +local function _bor(a, b) + local r = 0 + for i = 0, 31 do + if _rshift(a, 31 - i) % 0x2 == 1 or _rshift(b, 31 - i) % 0x2 == 1 then + r = r * 2 + 1 + else + r = r * 2 + end + end + return r +end + +local function _bxor(a, b) + local r = 0 + for i = 0, 31 do + if _rshift(a, 31 - i) % 0x2 ~= _rshift(b, 31 - i) % 0x2 then + r = r * 2 + 1 + else + r = r * 2 + end + end + return r +end + +local function _bnot(a) + local r = 0 + for i = 0, 31 do + if _rshift(a, 31 - i) % 0x2 == 0x0 then + r = r * 2 + 1 + else + r = r * 2 + end + end + return r +end + +local function get_parts_as_number(str) + local t = {} + for part in string.gmatch(str, "%d+") do + table.insert(t, tonumber(part, 10)) + end + return t +end + +-- ipstr: a.b.c.d +local function ipstr2int(ipstr) + local ip = get_parts_as_number(ipstr) + if #ip == 4 then + return (((ip[1] * 0x100 + ip[2]) * 0x100 + ip[3]) * 0x100 + ip[4]) + end + return 0 +end + +local function int2ipstr(x) + local a = _rshift(x, 24) % 0x100 + local b = _rshift(x, 16) % 0x100 + local c = _rshift(x, 8) % 0x100 + local d = _rshift(x, 0) % 0x100 + return string.format("%u.%u.%u.%u", a, b, c, d) +end + +-- cidr: n +local function cidr2int(cidr) + if cidr == 0 then return 0 end + local x = 0 + for i = 0, cidr - 1 do + x = x + _lshift(1, 31 - i) + end + return x +end + +local function int2cidr(x) + for i = 0, 31 do + if _band(x, _lshift(1, 31 - i)) == 0 then + return i + end + end + return 32 +end + +local function cidr2maskstr(cidr) + return int2ipstr(cidr2int(cidr)) +end + +local function maskstr2cidr(maskstr) + return int2cidr(ipstr2int(maskstr)) +end + +-- ipaddr: a.b.c.d, a.b.c.d/cidr +-- return ip_int, mask_int +local function get_ip_and_mask(ipaddr) + local n = get_parts_as_number(ipaddr) + return (((n[1] * 256 + n[2]) * 256 + n[3]) * 256 + n[4]), cidr2int(n[5] or 32) +end + +-- return ip_str, mask_str +local function get_ipstr_and_maskstr(ipaddr) + local ip, mask = get_ip_and_mask(ipaddr) + return int2ipstr(ip), int2ipstr(mask) +end + +-- netString: ipaddr, a.b.c.d-e.f.g.h, a.b.c.d/m1.m2.m3.m4 +-- return: range: [n1, n2] where n1 <= n2 +local function netString2range(netString) + ip = get_parts_as_number(netString) + if #ip == 4 then + local i = (((ip[1] * 256 + ip[2]) * 256 + ip[3]) * 256 + ip[4]) + return {i, i} + end + + if #ip == 5 and ip[5] >= 0 and ip[5] <= 32 then + local i = (((ip[1] * 256 + ip[2]) * 256 + ip[3]) * 256 + ip[4]) + local m = cidr2int(ip[5]) + local s = _band(i, m) + local e = _bor(i, _bnot(m)) + return {s, e} + end + + if #ip == 8 then + local i = (((ip[1] * 256 + ip[2]) * 256 + ip[3]) * 256 + ip[4]) + local m = (((ip[5] * 256 + ip[6]) * 256 + ip[7]) * 256 + ip[8]) + if netString:match('/') then + local s = _band(i, m) + local e = _bor(s, _bnot(m)) + if s <= e then + return {s, e} + end + else + if i <= m then + return {i, m} + end + end + end + + return nil +end + +local function range2netString(range) + if range[1] <= range[2] then + return int2ipstr(range[1]) .. "-" .. int2ipstr(range[2]) + end + return nil +end + +-- rangeSet: [range, ...] +local function rangeSet_add_range(rangeSet, range) + rangeSet = rangeSet or {} + if not range then + return rangeSet + end + if #rangeSet == 0 then + table.insert(rangeSet, range) + return rangeSet + end + + local rangeSet_new = {} + for _, r in ipairs(rangeSet) do + if range[1] < r[1] then + if range[2] < r[1] then + if range[2] + 1 < r[1] then + table.insert(rangeSet_new, range) + range = r + else -- range[2] == r[1] + range = {range[1], r[2]} + end + elseif range[2] <= r[2] then + range = {range[1], r[2]} + end + elseif range[1] <= r[2] then + if range[2] <= r[2] then + range = {r[1], r[2]} + elseif range[2] > r[2] then + range = {r[1], range[2]} + end + elseif range[1] == r[2] + 1 then + range = {r[1], range[2]} + else -- range[1] > r[2] + 1 + table.insert(rangeSet_new, r) + end + end + table.insert(rangeSet_new, range) + + return rangeSet_new +end + +local function rangeSet_del_range(rangeSet, range) + rangeSet = rangeSet or {} + if not range then + return rangeSet + end + if #rangeSet == 0 then + return rangeSet + end + + local rangeSet_new = {} + for _, r in ipairs(rangeSet) do + if r[2] < range[1] then + table.insert(rangeSet_new, r) + else --r[2] >= range[1] + if r[1] < range[1] then + table.insert(rangeSet_new, {r[1], range[1] - 1}) + --else --r[1] >= range[1] + end + if r[2] > range[2] then + if r[1] > range[2] then + table.insert(rangeSet_new, r) + else --r[1] <= range[2] + table.insert(rangeSet_new, {range[2] + 1, r[2]}) + end + --else --r[2] == range[2] + end + end + end + + return rangeSet_new +end + +local function rangeSet_sub_rangeSet(rangeSetA, rangeSetB) + rangeSetA = rangeSetA or {} + if #rangeSetA == 0 then + return rangeSetA + end + for _, range in ipairs(rangeSetB) do + rangeSetA = rangeSet_del_range(rangeSetA, range) + end + return rangeSetA +end + +local function range_in_rangeSet(range, rangeSet) + for _, r in ipairs(rangeSet) do + if range[1] >= r[1] and range[2] <= r[2] then + return true + end + end + return false +end + +local function rangeSet_in_rangeSet(rangeSetA, rangeSetB) + rangeSetA = rangeSetA or {} + if #rangeSetA == 0 then + return true + end + for _, range in ipairs(rangeSetA) do + if not range_in_rangeSet(range, rangeSetB) then + return false + end + end + return true +end + +-- netStringSet: [netString, ...] +local function netStringSet2rangeSet(netStringSet) + local rangeSet = {} + for _, netString in ipairs(netStringSet) do + rangeSet = rangeSet_add_range(rangeSet, netString2range(netString)) + end + return rangeSet +end + +local function rangeSet2netStringSet(rangeSet) + local netStringSet = {} + for _, range in ipairs(rangeSet) do + table.insert(netStringSet, string.format("%s-%s", int2ipstr(range[1]), int2ipstr(range[2]))) + end + return netStringSet +end + +--ipcidr: a.b.c.d/cidr +--ipcidrSet: [ipcidr, ...], yes it is a netStringSet +local function rangeSet2ipcidrSet(rangeSet) + local ipcidrSet = {} + for _, range in ipairs(rangeSet) do + while range[1] <= range[2] do + for cidr = 0, 32 do + local m = cidr2int(cidr) + local s = _band(range[1], m) + local e = _bor(s, _bnot(m)) + if s == range[1] and e <= range[2] then + table.insert(ipcidrSet, int2ipstr(s) .. '/' .. cidr) + range[1] = e + 1 + break + end + end + end + end + return ipcidrSet +end + +--[[DEBUG]] +--[[ +local netStringSet = { + "1.1.1.1-2.2.2.2", + "192.168.0.0/16", + "192.168.0.1-192.168.0.2", + "192.168.255.254-192.169.0.100", + "172.16.0.1-172.16.0.100", + "172.168.0.0/255.255.0.0", + "192.168.11.6/24", + "192.168.0.1-192.168.0.22", + "192.168.0.33-192.168.0.52", +} + +print("dump netStringSet") +for _, netString in ipairs(netStringSet) do + print(netString, range2netString(netString2range(netString))) +end + +print("netStringSet to rangeSet") +local rangeSet = netStringSet2rangeSet(netStringSet) +for _, r in ipairs(rangeSet) do + print(r[1], r[2]) +end + +print("rangeSet to netStringSet") +netStringSet = rangeSet2netStringSet(rangeSet) +for _, netString in ipairs(netStringSet) do + print(netString) +end + +print("rangeSet to ipcidrSet") +local ipcidrSet = rangeSet2ipcidrSet(rangeSet) +for _, ipcidr in ipairs(ipcidrSet) do + print(ipcidr) +end + +print("ipcidrSet to rangeSet") +rangeSet = netStringSet2rangeSet(ipcidrSet) +for _, r in ipairs(rangeSet) do + print(r[1], r[2]) +end + +print("rangeSet to netStringSet") +netStringSet = rangeSet2netStringSet(rangeSet) +for _, netString in ipairs(netStringSet) do + print(netString) +end + +print("get_ipstr_and_maskstr") +local ip, mask = get_ipstr_and_maskstr("1.2.3.4") +print(ip, mask) +]] + +local __func__ = { + ipstr2int = ipstr2int, + int2ipstr = int2ipstr, + cidr2int = cidr2int, + int2cidr = int2cidr, + cidr2maskstr = cidr2maskstr, + maskstr2cidr = maskstr2cidr, + get_ip_and_mask = get_ip_and_mask, + get_ipstr_and_maskstr = get_ipstr_and_maskstr, + + lshift = _lshift, + rshift = _rshift, + + b32and = _band, + b32or = _bor, + b32xor = _bxor, + b32not = _bnot, + + netString2range = netString2range, + netStringSet2rangeSet = netStringSet2rangeSet, + range2netString = range2netString, + rangeSet2netStringSet = rangeSet2netStringSet, + rangeSet2ipcidrSet = rangeSet2ipcidrSet, + rangeSet_add_range = rangeSet_add_range, + rangeSet_del_range = rangeSet_del_range, + rangeSet_sub_rangeSet = rangeSet_sub_rangeSet, + rangeSet_in_rangeSet = rangeSet_in_rangeSet, +} + +-- api for test_func +-- argv = [ "netString,netString" ] +-- return: exit code +-- eg: lua ipops.lua netStrings2ipcidrStrings "1.2.3.4,192.168.1.0/24,192.168.100.100-192.168.200.222" +local function netStrings2ipcidrStrings(argv) + local rangeSet = {} + local netString + local netStrings = argv[1] + if not netStrings then + return -1 + end + for netString in netStrings:gmatch("[^,]+") do + rangeSet = rangeSet_add_range(rangeSet, netString2range(netString)) + end + + local ipcidrSet = rangeSet2ipcidrSet(rangeSet) + + print(table.concat(ipcidrSet, ',')) + + return 0 +end + +-- eg: lua ipops.lua netStrings_sub_netStrings "0.0.0.0/0" "1.2.3.4,192.168.1.0/24,192.168.100.100-192.168.200.222" +local function netStrings_sub_netStrings(argv) + local netString + local rangeSetA = {} + local rangeSetB = {} + local netStringsA, netStringsB = argv[1], argv[2] + if not netStringsA or not netStringsB then + return -1 + end + for netString in netStringsA:gmatch("[^,]+") do + rangeSetA = rangeSet_add_range(rangeSetA, netString2range(netString)) + end + for netString in netStringsB:gmatch("[^,]+") do + rangeSetB = rangeSet_add_range(rangeSetB, netString2range(netString)) + end + + rangeSetA = rangeSet_sub_rangeSet(rangeSetA, rangeSetB) + + local ipcidrSet = rangeSet2ipcidrSet(rangeSetA) + + print(table.concat(ipcidrSet, ',')) + + return 0 +end + +-- eg: lua ipops.lua netStrings_test_netStrings "192.168.15.0/24" "192.168.15.0/29" +local function netStrings_test_netStrings(argv) + local netString + local rangeSetA = {} + local rangeSetB = {} + local netStringsA, netStringsB = argv[1], argv[2] + if not netStringsA or not netStringsB then + return -1 + end + for netString in netStringsA:gmatch("[^,]+") do + rangeSetA = rangeSet_add_range(rangeSetA, netString2range(netString)) + end + for netString in netStringsB:gmatch("[^,]+") do + rangeSetB = rangeSet_add_range(rangeSetB, netString2range(netString)) + end + + if (rangeSet_in_rangeSet(rangeSetB, rangeSetA)) then + return 0 + end + + return 1 +end + +local test_func = { + netStrings2ipcidrStrings = { + argc = 1, + func = netStrings2ipcidrStrings + }, + netStrings_sub_netStrings = { + argc = 2, + func = netStrings_sub_netStrings + }, + netStrings_test_netStrings = { + argc = 2; + func = netStrings_test_netStrings + } +} + +function test_main(...) + if arg[1] and test_func[arg[1]] and test_func[arg[1]].func then + local argc = test_func[arg[1]].argc or 0 + local func = test_func[arg[1]].func + local argv = {} + if argc > 0 then + for i = 1, argc do + table.insert(argv, arg[1 + i]) + end + end + return true, func(argv) + end + return false +end + +local test, ret = test_main(...) +if test then + os.exit(ret) +end + +return __func__ diff --git a/luci-app-macvlan/Makefile b/luci-app-macvlan/Makefile new file mode 100644 index 000000000..a35bf37d5 --- /dev/null +++ b/luci-app-macvlan/Makefile @@ -0,0 +1,80 @@ +# +# Copyright (C) 2017-2019 Chen Minqiang +# +# This is free software, licensed under the GNU General Public License v3. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=luci-app-macvlan +PKG_VERSION:=1.0.0 +PKG_RELEASE:=1 + +PKG_LICENSE:=GPLv3 +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Chen Minqiang + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/luci-app-macvlan + CATEGORY:=X + SUBMENU:=Macvlan + TITLE:=LuCI Support for macvlan + PKGARCH:=all + DEPENDS:=+kmod-macvlan +kmod-ipvlan +busybox +@BUSYBOX_CUSTOM +@BUSYBOX_CONFIG_VCONFIG +endef + +define Package/luci-app-macvlan/description + LuCI Support for macvlan. +endef + +define Build/Prepare + $(foreach po,$(wildcard ${CURDIR}/files/luci/i18n/*.po), \ + po2lmo $(po) $(PKG_BUILD_DIR)/$(patsubst %.po,%.lmo,$(notdir $(po)));) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/luci-app-macvlan/postinst +#!/bin/sh +if [ -z "$${IPKG_INSTROOT}" ]; then + rm -rf /tmp/luci-indexcache /tmp/luci-modulecache +fi + +if [ -z "$$IPKG_INSTROOT" ]; then + ( . /etc/uci-defaults/40_luci-app-macvlan ) + rm -f /etc/uci-defaults/40_luci-app-macvlan +fi + +exit 0 +endef + +define Package/luci-app-macvlan/conffiles +/etc/config/macvlan +endef + +define Package/luci-app-macvlan/install + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/i18n + $(INSTALL_DATA) $(PKG_BUILD_DIR)/macvlan.*.lmo $(1)/usr/lib/lua/luci/i18n/ + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller + $(INSTALL_DATA) ./files/luci/controller/*.lua $(1)/usr/lib/lua/luci/controller/ + $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/macvlan + $(INSTALL_DATA) ./files/luci/model/cbi/macvlan/*.lua $(1)/usr/lib/lua/luci/model/cbi/macvlan/ + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/root/etc/config/macvlan $(1)/etc/config/macvlan + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/root/etc/init.d/macvlan $(1)/etc/init.d/macvlan + $(INSTALL_DIR) $(1)/etc/uci-defaults + $(INSTALL_DATA) ./files/root/etc/uci-defaults/40_luci-app-macvlan $(1)/etc/uci-defaults/40_luci-app-macvlan + $(INSTALL_DIR) $(1)/usr/share/rpcd/acl.d + $(INSTALL_DATA) ./root/usr/share/rpcd/acl.d/*.json $(1)/usr/share/rpcd/acl.d/ +endef + +$(eval $(call BuildPackage,luci-app-macvlan)) diff --git a/luci-app-macvlan/files/luci/controller/macvlan.lua b/luci-app-macvlan/files/luci/controller/macvlan.lua new file mode 100644 index 000000000..c53c7e6d8 --- /dev/null +++ b/luci-app-macvlan/files/luci/controller/macvlan.lua @@ -0,0 +1,11 @@ +-- Copyright (C) 2019 X-WRT + +module("luci.controller.macvlan", package.seeall) + +function index() + local page + + page = entry({"admin", "network", "macvlan"}, cbi("macvlan/macvlan"), _("Macvlan")) + page.leaf = true + page.acl_depends = { "luci-app-macvlan" } +end diff --git a/luci-app-macvlan/files/luci/i18n/macvlan.zh-cn.po b/luci-app-macvlan/files/luci/i18n/macvlan.zh-cn.po new file mode 100644 index 000000000..a06710760 --- /dev/null +++ b/luci-app-macvlan/files/luci/i18n/macvlan.zh-cn.po @@ -0,0 +1,14 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8\n" + +msgid "Macvlan" +msgstr "Macvlan" + +msgid "Macvlan Settings" +msgstr "Macvlan设置" + +msgid "Interface" +msgstr "网络接口" + +msgid "Index" +msgstr "序号" diff --git a/luci-app-macvlan/files/luci/model/cbi/macvlan/macvlan.lua b/luci-app-macvlan/files/luci/model/cbi/macvlan/macvlan.lua new file mode 100644 index 000000000..9c22d6ee2 --- /dev/null +++ b/luci-app-macvlan/files/luci/model/cbi/macvlan/macvlan.lua @@ -0,0 +1,31 @@ +-- Copyright (C) 2019 X-WRT + +m = Map("macvlan", translate("Macvlan")) + +s = m:section(TypedSection, "macvlan", translate("Macvlan Settings")) +s.addremove = true +s.anonymous = true +s.template = "cbi/tblsection" + +o = s:option(Value, "ifname", translate("Interface")) +o.datatype = "string" +o.rmempty = false + +o = s:option(Value, "index", translate("Index")) +o.datatype = "and(uinteger,min(0),max(255))" +o.rmempty = false + +o = s:option(ListValue, "type", translate("Type")) +o:value("macvlan", translate("macvlan")) +o:value("ipvlan", translate("ipvlan")) + +o = s:option(ListValue, "mode", translate("Mode")) +o:value("l2", translate("l2")) +o:value("l3", translate("l3")) + +o = s:option(ListValue, "flag", translate("Flag")) +o:value("bridge", translate("bridge")) +o:value("private", translate("private")) +o:value("vepa", translate("vepa")) + +return m diff --git a/luci-app-macvlan/files/root/etc/config/macvlan b/luci-app-macvlan/files/root/etc/config/macvlan new file mode 100644 index 000000000..e69de29bb diff --git a/luci-app-macvlan/files/root/etc/init.d/macvlan b/luci-app-macvlan/files/root/etc/init.d/macvlan new file mode 100755 index 000000000..58f290255 --- /dev/null +++ b/luci-app-macvlan/files/root/etc/init.d/macvlan @@ -0,0 +1,74 @@ +#!/bin/sh /etc/rc.common + +START=19 + +MC=/tmp/macvlan_cleanup.sh + +stop_macvlan() { + local idx=0 + test -f $MC && { + cat $MC | while read line; do + echo "$idx#$line" + idx=$((idx+1)) + done | sort -nr | while read line; do + cmd=`echo "$line" | cut -d"#" -f2` + $cmd + done + rm -f $MC + } +} + +add_macvlan() { + local cfg="$1" + local ifname index type mode flag + local mvname + + config_get ifname "$cfg" ifname + config_get index "$cfg" index + config_get type "$cfg" type + config_get mode "$cfg" mode + config_get flag "$cfg" flag + + test -n "$ifname" || return 1 + test -n "$index" || return 1 + test -n "$type" || return 1 + + mvname="${type}${index}${ifname}" + + echo "$ifname" | grep -q "^[a-zA-Z].*\.[0-9]*$" && { + ifn=`echo $ifname | cut -d"." -f 1` + iid=`echo $ifname | cut -d"." -f 2` + test -n "$ifn" && ifconfig $ifn >/dev/null 2>&1 || return 1 + ifconfig $ifn up 2>/dev/null + vconfig set_name_type DEV_PLUS_VID_NO_PAD + vconfig add $ifn $iid 2>/dev/null && echo ip link del $ifname >>$MC + mvname="${type}${index}${ifn}t${iid}" + } + + ifconfig $ifname >/dev/null 2>&1 || return 1 + + ifconfig $ifname up 2>/dev/null + if [ "${type}" = "macvlan" ]; then + ip link add link $ifname $mvname type ${type} 2>/dev/null && echo ip link del $mvname >>$MC + elif [ "${type}" = "ipvlan" ]; then + case "$mode" in + "l2") + ip link add link $ifname $mvname type ${type} mode ${mode} ${flag} 2>/dev/null && echo ip link del $mvname >>$MC + ;; + "l3") + ip link add link $ifname $mvname type ${type} 2>/dev/null && echo ip link del $mvname >>$MC + ;; + esac + fi +} + +start() { + stop_macvlan + echo -n >$MC + config_load macvlan + config_foreach add_macvlan macvlan +} + +stop() { + stop_macvlan +} diff --git a/luci-app-macvlan/files/root/etc/uci-defaults/40_luci-app-macvlan b/luci-app-macvlan/files/root/etc/uci-defaults/40_luci-app-macvlan new file mode 100644 index 000000000..4f0aa4429 --- /dev/null +++ b/luci-app-macvlan/files/root/etc/uci-defaults/40_luci-app-macvlan @@ -0,0 +1,10 @@ + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@macvlan[-1] + add ucitrack macvlan + set ucitrack.@macvlan[-1].init=macvlan + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 diff --git a/luci-app-macvlan/root/usr/share/rpcd/acl.d/luci-app-macvlan.json b/luci-app-macvlan/root/usr/share/rpcd/acl.d/luci-app-macvlan.json new file mode 100644 index 000000000..1967c1bdc --- /dev/null +++ b/luci-app-macvlan/root/usr/share/rpcd/acl.d/luci-app-macvlan.json @@ -0,0 +1,11 @@ +{ + "luci-app-macvlan": { + "description": "Grant UCI access for luci-app-macvlan", + "read": { + "uci": [ "macvlan" ] + }, + "write": { + "uci": [ "macvlan" ] + } + } +} diff --git a/luci-app-mail/Makefile b/luci-app-mail/Makefile new file mode 100644 index 000000000..a6a9edad5 --- /dev/null +++ b/luci-app-mail/Makefile @@ -0,0 +1,16 @@ +# +# Copyright (C) 2018-2019 Ycarus (Yannick Chabanois) +# +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI Mail Configuration +LUCI_DEPENDS:=+msmtp-mta + +PKG_LICENSE:=GPLv3 + +#include ../luci/luci.mk +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signature diff --git a/luci-app-mail/luasrc/controller/mail.lua b/luci-app-mail/luasrc/controller/mail.lua new file mode 100644 index 000000000..b4fb98e37 --- /dev/null +++ b/luci-app-mail/luasrc/controller/mail.lua @@ -0,0 +1,6 @@ +module("luci.controller.mail", package.seeall) + +function index() + entry({"admin", "services", "mail"}, alias("admin", "services", "mail", "index"), _("Mail settings")) + entry({"admin", "services", "mail", "index"}, cbi("mail")) +end diff --git a/luci-app-mail/luasrc/model/cbi/mail.lua b/luci-app-mail/luasrc/model/cbi/mail.lua new file mode 100644 index 000000000..5d26aa589 --- /dev/null +++ b/luci-app-mail/luasrc/model/cbi/mail.lua @@ -0,0 +1,44 @@ +-- Copyright 2018 Ycarus (Yannick Chabanois) +-- Licensed to the public under the Apache License 2.0. + +m = Map("mail", translate("Mail settings"), translate("Set mail settings for services that need to send mails.")) + +s = m:section(TypedSection, "smtp", translate("SMTP")) +s.anonymous = true +s.addremove = false + +server = s:option(Value, "server", translate("Server")) +server.datatype = "host" +server.placeholder = "smtp.gmail.com" +server.optional = false + +port = s:option(Value, "port", translate("Port")) +port.datatype = "port" +port.optional = false +port.rmempty = true +port.default = "25" + +tls = s:option(Flag, "tls", translate("TLS")) +tls.rmempty = false + +tls_starttls = s:option(Flag, "tls_starttls", translate("STARTTLS")) +tls_starttls.rmempty = false + +user = s:option(Value, "user", translate("Username")) +user.rmempty = true + +password = s:option(Value, "password", translate("Password")) +password.password = true +password.rmempty = true + +from = s:option(Value, "from", translate("From")) +from.optional = false +from.rmempty = true +from.placeholder = "myself@gmail.com" + +to = s:option(Value, "to", translate("To")) +to.optional = false +to.rmempty = true +to.placeholder = "myself@gmail.com" + +return m diff --git a/luci-app-mail/po/de/mail.po b/luci-app-mail/po/de/mail.po new file mode 100644 index 000000000..2b7c7984e --- /dev/null +++ b/luci-app-mail/po/de/mail.po @@ -0,0 +1,64 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2020-08-14 08:04+0000\n" +"Last-Translator: Andreas Dorfer \n" +"Language-Team: German \n" +"Language: de\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.0.4\n" + +#: luci-app-mail/root/usr/share/luci/menu.d/luci-app-mail.json:3 +msgid "E-Mail" +msgstr "" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:34 +msgid "From" +msgstr "Von" + +#: luci-app-mail/root/usr/share/rpcd/acl.d/luci-app-mail.json:3 +msgid "Grant UCI access for luci-app-mail" +msgstr "" + +#: luci-app-mail/luasrc/controller/mail.lua:4 +#: luci-app-mail/luasrc/model/cbi/mail.lua:4 +msgid "Mail settings" +msgstr "E-Mail-Einstellungen" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:30 +msgid "Password" +msgstr "Schlüssel" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:15 +msgid "Port" +msgstr "Port" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:6 +msgid "SMTP" +msgstr "SMTP" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:24 +msgid "STARTTLS" +msgstr "StartTLS" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:10 +msgid "Server" +msgstr "Server" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:4 +msgid "Set mail settings for services that need to send mails." +msgstr "Einstellungen für Dienste, die E-Mail versenden können sollen." + +#: luci-app-mail/luasrc/model/cbi/mail.lua:21 +msgid "TLS" +msgstr "TLS" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:39 +msgid "To" +msgstr "An" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:27 +msgid "Username" +msgstr "Benutzername" diff --git a/luci-app-mail/po/de/mail.po~ b/luci-app-mail/po/de/mail.po~ new file mode 100644 index 000000000..f04c4e7c4 --- /dev/null +++ b/luci-app-mail/po/de/mail.po~ @@ -0,0 +1,44 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2020-08-14 08:04+0000\n" +"Last-Translator: Andreas Dorfer \n" +"Language-Team: German \n" +"Language: de\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.0.4\n" + +msgid "From" +msgstr "Von" + +msgid "Mail settings" +msgstr "E-Mail-Einstellungen" + +msgid "Password" +msgstr "Schlüssel" + +msgid "Port" +msgstr "Port" + +msgid "SMTP" +msgstr "SMTP" + +msgid "STARTTLS" +msgstr "StartTLS" + +msgid "Server" +msgstr "Server" + +msgid "Set mail settings for services that need to send mails." +msgstr "Einstellungen für Dienste, die E-Mail versenden können sollen." + +msgid "TLS" +msgstr "TLS" + +msgid "To" +msgstr "An" + +msgid "Username" +msgstr "Benutzername" diff --git a/luci-app-mail/po/fr/mail.po b/luci-app-mail/po/fr/mail.po new file mode 100644 index 000000000..78f77d558 --- /dev/null +++ b/luci-app-mail/po/fr/mail.po @@ -0,0 +1,69 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2021-05-31 18:51+0000\n" +"Last-Translator: Weblate Admin \n" +"Language-Team: French \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.6.1\n" + +#: luci-app-mail/root/usr/share/luci/menu.d/luci-app-mail.json:3 +msgid "E-Mail" +msgstr "E-Mail" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:34 +msgid "From" +msgstr "De" + +#: luci-app-mail/root/usr/share/rpcd/acl.d/luci-app-mail.json:3 +msgid "Grant UCI access for luci-app-mail" +msgstr "Accorder l'accès UCI pour luci-app-mail" + +#: luci-app-mail/luasrc/controller/mail.lua:4 +#: luci-app-mail/luasrc/model/cbi/mail.lua:4 +msgid "Mail settings" +msgstr "Paramètres e-mail" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:30 +msgid "Password" +msgstr "Mot de passe" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:15 +msgid "Port" +msgstr "Port" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:6 +msgid "SMTP" +msgstr "SMTP" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:24 +msgid "STARTTLS" +msgstr "STARTTLS" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:10 +msgid "Server" +msgstr "Serveur" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:4 +msgid "Set mail settings for services that need to send mails." +msgstr "" +"Définissez les paramètres de messagerie pour les services qui doivent " +"envoyer des e-mails." + +#: luci-app-mail/luasrc/model/cbi/mail.lua:21 +msgid "TLS" +msgstr "TLS" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:39 +msgid "To" +msgstr "À" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:27 +msgid "Username" +msgstr "Nom d'utilisateur" diff --git a/luci-app-mail/po/fr/mail.po~ b/luci-app-mail/po/fr/mail.po~ new file mode 100644 index 000000000..ed30dd37f --- /dev/null +++ b/luci-app-mail/po/fr/mail.po~ @@ -0,0 +1,49 @@ +msgid "" +msgstr "" +"Project-Id-Version: \n" +"POT-Creation-Date: \n" +"PO-Revision-Date: 2020-08-03 12:39+0000\n" +"Last-Translator: Weblate Admin \n" +"Language-Team: French \n" +"Language: fr\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.0.4\n" + +msgid "From" +msgstr "De" + +msgid "Mail settings" +msgstr "Paramètres e-mail" + +msgid "Password" +msgstr "Mot de passe" + +msgid "Port" +msgstr "Port" + +msgid "SMTP" +msgstr "SMTP" + +msgid "STARTTLS" +msgstr "STARTTLS" + +msgid "Server" +msgstr "Serveur" + +msgid "Set mail settings for services that need to send mails." +msgstr "" +"Définissez les paramètres de messagerie pour les services qui doivent " +"envoyer des e-mails." + +msgid "TLS" +msgstr "TLS" + +msgid "To" +msgstr "À" + +msgid "Username" +msgstr "Nom d'utilisateur" diff --git a/luci-app-mail/po/it/mail.po b/luci-app-mail/po/it/mail.po new file mode 100644 index 000000000..684d94dc4 --- /dev/null +++ b/luci-app-mail/po/it/mail.po @@ -0,0 +1,64 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2020-12-01 10:49+0000\n" +"Last-Translator: Giuseppe Dipierro \n" +"Language-Team: Italian \n" +"Language: it\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.0.4\n" + +#: luci-app-mail/root/usr/share/luci/menu.d/luci-app-mail.json:3 +msgid "E-Mail" +msgstr "" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:34 +msgid "From" +msgstr "Da" + +#: luci-app-mail/root/usr/share/rpcd/acl.d/luci-app-mail.json:3 +msgid "Grant UCI access for luci-app-mail" +msgstr "" + +#: luci-app-mail/luasrc/controller/mail.lua:4 +#: luci-app-mail/luasrc/model/cbi/mail.lua:4 +msgid "Mail settings" +msgstr "Configurazione mail" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:30 +msgid "Password" +msgstr "Password" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:15 +msgid "Port" +msgstr "Porta" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:6 +msgid "SMTP" +msgstr "SMTP" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:24 +msgid "STARTTLS" +msgstr "STARTTLS" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:10 +msgid "Server" +msgstr "Server" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:4 +msgid "Set mail settings for services that need to send mails." +msgstr "Configurazione del server mail da utilizzare per inviare alert." + +#: luci-app-mail/luasrc/model/cbi/mail.lua:21 +msgid "TLS" +msgstr "TLS" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:39 +msgid "To" +msgstr "A" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:27 +msgid "Username" +msgstr "Username" diff --git a/luci-app-mail/po/it/mail.po~ b/luci-app-mail/po/it/mail.po~ new file mode 100644 index 000000000..fd43053e7 --- /dev/null +++ b/luci-app-mail/po/it/mail.po~ @@ -0,0 +1,44 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2020-12-01 10:49+0000\n" +"Last-Translator: Giuseppe Dipierro \n" +"Language-Team: Italian \n" +"Language: it\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.0.4\n" + +msgid "From" +msgstr "Da" + +msgid "Mail settings" +msgstr "Configurazione mail" + +msgid "Password" +msgstr "Password" + +msgid "Port" +msgstr "Porta" + +msgid "SMTP" +msgstr "SMTP" + +msgid "STARTTLS" +msgstr "STARTTLS" + +msgid "Server" +msgstr "Server" + +msgid "Set mail settings for services that need to send mails." +msgstr "Configurazione del server mail da utilizzare per inviare alert." + +msgid "TLS" +msgstr "TLS" + +msgid "To" +msgstr "A" + +msgid "Username" +msgstr "Username" diff --git a/luci-app-mail/po/oc/mail.po b/luci-app-mail/po/oc/mail.po new file mode 100644 index 000000000..a822d14de --- /dev/null +++ b/luci-app-mail/po/oc/mail.po @@ -0,0 +1,66 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2020-08-21 20:21+0000\n" +"Last-Translator: Quentin PAGÈS \n" +"Language-Team: Occitan \n" +"Language: oc\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.0.4\n" + +#: luci-app-mail/root/usr/share/luci/menu.d/luci-app-mail.json:3 +msgid "E-Mail" +msgstr "" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:34 +msgid "From" +msgstr "De" + +#: luci-app-mail/root/usr/share/rpcd/acl.d/luci-app-mail.json:3 +msgid "Grant UCI access for luci-app-mail" +msgstr "" + +#: luci-app-mail/luasrc/controller/mail.lua:4 +#: luci-app-mail/luasrc/model/cbi/mail.lua:4 +msgid "Mail settings" +msgstr "Paramètres e-mail" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:30 +msgid "Password" +msgstr "Senhal" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:15 +msgid "Port" +msgstr "Pòrt" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:6 +msgid "SMTP" +msgstr "SMTP" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:24 +msgid "STARTTLS" +msgstr "STARTTLS" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:10 +msgid "Server" +msgstr "Servidor" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:4 +msgid "Set mail settings for services that need to send mails." +msgstr "" +"Definissètz los paramètres de messatjariá pels servicis que devon enviar d’e-" +"mails." + +#: luci-app-mail/luasrc/model/cbi/mail.lua:21 +msgid "TLS" +msgstr "TLS" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:39 +msgid "To" +msgstr "A" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:27 +msgid "Username" +msgstr "Nom d'utilizaire" diff --git a/luci-app-mail/po/oc/mail.po~ b/luci-app-mail/po/oc/mail.po~ new file mode 100644 index 000000000..ce93d0ed8 --- /dev/null +++ b/luci-app-mail/po/oc/mail.po~ @@ -0,0 +1,46 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2020-08-21 20:21+0000\n" +"Last-Translator: Quentin PAGÈS \n" +"Language-Team: Occitan \n" +"Language: oc\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.0.4\n" + +msgid "From" +msgstr "De" + +msgid "Mail settings" +msgstr "Paramètres e-mail" + +msgid "Password" +msgstr "Senhal" + +msgid "Port" +msgstr "Pòrt" + +msgid "SMTP" +msgstr "SMTP" + +msgid "STARTTLS" +msgstr "STARTTLS" + +msgid "Server" +msgstr "Servidor" + +msgid "Set mail settings for services that need to send mails." +msgstr "" +"Definissètz los paramètres de messatjariá pels servicis que devon enviar d’e-" +"mails." + +msgid "TLS" +msgstr "TLS" + +msgid "To" +msgstr "A" + +msgid "Username" +msgstr "Nom d'utilizaire" diff --git a/luci-app-mail/po/ru/mail.po b/luci-app-mail/po/ru/mail.po new file mode 100644 index 000000000..55fcead70 --- /dev/null +++ b/luci-app-mail/po/ru/mail.po @@ -0,0 +1,65 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2021-05-13 21:38+0000\n" +"Last-Translator: Aleksandr Serdyukov \n" +"Language-Team: Russian \n" +"Language: ru\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 4.6.1\n" + +#: luci-app-mail/root/usr/share/luci/menu.d/luci-app-mail.json:3 +msgid "E-Mail" +msgstr "E-Mail" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:34 +msgid "From" +msgstr "От" + +#: luci-app-mail/root/usr/share/rpcd/acl.d/luci-app-mail.json:3 +msgid "Grant UCI access for luci-app-mail" +msgstr "Полный UCI доступ для luci-app-mail" + +#: luci-app-mail/luasrc/controller/mail.lua:4 +#: luci-app-mail/luasrc/model/cbi/mail.lua:4 +msgid "Mail settings" +msgstr "Настройки почты" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:30 +msgid "Password" +msgstr "Пароль" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:15 +msgid "Port" +msgstr "Порт" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:6 +msgid "SMTP" +msgstr "SMTP" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:24 +msgid "STARTTLS" +msgstr "STARTTLS" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:10 +msgid "Server" +msgstr "Сервер" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:4 +msgid "Set mail settings for services that need to send mails." +msgstr "Выбор настроек почты для сервисов, которым нужно отправлять почту." + +#: luci-app-mail/luasrc/model/cbi/mail.lua:21 +msgid "TLS" +msgstr "TLS" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:39 +msgid "To" +msgstr "Кому" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:27 +msgid "Username" +msgstr "Имя пользователя" diff --git a/luci-app-mail/po/templates/mail.pot b/luci-app-mail/po/templates/mail.pot new file mode 100644 index 000000000..9abad09a1 --- /dev/null +++ b/luci-app-mail/po/templates/mail.pot @@ -0,0 +1,55 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +#: luci-app-mail/root/usr/share/luci/menu.d/luci-app-mail.json:3 +msgid "E-Mail" +msgstr "" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:34 +msgid "From" +msgstr "" + +#: luci-app-mail/root/usr/share/rpcd/acl.d/luci-app-mail.json:3 +msgid "Grant UCI access for luci-app-mail" +msgstr "" + +#: luci-app-mail/luasrc/controller/mail.lua:4 +#: luci-app-mail/luasrc/model/cbi/mail.lua:4 +msgid "Mail settings" +msgstr "" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:30 +msgid "Password" +msgstr "" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:15 +msgid "Port" +msgstr "" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:6 +msgid "SMTP" +msgstr "" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:24 +msgid "STARTTLS" +msgstr "" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:10 +msgid "Server" +msgstr "" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:4 +msgid "Set mail settings for services that need to send mails." +msgstr "" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:21 +msgid "TLS" +msgstr "" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:39 +msgid "To" +msgstr "" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:27 +msgid "Username" +msgstr "" diff --git a/luci-app-mail/po/zh-cn b/luci-app-mail/po/zh-cn new file mode 120000 index 000000000..8d69574dd --- /dev/null +++ b/luci-app-mail/po/zh-cn @@ -0,0 +1 @@ +zh_Hans \ No newline at end of file diff --git a/luci-app-mail/po/zh_Hans/mail.po b/luci-app-mail/po/zh_Hans/mail.po new file mode 100644 index 000000000..f857e08b7 --- /dev/null +++ b/luci-app-mail/po/zh_Hans/mail.po @@ -0,0 +1,64 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2021-05-13 21:38+0000\n" +"Last-Translator: justbin <419989953@qq.com>\n" +"Language-Team: Chinese (Simplified) \n" +"Language: zh_Hans\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 4.6.1\n" + +#: luci-app-mail/root/usr/share/luci/menu.d/luci-app-mail.json:3 +msgid "E-Mail" +msgstr "电子邮件" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:34 +msgid "From" +msgstr "来自" + +#: luci-app-mail/root/usr/share/rpcd/acl.d/luci-app-mail.json:3 +msgid "Grant UCI access for luci-app-mail" +msgstr "授予luci-app-iperf UCI访问权限" + +#: luci-app-mail/luasrc/controller/mail.lua:4 +#: luci-app-mail/luasrc/model/cbi/mail.lua:4 +msgid "Mail settings" +msgstr "邮件设置" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:30 +msgid "Password" +msgstr "密码" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:15 +msgid "Port" +msgstr "端口" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:6 +msgid "SMTP" +msgstr "SMTP设置" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:24 +msgid "STARTTLS" +msgstr "STARTTLS设置" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:10 +msgid "Server" +msgstr "服务器" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:4 +msgid "Set mail settings for services that need to send mails." +msgstr "为需要发送邮件的服务设置邮件设置." + +#: luci-app-mail/luasrc/model/cbi/mail.lua:21 +msgid "TLS" +msgstr "证书" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:39 +msgid "To" +msgstr "发送到" + +#: luci-app-mail/luasrc/model/cbi/mail.lua:27 +msgid "Username" +msgstr "账号" diff --git a/luci-app-mail/po/zh_Hans/mail.po~ b/luci-app-mail/po/zh_Hans/mail.po~ new file mode 100644 index 000000000..1c3a57e2f --- /dev/null +++ b/luci-app-mail/po/zh_Hans/mail.po~ @@ -0,0 +1,44 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2020-12-04 16:02+0000\n" +"Last-Translator: antrouter \n" +"Language-Team: Chinese (Simplified) \n" +"Language: zh_Hans\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 4.0.4\n" + +msgid "From" +msgstr "来自" + +msgid "Mail settings" +msgstr "邮件设置" + +msgid "Password" +msgstr "密码" + +msgid "Port" +msgstr "端口" + +msgid "SMTP" +msgstr "SMTP设置" + +msgid "STARTTLS" +msgstr "STARTTLS设置" + +msgid "Server" +msgstr "服务器" + +msgid "Set mail settings for services that need to send mails." +msgstr "为需要发送邮件的服务设置邮件设置." + +msgid "TLS" +msgstr "证书" + +msgid "To" +msgstr "发送到" + +msgid "Username" +msgstr "账号" diff --git a/luci-app-mail/root/etc/config/mail b/luci-app-mail/root/etc/config/mail new file mode 100644 index 000000000..07e4b469d --- /dev/null +++ b/luci-app-mail/root/etc/config/mail @@ -0,0 +1 @@ +config smtp 'default' \ No newline at end of file diff --git a/luci-app-mail/root/etc/init.d/msmtp b/luci-app-mail/root/etc/init.d/msmtp new file mode 100755 index 000000000..509268028 --- /dev/null +++ b/luci-app-mail/root/etc/init.d/msmtp @@ -0,0 +1,64 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2018 Ycarus (Yannick Chabanois) + +START=90 +STOP=10 + +USE_PROCD=1 + +validate_section() { + uci_validate_section mail smtp "${1}" \ + 'server:host' \ + 'tls:bool:0' \ + 'tls_starttls:bool:0' \ + 'from:string' \ + 'user:string' \ + 'password:string' \ + 'port:port:25' +} + +config_account() { + local server tls tls_starttls from user password + + validate_section "${1}" || { + _err "validation failed" + return 1 + } + + cat > /tmp/msmtp.tmp <<-EOF + account default + host $server + port $port + EOF + [ -n "$user" ] && [ -n "$password" ] && { + cat >> /tmp/msmtp.tmp <<-EOF + auth on + user $user + password $password + EOF + } + [ -n "$from" ] && echo "from $from" >> /tmp/msmtp.tmp + [ "$tls" = "1" ] && { + cat >> /tmp/msmtp.tmp <<-EOF + tls_trust_file /etc/ssl/certs/ca-certificates.crt + tls on + EOF + } || { + echo 'tls off' >> /tmp/msmtp.tmp + } + [ "$tls_starttls" = "1" ] && { + echo 'tls_starttls on' >> /tmp/msmtp.tmp + } || { + echo 'tls_starttls off' >> /tmp/msmtp.tmp + } +} + +start_service() { + config_load mail + config_foreach config_account smtp + [ -f "/tmp/msmtp.tmp" ] && mv /tmp/msmtp.tmp /etc/msmtprc +} + +service_triggers() { + procd_add_reload_trigger mail +} \ No newline at end of file diff --git a/luci-app-mail/root/etc/uci-defaults/4101-mail b/luci-app-mail/root/etc/uci-defaults/4101-mail new file mode 100755 index 000000000..357bf804a --- /dev/null +++ b/luci-app-mail/root/etc/uci-defaults/4101-mail @@ -0,0 +1,8 @@ +#!/bin/sh +uci -q batch <<-EOF >/dev/null + delete ucitrack.@mail[-1] + add ucitrack mail + set ucitrack.@mail[-1].init=mail + commit ucitrack +EOF +exit 0 \ No newline at end of file diff --git a/luci-app-mail/root/usr/share/luci/menu.d/luci-app-mail.json b/luci-app-mail/root/usr/share/luci/menu.d/luci-app-mail.json new file mode 100644 index 000000000..6098e0a26 --- /dev/null +++ b/luci-app-mail/root/usr/share/luci/menu.d/luci-app-mail.json @@ -0,0 +1,13 @@ +{ + "admin/services/mail": { + "title": "E-Mail", + "order": 90, + "action": { + "type": "cbi", + "path": "mail" + }, + "depends": { + "acl": [ "luci-app-mail" ] + } + } +} diff --git a/luci-app-mail/root/usr/share/rpcd/acl.d/luci-app-mail.json b/luci-app-mail/root/usr/share/rpcd/acl.d/luci-app-mail.json new file mode 100644 index 000000000..719eead98 --- /dev/null +++ b/luci-app-mail/root/usr/share/rpcd/acl.d/luci-app-mail.json @@ -0,0 +1,11 @@ +{ + "luci-app-mail": { + "description": "Grant UCI access for luci-app-mail", + "read": { + "uci": [ "mail" ] + }, + "write": { + "uci": [ "mail" ] + } + } +} \ No newline at end of file diff --git a/luci-app-packet-capture/Makefile b/luci-app-packet-capture/Makefile new file mode 100644 index 000000000..aa9bcf5a2 --- /dev/null +++ b/luci-app-packet-capture/Makefile @@ -0,0 +1,14 @@ +# Copyright 2020 Wojciech Jowsa (wojciech.jowsa@gmail.com) +# This is free software, licensed under the Apache License, Version 2.0 + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=Packet capture application +LUCI_DEPENDS:=+luci-mod-admin-full +tcpdump +coreutils +coreutils-timeout + +PKG_MAINTAINER:=Wojciech Jowsa +PKG_LICENSE:=Apache-2.0 + +include $(TOPDIR)/feeds/luci/luci.mk + +# call BuildPackage - OpenWrt buildroot signatureet diff --git a/luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js b/luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js new file mode 100644 index 000000000..6bf42cc3f --- /dev/null +++ b/luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js @@ -0,0 +1,287 @@ +'use strict'; +'require rpc'; +'require uci'; +'require ui'; +'require fs'; +'require form'; +'require network'; +'require tools.widgets as widgets'; + +var eventSource, + captureFilePoll, + hostName; + +function stopTcpdump() { + fs.exec("/usr/libexec/packet_capture_stop").then(function(replay) { + if (eventSource) + eventSource.close(); + }.bind(this)).catch(function(error) { + console.log(error); + }); +} + +window.addEventListener('beforeunload', stopTcpdump); + +var callLuciProcessList = rpc.declare({ + object: 'luci', + method: 'getProcessList', + expect: { result: [] } +}); + +var callInitAction = rpc.declare({ + object: 'luci', + method: 'setInitAction', + params: [ 'name', 'action' ], + expect: { result: false } +}); + +function addOutput() { + var tcpdumpOut = document.querySelectorAll('[id$="tcpdump_out"]')[0]; + if (tcpdumpOut) + return; + + var frameEl = E('div', {'class': 'cbi-value'}); + + frameEl.appendChild(E('textarea', { + 'id': 'tcpdump_out', + 'class': 'cbi-input-textarea', + 'readonly': '', + 'style': 'width:100%', + 'rows': 30, + })); + + frameEl.firstElementChild.style.fontFamily = 'monospace'; + + var downloadBtn = document.querySelectorAll('[id$="download_file"]')[0]; + if (downloadBtn) + downloadBtn.parentNode.insertBefore(frameEl, downloadBtn.nextSibling); +} + +var downloadCaptureFile = function(ev) { + var form = E('form', { + method: 'post', + action: '/cgi-bin/cgi-download', + enctype: 'application/x-www-form-urlencoded' + }, E('input', { type: 'hidden', name: 'sessionid', value: rpc.getSessionID()}, + E('input', { type: 'hidden', name: 'path', value: "/tmp/capture.pcap"}, + E('input', { type: 'hidden', name: 'filename', value: hostName + "-" + Date.now() + ".pcap"}, + E('input', { type: 'hidden', name: 'mimetype', value: 'application/vnd.tcpdump.pcap'} + ))))); + + ev.currentTarget.parentNode.appendChild(form); + form.submit(); + form.parentNode.removeChild(form); +} + +function subscribeTcpdump() { + if (eventSource) + eventSource.close(); + + eventSource = new EventSource('/ubus/subscribe/tcpdump' + '?' + rpc.getSessionID()); + eventSource.onerror = function(event) { + eventSource.close(); + console.log(event); + }; + + addOutput(); + var textOut = document.querySelectorAll('[id$="tcpdump_out"]')[0]; + textOut.value = ""; + eventSource.addEventListener("tcpdump.data", function(event) { + textOut.value = textOut.value + "\n" + JSON.parse(event.data).data; + }); +} + +function updateButtons() { + var tasks = []; + tasks.push(fs.stat("/var/run/packet_capture.pid").then(L.bind(function(res) { + var downloadBtn = document.querySelectorAll('[id$="download_file"]')[0]; + if (!downloadBtn) + return; + if (!eventSource || eventSource.readyState == 2) + subscribeTcpdump(); + var textOut = document.querySelectorAll('[id$="tcpdump_out"]')[0]; + if (textOut) + textOut.style.borderColor = "green"; + var startBtn = document.querySelectorAll('[id$="start_tcpdump"]')[0]; + if (startBtn) + startBtn.hidden = true; + var stopBtn = document.querySelectorAll('[id$="stop_tcpdump"]')[0]; + if (stopBtn) + stopBtn.hidden = false; + return; + })).catch(function(error) { + var textOut = document.querySelectorAll('[id$="tcpdump_out"]')[0]; + if (textOut) + textOut.style.borderColor = "red"; + var startBtn = document.querySelectorAll('[id$="start_tcpdump"]')[0]; + if (startBtn) + startBtn.hidden = false; + var stopBtn = document.querySelectorAll('[id$="stop_tcpdump"]')[0]; + if (stopBtn) + stopBtn.hidden = true; + if (eventSource) + eventSource.close(); + })); + + return Promise.all(tasks); +} + +function updatePollCheckCaptureFileExists() { + checkCaptureFileExists(); + L.Poll.remove(captureFilePoll); + L.Poll.add(L.bind(checkCaptureFileExists, m),5); +} + +function checkCaptureFileExists() { + var tasks = []; + tasks.push(fs.stat("/tmp/capture.pcap").then(L.bind(function(res) { + var downloadBtn = document.querySelector('[data-action="download"]'); + if (!downloadBtn) + return; + var downloadCheckBox = document.querySelectorAll('[data-widget-id$="file"]')[0].checked; + if (!downloadCheckBox) { + fs.remove("/tmp/capture.pcap").then(function(replay) { + downloadBtn.disabled = true;; + }.bind(this)).catch(function(error) { + console.log(error); + }); + } else { + downloadBtn.disabled = false; + } + })).catch(function(error) { + var downloadBtn = document.querySelector('[data-action="download"]'); + if (downloadBtn) + downloadBtn.disabled = true; + })); + + return Promise.all(tasks); +} + +return L.view.extend({ + + load: function() { + return Promise.all([ + uci.load('system') + ]); + }, + + handleDownload: function(ev) { + downloadCaptureFile(ev); + }, + + render: function(processes) { + var m, s, o; + + hostName = uci.get('system', '@system[0]', 'hostname'); + + m = new form.Map('packet_capture', _('Packet Capture - Tcpdump'), _('Capture packets with tcpdump.')); + s = m.section(form.TypedSection, 'tcpdump'); + s.anonymous = 1; + + o = s.option(widgets.DeviceSelect, 'interface', _('Interface'), _('')); + o.noaliases = true; + o.modalonly = true; + o.rmempty = false; + o.filter = function(section_id, value) { + return true; + } + + o = s.option(form.Value, 'filter', _('Filter'), _('Tcpdump filter like protocol, port etc.')); + o.modalonly = false; + o.datatype = 'and(minlength(1),maxlength(1024))'; + + o = s.option(form.Value, 'duration', _('Duration'), _('Duration of packet capturing in seconds.')); + o.modalonly = false; + o.datatype = 'range(1,4294967296)'; + + o = s.option(form.Value, 'packets', _('Packets'), _('Number of packets to be captured.')); + o.modalonly = false; + o.datatype = 'range(1,4294967296)'; + + o = s.option(form.Flag, 'domains', _('Resolve domains'), _("Convert host addresses to names.")); + + o = s.option(form.Flag, 'verbose', _('Verbose output'), _("Print the link-level header on each dump line.")); + + o = s.option(form.Flag, 'file', _('Save to file'), _("Save capture to pcap file.")); + + o = s.option(form.Button, 'start_tcpdump', _('Start tcpdump'), _('')); + o.inputstyle = 'apply'; + o.onclick = ui.createHandlerFn(this, function(section_id, ev) { + var downloadBtn = document.querySelector('[data-action="download"]'); + if (!downloadBtn) + return; + fs.remove("/tmp/capture.pcap").then(function(replay) { + downloadBtn.disabled = true;; + }.bind(this)).catch(function(error) { + console.log(error); + }); + + var iface = document.querySelectorAll('[id$="interface"]')[1].value, + filter = document.querySelectorAll('[id$="filter"]')[2].value, + packets = document.querySelectorAll('[id$="packets"]')[2].value, + duration = document.querySelectorAll('[id$="duration"]')[2].value, + verbose = document.querySelectorAll('[data-widget-id$="verbose"]')[0].checked, + domains = document.querySelectorAll('[data-widget-id$="domains"]')[0].checked, + file = document.querySelectorAll('[data-widget-id$="file"]')[0].checked + + var args = { + "interface": iface, + "filter": filter, + "packets": packets, + "duration": duration, + "verbose": verbose, + "domains": domains, + "file": file + } + + return fs.exec_direct('/usr/libexec/packet_capture_start', [JSON.stringify(args)]).then(function(replay) { + var error_position = replay.search("error:"); + if (error_position != -1){ + ui.showModal(_(replay.substring(error_position + 6, replay.length)), [ + E('div', { 'class': 'right' }, [ + E('button', { + 'class': 'cbi-button cbi-button-negative important', + 'click': function(ev) { + ui.hideModal(); + } + }, _('Close')), + ]) + ]); + return; + } + rpc.list.apply(rpc).then(function(res) { + for (var k in res) { + if (res[k] == "tcpdump" ) + subscribeTcpdump() + } + }.bind(this)); + }.bind(this)).catch(function(error) { + console.log(error); + }); + }); + + o = s.option(form.Button, 'stop_tcpdump', _('Stop tcpdump'), _('')); + o.inputstyle = 'apply'; + o.onclick = ui.createHandlerFn(this, function(section_id, ev) { + if (!eventSource) + return; + return fs.exec("/usr/libexec/packet_capture_stop").then(function(replay) { + eventSource.close(); + }.bind(this)).catch(function(error) { + console.log(error); + }); + }); + + o = s.option(form.Button, 'download_file', _('Download capture file')); + o.inputstyle = 'action important'; + o.inputtitle = _('Download'); + o.data_action = 'download' + o.onclick = this.handleDownload; + + L.Poll.add(L.bind(updateButtons, m),1); + captureFilePoll = L.bind(updatePollCheckCaptureFileExists, m); + L.Poll.add(captureFilePoll,1); + + return m.render(); + }, +}); diff --git a/luci-app-packet-capture/po/fr/packet-capture.po b/luci-app-packet-capture/po/fr/packet-capture.po new file mode 100644 index 000000000..f2169d1f7 --- /dev/null +++ b/luci-app-packet-capture/po/fr/packet-capture.po @@ -0,0 +1,99 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2021-03-31 15:07+0000\n" +"Last-Translator: Weblate Admin \n" +"Language-Team: French \n" +"Language: fr\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.5.2\n" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:177 +msgid "Capture packets with tcpdump." +msgstr "Capturez des paquets avec tcpdump." + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:247 +msgid "Close" +msgstr "Fermer" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:201 +msgid "Convert host addresses to names." +msgstr "Convertissez les adresses d'hôte en noms." + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:277 +msgid "Download" +msgstr "Téléchargement" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:275 +msgid "Download capture file" +msgstr "Télécharger le fichier de capture" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:193 +msgid "Duration" +msgstr "Durée" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:193 +msgid "Duration of packet capturing in seconds." +msgstr "Durée de la capture des paquets en secondes." + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:189 +msgid "Filter" +msgstr "Filtre" + +#: luci-app-packet-capture/root/usr/share/rpcd/acl.d/luci-app-packet-capture.json:3 +msgid "Grant access to tcpdump ubus object" +msgstr "Accorder l'accès à l'objet ubus tcpdump" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:181 +msgid "Interface" +msgstr "Interface" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:197 +msgid "Number of packets to be captured." +msgstr "Nombre de paquets à capturer." + +#: luci-app-packet-capture/root/usr/share/luci/menu.d/luci-app-packet-capture.json:3 +msgid "Packet Capture" +msgstr "Capture de paquets" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:177 +msgid "Packet Capture - Tcpdump" +msgstr "Capture de paquets - Tcpdump" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:197 +msgid "Packets" +msgstr "Paquets" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:203 +msgid "Print the link-level header on each dump line." +msgstr "Imprimez l'en-tête du lien sur chaque ligne de capture." + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:201 +msgid "Resolve domains" +msgstr "Résoudre les domaines" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:205 +msgid "Save capture to pcap file." +msgstr "Enregistrez la capture dans le fichier pcap." + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:205 +msgid "Save to file" +msgstr "Enregistrer dans un fichier" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:207 +msgid "Start tcpdump" +msgstr "Démarrez tcpdump" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:263 +msgid "Stop tcpdump" +msgstr "Arrêter tcpdump" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:189 +msgid "Tcpdump filter like protocol, port etc." +msgstr "Filtre pour tcpdump comme le protocole, le port, etc." + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:203 +msgid "Verbose output" +msgstr "Sortie verbeuse" diff --git a/luci-app-packet-capture/po/templates/packet-capture.pot b/luci-app-packet-capture/po/templates/packet-capture.pot new file mode 100644 index 000000000..4a2659477 --- /dev/null +++ b/luci-app-packet-capture/po/templates/packet-capture.pot @@ -0,0 +1,90 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:177 +msgid "Capture packets with tcpdump." +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:247 +msgid "Close" +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:201 +msgid "Convert host addresses to names." +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:277 +msgid "Download" +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:275 +msgid "Download capture file" +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:193 +msgid "Duration" +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:193 +msgid "Duration of packet capturing in seconds." +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:189 +msgid "Filter" +msgstr "" + +#: luci-app-packet-capture/root/usr/share/rpcd/acl.d/luci-app-packet-capture.json:3 +msgid "Grant access to tcpdump ubus object" +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:181 +msgid "Interface" +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:197 +msgid "Number of packets to be captured." +msgstr "" + +#: luci-app-packet-capture/root/usr/share/luci/menu.d/luci-app-packet-capture.json:3 +msgid "Packet Capture" +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:177 +msgid "Packet Capture - Tcpdump" +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:197 +msgid "Packets" +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:203 +msgid "Print the link-level header on each dump line." +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:201 +msgid "Resolve domains" +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:205 +msgid "Save capture to pcap file." +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:205 +msgid "Save to file" +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:207 +msgid "Start tcpdump" +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:263 +msgid "Stop tcpdump" +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:189 +msgid "Tcpdump filter like protocol, port etc." +msgstr "" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:203 +msgid "Verbose output" +msgstr "" diff --git a/luci-app-packet-capture/po/zh-cn b/luci-app-packet-capture/po/zh-cn new file mode 120000 index 000000000..8d69574dd --- /dev/null +++ b/luci-app-packet-capture/po/zh-cn @@ -0,0 +1 @@ +zh_Hans \ No newline at end of file diff --git a/luci-app-packet-capture/po/zh_Hans/packet-capture.po b/luci-app-packet-capture/po/zh_Hans/packet-capture.po new file mode 100644 index 000000000..c8704a7f9 --- /dev/null +++ b/luci-app-packet-capture/po/zh_Hans/packet-capture.po @@ -0,0 +1,99 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2021-04-30 16:03+0000\n" +"Last-Translator: niergouge <1150108426@qq.com>\n" +"Language-Team: Chinese (Simplified) \n" +"Language: zh_Hans\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 4.5.2\n" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:177 +msgid "Capture packets with tcpdump." +msgstr "使用tcpdump捕获数据包。" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:247 +msgid "Close" +msgstr "关闭" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:201 +msgid "Convert host addresses to names." +msgstr "将主机地址转换为名称。" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:277 +msgid "Download" +msgstr "下载" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:275 +msgid "Download capture file" +msgstr "下载抓包文件" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:193 +msgid "Duration" +msgstr "持续时间" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:193 +msgid "Duration of packet capturing in seconds." +msgstr "抓包时间(以秒为单位)。" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:189 +msgid "Filter" +msgstr "过滤器" + +#: luci-app-packet-capture/root/usr/share/rpcd/acl.d/luci-app-packet-capture.json:3 +msgid "Grant access to tcpdump ubus object" +msgstr "授权访问tcpdump ubus对象" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:181 +msgid "Interface" +msgstr "接口" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:197 +msgid "Number of packets to be captured." +msgstr "需要抓包的个数。" + +#: luci-app-packet-capture/root/usr/share/luci/menu.d/luci-app-packet-capture.json:3 +msgid "Packet Capture" +msgstr "数据包捕获" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:177 +msgid "Packet Capture - Tcpdump" +msgstr "Tcpdump抓包" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:197 +msgid "Packets" +msgstr "包" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:203 +msgid "Print the link-level header on each dump line." +msgstr "打印每个转储行上的链接标题。" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:201 +msgid "Resolve domains" +msgstr "解决域" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:205 +msgid "Save capture to pcap file." +msgstr "保存捕获到pcap文件。" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:205 +msgid "Save to file" +msgstr "保存到文件" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:207 +msgid "Start tcpdump" +msgstr "开始tcp转存" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:263 +msgid "Stop tcpdump" +msgstr "停止tcp转存" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:189 +msgid "Tcpdump filter like protocol, port etc." +msgstr "Tcp转存过滤协议,端口等。" + +#: luci-app-packet-capture/htdocs/luci-static/resources/view/packet_capture/tcpdump.js:203 +msgid "Verbose output" +msgstr "详细输出" diff --git a/luci-app-packet-capture/root/etc/config/packet_capture b/luci-app-packet-capture/root/etc/config/packet_capture new file mode 100644 index 000000000..105a0dc30 --- /dev/null +++ b/luci-app-packet-capture/root/etc/config/packet_capture @@ -0,0 +1 @@ +config tcpdump \ No newline at end of file diff --git a/luci-app-packet-capture/root/usr/libexec/packet_capture b/luci-app-packet-capture/root/usr/libexec/packet_capture new file mode 100755 index 000000000..e1ecf23f7 --- /dev/null +++ b/luci-app-packet-capture/root/usr/libexec/packet_capture @@ -0,0 +1,64 @@ +#!/usr/bin/env lua + +local ubus = require "ubus" +local fs = require "nixio.fs" + +local conn = ubus.connect() +if not conn then + error("Failed to connect to ubus") + return +end + +local args = "-n" +local duration = "" + +if arg[1] ~= nil then + args = arg[1] + if arg[2] ~= "" then + duration = arg[2] + end +end + +local filter = fs.stat("/tmp/tcpdump_filter") +if filter then + args = args .. " -F /tmp/tcpdump_filter" +end + +local ubus_objects = { + tcpdump = { + } +} + +conn:add( ubus_objects ) + +os.execute("sleep 1") + +local command = "tcpdump -l " .. args .. " 2>&1" + +if duration ~= "" then + command = "timeout " .. duration .. " " .. command +end + +local pipe = io.popen(command) + +for line in pipe:lines() do + local params = { + data = line + } + conn:notify(ubus_objects.tcpdump.__ubusobj, "tcpdump.data", params) +end + +local pcap = fs.stat("/tmp/capture.pcap0") +if pcap then + fs.move("/tmp/capture.pcap0","/tmp/capture.pcap") + fs.remove("/tmp/capture.pcap1") +end + +if filter then + fs.remove("/tmp/tcpdump_filter") +end + +conn:close() +pipe:close() + +fs.remove("/var/run/packet_capture.pid") diff --git a/luci-app-packet-capture/root/usr/libexec/packet_capture_start b/luci-app-packet-capture/root/usr/libexec/packet_capture_start new file mode 100755 index 000000000..acdf89152 --- /dev/null +++ b/luci-app-packet-capture/root/usr/libexec/packet_capture_start @@ -0,0 +1,69 @@ +#!/bin/sh + +. /usr/share/libubox/jshn.sh + +PIDFILE="/var/run/packet_capture.pid" + +if [ -f "$PIDFILE"];then + echo "error: Packet capture is running" + exit 1 +fi + +json_load "$1" +json_get_var interface interface +json_get_var filter filter +json_get_var duration duration +json_get_var packets packets +json_get_var verbose verbose +json_get_var domains domains +json_get_var file file + +args="-n" + +if [ "$domains" == "1" ];then + args="" +fi + +if [ -n "$interface" ];then + ip a show "$interface" > /dev/null 2>&1 + if [ "$?" == "1" ]; then + echo "error: Incorrect format of an interface" + exit 1 + fi + + args="$args -i $interface" +fi + +if [ -n "$packets" ];then + echo "$packets" | egrep '^[0-9]*$' + if [ "$?" -eq 0 ];then + args="$args -c $packets" + else + echo "error: Incorrect packets argument" + exit 1 + fi +fi + +if [ "$verbose" == "1" ];then + args="$args -e" +fi + +if [ "$file" == "1" ];then + mem=$(awk '/MemTotal/ {print $2}' /proc/meminfo) + args="$args -W 2 -C $((mem/(1024 * 10))) -w /tmp/capture.pcap -z /usr/libexec/packet_capture_stop" +fi + +if [ -n "$filter" ];then + tcpdump -i lo -d "$filter" >/dev/null 2>/dev/null + if [ $? -eq 1 ];then + echo "error: Incorrect filter argument" + exit 1 + fi + echo "$filter" > /tmp/tcpdump_filter +fi + +(/usr/libexec/packet_capture "$args" "$duration")& + +echo $! > /var/run/packet_capture.pid + +exit 0 diff --git a/luci-app-packet-capture/root/usr/libexec/packet_capture_stop b/luci-app-packet-capture/root/usr/libexec/packet_capture_stop new file mode 100755 index 000000000..bce650346 --- /dev/null +++ b/luci-app-packet-capture/root/usr/libexec/packet_capture_stop @@ -0,0 +1,9 @@ +#!/bin/sh + +pid=$(cat /var/run/packet_capture.pid) +if [ -n "$pid" ] && grep -sq packet_capture "/proc/$pid/cmdline"; then + ppid=$(pgrep -P $pid) + kill -TERM $ppid +fi + +exit 0 diff --git a/luci-app-packet-capture/root/usr/share/luci/menu.d/luci-app-packet-capture.json b/luci-app-packet-capture/root/usr/share/luci/menu.d/luci-app-packet-capture.json new file mode 100644 index 000000000..304fe5431 --- /dev/null +++ b/luci-app-packet-capture/root/usr/share/luci/menu.d/luci-app-packet-capture.json @@ -0,0 +1,18 @@ +{ + "admin/services/packet_capture": { + "title": "Packet Capture", + "order": 90, + "action": { + "type": "view", + "path": "packet_capture/tcpdump" + }, + "depends" : { + "acl": [ "luci-app-packet-capture" ], + "uci": { "packet_capture": true }, + "fs": { "/usr/libexec/packet_capture": "executable", + "/usr/libexec/packet_capture_start": "executable", + "/usr/libexec/packet_capture_stop": "executable" + } + } + } +} diff --git a/luci-app-packet-capture/root/usr/share/rpcd/acl.d/luci-app-packet-capture.json b/luci-app-packet-capture/root/usr/share/rpcd/acl.d/luci-app-packet-capture.json new file mode 100644 index 000000000..f59d4060b --- /dev/null +++ b/luci-app-packet-capture/root/usr/share/rpcd/acl.d/luci-app-packet-capture.json @@ -0,0 +1,25 @@ +{ + "luci-app-packet-capture": { + "description": "Grant access to tcpdump ubus object", + "read": { + "cgi-io": [ "download", "exec" ], + "ubus": { + "tcpdump": [ "*" ], + "luci": [ "getProcessList" ] + }, + "uci": [ "packet_capture", "system" ], + "file": { + "/tmp/capture.pcap": [ "read" ] + } + }, + "write": { + "uci": [ "packet_capture" ], + "file": { + "/usr/libexec/packet_capture_start": [ "exec" ], + "/usr/libexec/packet_capture_stop": [ "exec" ], + "/usr/libexec/packet_capture": [ "exec" ], + "/tmp/capture.pcap": [ "write" ] + } + } + } +} diff --git a/luci-app-snmpd/Makefile b/luci-app-snmpd/Makefile new file mode 100644 index 000000000..12f22abd3 --- /dev/null +++ b/luci-app-snmpd/Makefile @@ -0,0 +1,15 @@ +# +# Copyright (C) 2018-2019 Ycarus (Yannick Chabanois) +# +# + +include $(TOPDIR)/rules.mk + +LUCI_TITLE:=LuCI SNMPD Interface +LUCI_DEPENDS:=+snmpd +snmptrapd +snmp-utils +snmp-mibs + +PKG_LICENSE:=GPLv3 + +#include ../luci/luci.mk +include $(TOPDIR)/feeds/luci/luci.mk +# call BuildPackage - OpenWrt buildroot signature diff --git a/luci-app-snmpd/luasrc/controller/snmpd.lua b/luci-app-snmpd/luasrc/controller/snmpd.lua new file mode 100644 index 000000000..2694da219 --- /dev/null +++ b/luci-app-snmpd/luasrc/controller/snmpd.lua @@ -0,0 +1,8 @@ +local ucic = luci.model.uci.cursor() +local dt = require "luci.cbi.datatypes" +module("luci.controller.snmpd", package.seeall) + +function index() + entry({"admin", "network", "snmpd"}, alias("admin", "network", "snmpd", "index"), _("SNMPd")) + entry({"admin", "network", "snmpd", "index"}, cbi("snmpd")) +end diff --git a/luci-app-snmpd/luasrc/model/cbi/snmpd.lua b/luci-app-snmpd/luasrc/model/cbi/snmpd.lua new file mode 100644 index 000000000..132b3a1d2 --- /dev/null +++ b/luci-app-snmpd/luasrc/model/cbi/snmpd.lua @@ -0,0 +1,141 @@ +-- Copyright 2018 Ycarus (Yannick Chabanois) +-- Licensed to the public under the Apache License 2.0. + +m = Map("snmpd", translate("SNMPd"), translate("SNMPd settings interface (Beta)")) + +s = m:section(TypedSection, "snmpd", translate("General")) +s.addremove = false + +enabled = s:option(Flag, "enabled", translate("Enabled")) +enabled.rmempty = false + +network = s:option(Value, "network", translate("Networks")) +network.template = "cbi/network_netlist" +network.widget = "checkbox" +network.rmempty = true +network.cast = "string" +network.nocreate = true + +s = m:section(TypedSection, "system", translate("System")) +s.addremove = false + +sysLocation = s:option(Value, "sysLocation", translate("Location")) +sysContact = s:option(Value, "sysContact", translate("Contact")) +sysName = s:option(Value, "sysName", translate("Name")) +--sysServices = s:option(Value, "sysServices", translate("Services")) +--sysDescr = s:option(Value, "sysDescr", translate("Description")) +--sysObjectID = s:option(Value, "sysObjectID", translate("ObjectID")) + +s = m:section(TypedSection, "com2sec", translate("com2sec security")) +s.addremove = true + +secname = s:option(ListValue, "secname", translate("Server")) +secname.optional = false +secname:value("ro",translate("Read-only")) +secname:value("rw",translate("Read-write")) + +source = s:option(Value, "source", translate("Source")) +source.datatype = "host" +source.optional = false +source.rmempty = false + +community = s:option(Value, "community", translate("Community")) +community.optional = false +community.rmempty = false + +--s = m:section(TypedSection, "com2sec6", translate("com2sec6")) +--s.addremove = true + +--secname = s:option(ListValue, "secname", translate("secname")) +--secname.optional = false +--secname:value("ro",translate("Read-only")) +--secname:value("rw",translate("Read-write")) + +--source = s:option(Value, "source", translate("Source")) +--source.datatype = "host" +--source.optional = false +--source.rmempty = false + +--community = s:option(Value, "community", translate("Community")) +--community.optional = false +--community.rmempty = false + +s = m:section(TypedSection, "group", translate("Group"), translate("Groups help define access methods")) +s.addremove = true +s.anonymous = false + +secname = s:option(ListValue, "secname", translate("secname")) +secname.optional = false +secname:value("ro",translate("Read-only")) +secname:value("rw",translate("Read-write")) + +group = s:option(Value, "group", translate("Group")) +group.optional = false +group.rmempty = false + +version = s:option(ListValue, "version", translate("version")) +version.optional = false +version:value("v1","v1") +version:value("v2c","v2c") +version:value("usm","usm") + +s = m:section(TypedSection, "access", translate("Access")) +s.addremove = true +s.anonymous = false + +group = s:option(Value, "group", translate("Group")) +group.optional = false +group.rmempty = false + +version = s:option(ListValue, "version", translate("version")) +version.optional = false +version:value("any",translate("any")) +version:value("v1","v1") +version:value("v2c","v2c") +version:value("usm","usm") + +context = s:option(ListValue, "context", translate("Context")) +context.optional = false +context:value("none","none") + +level = s:option(ListValue, "level", translate("Level")) +level.optional = false +level:value("noauth",translate("noauth")) +level:value("auth",translate("auth")) + +read = s:option(ListValue, "read", translate("Read")) +read.optional = false +read:value("all","all") +read:value("none","none") + +write = s:option(ListValue, "write", translate("Write")) +write.optional = false +write:value("all","all") +write:value("none","none") + +notify = s:option(ListValue, "notify", translate("Notify")) +notify.optional = false +notify:value("all","all") +notify:value("none","none") + +--s = m:section(TypedSection, "engineid", translate("engineid")) +--s.addremove = false +--s.anonymous = true + +--engineid = s:option(Value, "engineid", translate("engineid")) +--engineidtype = s:option(ListValue, "engineidtype", translate("engineidtype")) +--engineidtype:value("1",translate("IPv4")) +--engineidtype:value("2",translate("IPv6")) +--engineidtype:value("3",translate("MAC")) +--engineidnic = s:option(Value, "engineidnic", translate("engineidnic")) + +s = m:section(TypedSection, "exec", translate("Exec")) +s.addremove = true +s.anonymous = true + +miboid = s:option(Value, "miboid", translate("ObjectID")) +name = s:option(Value, "name", translate("Name")) +prog = s:option(Value, "prog", translate("Program")) +args = s:option(Value, "args", translate("Arguments")) + +return m diff --git a/luci-app-snmpd/luasrc/view/snmpd.htm b/luci-app-snmpd/luasrc/view/snmpd.htm new file mode 100644 index 000000000..74e60ca9a --- /dev/null +++ b/luci-app-snmpd/luasrc/view/snmpd.htm @@ -0,0 +1,132 @@ +<%+header%> + + + +<% + local uci = require("luci.model.uci").cursor() + local hosts = uci:get_list("dhcp", uci:get_first("dhcp","dnsmasq"), "ipset") + local ips = uci:get_list("omr-bypass", "ips", "ip") + local dpi = uci:get_list("omr-bypass", "dpi", "proto") + local tmpfile = os.tmpname() + local dpi_available_proto = luci.util.execi("cat /proc/net/xt_ndpi/proto | awk '{print $3}' | sort -u | head -n -1") + local sys = require "luci.sys" + local ifaces = sys.net:devices() + local bypassif = uci:get("omr-bypass","defaults","ifname") or "" +%> +<% if stderr and #stderr > 0 then %>
<%=pcdata(stderr)%>
<% end %> +
+
+

<%:SNMPd%>

+
+ <%:General%> +
+
+ +
+ checked<% end %>> +
+
+
+ network +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+ +

<%:General%>

+ +
+
+
+
+
<%:Domain, IP or network%>
+
<%:Output interface%>
+
+
+
+
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+

<%:Protocols%>

+
+
+
+
<%:Protocols%>
+
<%:Output interface%>
+
+
+
+
+<% + local allprt="""" + local protos = {} + for l in io.lines("/proc/net/xt_ndpi/proto") do + local a,b,c,d = l:match('(%w+) (%w+)') + if b ~= "2" and not string.match(b,"custom") then + table.insert(protos,b) + end + end + table.sort(protos) + for _,b in ipairs(protos) do + allprt=allprt .. ","" .. b .. """ + end +%> +
+
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ + +
+ + +<%+footer%> diff --git a/luci-app-snmpd/po/de/snmpd.po b/luci-app-snmpd/po/de/snmpd.po new file mode 100644 index 000000000..cfe49bcae --- /dev/null +++ b/luci-app-snmpd/po/de/snmpd.po @@ -0,0 +1,184 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2020-10-05 12:39+0000\n" +"Last-Translator: Weblate Admin \n" +"Language-Team: German \n" +"Language: de\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.0.4\n" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:82 +msgid "Access" +msgstr "Zugriff" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:81 +#: luci-app-snmpd/luasrc/view/snmpd.htm:122 +msgid "Add" +msgstr "Hinzufügen" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:66 +#: luci-app-snmpd/luasrc/view/snmpd.htm:116 +msgid "All" +msgstr "alle" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:139 +msgid "Arguments" +msgstr "Parameter" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:42 +msgid "Community" +msgstr "Community" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:23 +msgid "Contact" +msgstr "Kontakt" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:97 +msgid "Context" +msgstr "Umgebung" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:54 +msgid "Domain, IP or network" +msgstr "FQDN, IP-Adresse oder CIDR-Netzmaske" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:9 +#: luci-app-snmpd/luasrc/view/snmpd.htm:24 +msgid "Enabled" +msgstr "Aktiv" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:132 +msgid "Exec" +msgstr "Ausführung" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:6 +#: luci-app-snmpd/luasrc/view/snmpd.htm:21 +#: luci-app-snmpd/luasrc/view/snmpd.htm:48 +msgid "General" +msgstr "Allgemein" + +#: luci-app-snmpd/root/usr/share/rpcd/acl.d/luci-app-snmpd.json:3 +msgid "Grant UCI access for luci-app-snmpd" +msgstr "UCI-Zugriff für luci-app-snmpd gewähren" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:63 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:72 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:86 +msgid "Group" +msgstr "Gruppe" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:63 +msgid "Groups help define access methods" +msgstr "Gruppen ermöglichen es, Zugriffsmethoden festzulegen" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:64 +#: luci-app-snmpd/luasrc/view/snmpd.htm:114 +msgid "Interface" +msgstr "Schnittstelle" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:101 +msgid "Level" +msgstr "Ebene" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:22 +msgid "Location" +msgstr "Ort" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:24 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:137 +msgid "Name" +msgstr "Name" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:12 +msgid "Networks" +msgstr "Netzwerke" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:116 +msgid "Notify" +msgstr "Benachrichten" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:136 +msgid "ObjectID" +msgstr "Objekt-Identifikation" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:55 +#: luci-app-snmpd/luasrc/view/snmpd.htm:90 +msgid "Output interface" +msgstr "Ausgabe-Anschluss" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:138 +msgid "Program" +msgstr "Programm" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:85 +#: luci-app-snmpd/luasrc/view/snmpd.htm:89 +msgid "Protocols" +msgstr "Protokolle" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:106 +msgid "Read" +msgstr "Lesen" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:34 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:69 +msgid "Read-only" +msgstr "Nur-Lesen" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:35 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:70 +msgid "Read-write" +msgstr "Lesen/Schreiben" + +#: luci-app-snmpd/luasrc/controller/snmpd.lua:6 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:4 +#: luci-app-snmpd/luasrc/view/snmpd.htm:19 +#: luci-app-snmpd/root/usr/share/luci/menu.d/luci-app-snmpd.json:3 +msgid "SNMPd" +msgstr "SNMPd" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:4 +msgid "SNMPd settings interface (Beta)" +msgstr "SNMPd Einstellungen (Beta)" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:32 +msgid "Server" +msgstr "Server" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:37 +msgid "Source" +msgstr "Quelle" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:19 +msgid "System" +msgstr "System" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:111 +msgid "Write" +msgstr "Schreiben" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:92 +msgid "any" +msgstr "jede" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:104 +msgid "auth" +msgstr "Authentifizierung" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:29 +msgid "com2sec security" +msgstr "com2sec-Sicherheit" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:103 +msgid "noauth" +msgstr "noauth/offen" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:67 +msgid "secname" +msgstr "sec-Name" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:76 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:90 +msgid "version" +msgstr "Version" diff --git a/luci-app-snmpd/po/fr/snmpd.po b/luci-app-snmpd/po/fr/snmpd.po new file mode 100644 index 000000000..7efb48a42 --- /dev/null +++ b/luci-app-snmpd/po/fr/snmpd.po @@ -0,0 +1,184 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2022-02-19 07:53+0000\n" +"Last-Translator: Weblate Admin \n" +"Language-Team: French \n" +"Language: fr\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.6.1\n" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:82 +msgid "Access" +msgstr "Accès" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:81 +#: luci-app-snmpd/luasrc/view/snmpd.htm:122 +msgid "Add" +msgstr "Ajouter" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:66 +#: luci-app-snmpd/luasrc/view/snmpd.htm:116 +msgid "All" +msgstr "Tout" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:139 +msgid "Arguments" +msgstr "Arguments" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:42 +msgid "Community" +msgstr "Communauté" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:23 +msgid "Contact" +msgstr "Contact" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:97 +msgid "Context" +msgstr "Contexte" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:54 +msgid "Domain, IP or network" +msgstr "Domaine, IP ou réseau" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:9 +#: luci-app-snmpd/luasrc/view/snmpd.htm:24 +msgid "Enabled" +msgstr "Activer" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:132 +msgid "Exec" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:6 +#: luci-app-snmpd/luasrc/view/snmpd.htm:21 +#: luci-app-snmpd/luasrc/view/snmpd.htm:48 +msgid "General" +msgstr "Général" + +#: luci-app-snmpd/root/usr/share/rpcd/acl.d/luci-app-snmpd.json:3 +msgid "Grant UCI access for luci-app-snmpd" +msgstr "Accorder l'accès UCI pour luci-app-snmpd" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:63 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:72 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:86 +msgid "Group" +msgstr "Groupe" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:63 +msgid "Groups help define access methods" +msgstr "Les groupes aident à définir les méthodes d'accès" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:64 +#: luci-app-snmpd/luasrc/view/snmpd.htm:114 +msgid "Interface" +msgstr "Interface" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:101 +msgid "Level" +msgstr "Niveau" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:22 +msgid "Location" +msgstr "Localisation" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:24 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:137 +msgid "Name" +msgstr "Nom" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:12 +msgid "Networks" +msgstr "Réseaux" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:116 +msgid "Notify" +msgstr "Notifier" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:136 +msgid "ObjectID" +msgstr "ObjectID" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:55 +#: luci-app-snmpd/luasrc/view/snmpd.htm:90 +msgid "Output interface" +msgstr "Interface de sortie" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:138 +msgid "Program" +msgstr "Programme" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:85 +#: luci-app-snmpd/luasrc/view/snmpd.htm:89 +msgid "Protocols" +msgstr "Protocoles" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:106 +msgid "Read" +msgstr "Lecture" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:34 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:69 +msgid "Read-only" +msgstr "Lecture Seule" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:35 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:70 +msgid "Read-write" +msgstr "Lecture-écriture" + +#: luci-app-snmpd/luasrc/controller/snmpd.lua:6 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:4 +#: luci-app-snmpd/luasrc/view/snmpd.htm:19 +#: luci-app-snmpd/root/usr/share/luci/menu.d/luci-app-snmpd.json:3 +msgid "SNMPd" +msgstr "SNMPd" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:4 +msgid "SNMPd settings interface (Beta)" +msgstr "Paramètres du protocole SNMPd (Beta)" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:32 +msgid "Server" +msgstr "Serveur" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:37 +msgid "Source" +msgstr "Source" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:19 +msgid "System" +msgstr "Système" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:111 +msgid "Write" +msgstr "Ecriture" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:92 +msgid "any" +msgstr "Tout" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:104 +msgid "auth" +msgstr "Authentification" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:29 +msgid "com2sec security" +msgstr "com2sec security" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:103 +msgid "noauth" +msgstr "pas d'authentification" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:67 +msgid "secname" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:76 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:90 +msgid "version" +msgstr "version" diff --git a/luci-app-snmpd/po/it/snmpd.po b/luci-app-snmpd/po/it/snmpd.po new file mode 100644 index 000000000..5517296de --- /dev/null +++ b/luci-app-snmpd/po/it/snmpd.po @@ -0,0 +1,184 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2022-02-21 21:14+0000\n" +"Last-Translator: Deleted User \n" +"Language-Team: Italian \n" +"Language: it\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.10.1\n" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:82 +msgid "Access" +msgstr "Accesso" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:81 +#: luci-app-snmpd/luasrc/view/snmpd.htm:122 +msgid "Add" +msgstr "Aggiungi" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:66 +#: luci-app-snmpd/luasrc/view/snmpd.htm:116 +msgid "All" +msgstr "Tutti" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:139 +msgid "Arguments" +msgstr "Parametri" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:42 +msgid "Community" +msgstr "Community" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:23 +msgid "Contact" +msgstr "Contatto" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:97 +msgid "Context" +msgstr "Contesto" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:54 +msgid "Domain, IP or network" +msgstr "Dominio, IP o rete" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:9 +#: luci-app-snmpd/luasrc/view/snmpd.htm:24 +msgid "Enabled" +msgstr "Abilitato" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:132 +msgid "Exec" +msgstr "Esegui" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:6 +#: luci-app-snmpd/luasrc/view/snmpd.htm:21 +#: luci-app-snmpd/luasrc/view/snmpd.htm:48 +msgid "General" +msgstr "Generale" + +#: luci-app-snmpd/root/usr/share/rpcd/acl.d/luci-app-snmpd.json:3 +msgid "Grant UCI access for luci-app-snmpd" +msgstr "Concedi l'accesso UCI per luci-app-snmpd" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:63 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:72 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:86 +msgid "Group" +msgstr "Gruppo" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:63 +msgid "Groups help define access methods" +msgstr "I gruppi aiutano a definire i metodi di accesso" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:64 +#: luci-app-snmpd/luasrc/view/snmpd.htm:114 +msgid "Interface" +msgstr "Interfaccia" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:101 +msgid "Level" +msgstr "Livello" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:22 +msgid "Location" +msgstr "Sede" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:24 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:137 +msgid "Name" +msgstr "Nome" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:12 +msgid "Networks" +msgstr "Reti" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:116 +msgid "Notify" +msgstr "Notificare" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:136 +msgid "ObjectID" +msgstr "" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:55 +#: luci-app-snmpd/luasrc/view/snmpd.htm:90 +msgid "Output interface" +msgstr "Interfaccia di output" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:138 +msgid "Program" +msgstr "Programma" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:85 +#: luci-app-snmpd/luasrc/view/snmpd.htm:89 +msgid "Protocols" +msgstr "Protocollo" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:106 +msgid "Read" +msgstr "Leggi" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:34 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:69 +msgid "Read-only" +msgstr "Sola lettura" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:35 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:70 +msgid "Read-write" +msgstr "Leggi-Scrivi" + +#: luci-app-snmpd/luasrc/controller/snmpd.lua:6 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:4 +#: luci-app-snmpd/luasrc/view/snmpd.htm:19 +#: luci-app-snmpd/root/usr/share/luci/menu.d/luci-app-snmpd.json:3 +msgid "SNMPd" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:4 +msgid "SNMPd settings interface (Beta)" +msgstr "Interfaccia delle impostazioni SNMPd (Beta)" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:32 +msgid "Server" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:37 +msgid "Source" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:19 +msgid "System" +msgstr "Sistema" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:111 +msgid "Write" +msgstr "Scrittura" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:92 +msgid "any" +msgstr "qualsiasi" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:104 +msgid "auth" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:29 +msgid "com2sec security" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:103 +msgid "noauth" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:67 +msgid "secname" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:76 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:90 +msgid "version" +msgstr "versione" diff --git a/luci-app-snmpd/po/oc/snmpd.po b/luci-app-snmpd/po/oc/snmpd.po new file mode 100644 index 000000000..10292f065 --- /dev/null +++ b/luci-app-snmpd/po/oc/snmpd.po @@ -0,0 +1,184 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2020-08-31 17:15+0000\n" +"Last-Translator: Quentin PAGÈS \n" +"Language-Team: Occitan \n" +"Language: oc\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.0.4\n" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:82 +msgid "Access" +msgstr "Accès" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:81 +#: luci-app-snmpd/luasrc/view/snmpd.htm:122 +msgid "Add" +msgstr "Ajustar" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:66 +#: luci-app-snmpd/luasrc/view/snmpd.htm:116 +msgid "All" +msgstr "Tot" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:139 +msgid "Arguments" +msgstr "Arguments" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:42 +msgid "Community" +msgstr "Comunautat" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:23 +msgid "Contact" +msgstr "Contacte" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:97 +msgid "Context" +msgstr "Contèxt" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:54 +msgid "Domain, IP or network" +msgstr "Domeni, IP o ret" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:9 +#: luci-app-snmpd/luasrc/view/snmpd.htm:24 +msgid "Enabled" +msgstr "Activat" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:132 +msgid "Exec" +msgstr "Exec" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:6 +#: luci-app-snmpd/luasrc/view/snmpd.htm:21 +#: luci-app-snmpd/luasrc/view/snmpd.htm:48 +msgid "General" +msgstr "General" + +#: luci-app-snmpd/root/usr/share/rpcd/acl.d/luci-app-snmpd.json:3 +msgid "Grant UCI access for luci-app-snmpd" +msgstr "Acordar l'accès UCI a luci-app-snmpd" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:63 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:72 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:86 +msgid "Group" +msgstr "Grop" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:63 +msgid "Groups help define access methods" +msgstr "Los grops ajudan a gerir los metòdes d'accès" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:64 +#: luci-app-snmpd/luasrc/view/snmpd.htm:114 +msgid "Interface" +msgstr "Interfàcia" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:101 +msgid "Level" +msgstr "Nivèl" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:22 +msgid "Location" +msgstr "Emplaçament" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:24 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:137 +msgid "Name" +msgstr "Nom" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:12 +msgid "Networks" +msgstr "Rets" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:116 +msgid "Notify" +msgstr "Notificar" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:136 +msgid "ObjectID" +msgstr "ObjectID" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:55 +#: luci-app-snmpd/luasrc/view/snmpd.htm:90 +msgid "Output interface" +msgstr "Interfàcia de sortida" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:138 +msgid "Program" +msgstr "Programa" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:85 +#: luci-app-snmpd/luasrc/view/snmpd.htm:89 +msgid "Protocols" +msgstr "Protocòls" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:106 +msgid "Read" +msgstr "Lectura" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:34 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:69 +msgid "Read-only" +msgstr "Lectura sola" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:35 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:70 +msgid "Read-write" +msgstr "Lectura-escritura" + +#: luci-app-snmpd/luasrc/controller/snmpd.lua:6 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:4 +#: luci-app-snmpd/luasrc/view/snmpd.htm:19 +#: luci-app-snmpd/root/usr/share/luci/menu.d/luci-app-snmpd.json:3 +msgid "SNMPd" +msgstr "SNMPd" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:4 +msgid "SNMPd settings interface (Beta)" +msgstr "Interfàcia de paramètres SNMPd (Beta)" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:32 +msgid "Server" +msgstr "Servidor" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:37 +msgid "Source" +msgstr "Font" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:19 +msgid "System" +msgstr "Sistèma" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:111 +msgid "Write" +msgstr "Escritura" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:92 +msgid "any" +msgstr "Quin que siá" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:104 +msgid "auth" +msgstr "auth" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:29 +msgid "com2sec security" +msgstr "seguretat com2sec" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:103 +msgid "noauth" +msgstr "noauth" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:67 +msgid "secname" +msgstr "secname" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:76 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:90 +msgid "version" +msgstr "version" diff --git a/luci-app-snmpd/po/templates/snmpd.pot b/luci-app-snmpd/po/templates/snmpd.pot new file mode 100644 index 000000000..9acfaf5cb --- /dev/null +++ b/luci-app-snmpd/po/templates/snmpd.pot @@ -0,0 +1,175 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:82 +msgid "Access" +msgstr "" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:81 +#: luci-app-snmpd/luasrc/view/snmpd.htm:122 +msgid "Add" +msgstr "" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:66 +#: luci-app-snmpd/luasrc/view/snmpd.htm:116 +msgid "All" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:139 +msgid "Arguments" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:42 +msgid "Community" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:23 +msgid "Contact" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:97 +msgid "Context" +msgstr "" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:54 +msgid "Domain, IP or network" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:9 +#: luci-app-snmpd/luasrc/view/snmpd.htm:24 +msgid "Enabled" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:132 +msgid "Exec" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:6 +#: luci-app-snmpd/luasrc/view/snmpd.htm:21 +#: luci-app-snmpd/luasrc/view/snmpd.htm:48 +msgid "General" +msgstr "" + +#: luci-app-snmpd/root/usr/share/rpcd/acl.d/luci-app-snmpd.json:3 +msgid "Grant UCI access for luci-app-snmpd" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:63 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:72 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:86 +msgid "Group" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:63 +msgid "Groups help define access methods" +msgstr "" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:64 +#: luci-app-snmpd/luasrc/view/snmpd.htm:114 +msgid "Interface" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:101 +msgid "Level" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:22 +msgid "Location" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:24 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:137 +msgid "Name" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:12 +msgid "Networks" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:116 +msgid "Notify" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:136 +msgid "ObjectID" +msgstr "" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:55 +#: luci-app-snmpd/luasrc/view/snmpd.htm:90 +msgid "Output interface" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:138 +msgid "Program" +msgstr "" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:85 +#: luci-app-snmpd/luasrc/view/snmpd.htm:89 +msgid "Protocols" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:106 +msgid "Read" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:34 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:69 +msgid "Read-only" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:35 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:70 +msgid "Read-write" +msgstr "" + +#: luci-app-snmpd/luasrc/controller/snmpd.lua:6 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:4 +#: luci-app-snmpd/luasrc/view/snmpd.htm:19 +#: luci-app-snmpd/root/usr/share/luci/menu.d/luci-app-snmpd.json:3 +msgid "SNMPd" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:4 +msgid "SNMPd settings interface (Beta)" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:32 +msgid "Server" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:37 +msgid "Source" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:19 +msgid "System" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:111 +msgid "Write" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:92 +msgid "any" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:104 +msgid "auth" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:29 +msgid "com2sec security" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:103 +msgid "noauth" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:67 +msgid "secname" +msgstr "" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:76 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:90 +msgid "version" +msgstr "" diff --git a/luci-app-snmpd/po/zh-cn b/luci-app-snmpd/po/zh-cn new file mode 120000 index 000000000..8d69574dd --- /dev/null +++ b/luci-app-snmpd/po/zh-cn @@ -0,0 +1 @@ +zh_Hans \ No newline at end of file diff --git a/luci-app-snmpd/po/zh_Hans/snmpd.po b/luci-app-snmpd/po/zh_Hans/snmpd.po new file mode 100644 index 000000000..43c9d8f1d --- /dev/null +++ b/luci-app-snmpd/po/zh_Hans/snmpd.po @@ -0,0 +1,184 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2021-05-05 11:40+0000\n" +"Last-Translator: niergouge <1150108426@qq.com>\n" +"Language-Team: Chinese (Simplified) \n" +"Language: zh_Hans\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 4.6.1\n" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:82 +msgid "Access" +msgstr "访问" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:81 +#: luci-app-snmpd/luasrc/view/snmpd.htm:122 +msgid "Add" +msgstr "添加" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:66 +#: luci-app-snmpd/luasrc/view/snmpd.htm:116 +msgid "All" +msgstr "所有" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:139 +msgid "Arguments" +msgstr "理由" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:42 +msgid "Community" +msgstr "公共" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:23 +msgid "Contact" +msgstr "联系" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:97 +msgid "Context" +msgstr "语境" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:54 +msgid "Domain, IP or network" +msgstr "域,IP或网络" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:9 +#: luci-app-snmpd/luasrc/view/snmpd.htm:24 +msgid "Enabled" +msgstr "启用" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:132 +msgid "Exec" +msgstr "执行" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:6 +#: luci-app-snmpd/luasrc/view/snmpd.htm:21 +#: luci-app-snmpd/luasrc/view/snmpd.htm:48 +msgid "General" +msgstr "通用" + +#: luci-app-snmpd/root/usr/share/rpcd/acl.d/luci-app-snmpd.json:3 +msgid "Grant UCI access for luci-app-snmpd" +msgstr "授予UCI访问luci-app-snmpd的权限" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:63 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:72 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:86 +msgid "Group" +msgstr "组" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:63 +msgid "Groups help define access methods" +msgstr "定义访问组帮助方法" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:64 +#: luci-app-snmpd/luasrc/view/snmpd.htm:114 +msgid "Interface" +msgstr "接口" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:101 +msgid "Level" +msgstr "级别" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:22 +msgid "Location" +msgstr "位置" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:24 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:137 +msgid "Name" +msgstr "名称" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:12 +msgid "Networks" +msgstr "网络" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:116 +msgid "Notify" +msgstr "通知" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:136 +msgid "ObjectID" +msgstr "对象ID" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:55 +#: luci-app-snmpd/luasrc/view/snmpd.htm:90 +msgid "Output interface" +msgstr "输出接口" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:138 +msgid "Program" +msgstr "程序" + +#: luci-app-snmpd/luasrc/view/snmpd.htm:85 +#: luci-app-snmpd/luasrc/view/snmpd.htm:89 +msgid "Protocols" +msgstr "协议" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:106 +msgid "Read" +msgstr "读取" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:34 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:69 +msgid "Read-only" +msgstr "只读" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:35 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:70 +msgid "Read-write" +msgstr "读写" + +#: luci-app-snmpd/luasrc/controller/snmpd.lua:6 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:4 +#: luci-app-snmpd/luasrc/view/snmpd.htm:19 +#: luci-app-snmpd/root/usr/share/luci/menu.d/luci-app-snmpd.json:3 +msgid "SNMPd" +msgstr "SNMPd设置" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:4 +msgid "SNMPd settings interface (Beta)" +msgstr "SNMPd设置界面(测试版)" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:32 +msgid "Server" +msgstr "服务器" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:37 +msgid "Source" +msgstr "源" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:19 +msgid "System" +msgstr "系统" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:111 +msgid "Write" +msgstr "写" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:92 +msgid "any" +msgstr "任何" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:104 +msgid "auth" +msgstr "认证" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:29 +msgid "com2sec security" +msgstr "com2sec安全" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:103 +msgid "noauth" +msgstr "无认证" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:67 +msgid "secname" +msgstr "第二名称" + +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:76 +#: luci-app-snmpd/luasrc/model/cbi/snmpd.lua:90 +msgid "version" +msgstr "版本" diff --git a/luci-app-snmpd/root/etc/config/snmpd b/luci-app-snmpd/root/etc/config/snmpd new file mode 100644 index 000000000..09a89474f --- /dev/null +++ b/luci-app-snmpd/root/etc/config/snmpd @@ -0,0 +1,91 @@ + +config agent + option agentaddress 'UDP:161,UDP6:161' + +config agentx + option agentxsocket '/var/run/agentx.sock' + +config com2sec 'public' + option secname 'ro' + option source 'default' + option community 'public' + +config com2sec 'private' + option secname 'rw' + option source 'localhost' + option community 'private' + +config group 'public_v1' + option group 'public' + option version 'v1' + option secname 'ro' + +config group 'public_v2c' + option group 'public' + option version 'v2c' + option secname 'ro' + +config group 'public_usm' + option group 'public' + option version 'usm' + option secname 'ro' + +config group 'private_v1' + option group 'private' + option version 'v1' + option secname 'rw' + +config group 'private_v2c' + option group 'private' + option version 'v2c' + option secname 'rw' + +config group 'private_usm' + option group 'private' + option version 'usm' + option secname 'rw' + +config view 'all' + option viewname 'all' + option type 'included' + option oid '.1' + +config access 'public_access' + option group 'public' + option context 'none' + option version 'any' + option level 'noauth' + option prefix 'exact' + option read 'all' + option write 'none' + option notify 'none' + +config access 'private_access' + option group 'private' + option context 'none' + option version 'any' + option level 'noauth' + option prefix 'exact' + option read 'all' + option write 'all' + option notify 'all' + +config system + option sysLocation 'office' + option sysContact 'bofh@example.com' + option sysName 'OpenMPTCProuter' + +config exec + option name 'filedescriptors' + option prog '/bin/cat' + option args '/proc/sys/fs/file-nr' + +config engineid + option engineidtype '3' + option engineidnic 'eth0' + +config snmpd 'general' + list network 'lan' + option enabled '0' + option ipv6cpipv4 '1' + diff --git a/luci-app-snmpd/root/etc/init.d/snmpd b/luci-app-snmpd/root/etc/init.d/snmpd new file mode 100755 index 000000000..39fc71445 --- /dev/null +++ b/luci-app-snmpd/root/etc/init.d/snmpd @@ -0,0 +1,349 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2008 OpenWrt.org +START=50 + +USE_PROCD=1 +PROG="/usr/sbin/snmpd" + +CONFIGFILE="/var/run/snmpd.conf" + +snmpd_agent_add() { + local cfg="$1" + + config_get agentaddress "$cfg" agentaddress + [ -n "$agentaddress" ] || return 0 + echo "agentaddress $agentaddress" >> $CONFIGFILE +} + +snmpd_agentx_add() { + local cfg="$1" + echo "master agentx" >> $CONFIGFILE + config_get agentxsocket "$cfg" agentxsocket + [ -n "$agentxsocket" ] && echo "agentXSocket $agentxsocket" >> $CONFIGFILE +} + +snmpd_system_add() { + local cfg="$1" + config_get syslocation "$cfg" sysLocation + [ -n "$syslocation" ] && echo "sysLocation $syslocation" >> $CONFIGFILE + config_get syscontact "$cfg" sysContact + [ -n "$syscontact" ] && echo "sysContact $syscontact" >> $CONFIGFILE + config_get sysname "$cfg" sysName + [ -n "$sysname" ] && echo "sysName $sysname" >> $CONFIGFILE + config_get sysservice "$cfg" sysService + [ -n "$sysservice" ] && echo "sysService $sysservice" >> $CONFIGFILE + config_get sysdescr "$cfg" sysDescr + [ -n "$sysdescr" ] && echo "sysDescr $sysdescr" >> $CONFIGFILE + config_get sysobjectid "$cfg" sysObjectID + [ -n "$sysobjectid" ] && echo "sysObjectID $sysobjectid" >> $CONFIGFILE +} + +snmpd_com2sec_add() { + local cfg="$1" + config_get secname "$cfg" secname + [ -n "$secname" ] || return 0 + config_get source "$cfg" source + [ -n "$source" ] || return 0 + config_get community "$cfg" community + [ -n "$community" ] || return 0 + echo "com2sec $secname $source $community" >> $CONFIGFILE +} + +snmpd_com2sec6_add() { + local cfg="$1" + config_get secname "$cfg" secname + [ -n "$secname" ] || return 0 + config_get source "$cfg" source + [ -n "$source" ] || return 0 + config_get community "$cfg" community + [ -n "$community" ] || return 0 + echo "com2sec6 $secname $source $community" >> $CONFIGFILE +} + +snmpd_group_add() { + local cfg="$1" + config_get group "$cfg" group + [ -n "$group" ] || return 0 + config_get version "$cfg" version + [ -n "$version" ] || return 0 + config_get secname "$cfg" secname + [ -n "$secname" ] || return 0 + echo "group $group $version $secname" >> $CONFIGFILE +} + +snmpd_view_add() { + local cfg="$1" + config_get viewname "$cfg" viewname + [ -n "$viewname" ] || return 0 + config_get type "$cfg" type + [ -n "$type" ] || return 0 + config_get oid "$cfg" oid + [ -n "$oid" ] || return 0 + # optional mask + config_get mask "$cfg" mask + echo "view $viewname $type $oid $mask" >> $CONFIGFILE +} + +snmpd_access_add() { + local cfg="$1" + config_get group "$cfg" group + [ -n "$group" ] || return 0 + config_get context "$cfg" context + [ -n $context ] || return 0 + [ "$context" == "none" ] && context='""' + config_get version "$cfg" version + [ -n "$version" ] || return 0 + config_get level "$cfg" level + [ -n "$level" ] || return 0 + config_get prefix "$cfg" prefix + [ -n "$prefix" ] || return 0 + config_get read "$cfg" read + [ -n "$read" ] || return 0 + config_get write "$cfg" write + [ -n "$write" ] || return 0 + config_get notify "$cfg" notify + [ -n "$notify" ] || return 0 + echo "access $group $context $version $level $prefix $read $write $notify" >> $CONFIGFILE +} + +snmpd_trap_hostname_add() { + local cfg="$1" + config_get hostname "$cfg" HostName + config_get port "$cfg" Port + config_get community "$cfg" Community + config_get type "$cfg" Type + echo "$type $hostname $community $port" >> $CONFIGFILE +} + +snmpd_trap_ip_add() { + local cfg="$1" + config_get host_ip "$cfg" HostIP + config_get port "$cfg" Port + config_get community "$cfg" Community + config_get type "$cfg" Type + echo "$type $host_ip $community $port" >> $CONFIGFILE +} + +snmpd_access_default_add() { + local cfg="$1" + config_get mode "$cfg" Mode + config_get community "$cfg" CommunityName + config_get oidrestrict "$cfg" RestrictOID + config_get oid "$cfg" RestrictedOID + echo -n "$mode $community default" >> $CONFIGFILE + [ "$oidrestrict" == "yes" ] && echo " $oid" >> $CONFIGFILE + [ "$oidrestrict" == "no" ] && echo "" >> $CONFIGFILE +} + +snmpd_access_HostName_add() { + local cfg="$1" + config_get hostname "$cfg" HostName + config_get mode "$cfg" Mode + config_get community "$cfg" CommunityName + config_get oidrestrict "$cfg" RestrictOID + config_get oid "$cfg" RestrictedOID + echo -n "$mode $community $hostname" >> $CONFIGFILE + [ "$oidrestrict" == "yes" ] && echo " $oid" >> $CONFIGFILE + [ "$oidrestrict" == "no" ] && echo "" >> $CONFIGFILE +} + +snmpd_access_HostIP_add() { + local cfg="$1" + config_get host_ip "$cfg" HostIP + config_get ip_mask "$cfg" IPMask + config_get mode "$cfg" Mode + config_get community "$cfg" CommunityName + config_get oidrestrict "$cfg" RestrictOID + config_get oid "$cfg" RestrictedOID + echo -n "$mode $community $host_ip/$ip_mask" >> $CONFIGFILE + [ "$oidrestrict" == "yes" ] && echo " $oid" >> $CONFIGFILE + [ "$oidrestrict" == "no" ] && echo "" >> $CONFIGFILE +} + +snmpd_pass_add() { + local cfg="$1" + local pass='pass' + + config_get miboid "$cfg" miboid + [ -n "$miboid" ] || return 0 + config_get prog "$cfg" prog + [ -n "$prog" ] || return 0 + config_get_bool persist "$cfg" persist 0 + [ $persist -ne 0 ] && pass='pass_persist' + config_get priority "$cfg" priority + priority=${priority:+-p $priority} + echo "$pass $priority $miboid $prog" >> $CONFIGFILE +} + +snmpd_exec_add() { + local cfg="$1" + + config_get name "$cfg" name + [ -n "$name" ] || return 0 + config_get prog "$cfg" prog + [ -n "$prog" ] || return 0 + config_get args "$cfg" args + config_get miboid "$cfg" miboid + echo "exec $miboid $name $prog $args" >> $CONFIGFILE +} + +snmpd_disk_add() { + local cfg="$1" + local disk='disk' + + config_get partition "$cfg" partition + [ -n "$partition" ] || return 0 + config_get size "$cfg" size + [ -n "$size" ] || return 0 + echo "$disk $partition $size" >> $CONFIGFILE +} + +snmpd_engineid_add() { + local cfg="$1" + + config_get engineid "$cfg" engineid + [ -n "$engineid" ] && echo "engineID $engineid" >> $CONFIGFILE + config_get engineidtype "$cfg" engineidtype + [ "$engineidtype" -ge 1 -a "$engineidtype" -le 3 ] && \ + echo "engineIDType $engineidtype" >> $CONFIGFILE + config_get engineidnic "$cfg" engineidnic + [ -n "$engineidnic" ] && echo "engineIDNic $engineidnic" >> $CONFIGFILE +} + +snmpd_sink_add() { + local cfg="$1" + local section="$2" + local community + local port + local host + + config_get host "$cfg" host + [ -n "section" -a -n "$host" ] || return 0 + # optional community + config_get community "$cfg" community + # optional port + config_get port "$cfg" port + port=${port:+:$port} + echo "$section $host$port $community" >> $CONFIGFILE +} + +append_parm() { + local section="$1" + local option="$2" + local switch="$3" + local _loctmp + config_get _loctmp "$section" "$option" + [ -z "$_loctmp" ] && return 0 + echo "$switch $_loctmp" >> $CONFIGFILE +} + +append_authtrapenable() { + local section="$1" + local option="$2" + local switch="$3" + local _loctmp + config_get_bool _loctmp "$section" "$option" + [ -z "$_loctmp" ] && return 0 + [ "$_loctmp" -gt 0 ] && echo "$switch $_loctmp" >> $CONFIGFILE +} + +snmpd_setup_fw_rules() { + local net="$1" + local zone + + zone=$(fw3 -q network "$net" 2>/dev/null) + + local handled_zone + for handled_zone in $HANDLED_SNMP_ZONES; do + [ "$handled_zone" = "$zone" ] && return + done + + json_add_object "" + json_add_string type rule + json_add_string src "$zone" + json_add_string proto udp + json_add_string dest_port 161 + json_add_string target ACCEPT + json_close_object + + HANDLED_SNMP_ZONES="$HANDLED_SNMP_ZONES $zone" +} + +start_service() { + [ -f "$CONFIGFILE" ] && rm -f "$CONFIGFILE" + + config_load snmpd + + config_get_bool snmp_enabled general enabled 1 + [ "$snmp_enabled" -eq 0 ] && return + + procd_open_instance + + config_foreach snmpd_agent_add agent + config_foreach snmpd_agentx_add agentx + config_foreach snmpd_system_add system + config_foreach snmpd_com2sec_add com2sec + if [ "$(uci -q get snmpd.general.ipv6cpipv4)" = "1" ]; then + config_foreach snmpd_com2sec6_add com2sec + else + config_foreach snmpd_com2sec6_add com2sec6 + fi + config_foreach snmpd_group_add group + config_foreach snmpd_view_add view + config_foreach snmpd_access_add access + config_foreach snmpd_trap_hostname_add trap_HostName + config_foreach snmpd_trap_ip_add trap_HostIP + config_foreach snmpd_access_default_add access_default + config_foreach snmpd_access_HostName_add access_HostName + config_foreach snmpd_access_HostIP_add access_HostIP + config_foreach snmpd_pass_add pass + config_foreach snmpd_exec_add exec + config_foreach snmpd_disk_add disk + config_foreach snmpd_engineid_add engineid + append_parm trapcommunity community trapcommunity + config_foreach snmpd_sink_add trapsink trapsink + config_foreach snmpd_sink_add trap2sink trap2sink + config_foreach snmpd_sink_add informsink informsink + append_authtrapenable authtrapenable enable authtrapenable + append_parm v1trapaddress host v1trapaddress + append_parm trapsess trapsess trapsess + + procd_set_param command $PROG -Lf /dev/null -f + procd_set_param file $CONFIGFILE + procd_set_param respawn + + for iface in $(ls /sys/class/net 2>/dev/null); do + procd_append_param netdev "$iface" + done + + procd_open_data + + json_add_array firewall + config_list_foreach general network snmpd_setup_fw_rules + json_close_array + + procd_close_data + + procd_close_instance +} + +stop_service() { + [ -f "$CONFIGFILE" ] && rm -f "$CONFIGFILE" + procd_set_config_changed firewall +} + +service_triggers(){ + local script=$(readlink "$initscript") + local name=$(basename ${script:-$initscript}) + + procd_open_trigger + procd_add_raw_trigger "interface.*" 2000 /etc/init.d/$name reload + procd_close_trigger + + procd_add_reload_trigger 'snmpd' +} + +service_started() { + [ "$snmp_enabled" -eq 0 ] && return + procd_set_config_changed firewall +} diff --git a/luci-app-snmpd/root/etc/uci-defaults/4400-snmpd b/luci-app-snmpd/root/etc/uci-defaults/4400-snmpd new file mode 100755 index 000000000..8c6f6a547 --- /dev/null +++ b/luci-app-snmpd/root/etc/uci-defaults/4400-snmpd @@ -0,0 +1,19 @@ +#!/bin/sh +if [ "$(uci -q get snmpd.general.network)" = "" ]; then + uci -q batch <<-EOF >/dev/null + add_list snmpd.general.network=lan + set snmpd.@system[0].sysName="OpenMPTCProuter" + set snmpd.general.enabled=0 + commit snmpd + EOF +fi + +uci -q batch <<-EOF >/dev/null + delete ucitrack.@snmpd[-1] + add ucitrack snmpd + set ucitrack.@snmpd[-1].init=snmpd + commit ucitrack +EOF + +rm -f /tmp/luci-indexcache +exit 0 \ No newline at end of file diff --git a/luci-app-snmpd/root/usr/share/luci/menu.d/luci-app-snmpd.json b/luci-app-snmpd/root/usr/share/luci/menu.d/luci-app-snmpd.json new file mode 100644 index 000000000..771c4021a --- /dev/null +++ b/luci-app-snmpd/root/usr/share/luci/menu.d/luci-app-snmpd.json @@ -0,0 +1,13 @@ +{ + "admin/network/snmpd": { + "title": "SNMPd", + "order": 91, + "action": { + "type": "cbi", + "path": "snmpd" + }, + "depends": { + "acl": [ "luci-app-snmpd" ] + } + } +} diff --git a/luci-app-snmpd/root/usr/share/rpcd/acl.d/luci-app-snmpd.json b/luci-app-snmpd/root/usr/share/rpcd/acl.d/luci-app-snmpd.json new file mode 100644 index 000000000..1fc168524 --- /dev/null +++ b/luci-app-snmpd/root/usr/share/rpcd/acl.d/luci-app-snmpd.json @@ -0,0 +1,11 @@ +{ + "luci-app-snmpd": { + "description": "Grant UCI access for luci-app-snmpd", + "read": { + "uci": [ "snmpd" ] + }, + "write": { + "uci": [ "snmpd" ] + } + } +} \ No newline at end of file diff --git a/mbedtls/Makefile b/mbedtls/Makefile new file mode 100644 index 000000000..55ddbbaa5 --- /dev/null +++ b/mbedtls/Makefile @@ -0,0 +1,139 @@ +# +# Copyright (C) 2011-2015 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=mbedtls +PKG_VERSION:=2.16.12 +PKG_RELEASE:=$(AUTORELEASE) +PKG_USE_MIPS16:=0 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/ARMmbed/mbedtls/tar.gz/v$(PKG_VERSION)? +PKG_HASH:=294871ab1864a65d0b74325e9219d5bcd6e91c34a3c59270c357bb9ae4d5c393 + +PKG_BUILD_PARALLEL:=1 +PKG_LICENSE:=GPL-2.0-or-later +PKG_LICENSE_FILES:=gpl-2.0.txt +PKG_CPE_ID:=cpe:/a:arm:mbed_tls + +PKG_CONFIG_DEPENDS := \ + CONFIG_LIBMBEDTLS_DEBUG_C \ + CONFIG_LIBMBEDTLS_HKDF_C + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/mbedtls/Default + TITLE:=Embedded SSL + URL:=https://tls.mbed.org +endef + +define Package/mbedtls/Default/description +The aim of the mbedtls project is to provide a quality, open-source +cryptographic library written in C and targeted at embedded systems. +endef + +define Package/libmbedtls +$(call Package/mbedtls/Default) + SECTION:=libs + CATEGORY:=Libraries + SUBMENU:=SSL + TITLE+= (library) + ABI_VERSION:=12 +endef + +define Package/libmbedtls/config +config LIBMBEDTLS_DEBUG_C + depends on PACKAGE_libmbedtls + bool "Enable debug functions" + default n + help + This option enables mbedtls library's debug functions. + + It increases the uncompressed libmbedtls binary size + by around 60 KiB (for an ARMv5 platform). + + Usually, you don't need this, so don't select this if you're unsure. + +config LIBMBEDTLS_HKDF_C + depends on PACKAGE_libmbedtls + bool "Enable the HKDF algorithm (RFC 5869)" + default n + help + This option adds support for the Hashed Message Authentication Code + (HMAC)-based key derivation function (HKDF). +endef + +define Package/mbedtls-util +$(call Package/mbedtls/Default) + SECTION:=utils + CATEGORY:=Utilities + TITLE+= (utilities) + DEPENDS:=+libmbedtls +endef + +define Package/libmbedtls/description +$(call Package/mbedtls/Default/description) +This package contains the mbedtls library. +endef + +define Package/mbedtls-util/description +$(call Package/mbedtls/Default/description) +This package contains mbedtls helper programs for private key and +CSR generation (gen_key, cert_req) +endef + +PKG_INSTALL:=1 + +TARGET_CFLAGS += -ffunction-sections -fdata-sections +TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS)) + +CMAKE_OPTIONS += \ + -DUSE_SHARED_MBEDTLS_LIBRARY:Bool=ON \ + -DENABLE_TESTING:Bool=OFF \ + -DENABLE_PROGRAMS:Bool=ON + +define Build/Configure + $(Build/Configure/Default) + + awk 'BEGIN { rc = 1 } \ + /#define MBEDTLS_DEBUG_C/ { $$$$0 = "$(if $(CONFIG_LIBMBEDTLS_DEBUG_C),,// )#define MBEDTLS_DEBUG_C"; rc = 0 } \ + { print } \ + END { exit(rc) }' $(PKG_BUILD_DIR)/include/mbedtls/config.h \ + >$(PKG_BUILD_DIR)/include/mbedtls/config.h.new && \ + mv $(PKG_BUILD_DIR)/include/mbedtls/config.h.new $(PKG_BUILD_DIR)/include/mbedtls/config.h + + awk 'BEGIN { rc = 1 } \ + /#define MBEDTLS_HKDF_C/ { $$$$0 = "$(if $(CONFIG_LIBMBEDTLS_HKDF_C),,// )#define MBEDTLS_HKDF_C"; rc = 0 } \ + { print } \ + END { exit(rc) }' $(PKG_BUILD_DIR)/include/mbedtls/config.h \ + >$(PKG_BUILD_DIR)/include/mbedtls/config.h.new && \ + mv $(PKG_BUILD_DIR)/include/mbedtls/config.h.new $(PKG_BUILD_DIR)/include/mbedtls/config.h +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/mbedtls $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.a $(1)/usr/lib/ +endef + +define Package/libmbedtls/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/lib*.so.* $(1)/usr/lib/ +endef + +define Package/mbedtls-util/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gen_key $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/cert_req $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,libmbedtls)) +$(eval $(call BuildPackage,mbedtls-util)) diff --git a/mbedtls/patches/200-config.patch b/mbedtls/patches/200-config.patch new file mode 100644 index 000000000..1e3d41f0e --- /dev/null +++ b/mbedtls/patches/200-config.patch @@ -0,0 +1,245 @@ +--- a/include/mbedtls/config.h ++++ b/include/mbedtls/config.h +@@ -692,14 +692,14 @@ + * + * Enable Output Feedback mode (OFB) for symmetric ciphers. + */ +-#define MBEDTLS_CIPHER_MODE_OFB ++//#define MBEDTLS_CIPHER_MODE_OFB + + /** + * \def MBEDTLS_CIPHER_MODE_XTS + * + * Enable Xor-encrypt-xor with ciphertext stealing mode (XTS) for AES. + */ +-#define MBEDTLS_CIPHER_MODE_XTS ++//#define MBEDTLS_CIPHER_MODE_XTS + + /** + * \def MBEDTLS_CIPHER_NULL_CIPHER +@@ -816,19 +816,19 @@ + * + * Comment macros to disable the curve and functions for it + */ +-#define MBEDTLS_ECP_DP_SECP192R1_ENABLED +-#define MBEDTLS_ECP_DP_SECP224R1_ENABLED ++//#define MBEDTLS_ECP_DP_SECP192R1_ENABLED ++//#define MBEDTLS_ECP_DP_SECP224R1_ENABLED + #define MBEDTLS_ECP_DP_SECP256R1_ENABLED + #define MBEDTLS_ECP_DP_SECP384R1_ENABLED +-#define MBEDTLS_ECP_DP_SECP521R1_ENABLED +-#define MBEDTLS_ECP_DP_SECP192K1_ENABLED +-#define MBEDTLS_ECP_DP_SECP224K1_ENABLED ++//#define MBEDTLS_ECP_DP_SECP521R1_ENABLED ++//#define MBEDTLS_ECP_DP_SECP192K1_ENABLED ++//#define MBEDTLS_ECP_DP_SECP224K1_ENABLED + #define MBEDTLS_ECP_DP_SECP256K1_ENABLED +-#define MBEDTLS_ECP_DP_BP256R1_ENABLED +-#define MBEDTLS_ECP_DP_BP384R1_ENABLED +-#define MBEDTLS_ECP_DP_BP512R1_ENABLED ++//#define MBEDTLS_ECP_DP_BP256R1_ENABLED ++//#define MBEDTLS_ECP_DP_BP384R1_ENABLED ++//#define MBEDTLS_ECP_DP_BP512R1_ENABLED + #define MBEDTLS_ECP_DP_CURVE25519_ENABLED +-#define MBEDTLS_ECP_DP_CURVE448_ENABLED ++//#define MBEDTLS_ECP_DP_CURVE448_ENABLED + + /** + * \def MBEDTLS_ECP_NIST_OPTIM +@@ -952,7 +952,7 @@ + * See dhm.h for more details. + * + */ +-#define MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED ++//#define MBEDTLS_KEY_EXCHANGE_DHE_PSK_ENABLED + + /** + * \def MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED +@@ -972,7 +972,7 @@ + * MBEDTLS_TLS_ECDHE_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_ECDHE_PSK_WITH_RC4_128_SHA + */ +-#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED ++//#define MBEDTLS_KEY_EXCHANGE_ECDHE_PSK_ENABLED + + /** + * \def MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED +@@ -997,7 +997,7 @@ + * MBEDTLS_TLS_RSA_PSK_WITH_3DES_EDE_CBC_SHA + * MBEDTLS_TLS_RSA_PSK_WITH_RC4_128_SHA + */ +-#define MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED ++//#define MBEDTLS_KEY_EXCHANGE_RSA_PSK_ENABLED + + /** + * \def MBEDTLS_KEY_EXCHANGE_RSA_ENABLED +@@ -1131,7 +1131,7 @@ + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_ECDSA_WITH_CAMELLIA_256_GCM_SHA384 + */ +-#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED ++//#define MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED + + /** + * \def MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED +@@ -1155,7 +1155,7 @@ + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_ECDH_RSA_WITH_CAMELLIA_256_GCM_SHA384 + */ +-#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED ++//#define MBEDTLS_KEY_EXCHANGE_ECDH_RSA_ENABLED + + /** + * \def MBEDTLS_KEY_EXCHANGE_ECJPAKE_ENABLED +@@ -1259,7 +1259,7 @@ + * This option is only useful if both MBEDTLS_SHA256_C and + * MBEDTLS_SHA512_C are defined. Otherwise the available hash module is used. + */ +-//#define MBEDTLS_ENTROPY_FORCE_SHA256 ++#define MBEDTLS_ENTROPY_FORCE_SHA256 + + /** + * \def MBEDTLS_ENTROPY_NV_SEED +@@ -1354,14 +1354,14 @@ + * Uncomment this macro to disable the use of CRT in RSA. + * + */ +-//#define MBEDTLS_RSA_NO_CRT ++#define MBEDTLS_RSA_NO_CRT + + /** + * \def MBEDTLS_SELF_TEST + * + * Enable the checkup functions (*_self_test). + */ +-#define MBEDTLS_SELF_TEST ++//#define MBEDTLS_SELF_TEST + + /** + * \def MBEDTLS_SHA256_SMALLER +@@ -1515,7 +1515,7 @@ + * configuration of this extension). + * + */ +-#define MBEDTLS_SSL_RENEGOTIATION ++//#define MBEDTLS_SSL_RENEGOTIATION + + /** + * \def MBEDTLS_SSL_SRV_SUPPORT_SSLV2_CLIENT_HELLO +@@ -1690,7 +1690,7 @@ + * + * Comment this macro to disable support for SSL session tickets + */ +-#define MBEDTLS_SSL_SESSION_TICKETS ++//#define MBEDTLS_SSL_SESSION_TICKETS + + /** + * \def MBEDTLS_SSL_EXPORT_KEYS +@@ -1720,7 +1720,7 @@ + * + * Comment this macro to disable support for truncated HMAC in SSL + */ +-#define MBEDTLS_SSL_TRUNCATED_HMAC ++//#define MBEDTLS_SSL_TRUNCATED_HMAC + + /** + * \def MBEDTLS_SSL_TRUNCATED_HMAC_COMPAT +@@ -1796,7 +1796,7 @@ + * + * Comment this to disable run-time checking and save ROM space + */ +-#define MBEDTLS_VERSION_FEATURES ++//#define MBEDTLS_VERSION_FEATURES + + /** + * \def MBEDTLS_X509_ALLOW_EXTENSIONS_NON_V3 +@@ -2126,7 +2126,7 @@ + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_GCM_SHA256 + * MBEDTLS_TLS_PSK_WITH_CAMELLIA_128_CBC_SHA256 + */ +-#define MBEDTLS_CAMELLIA_C ++//#define MBEDTLS_CAMELLIA_C + + /** + * \def MBEDTLS_ARIA_C +@@ -2192,7 +2192,7 @@ + * This module enables the AES-CCM ciphersuites, if other requisites are + * enabled as well. + */ +-#define MBEDTLS_CCM_C ++//#define MBEDTLS_CCM_C + + /** + * \def MBEDTLS_CERTS_C +@@ -2204,7 +2204,7 @@ + * + * This module is used for testing (ssl_client/server). + */ +-#define MBEDTLS_CERTS_C ++//#define MBEDTLS_CERTS_C + + /** + * \def MBEDTLS_CHACHA20_C +@@ -2312,7 +2312,7 @@ + * \warning DES is considered a weak cipher and its use constitutes a + * security risk. We recommend considering stronger ciphers instead. + */ +-#define MBEDTLS_DES_C ++//#define MBEDTLS_DES_C + + /** + * \def MBEDTLS_DHM_C +@@ -2475,7 +2475,7 @@ + * This module adds support for the Hashed Message Authentication Code + * (HMAC)-based key derivation function (HKDF). + */ +-#define MBEDTLS_HKDF_C ++//#define MBEDTLS_HKDF_C + + /** + * \def MBEDTLS_HMAC_DRBG_C +@@ -2785,7 +2785,7 @@ + * + * This module enables abstraction of common (libc) functions. + */ +-#define MBEDTLS_PLATFORM_C ++//#define MBEDTLS_PLATFORM_C + + /** + * \def MBEDTLS_POLY1305_C +@@ -2806,7 +2806,7 @@ + * Caller: library/md.c + * + */ +-#define MBEDTLS_RIPEMD160_C ++//#define MBEDTLS_RIPEMD160_C + + /** + * \def MBEDTLS_RSA_C +@@ -2913,7 +2913,7 @@ + * + * Requires: MBEDTLS_CIPHER_C + */ +-#define MBEDTLS_SSL_TICKET_C ++//#define MBEDTLS_SSL_TICKET_C + + /** + * \def MBEDTLS_SSL_CLI_C +@@ -3013,7 +3013,7 @@ + * + * This module provides run-time version information. + */ +-#define MBEDTLS_VERSION_C ++//#define MBEDTLS_VERSION_C + + /** + * \def MBEDTLS_X509_USE_C +@@ -3123,7 +3123,7 @@ + * Module: library/xtea.c + * Caller: + */ +-#define MBEDTLS_XTEA_C ++//#define MBEDTLS_XTEA_C + + /* \} name SECTION: mbed TLS modules */ + diff --git a/msmtp/Makefile b/msmtp/Makefile new file mode 100644 index 000000000..d4588bbcf --- /dev/null +++ b/msmtp/Makefile @@ -0,0 +1,141 @@ +# +# Copyright (C) 2009 David Cooper +# Copyright (C) 2009-2016 OpenWrt.org +# Copyright (C) 2021 Ycarus (Yannick Chabanois) for OpenMPTCProuter +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=msmtp +PKG_VERSION:=1.8.14 +PKG_RELEASE:=2 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz +PKG_SOURCE_URL:=https://marlam.de/msmtp/releases +PKG_HASH:=d56f065d711486e9c234618515a02a48a48dab4051b34f3e108fbecb6fb773b4 + +PKG_MAINTAINER:= +PKG_LICENSE:=GPL-3.0-or-later +PKG_LICENSE_FILES:=COPYING +PKG_CPE_ID:=cpe:/a:marlam:msmtp + +PKG_INSTALL:=1 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/nls.mk + +define Package/msmtp/Default + SECTION:=mail + CATEGORY:=Mail + DEPENDS:=$(INTL_DEPENDS) + TITLE:=Simple sendmail SMTP forwarding + URL:=https://marlam.de/msmtp +endef + +define Package/msmtp/Default/description + msmtp is an SMTP client. In the default mode, it transmits a mail to + an SMTP server (for example at a free mail provider) which does the + delivery. To use this program with your mail user agent (MUA), create + a configuration file with your mail account(s) and tell your MUA to + call msmtp instead of /usr/sbin/sendmail. +endef + +define Package/msmtp +$(call Package/msmtp/Default) + DEPENDS+= +libgnutls +ca-bundle + TITLE+= (with SSL support) + VARIANT:=ssl + DEFAULT_VARIANT:=1 +endef + +define Package/msmtp/conffiles +/etc/msmtprc +endef + +define Package/msmtp/description +$(call Package/msmtp/Default/description) + This package is built with SSL support. +endef + +define Package/msmtp-nossl +$(call Package/msmtp/Default) + TITLE+= (without SSL support) + VARIANT:=nossl + PROVIDES:=msmtp +endef + +define Package/msmtp-nossl/description +$(call Package/msmtp/Default/description) + This package is built without SSL support. +endef + +define Package/msmtp-mta +$(call Package/msmtp/Default) + TITLE+= (as MTA) + DEPENDS+=+msmtp + ALTERNATIVES:=\ + 100:/usr/sbin/sendmail:/usr/bin/msmtp \ + 100:/usr/lib/sendmail:/usr/bin/msmtp +endef + +define Package/msmtp-mta/description +$(call Package/msmtp/Default/description) + This package add a link from sendmail to msmtp + and is built with SSL support. +endef + +define Package/msmtp-queue +$(call Package/msmtp/Default) + DEPENDS+= +bash +msmtp + TITLE+= (queue scripts) +endef + +define Package/msmtp-queue/description +$(call Package/msmtp/Default/description) + This package contains the msmtp queue scripts. +endef + +CONFIGURE_ARGS += \ + --disable-rpath \ + --without-libintl-prefix \ + --without-libgsasl \ + --without-libidn \ + --without-libsecret \ + --without-macosx-keyring \ + --without-msmtpd + +ifeq ($(BUILD_VARIANT),ssl) + CONFIGURE_ARGS += --with-tls=openssl +else + CONFIGURE_ARGS += --without-tls +endif + +define Package/msmtp/install + $(INSTALL_DIR) $(1)/etc + $(INSTALL_CONF) $(PKG_BUILD_DIR)/doc/msmtprc-system.example \ + $(1)/etc/msmtprc + $(INSTALL_DIR) $(1)/usr/bin + $(CP) $(PKG_INSTALL_DIR)/usr/bin/msmtp $(1)/usr/bin/ +endef + +define Package/msmtp-mta/install + $(INSTALL_DIR) $(1)/usr/sbin $(1)/usr/lib +endef + +Package/msmtp-nossl/conffiles = $(Package/msmtp/conffiles) +Package/msmtp-nossl/install = $(Package/msmtp/install) + +define Package/msmtp-queue/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/msmtpq/msmtp{q,-queue} $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/msmtpqueue/msmtp-{en,list,run}queue.sh $(1)/usr/bin/ +endef + +$(eval $(call BuildPackage,msmtp)) +$(eval $(call BuildPackage,msmtp-nossl)) +$(eval $(call BuildPackage,msmtp-queue)) +$(eval $(call BuildPackage,msmtp-mta)) diff --git a/natflow/Makefile b/natflow/Makefile new file mode 100644 index 000000000..79ac30952 --- /dev/null +++ b/natflow/Makefile @@ -0,0 +1,103 @@ +# +# Copyright (C) 2017-2019 Chen Minqiang +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=natflow +PKG_VERSION:=20221225 + +PKG_SOURCE_URL:=https://codeload.github.com/ptpt52/natflow/tar.gz/$(PKG_VERSION)? +PKG_HASH:=c85ddeef4ab2c8edbf5f53e793cb78b55c2663dc010dd5d3d15e428e19ba3917 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz + +PKG_MAINTAINER:=Chen Minqiang +PKG_LICENSE:=GPL-2.0 + +include $(INCLUDE_DIR)/package.mk + +define KernelPackage/natflow + CATEGORY:=X + SUBMENU:=Fast Forward Stacks + TITLE:=natflow kernel driver + KCONFIG:= \ + CONFIG_NF_CONNTRACK_MARK=y \ + CONFIG_NETFILTER_INGRESS=y \ + CONFIG_NF_FLOW_TABLE + FILES:=$(PKG_BUILD_DIR)/natflow.ko + AUTOLOAD:=$(call AutoLoad,96,natflow) + DEPENDS:= +kmod-ipt-conntrack +kmod-ipt-nat +kmod-ipt-ipset +kmod-br-netfilter +LINUX_5_4:kmod-nf-flow +endef + +define KernelPackage/natflow/description + fast nat forward kmod +endef + +include $(INCLUDE_DIR)/kernel-defaults.mk + +EXTRA_CFLAGS += -DCONFIG_NATFLOW_PATH -DCONFIG_NATFLOW_URLLOGGER +ifneq ($(CONFIG_TARGET_mediatek_mt7622),) +EXTRA_CFLAGS += -DCONFIG_HWNAT_EXTDEV_USE_VLAN_HASH +endif + +define Build/Compile/natflow + +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ + EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ + $(KERNEL_MAKE_FLAGS) \ + ARCH="$(LINUX_KARCH)" \ + CROSS_COMPILE="$(KERNEL_CROSS)" \ + M="$(PKG_BUILD_DIR)" \ + $(if $(CONFIG_KERNEL_DEBUG_INFO),,NO_DEBUG=1) \ + modules +endef + +define Build/Compile + $(call Build/Compile/natflow) +endef + +define Package/natflow-boot + CATEGORY:=X + SUBMENU:=Fast Forward Stacks + TITLE:=natflow boot init script + DEPENDS:= +kmod-natflow +endef + +define Package/natflow-boot/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/natflow-boot.init $(1)/etc/init.d/natflow-boot + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_DATA) ./files/21-natflow-boot.hotplug $(1)/etc/hotplug.d/iface/21-natflow-boot + $(INSTALL_DIR) $(1)/lib/preinit + $(INSTALL_DATA) ./files/natflow-boot.preinit $(1)/lib/preinit/95_natflow-boot +endef + +define Package/natflow-auth + CATEGORY:=X + SUBMENU:=Fast Forward Stacks + TITLE:=natflow auth init script + DEPENDS:= +kmod-natflow +ipset +lua-ipops +endef + +define Package/natflow-auth/conffiles +/etc/config/natflow +endef + +define Package/natflow-auth/install + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/natflow-simple-qos.init $(1)/etc/init.d/natflow-simple-qos + $(INSTALL_BIN) ./files/natflow-qos.init $(1)/etc/init.d/natflow-qos + $(INSTALL_BIN) ./files/natflow-user.init $(1)/etc/init.d/natflow-user + $(INSTALL_BIN) ./files/natflow-zone.init $(1)/etc/init.d/natflow-zone + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/natflow.config $(1)/etc/config/natflow + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_DATA) ./files/20-natflow-zone.hotplug $(1)/etc/hotplug.d/iface/20-natflow-zone +endef + +$(eval $(call KernelPackage,natflow)) +$(eval $(call BuildPackage,natflow-boot)) +$(eval $(call BuildPackage,natflow-auth)) diff --git a/natflow/files/20-natflow-zone.hotplug b/natflow/files/20-natflow-zone.hotplug new file mode 100644 index 000000000..069c8326d --- /dev/null +++ b/natflow/files/20-natflow-zone.hotplug @@ -0,0 +1,7 @@ +#!/bin/sh + +[ "$ACTION" = ifup -o "$ACTION" = ifupdate ] || exit 0 +[ "$ACTION" = ifupdate -a -z "$IFUPDATE_ADDRESSES" -a -z "$IFUPDATE_DATA" ] && exit 0 + +logger -t natflow "Reloading natflow-zone due to $ACTION of $INTERFACE ($DEVICE)" +/etc/init.d/natflow-zone start & diff --git a/natflow/files/21-natflow-boot.hotplug b/natflow/files/21-natflow-boot.hotplug new file mode 100644 index 000000000..335020a2a --- /dev/null +++ b/natflow/files/21-natflow-boot.hotplug @@ -0,0 +1,7 @@ +#!/bin/sh + +[ "$ACTION" = ifup -o "$ACTION" = ifupdate ] || exit 0 +[ "$ACTION" = ifupdate -a -z "$IFUPDATE_ADDRESSES" -a -z "$IFUPDATE_DATA" ] && exit 0 + +logger -t natflow "Reloading natflow-boot due to $ACTION of $INTERFACE ($DEVICE)" +/etc/init.d/natflow-boot start & diff --git a/natflow/files/natflow-boot.init b/natflow/files/natflow-boot.init new file mode 100644 index 000000000..8458b4a74 --- /dev/null +++ b/natflow/files/natflow-boot.init @@ -0,0 +1,48 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=95 + +disable_gro() { + which ethtool &>/dev/null || return 0 + for eth in $(ifconfig | grep "^eth\|^dsa" | awk '{print $1}' | sort | uniq); do + ethtool -k "$eth" | grep -q "generic-segmentation-offload: on" || { + ethtool -K "$eth" gro off + logger -t natfflow "disable gro for <$eth>" + } + done +} + +start() { + test -c /dev/natflow_ctl || return 0 + disable_gro + hwnat_wed=$(uci get natflow.main.hwnat_wed 2>/dev/null || echo 0) + hwnat=$(uci get natflow.main.hwnat 2>/dev/null || echo 0) + enabled=$(uci get natflow.main.enabled 2>/dev/null || echo 0) + debug=$(uci get natflow.main.debug 2>/dev/null || echo 3) + delay_pkts=$(uci get natflow.main.delay_pkts 2>/dev/null || echo 0) + skip_qos_to_slow_path=$(uci get natflow.main.skip_qos_to_slow_path 2>/dev/null || echo 0) + ifname_filter=$(uci get natflow.main.ifname_filter 2>/dev/null) + + echo debug=$debug >/dev/natflow_ctl + echo disabled=$((!enabled)) >/dev/natflow_ctl + cat /dev/natflow_ctl | grep -q hwnat= && { + echo hwnat=$hwnat >/dev/natflow_ctl + echo hwnat_wed_disabled=$((!hwnat_wed)) >/dev/natflow_ctl + } + echo delay_pkts=$delay_pkts >/dev/natflow_ctl + echo skip_qos_to_slow_path=$skip_qos_to_slow_path >/dev/natflow_ctl + echo ifname_clear >/dev/natflow_ctl + for ifn in ${ifname_filter}; do + echo ifname_add=$ifn >/dev/natflow_ctl + done +} + +stop() { + test -c /dev/natflow_ctl || return 0 + echo disabled=1 >/dev/natflow_ctl +} + +restart() { + start +} diff --git a/natflow/files/natflow-boot.preinit b/natflow/files/natflow-boot.preinit new file mode 100644 index 000000000..8e22bcc19 --- /dev/null +++ b/natflow/files/natflow-boot.preinit @@ -0,0 +1,11 @@ +# Copyright (C) 2022 X-WRT.COM + +do_pre_kmodload() +{ + return + test -e /etc/modules.d/mt7915e && { + cat /etc/modules.d/mt7915e | grep -q wed_enable=Y || echo mt7915e wed_enable=Y >/etc/modules.d/mt7915e + } +} + +boot_hook_add preinit_main do_pre_kmodload diff --git a/natflow/files/natflow-qos.init b/natflow/files/natflow-qos.init new file mode 100644 index 000000000..d662a31c3 --- /dev/null +++ b/natflow/files/natflow-qos.init @@ -0,0 +1,141 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=95 + +DEVCTL=/dev/qos_ctl +IPOPS="lua /usr/lib/lua/ipops.lua" +test -e /usr/share/natflow/ipops.lua && IPOPS="lua /usr/share/natflow/ipops.lua" + +qos_idx=0 + +# ipset_add ipsetname net +ipv4set_add() +{ + local ipsetname=$1 + local net=$2 + #hack for 0.0.0.0/0 + [ "$net" = "0.0.0.0/0" ] && net="0.0.0.0/1 128.0.0.0/1" + for n in $net; do + ipset add $ipsetname $n + done +} + +get_rate_data() +{ + local cnt num unit + echo -n $1 | grep -qi "bps$" || { + num=$1 + echo -n $((num)) # assume num B/s + return + } + cnt=`echo -n $1 | wc -c || echo 0` + test $cnt -le 4 && echo -n 0 && return # assume 0 B/s + + num=`echo -n $1 | cut -c0-$((cnt-4))` + unit=`echo -n $1 | cut -c$((cnt-3))-$cnt | tr A-Z a-z` + case $unit in + "kbps") + num=$((num*128)) + ;; + "mbps") + num=$((num*128*1024)) + ;; + "gbps") + num=$((num*128*1024*1024)) + ;; + *) + num=$((num/8)) + ;; + esac + echo -n $num # assume num bps +} + +natflow_qos_setup() +{ + local idx=$qos_idx + qos_idx=$((qos_idx+1)) + local cfg="$1" + local disabled user user_port remote remote_port proto rx_rate tx_rate + + config_get disabled "$cfg" disabled 0 + config_get user "$cfg" user + config_get user_port "$cfg" user_port + config_get remote "$cfg" remote + config_get remote_port "$cfg" remote_port + config_get proto "$cfg" proto + config_get rx_rate "$cfg" rx_rate 0 + config_get tx_rate "$cfg" tx_rate 0 + + [ "$disabled" = "1" ] && return 0 + + #echo add user=,user_port=,remote=,remote_port=,proto=,rxbytes=Bytes,txbytes=Bytes + + user=$($IPOPS netStrings2ipcidrStrings "$user") + if [ "$(echo $user | sed 's/,/ /g' | wc -w)" -gt 1 ]; then + ipset create qos_u$idx nethash 2>/dev/null + ipset flush qos_u$idx + for net in $(echo $user | sed 's/,/ /g'); do + ipv4set_add qos_u$idx $net + done + user=qos_u$idx + fi + + if [ "$(echo $user_port | sed 's/,/ /g' | wc -w)" -gt 1 ]; then + ipset create qos_up$idx bitmap:port range 0-65535 2>/dev/null + ipset flush qos_up$idx + for port in $(echo $user_port | sed 's/,/ /g'); do + ipset add qos_up$idx $port + done + user_port=qos_up$idx + fi + + remote=$($IPOPS netStrings2ipcidrStrings "$remote") + if [ "$(echo $remote | sed 's/,/ /g' | wc -w)" -gt 1 ]; then + ipset create qos_r$idx nethash 2>/dev/null + ipset flush qos_r$idx + for net in $(echo $remote | sed 's/,/ /g'); do + ipv4set_add qos_r$idx $net + done + remote=qos_r$idx + fi + + if [ "$(echo $remote_port | sed 's/,/ /g' | wc -w)" -gt 1 ]; then + ipset create qos_rp$idx bitmap:port range 0-65535 2>/dev/null + ipset flush qos_rp$idx + for port in $(echo $remote_port | sed 's/,/ /g'); do + ipset add qos_rp$idx $port + done + remote_port=qos_rp$idx + fi + + rx_rate=$(get_rate_data "$rx_rate") + tx_rate=$(get_rate_data "$tx_rate") + + cmd="add user=$user,user_port=$user_port,remote=$remote,remote_port=$remote_port,proto=$proto,rxbytes=$rx_rate,txbytes=$tx_rate" + + echo "$cmd" >$DEVCTL +} + +start() { + test -c $DEVCTL || return 0 + + echo clear >$DEVCTL + + config_load natflow + config_foreach natflow_qos_setup qos +} + +stop() { + test -c $DEVCTL || return 0 + + echo clear >$DEVCTL + ipset list -n | grep ^qos_ | while read ipset; do + ipset destroy $ipset + done +} + +restart() { + stop + start +} diff --git a/natflow/files/natflow-simple-qos.init b/natflow/files/natflow-simple-qos.init new file mode 100644 index 000000000..03568e950 --- /dev/null +++ b/natflow/files/natflow-simple-qos.init @@ -0,0 +1,98 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=95 + +IPOPS="lua /usr/lib/lua/ipops.lua" +test -e /usr/share/natflow/ipops.lua && IPOPS="lua /usr/share/natflow/ipops.lua" + +get_rate_data() +{ + local cnt num unit + echo -n $1 | grep -qi "bps$" || { + num=$1 + echo -n $((num)) # assume num B/s + return + } + cnt=`echo -n $1 | wc -c || echo 0` + test $cnt -le 4 && echo -n 0 && return # assume 0 B/s + + num=`echo -n $1 | cut -c0-$((cnt-4))` + unit=`echo -n $1 | cut -c$((cnt-3))-$cnt | tr A-Z a-z` + case $unit in + "kbps") + num=$((num*128)) + ;; + "mbps") + num=$((num*128*1024)) + ;; + "gbps") + num=$((num*128*1024*1024)) + ;; + *) + num=$((num/8)) + ;; + esac + echo -n $num # assume num bps +} + +qos_simple_watch() +{ + cat /dev/userinfo_event_ctl 2>/dev/null | while read line; do + ip=${line//,*} + idx=0 + while uci get natflow.@qos_simple[$idx] &>/dev/null; do + disabled=$(uci get natflow.@qos_simple[$idx].disabled 2>/dev/null || echo 0) + if [ "$disabled" = "0" ]; then + user=$(uci get natflow.@qos_simple[$idx].user 2>/dev/null) + if test -z "$user" || $IPOPS netStrings_test_netStrings "$user" "$ip"; then + rx_rate=$(uci get natflow.@qos_simple[$idx].rx_rate 2>/dev/null) + tx_rate=$(uci get natflow.@qos_simple[$idx].tx_rate 2>/dev/null) + rx_rate=$(get_rate_data "$rx_rate") + tx_rate=$(get_rate_data "$tx_rate") + echo set-token-ctrl $ip $rx_rate $tx_rate >/dev/userinfo_ctl + break + fi + fi + idx=$((idx+1)) + done + done +} + +start() { + cat /dev/userinfo_ctl | while read line; do + ip=${line//,*} + idx=0 + while uci get natflow.@qos_simple[$idx] &>/dev/null; do + disabled=$(uci get natflow.@qos_simple[$idx].disabled 2>/dev/null || echo 0) + if [ "$disabled" = "0" ]; then + user=$(uci get natflow.@qos_simple[$idx].user 2>/dev/null) + if test -z "$user" || $IPOPS netStrings_test_netStrings "$user" "$ip"; then + rx_rate=$(uci get natflow.@qos_simple[$idx].rx_rate 2>/dev/null) + tx_rate=$(uci get natflow.@qos_simple[$idx].tx_rate 2>/dev/null) + rx_rate=$(get_rate_data "$rx_rate") + tx_rate=$(get_rate_data "$tx_rate") + echo set-token-ctrl $ip $rx_rate $tx_rate + echo set-token-ctrl $ip $rx_rate $tx_rate >/dev/userinfo_ctl + break + fi + fi + idx=$((idx+1)) + done + done + + qos_simple_watch & +} + +stop() { + kill -TERM $(pgrep -f "cat /dev/userinfo_event_ctl") &>/dev/null + cat /dev/userinfo_ctl | while read line; do + ip=${line//,*} + echo set-token-ctrl $ip 0 0 >/dev/userinfo_ctl + done +} + +restart() { + stop + start +} diff --git a/natflow/files/natflow-user.init b/natflow/files/natflow-user.init new file mode 100644 index 000000000..46caf212d --- /dev/null +++ b/natflow/files/natflow-user.init @@ -0,0 +1,105 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=95 + +DEVCTL=/dev/natflow_user_ctl +IPOPS="lua /usr/lib/lua/ipops.lua" +test -e /usr/share/natflow/ipops.lua && IPOPS="lua /usr/share/natflow/ipops.lua" + +auth_idx=0 + +# ipset_add ipsetname net +ipv4set_add() +{ + local ipsetname=$1 + local net=$2 + #hack for 0.0.0.0/0 + [ "$net" = "0.0.0.0/0" ] && net="0.0.0.0/1 128.0.0.0/1" + for n in $net; do + ipset add $ipsetname $n + done +} + +natflow_user_setup() +{ + local idx=$auth_idx + auth_idx=$((auth_idx+1)) + local cfg="$1" + local enabled szone type sipgrp ipwhite macwhite + + config_get enabled "$cfg" enabled + config_get szone "$cfg" szone + config_get type "$cfg" type + config_get sipgrp "$cfg" sipgrp + config_get ipwhite "$cfg" ipwhite + config_get macwhite "$cfg" macwhite + + [ "$enabled" = "1" ] || return 0 + + #echo auth id=0,szone=0,type=auto,sipgrp=auth_sipgrp,ipwhite=,macwhite= + + sipgrp=$($IPOPS netStrings2ipcidrStrings "$sipgrp") + ipset create auth_sipgrp_$idx nethash 2>/dev/null + ipset flush auth_sipgrp_$idx + for net in $(echo "$sipgrp" | sed 's/,/ /g'); do + ipv4set_add auth_sipgrp_$idx $net + done + + cmd="auth id=$idx,szone=$szone,type=$type,sipgrp=auth_sipgrp_$idx" + if test -n "$ipwhite"; then + ipwhite=$($IPOPS netStrings2ipcidrStrings "$ipwhite") + ipset create auth_ipwhite_$idx nethash 2>/dev/null + ipset flush auth_ipwhite_$idx + for net in $(echo "$ipwhite" | sed 's/,/ /g'); do + ipv4set_add auth_ipwhite_$idx $net + done + cmd="$cmd,ipwhite=auth_ipwhite_$idx" + else + cmd="$cmd,ipwhite=" + fi + + if test -n "$macwhite"; then + ipset create auth_macwhite_$idx machash 2>/dev/null + ipset flush auth_macwhite_$idx + for mac in $(echo "$macwhite" | sed 's/,/ /g'); do + ipset add auth_macwhite_$idx $mac + done + cmd="$cmd,macwhite=auth_macwhite_$idx" + else + cmd="$cmd,macwhite=" + fi + + echo "$cmd" >$DEVCTL +} + +start() { + test -c $DEVCTL || return 0 + + echo clean >$DEVCTL + echo disabled=0 >$DEVCTL + + config_load natflow + config_foreach natflow_user_setup auth + + no_flow_timeout=$(uci get natflow.globals.no_flow_timeout 2>/dev/null || echo 1800) + echo no_flow_timeout=${no_flow_timeout} >$DEVCTL + redirect_ip=$(uci get natflow.globals.redirect_ip 2>/dev/null || echo 10.10.10.10) + echo redirect_ip=${redirect_ip} >$DEVCTL + + echo update_magic >$DEVCTL +} + +stop() { + test -c $DEVCTL || return 0 + + echo disabled=1 >$DEVCTL + ipset list -n | grep ^auth_ | while read ipset; do + ipset destroy $ipset + done +} + +restart() { + stop + start +} diff --git a/natflow/files/natflow-zone.init b/natflow/files/natflow-zone.init new file mode 100644 index 000000000..5c0157334 --- /dev/null +++ b/natflow/files/natflow-zone.init @@ -0,0 +1,49 @@ +#!/bin/sh /etc/rc.common +# Copyright (C) 2006-2011 OpenWrt.org + +START=95 + +DEVCTL=/dev/natflow_zone_ctl + +zone_idx=0 + +natflow_zone_setup() +{ + local idx=$zone_idx + zone_idx=$((zone_idx+1)) + local cfg="$1" + local fw_zone ifname type + + config_get fw_zone "$cfg" fw_zone + config_get ifname "$cfg" ifname + config_get type "$cfg" type + + (for fwz in $fw_zone; do + fw3 -q zone $fwz + done; \ + for ifn in $ifname; do + echo $ifn + done) | sed 's/\*$/+/' | sort | uniq | while read IFN; do + echo $type $idx=$IFN >$DEVCTL + done +} + +start() { + test -c $DEVCTL || return 0 + + echo clean >$DEVCTL + + config_load natflow + config_foreach natflow_zone_setup zone + + echo update_match >$DEVCTL +} + +stop() { + test -c $DEVCTL || return 0 +} + +restart() +{ + start +} diff --git a/natflow/files/natflow.config b/natflow/files/natflow.config new file mode 100644 index 000000000..932499a7f --- /dev/null +++ b/natflow/files/natflow.config @@ -0,0 +1,46 @@ +config natflow 'main' + option hwnat '1' + option hwnat_wed '0' + option enabled '1' + option debug '3' + option delay_pkts '0' + option skip_qos_to_slow_path '0' + list ifname_filter '' + +config globals 'globals' + option redirect_ip '10.10.10.1' + option no_flow_timeout '1800' + +config auth + option enabled '1' + option szone '0' + option type 'auto' + option sipgrp '192.168.15.2-192.168.15.254' + option ipwhite '' + option macwhite '' + +config zone + option type 'lan_zone' + list fw_zone 'lan' + list ifname 'tun+' + +config zone + option type 'wan_zone' + list fw_zone 'wan' + list ifname 'ppp+' + +config qos 'example' + option user '192.168.15.0/24' #ip,iprange,ipcidr or '' + option user_port '' + option remote '' + option remote_port '80,443' + option proto 'tcp' # tcp or udp or '' + option rx_rate '10Mbps' + option tx_rate '5Mbps' + option disabled '1' + +config qos_simple "simple1" + option user '192.168.15.0/24' + option rx_rate '10Mbps' + option tx_rate '5Mbps' + option disabled '1' diff --git a/ngrokc/Makefile b/ngrokc/Makefile new file mode 100644 index 000000000..f59fb735f --- /dev/null +++ b/ngrokc/Makefile @@ -0,0 +1,40 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=ngrokc +PKG_VERSION:=1.55 +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/dosgo/ngrok-c.git +PKG_SOURCE_DATE:=2021-09-01 +PKG_SOURCE_VERSION:=5da550284ed5bec7fa843c574e52b840e918fa4c +PKG_MIRROR_HASH:=3b62878222f93d267b69a6e8542a381d1ab7aeda9457d3bb3a86cccb8b8feb0b + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/ngrokc + SECTION:=net + CATEGORY:=Network + SUBMENU:=Web Servers/Proxies + TITLE:=Secure tunnels to localhost (C++ port) + URL:=https://github.com/dosgo/ngrok-c + DEPENDS:=+libc +libpthread +libopenssl +libstdcpp +zlib \ + +USE_GLIBC:libatomic +endef + +define Build/Prepare + $(call Build/Prepare/Default) + $(CP) $(PKG_BUILD_DIR)/Makefile.openssl $(PKG_BUILD_DIR)/Makefile +endef + +define Package/ngrokc/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/ngrokc $(1)/usr/bin +endef + +$(eval $(call BuildPackage,ngrokc)) diff --git a/njitclient/Makefile b/njitclient/Makefile new file mode 100644 index 000000000..087bac0f0 --- /dev/null +++ b/njitclient/Makefile @@ -0,0 +1,40 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=njit8021xclient +PKG_BASE_VERSION:=2.0 +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/bitdust/njit8021xclient.git +PKG_SOURCE_DATE:=2018-11-24 +PKG_SOURCE_VERSION:=dd28c17f24275bbbf4c44504b832c0f1e6b9ae40 +PKG_MIRROR_HASH:=66e4f20ceeceaed457657b60ec0b390aab0d7ff380b0abe749738b8f4aa23556 + +PKG_VERSION:=$(PKG_BASE_VERSION)-$(PKG_SOURCE_DATE)-$(call version_abbrev,$(PKG_SOURCE_VERSION)) + +PKG_FIXUP:=autoreconf +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/njit8021xclient + SECTION:=net + CATEGORY:=Network + SUBMENU:=Campus Network + TITLE:=NJIT 802.1X client program + DEPENDS:=+libopenssl +libpcap +endef + +define Package/njit8021xclient/description + 802.1X client from Nanjing Institude of Technology, compatable with + H3C iNode 802.1X client. Support H3C/iNode's private authentication + protocol V7.10. +endef + +define Package/njit8021xclient/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/njit-client $(1)/usr/sbin/ +endef + +$(eval $(call BuildPackage,njit8021xclient)) diff --git a/oscam/Config.in b/oscam/Config.in new file mode 100644 index 000000000..0b86f6695 --- /dev/null +++ b/oscam/Config.in @@ -0,0 +1,241 @@ +menu "OSCam build options" + depends on PACKAGE_oscam + +config OSCAM_USE_LIBCRYPTO + bool "Build with OpenSSL libcrypto" + help + "Use OpenSSL libcrypto instead of OSCam internal crypto functions" + default y + +config OSCAM_USE_LIBUSB + bool + default y + + menu "Protocols" + depends on PACKAGE_oscam + + config OSCAM_MODULE_CAMD33 + bool "camd 3.3" + default y + + config OSCAM_MODULE_CAMD35 + bool "camd 3.5 UDP" + default y + + config OSCAM_MODULE_CAMD35_TCP + bool "camd 3.5 TCP" + default y + + config OSCAM_MODULE_NEWCAMD + bool "newcamd" + default y + + config OSCAM_MODULE_CCCAM + bool "CCcam" + default y + + config OSCAM_MODULE_CCCSHARE + bool "CCcam share" + default y + + config OSCAM_MODULE_GBOX + bool "gbox" + default y + + config OSCAM_MODULE_RADEGAST + bool "radegast" + default y + + config OSCAM_MODULE_SERIAL + bool "Serial" + default y + + config OSCAM_MODULE_CONSTCW + bool "constant CW" + default y + + config OSCAM_MODULE_PANDORA + bool "Pandora" + default y + + config OSCAM_MODULE_GHTTP + bool "Ghttp" + default y + + config OSCAM_MODULE_SCAM + bool "scam" + default y + + endmenu + + menu "Readers" + depends on PACKAGE_oscam + + config OSCAM_READER_NAGRA + bool "Nagravision" + default y + + config OSCAM_READER_IRDETO + bool "Irdeto" + default y + + config OSCAM_READER_CONAX + bool "Conax" + default y + + config OSCAM_READER_CRYPTOWORKS + bool "Cryptoworks" + default y + + config OSCAM_READER_SECA + bool "Seca" + default y + + config OSCAM_READER_VIACCESS + bool "Viaccess" + default y + + config OSCAM_READER_VIDEOGUARD + bool "NDS Videoguard" + default y + + config OSCAM_READER_DRE + bool "DRE Crypt" + default y + + config OSCAM_READER_TONGFANG + bool "Tongfang" + default y + + config OSCAM_READER_BULCRYPT + bool "Bulcrypt" + default y + + config OSCAM_READER_GRIFFIN + bool "Griffin" + default y + + config OSCAM_READER_DGCRYPT + bool "DGCrypt" + default y + + endmenu + + menu "Card readers" + depends on PACKAGE_oscam + + config OSCAM_USE_PCSC + bool "PCSC compatible readers" + select OSCAM_USE_LIBUSB + default y + + config OSCAM_CARDREADER_PHOENIX + bool "Phoenix/mouse USB readers" + select OSCAM_USE_LIBUSB + default y + + config OSCAM_CARDREADER_SC8IN1 + bool "SC8in1" + select OSCAM_USE_LIBUSB + default y + + config OSCAM_CARDREADER_MP35 + bool "AD-Teknik MP 3.6/USB Phoenix" + select OSCAM_USE_LIBUSB + default y + + config OSCAM_CARDREADER_SMARGO + bool "Argolis Smargo Smartreader" + select OSCAM_USE_LIBUSB + default y + + config OSCAM_CARDREADER_STINGER + bool "Stinger USB Dual Smartcard Reader" + select OSCAM_USE_LIBUSB + default y + + config OSCAM_CARDREADER_DRECAS + bool "DRECAS reader" + default y + + endmenu + +comment "Addons" +config OSCAM_HAVE_DVBAPI + bool "DVB API" + default y + +config OSCAM_READ_SDT_CHARSETS + bool "DVB API read-sdt charsets" + default y + +config OSCAM_IRDETO_GUESSING + bool "Irdeto guessing" + default y + +config OSCAM_CS_ANTICASC + bool "Anti cascading" + default y + +config OSCAM_WITH_DEBUG + bool "Debug messages" + default y + +config OSCAM_MODULE_MONITOR + bool "Monitor" + default y + +config OSCAM_WITH_LB + bool "Loadbalancing" + default y + +config OSCAM_S_CACHEEX + bool "Cache exchange" + default y + +config OSCAM_CW_CYCLE_CHECK + bool "CW Cycle Check" + default y + +config OSCAM_LCDSUPPORT + bool "LCD support" + default n + +config OSCAM_LEDSUPPORT + bool "LED support" + default n + +config OSCAM_CLOCKFIX + bool "Clockfix (disable on old systems!)" + default y + +config OSCAM_IPV6SUPPORT + bool "IPv6 support (experimental)" + default n + +config OSCAM_WEBIF + bool "Web Interface" + default y + + config OSCAM_WEBIF_LIVELOG + bool "LiveLog" + depends on OSCAM_WEBIF + default y + + config OSCAM_WEBIF_JQUERY + bool "Jquery onboard (if disabled webload)" + depends on OSCAM_WEBIF + default y + + config OSCAM_TOUCH + bool "Touch Web Interface" + depends on OSCAM_WEBIF + default y + + config OSCAM_WITH_SSL + bool "SSL support" + depends on OSCAM_WEBIF + select OSCAM_USE_LIBCRYPTO + default y + +endmenu diff --git a/oscam/Makefile b/oscam/Makefile new file mode 100644 index 000000000..788e8cf8d --- /dev/null +++ b/oscam/Makefile @@ -0,0 +1,156 @@ +# +# Copyright (C) 2016-2017 Tomasz Maciej Nowak +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +include $(TOPDIR)/rules.mk + +PKG_NAME:=oscam +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/nx111/oscam.git +PKG_SOURCE_DATE:=2020-12-12 +PKG_SOURCE_VERSION:=aafda4bca3c347698ef1dc32f7ebeff76378d55a +PKG_MIRROR_HASH:=d2cd4508ef80a3cbd8ef950e5446f2f754b339f179c4f774ef8660b39fd5c4c1 + +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILE:=COPYING +PKG_MAINTAINER:=Tomasz Maciej Nowak + +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/oscam/config + source "$(SOURCE)/Config.in" +endef + +define Package/oscam + SECTION:=net + CATEGORY:=Network + TITLE:=Open Source Conditional Access Modul + URL:=http://www.streamboard.tv/oscam + DEPENDS:=+OSCAM_USE_LIBCRYPTO:libopenssl +OSCAM_USE_LIBUSB:libusb-1.0 +OSCAM_USE_PCSC:pcscd +endef + +define Package/list-smargo + SECTION:=net + CATEGORY:=Network + TITLE:=List Smargo readers + URL:=http://www.streamboard.tv/oscam + DEPENDS:=oscam @OSCAM_CARDREADER_SMARGO +endef + +CONFIGURE_CMD:=./config.sh +CONFIGURE_ARGS+= \ + --restore \ + $(if $(CONFIG_OSCAM_WEBIF),--enable,--disable) WEBIF \ + $(if $(CONFIG_OSCAM_WEBIF_LIVELOG),--enable,--disable) WEBIF_LIVELOG \ + $(if $(CONFIG_OSCAM_WEBIF_JQUERY),--enable,--disable) WEBIF_JQUERY \ + $(if $(CONFIG_OSCAM_TOUCH),--enable,--disable) TOUCH \ + $(if $(CONFIG_OSCAM_WITH_SSL),--enable,--disable) WITH_SSL \ + $(if $(CONFIG_OSCAM_HAVE_DVBAPI),--enable,--disable) HAVE_DVBAPI \ + $(if $(CONFIG_OSCAM_READ_SDT_CHARSETS),--enable,--disable) READ_SDT_CHARSETS \ + $(if $(CONFIG_OSCAM_IRDETO_GUESSING),--enable,--disable) IRDETO_GUESSING \ + $(if $(CONFIG_OSCAM_CS_ANTICASC),--enable,--disable) CS_ANTICASC \ + $(if $(CONFIG_OSCAM_WITH_DEBUG),--enable,--disable) WITH_DEBUG \ + $(if $(CONFIG_OSCAM_MODULE_MONITOR),--enable,--disable) MODULE_MONITOR \ + $(if $(CONFIG_OSCAM_WITH_LB),--enable,--disable) WITH_LB \ + $(if $(CONFIG_OSCAM_CS_CACHEEX),--enable,--disable) CS_CACHEEX \ + $(if $(CONFIG_OSCAM_CW_CYCLE_CHECK),--enable,--disable) CW_CYCLE_CHECK \ + $(if $(CONFIG_OSCAM_LCDSUPPORT),--enable,--disable) LCDSUPPORT \ + $(if $(CONFIG_OSCAM_LEDSUPPORT),--enable,--disable) LEDSUPPORT \ + $(if $(CONFIG_OSCAM_CLOCKFIX),--enable,--disable) CLOCKFIX \ + $(if $(CONFIG_OSCAM_IPV6SUPPORT),--enable,--disable) IPV6SUPPORT \ + $(if $(CONFIG_OSCAM_MODULE_CAMD33),--enable,--disable) MODULE_CAMD33 \ + $(if $(CONFIG_OSCAM_MODULE_CAMD35),--enable,--disable) MODULE_CAMD35 \ + $(if $(CONFIG_OSCAM_MODULE_CAMD35_TCP),--enable,--disable) MODULE_CAMD35_TCP \ + $(if $(CONFIG_OSCAM_MODULE_NEWCAMD),--enable,--disable) MODULE_NEWCAMD \ + $(if $(CONFIG_OSCAM_MODULE_CCCAM),--enable,--disable) MODULE_CCCAM \ + $(if $(CONFIG_OSCAM_MODULE_CCCSHARE),--enable,--disable) MODULE_CCCSHARE \ + $(if $(CONFIG_OSCAM_MODULE_GBOX),--enable,--disable) MODULE_GBOX \ + $(if $(CONFIG_OSCAM_MODULE_RADEGAST),--enable,--disable) MODULE_RADEGAST \ + $(if $(CONFIG_OSCAM_MODULE_SCAM),--enable,--disable) MODULE_SCAM \ + $(if $(CONFIG_OSCAM_MODULE_SERIAL),--enable,--disable) MODULE_SERIAL \ + $(if $(CONFIG_OSCAM_MODULE_CONSTCW),--enable,--disable) MODULE_CONSTCW \ + $(if $(CONFIG_OSCAM_MODULE_PANDORA),--enable,--disable) MODULE_PANDORA \ + $(if $(CONFIG_OSCAM_MODULE_GHTTP),--enable,--disable) MODULE_GHTTP \ + $(if $(CONFIG_OSCAM_READER_NAGRA),--enable,--disable) READER_NAGRA \ + $(if $(CONFIG_OSCAM_READER_IRDETO),--enable,--disable) READER_IRDETO \ + $(if $(CONFIG_OSCAM_READER_CONAX),--enable,--disable) READER_CONAX \ + $(if $(CONFIG_OSCAM_READER_CRYPTOWORKS),--enable,--disable) READER_CRYPTOWORKS \ + $(if $(CONFIG_OSCAM_READER_SECA),--enable,--disable) READER_SECA \ + $(if $(CONFIG_OSCAM_READER_VIACCESS),--enable,--disable) READER_VIACCESS \ + $(if $(CONFIG_OSCAM_READER_VIDEOGUARD),--enable,--disable) READER_VIDEOGUARD \ + $(if $(CONFIG_OSCAM_READER_DRE),--enable,--disable) READER_DRE \ + $(if $(CONFIG_OSCAM_READER_TONGFANG),--enable,--disable) READER_TONGFANG \ + $(if $(CONFIG_OSCAM_READER_BULCRYPT),--enable,--disable) READER_BULCRYPT \ + $(if $(CONFIG_OSCAM_READER_GRIFFIN),--enable,--disable) READER_GRIFFIN \ + $(if $(CONFIG_OSCAM_READER_DGCRYPT),--enable,--disable) READER_DGCRYPT \ + $(if $(CONFIG_OSCAM_CARDREADER_PHOENIX),--enable,--disable) CARDREADER_PHOENIX \ + $(if $(CONFIG_OSCAM_CARDREADER_SC8IN1),--enable,--disable) CARDREADER_SC8IN1 \ + $(if $(CONFIG_OSCAM_CARDREADER_MP35),--enable,--disable) CARDREADER_MP35 \ + $(if $(CONFIG_OSCAM_CARDREADER_SMARGO),--enable,--disable) CARDREADER_SMARGO \ + $(if $(CONFIG_OSCAM_CARDREADER_STINGER),--enable,--disable) CARDREADER_STINGER \ + $(if $(CONFIG_OSCAM_CARDREADER_DRECAS),--enable,--disable) CARDREADER_DRECAS \ + --disable CARDREADER_INTERNAL_AZBOX \ + --disable CARDREADER_INTERNAL_COOLAPI \ + --disable CARDREADER_INTERNAL_COOLAPI2 \ + --disable CARDREADER_INTERNAL_SCI \ + --disable CARDREADER_DB2COM \ + --disable CARDREADER_STAPI \ + --disable CARDREADER_STAPI5 + +ifeq ($(CONFIG_OSCAM_USE_LIBUSB),y) + MAKE_FLAGS += USE_LIBUSB=1 +endif + +ifeq ($(CONFIG_OSCAM_USE_PCSC),y) + MAKE_FLAGS += USE_PCSC=1 +endif + +ifeq ($(CONFIG_OSCAM_USE_LIBCRYPTO),y) + MAKE_FLAGS += USE_LIBCRYPTO=1 +endif + +ifeq ($(CONFIG_OSCAM_WITH_SSL),y) + MAKE_FLAGS += USE_SSL=1 +endif + +MAKE_FLAGS += \ + CONF_DIR=/etc/oscam \ + OSCAM_BIN=Distribution/oscam \ + LIST_SMARGO_BIN=Distribution/list-smargo + +define Package/oscam/conffiles +/etc/oscam/ +endef + +define Package/oscam/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/Distribution/oscam $(1)/usr/bin/oscam + + $(INSTALL_DIR) $(1)/etc/oscam + # $(CP) $(PKG_BUILD_DIR)/Distribution/doc/example/* $(1)/etc/oscam/ + $(INSTALL_CONF) ./files/oscam.conf $(1)/etc/oscam/oscam.conf + $(INSTALL_CONF) ./files/oscam.user $(1)/etc/oscam/oscam.user + $(INSTALL_CONF) ./files/oscam.dvbapi $(1)/etc/oscam/oscam.dvbapi + $(INSTALL_CONF) ./files/oscam.server $(1)/etc/oscam/oscam.server + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/oscam.init $(1)/etc/init.d/oscam + + $(INSTALL_DIR) $(1)/usr/share/oscam + $(INSTALL_BIN) ./files/oscam-watchdog.sh $(1)/usr/share/oscam/oscam-watchdog.sh + +endef + +define Package/list-smargo/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/Distribution/list-smargo $(1)/usr/bin/list-smargo +endef + +$(eval $(call BuildPackage,oscam)) +$(eval $(call BuildPackage,list-smargo)) diff --git a/oscam/files/oscam-watchdog.sh b/oscam/files/oscam-watchdog.sh new file mode 100755 index 000000000..d998af0f1 --- /dev/null +++ b/oscam/files/oscam-watchdog.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +sleeptime=60 +logfile="/var/log/oscam.log" +OSCAM_PATH=/usr/bin +enable=$(uci get oscam.config.enabled 2>/dev/null) + +oscam_log(){ + logrow=$(grep -c "" ${logfile}) + if [ $logrow -ge 500 ];then + cat /dev/null > ${logfile} + echo "$curtime Log条数超限,清空处理!" >> ${logfile} + fi +} + +while [ $enable -eq 1 ]; +do + oscam_log + curtime=`date "+%H:%M:%S"` + echo "$curtime online! " + + if ! pidof oscam>/dev/null; then + service_start ${OSCAM_PATH}/oscam -b -r 2 -u + echo "$curtime 重启服务!" >> ${logfile} + fi + +sleep ${sleeptime} +continue +done + + diff --git a/oscam/files/oscam.conf b/oscam/files/oscam.conf new file mode 100644 index 000000000..dff8e5397 --- /dev/null +++ b/oscam/files/oscam.conf @@ -0,0 +1,48 @@ +# oscam.conf generated automatically by Streamboard OSCAM 1.20-unstable_svn SVN r11390 +# Read more: http://www.streamboard.tv/svn/oscam/trunk/Distribution/doc/txt/oscam.conf.txt + +[global] +disablelog = 1 +logfile = /var/log/oscam/oscam.log +nice = 0 +maxlogsize = 1000 +preferlocalcards = 1 +lb_mode = 3 +lb_min_ecmcount = 8 + +[cache] + +[dvbapi] +enabled = 1 +au = 1 +pmt_mode = 4 +request_mode = 1 +listen_port = 9000 +delayer = 80 +user = TVH +boxtype = pc + +[camd33] +port = 44444 +serverip = 127.0.0.1 +nocrypt = 127.0.0.1 + +[cccam] +port = 12000 +nodeid = 178EC950108E1442 +version = 2.3.0 +reshare = 1 +ignorereshare = 1 +stealth = 1 + +[webif] +httpport = 8888 +httpuser = oscam +httppwd = oscam +httpshowmeminfo = 1 +httpshowuserinfo = 1 +httpshowecminfo = 1 +httpshowloadinfo = 1 +httpallowed = 0.0.0.0-255.255.255.255 +aulow = 120 +httputf8 diff --git a/oscam/files/oscam.dvbapi b/oscam/files/oscam.dvbapi new file mode 100755 index 000000000..68fc1c027 --- /dev/null +++ b/oscam/files/oscam.dvbapi @@ -0,0 +1,31 @@ +P: 0500:040620 # NTV+ (36Е) +P: 0500:041200 # NTV+ (36Е) +P: 0500:060A00 # NTV+ (36E) +P: 0500:060C00 # NTV+ (36E) +P: 0500:023100 # trk football (Shara)(5Е) +P: 0500:041200 # trk football (Shara)(5Е) +P: 0500:041700 # Dorcel TV (13Е) +P: 0500:042300 # rtvi (13Е) +P: 0500:042700 # SCT, S1-7-HQ,HD (13Е) +P: 0500:042800 # Absat/BisTV (13Е) +P: 0500:043800 # REDLIGHT HD, Redlight Premium & Daring! TV (13Е) +P: 0100:000068 # Cyfra+ 13e +P: 09CD:0 # Sky 13e +P: 1803:007001 # Polsat (13Е) +P: 1803:007101 # Polsat (13Е) +P: 1803:000000 # Polsat (13Е) +P: 090D:0 # yes 4w +P: 090F:0 # viasat baltic 5e + +# EMU +P: 2600:000000 # BISS +P: 0500:023800 # srg (EMU)(13Е) +P: 0E00:000000 # PowerVU +P: 0500:007400 +P: 0D00:000000 +P: 0D05:000000 +P: 0D02:000000 +P: 1801:000000 + +# Ignor +I:0 diff --git a/oscam/files/oscam.init b/oscam/files/oscam.init new file mode 100755 index 000000000..78f7029c2 --- /dev/null +++ b/oscam/files/oscam.init @@ -0,0 +1,45 @@ +#!/bin/sh /etc/rc.common + +START=99 +OSCAM_PATH=/usr/bin + +[ -f /tmp/oscam ] && +{ + OSCAM_PATH=/tmp + [ -x /tmp/oscam ] || chmod +x /tmp/oscam +} + +start() { + enable=$(uci get oscam.config.enabled 2>/dev/null) + kill -9 $(ps | grep oscam-watchdog.sh | grep -v "grep" | awk '{print $1}') >/dev/null 2>&1 + if [ $enable -eq 1 ]; then + /etc/init.d/pcscd enable + /etc/init.d/pcscd start + if pidof oscam >/dev/null; then + kill $(pidof oscam) >/dev/null 2>&1 || killall -9 oscam >/dev/null 2>&1 + sleep 1 + fi + echo "enable" + [ -d /var/log/oscam ] || mkdir -p /var/log/oscam + service_start ${OSCAM_PATH}/oscam -b -r 2 -u + nohup /usr/share/oscam/oscam-watchdog.sh > /var/log/oscam.log 2>&1 & + fi +} + +stop() { + enable=$(uci get oscam.config.enabled 2>/dev/null) + if [ $enable -ne 1 ]; then + echo "stop!" + kill -9 $(ps | grep oscam-watchdog.sh | grep -v "grep" | awk '{print $1}') >/dev/null 2>&1 + kill $(pidof oscam) >/dev/null 2>&1 || killall -9 oscam >/dev/null 2>&1 + /etc/init.d/pcscd stop + /etc/init.d/pcscd disable + fi +} + +restart(){ + stop + sleep 2 + start + echo "oscam Server has restarted." +} \ No newline at end of file diff --git a/oscam/files/oscam.server b/oscam/files/oscam.server new file mode 100755 index 000000000..0b337bda6 --- /dev/null +++ b/oscam/files/oscam.server @@ -0,0 +1,14 @@ +# oscam.server generated automatically by Streamboard OSCAM 1.20-unstable_svn SVN r11401 +# Read more: http://www.streamboard.tv/svn/oscam/trunk/Distribution/doc/txt/oscam.server.txt + +[reader] +label = emulator +protocol = emu +device = emulator +caid = 0D00,0D02,090F,0500,1801,0604,2600,FFFF,0E00 +detect = cd +ident = 0D00:000000,000004,000010,000014,000020,0000C0,0000C4,0000C8,0000CC;0D02:000000,00008C,0000A0,0000A4,0000A8;090F:000000;0500:000000,030B00,023800,021110,007400,007800;1801:000000,007301,001101;0604:000000;2600:000000;FFFF:000000;0E00:000000 +group = 1 +emmcache = 2,3,2,0 +emu_auproviders = 0500:030B00;0604:010200;0E00:000000 + diff --git a/oscam/files/oscam.user b/oscam/files/oscam.user new file mode 100755 index 000000000..5e02dd83e --- /dev/null +++ b/oscam/files/oscam.user @@ -0,0 +1,27 @@ +# oscam.user generated automatically by Streamboard OSCAM 1.20-unstable_svn SVN r11401 +# Read more: http://www.streamboard.tv/svn/oscam/trunk/Distribution/doc/txt/oscam.user.txt + +[account] +user = tvheadend_x +pwd = tvheadend_x +monlevel = 4 +au = 1 +group = 1 +max_connections = 100 +cccreshare = 1 + +[account] +user = user1 +pwd = user1 +monlevel = 4 +au = 1 +group = 1 +max_connections = 100 +cccreshare = 1 + +[account] +user = monitor +pwd = monitor +monlevel = 4 +group = 1 + diff --git a/quickjspp/Makefile b/quickjspp/Makefile new file mode 100644 index 000000000..a3aa76095 --- /dev/null +++ b/quickjspp/Makefile @@ -0,0 +1,53 @@ +# SPDX-License-Identifier: GPL-3.0-only +# +# Copyright (C) 2021 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +PKG_NAME:=quickjspp +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/ftk/quickjspp.git +PKG_SOURCE_DATE:=2022-07-22 +PKG_SOURCE_VERSION:=9cee4b4d27271d54b95f6f42bfdc534ebeaaeb72 +PKG_MIRROR_HASH:=1d23111923565d8f125ca52386299d7e497328765a30d677f9437687470c89a4 + +PKG_MAINTAINER:=Tianling Shen + +PKG_BUILD_PARALLEL:=1 +CMAKE_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/libquickjs + SECTION:=lib + CATEGORY:=Libraries + URL:=https://bellard.org/quickjs/ + TITLE:=A small and embeddable Javascript engine + # mips(el) & glibc require it + DEPENDS:=+libatomic +endef + +define Package/libquickjs/description + QuickJS is a small and embeddable Javascript engine. It supports the + ES2020 specification including modules, asynchronous generators, + proxies and BigInt. + + It optionally supports mathematical extensions such as big decimal + floating point numbers (BigDecimal), big binary floating point + numbers (BigFloat) and operator overloading. +endef + +CMAKE_OPTIONS+= \ + -DBUILD_SHARED_LIBS=ON \ + -DBUILD_TESTING=OFF \ + -DCMAKE_EXE_LINKER_FLAGS="-latomic" + +define Package/libquickjs/install + $(INSTALL_DIR) $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libquickjs.so $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,libquickjs)) diff --git a/quickjspp/patches/100-musl.patch b/quickjspp/patches/100-musl.patch new file mode 100644 index 000000000..022fb71d5 --- /dev/null +++ b/quickjspp/patches/100-musl.patch @@ -0,0 +1,15 @@ +--- a/quickjs/quickjs.c ++++ b/quickjs/quickjs.c +@@ -78,6 +78,12 @@ + #define CONFIG_STACK_CHECK + #endif + ++#ifndef FE_UPWARD ++#define FE_UPWARD 0x800 ++#endif ++#ifndef FE_DOWNWARD ++#define FE_DOWNWARD 0x400 ++#endif + + /* dump object free */ + //#define DUMP_FREE diff --git a/quickjspp/patches/200-libdir.patch b/quickjspp/patches/200-libdir.patch new file mode 100644 index 000000000..b8e8f57aa --- /dev/null +++ b/quickjspp/patches/200-libdir.patch @@ -0,0 +1,11 @@ +--- a/quickjs/CMakeLists.txt ++++ b/quickjs/CMakeLists.txt +@@ -22,6 +22,6 @@ endif() + include(GNUInstallDirs) + install(TARGETS quickjs + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/quickjs +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/quickjs +- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/quickjs ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) diff --git a/rapidjson/Makefile b/rapidjson/Makefile new file mode 100644 index 000000000..2ba7dcee8 --- /dev/null +++ b/rapidjson/Makefile @@ -0,0 +1,43 @@ +# SPDX-License-Identifier: GPL-3.0-only +# +# Copyright (C) 2021 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +PKG_NAME:=rapidjson +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/Tencent/rapidjson.git +PKG_SOURCE_DATE:=2022-08-23 +PKG_SOURCE_VERSION:=06d58b9e848c650114556a23294d0b6440078c61 +PKG_MIRROR_HASH:=3513dbcb4fdd5438adbe9cc348359c76d114a2cbf53de89866fc50cba992719b + +PKG_LICENSE:=BSD 3-Clause +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Tianling Shen + +PKG_BUILD_PARALLEL:=1 +CMAKE_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +CMAKE_OPTIONS+= \ + -DRAPIDJSON_BUILD_DOC=OFF \ + -DRAPIDJSON_BUILD_EXAMPLES=OFF \ + -DRAPIDJSON_BUILD_TESTS=OFF + +define Package/rapidjson + SECTION:=lib + CATEGORY:=Libraries + URL:=https://github.com/Tencent/rapidjson + TITLE:=rapidjson JSON parser/generator for C++ + BUILDONLY:=1 +endef + +define Package/rapidjson/description + A fast JSON parser/generator for C++ with both SAX/DOM style API +endef + +$(eval $(call BuildPackage,rapidjson)) diff --git a/scutclient/Makefile b/scutclient/Makefile new file mode 100644 index 000000000..f444f12e4 --- /dev/null +++ b/scutclient/Makefile @@ -0,0 +1,59 @@ +# +# Copyright (C) 2016-2018 SCUT Router Term +# +# This is free software, licensed under the GNU Affero General Public License v3. +# See /COPYING for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=scutclient +PKG_BASE_VERSION:=3.1.2 +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/scutclient/scutclient.git +PKG_SOURCE_DATE:=2020-11-29 +PKG_SOURCE_VERSION:=36128216c63f8954371e64d78ff30bca5e73a882 +PKG_MIRROR_HASH:=16be6312e7ca2e1b0201c2d2f7e01dbb6173fb9b13c93707ff272f992d4b3bff + +PKG_VERSION:=$(PKG_BASE_VERSION)-$(PKG_SOURCE_DATE)-$(call version_abbrev,$(PKG_SOURCE_VERSION)) + +PKG_MAINTAINER:=Scutclient Project +PKG_LICENSE:=AGPL-3.0 +PKG_LICENSE_FILE:=COPYING + +PKG_BUILD_PARALLEL:=1 +CMAKE_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/scutclient + SECTION:=net + CATEGORY:=Network + SUBMENU:=Campus Network + TITLE:=SCUT Dr.com client + URL:=https://github.com/scutclient/scutclient +endef + +define Package/scutclient/description + Support SCUT private authentication protocol. +endef + +define Package/scutclient/conffiles +/etc/config/scutclient +endef + +define Package/scutclient/install + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) $(PKG_BUILD_DIR)/openwrt/files/scutclient.config $(1)/etc/config/scutclient + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/files/scutclient.init $(1)/etc/init.d/scutclient + $(INSTALL_DIR) $(1)/etc/hotplug.d/iface + $(INSTALL_BIN) $(PKG_BUILD_DIR)/openwrt/files/scutclient.hotplug $(1)/etc/hotplug.d/iface/99-scutclient + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/scutclient $(1)/usr/bin +endef + +$(eval $(call BuildPackage,scutclient)) diff --git a/sub-web/Makefile b/sub-web/Makefile new file mode 100644 index 000000000..bb3e8a6d1 --- /dev/null +++ b/sub-web/Makefile @@ -0,0 +1,48 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=sub-web +PKG_RELEASE:=1 + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/CareyWang/sub-web.git +PKG_SOURCE_DATE:=2022-11-10 +PKG_SOURCE_VERSION:=71e53414a89b5fd5ec0ef453e32202194993d0cf +PKG_MIRROR_HASH:=2910c8a782c6a3b2886f91b1621a973a8d5923b9f6d979c9b3defaf0acca4e06 + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Tianling Shen + +PKG_BUILD_DEPENDS:=node/host node-yarn/host + +include $(INCLUDE_DIR)/package.mk + +define Package/sub-web + SECTION:=net + CATEGORY:=Network + URL:=https://github.com/CareyWang/sub-web + TITLE:=A WebUI for generating proxy subscription url + DEPENDS:=+subconverter + PKGARCH:=all +endef + +define Package/sub-web/description + Based on vue-cli and subconverter, for generating proxy subscription + url automatically. +endef + +define Build/Compile + ( \ + pushd "$(PKG_BUILD_DIR)"; \ + yarn install; \ + NODE_OPTIONS=--openssl-legacy-provider yarn build; \ + popd ; \ + ) +endef + +define Package/sub-web/install + $(INSTALL_DIR) $(1)/www/sub-web + $(CP) $(PKG_BUILD_DIR)/dist/* $(1)/www/sub-web/ +endef + +$(eval $(call BuildPackage,sub-web)) diff --git a/sub-web/patches/010-dist-support-run-in-curdir.patch b/sub-web/patches/010-dist-support-run-in-curdir.patch new file mode 100644 index 000000000..4c66bcca7 --- /dev/null +++ b/sub-web/patches/010-dist-support-run-in-curdir.patch @@ -0,0 +1,50 @@ +From 4359c358bd434d1d0b182a13a743881ee21e7d27 Mon Sep 17 00:00:00 2001 +From: CN_SZTL +Date: Mon, 11 Jan 2021 11:22:43 +0000 +Subject: [PATCH] dist: support run in curdir + +As https://cli.vuejs.org/config/#vue-config-js said: +``` +By default, Vue CLI assumes your app will be deployed at the root of +a domain, e.g. https://www.my-app.com/. If your app is deployed at a +sub-path, you will need to specify that sub-path using this option. +For example, if your app is deployed at https://www.foobar.com/my-app/, +set publicPath to '/my-app/'. + +The value can also be set to an empty string ('') or a relative path (./) +so that all assets are linked using relative paths. This allows the built +bundle to be deployed under any public path, or used in a file system based +environment like a Cordova hybrid app. +``` + +Reference: + - CareyWang/sub-web#38 + - CareyWang/sub-web#43 + +Signed-off-by: CN_SZTL +--- + src/router/index.js | 2 +- + vue.config.js | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +--- a/src/router/index.js ++++ b/src/router/index.js +@@ -5,7 +5,7 @@ Vue.use(VueRouter); + + const routes = [ + { +- path: "/", ++ path: "*", + name: "SubConverter", + component: () => import("../views/Subconverter.vue") + } +--- a/vue.config.js ++++ b/vue.config.js +@@ -5,6 +5,7 @@ function resolve(dir) { + } + + module.exports = { ++ publicPath: '', + css: { + loaderOptions: { + less: { diff --git a/sub-web/patches/020-views-add-examples-from-ACL4SSR-and-Subconverter.patch b/sub-web/patches/020-views-add-examples-from-ACL4SSR-and-Subconverter.patch new file mode 100644 index 000000000..e5fe2e78a --- /dev/null +++ b/sub-web/patches/020-views-add-examples-from-ACL4SSR-and-Subconverter.patch @@ -0,0 +1,123 @@ +From 0092ddca7faa480e07184c157e992badd4eef633 Mon Sep 17 00:00:00 2001 +From: CN_SZTL +Date: Mon, 11 Jan 2021 11:57:19 +0000 +Subject: [PATCH] views: add examples from ACL4SSR and Subconverter + +Signed-off-by: CN_SZTL +--- + src/views/Subconverter.vue | 104 +++++++++++++++++++++++++++++++++++++ + 1 file changed, 104 insertions(+) + +--- a/src/views/Subconverter.vue ++++ b/src/views/Subconverter.vue +@@ -299,6 +299,110 @@ export default { + backendOptions: [{ value: "http://127.0.0.1:25500/sub?" }], + remoteConfig: [ + { ++ label: "默认", ++ options: [ ++ { ++ label: "不选,由接口提供方提供", ++ value: "" ++ } ++ ] ++ }, ++ { ++ label: "ACL4SSR", ++ options: [ ++ { ++ label: "ACL4SSR_Online 默认版 分组比较全 (与Github同步)", ++ value: ++ "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online.ini" ++ }, ++ { ++ label: "ACL4SSR_Online_AdblockPlus 更多去广告 (与Github同步)", ++ value: ++ "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_AdblockPlus.ini" ++ }, ++ { ++ label: "ACL4SSR_Online_NoAuto 无自动测速 (与Github同步)", ++ value: ++ "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_NoAuto.ini" ++ }, ++ { ++ label: "ACL4SSR_Online_Mini 精简版 (与Github同步)", ++ value: ++ "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini.ini" ++ }, ++ { ++ label: "ACL4SSR_Online_Mini_AdblockPlus.ini 精简版 更多去广告 (与Github同步)", ++ value: ++ "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_AdblockPlus.ini" ++ }, ++ { ++ label: "ACL4SSR_Online_Mini_NoAuto.ini 精简版 不带自动测速 (与Github同步)", ++ value: ++ "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_NoAuto.ini" ++ }, ++ { ++ label: "ACL4SSR_Online_Mini_Fallback.ini 精简版 带故障转移 (与Github同步)", ++ value: ++ "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_Fallback.ini" ++ }, ++ { ++ label: "ACL4SSR_Online_Mini_MultiMode.ini 精简版 自动测速、故障转移、负载均衡 (与Github同步)", ++ value: ++ "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Mini_MultiMode.ini" ++ }, ++ { ++ label: "ACL4SSR_Online_Full 全分组 重度用户使用 (与Github同步)", ++ value: ++ "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full.ini" ++ }, ++ { ++ label: "ACL4SSR_Online_Full_AdblockPlus 全分组 重度用户使用 更多去广告 (与Github同步)", ++ value: ++ "https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online_Full_AdblockPlus.ini" ++ }, ++ { ++ label: "ACL4SSR 本地 默认版 分组比较全", ++ value: "config/ACL4SSR.ini" ++ }, ++ { ++ label: "ACL4SSR_Mini 本地 精简版", ++ value: "config/ACL4SSR_Mini.ini" ++ }, ++ { ++ label: "ACL4SSR_Mini_NoAuto.ini 本地 精简版+无自动测速", ++ value: "config/ACL4SSR_Mini_NoAuto.ini" ++ }, ++ { ++ label: "ACL4SSR_Mini_Fallback.ini 本地 精简版+fallback", ++ value: "config/ACL4SSR_Mini_Fallback.ini" ++ }, ++ { ++ label: "ACL4SSR_BackCN 本地 回国", ++ value: "config/ACL4SSR_BackCN.ini" ++ }, ++ { ++ label: "ACL4SSR_NoApple 本地 无苹果分流", ++ value: "config/ACL4SSR_NoApple.ini" ++ }, ++ { ++ label: "ACL4SSR_NoAuto 本地 无自动测速 ", ++ value: "config/ACL4SSR_NoAuto.ini" ++ }, ++ { ++ label: "ACL4SSR_NoAuto_NoApple 本地 无自动测速&无苹果分流", ++ value: "config/ACL4SSR_NoAuto_NoApple.ini" ++ }, ++ { ++ label: "ACL4SSR_NoMicrosoft 本地 无微软分流", ++ value: "config/ACL4SSR_NoMicrosoft.ini" ++ }, ++ { ++ label: "ACL4SSR_WithGFW 本地 GFW列表", ++ value: "config/ACL4SSR_WithGFW.ini" ++ } ++ ] ++ }, ++ { + label: "universal", + options: [ + { diff --git a/subconverter/Makefile b/subconverter/Makefile new file mode 100644 index 000000000..e33b023b7 --- /dev/null +++ b/subconverter/Makefile @@ -0,0 +1,53 @@ +# SPDX-License-Identifier: GPL-3.0-only +# +# Copyright (C) 2021 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +PKG_NAME:=subconverter +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE_PROTO:=git +PKG_SOURCE_URL:=https://github.com/tindy2013/subconverter.git +PKG_SOURCE_DATE:=2022-08-31 +PKG_SOURCE_VERSION:=35d296553bff0e7a641febfbff3320ae750469c6 +PKG_MIRROR_HASH:=f4ada87bf71e2347b95e632beca5aa114ee7a86865956806307a4c09495bdf33 +PKG_VERSION:=0.7.2-$(call version_abbrev,$(PKG_SOURCE_VERSION)) + +PKG_LICENSE:=GPL-3.0 +PKG_LICENSE_FILES:=LICENSE +PKG_MAINTAINER:=Tianling Shen + +PKG_BUILD_DEPENDS:=jpcre2 rapidjson toml11 +PKG_BUILD_PARALLEL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/subconverter + SECTION:=utils + CATEGORY:=Utilities + TITLE:=Utility to convert between various proxy subscription format + URL:=https://github.com/tindy2013/subconverter + DEPENDS:=+libatomic +libcron +libcurl +libevent2 +libpcre2 \ + +libquickjs +libstdcpp +libyaml-cpp +endef + +# mips(el) & glibc require it +CMAKE_OPTIONS+= -DCMAKE_EXE_LINKER_FLAGS="-latomic" + +TARGET_CXXFLAGS := $(filter-out -O%,$(TARGET_CXXFLAGS)) -O3 +TARGET_CXXFLAGS += -Wall -Wextra -ffunction-sections -fdata-sections -flto +TARGET_LDFLAGS += -Wl,--gc-sections -flto + +define Package/subconverter/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/subconverter $(1)/usr/bin/subconverter + $(INSTALL_DIR) $(1)/etc/subconverter + $(CP) $(PKG_BUILD_DIR)/base/* $(1)/etc/subconverter/ + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/subconverter.init $(1)/etc/init.d/subconverter +endef + +$(eval $(call BuildPackage,subconverter)) diff --git a/subconverter/files/subconverter.init b/subconverter/files/subconverter.init new file mode 100755 index 000000000..ff0d8e902 --- /dev/null +++ b/subconverter/files/subconverter.init @@ -0,0 +1,33 @@ +#!/bin/sh /etc/rc.common + +START=99 +USE_PROCD=1 + +BIN="/usr/bin/subconverter" +CONF="/etc/subconverter/pref.example.ini" +LOG_FILE="/tmp/subconverter.log" + +start_service() { + procd_open_instance + procd_set_param command "$BIN" + procd_append_param command -f "$CONF" + procd_append_param command -l "$LOG_FILE" + procd_set_param respawn ${respawn_threshold:-3600} ${respawn_timeout:-5} ${respawn_retry:-5} + procd_set_param limits core="unlimited" + procd_set_param stdout 1 + procd_set_param stderr 1 + procd_close_instance + logger -t Subconverter 'Starting Subconverter service' +} + +stop_service() { + rm -f "$LOG_FILE" + logger -t Subconverter 'Shutting down Subconverter service' +} + +reload_service() { + logger -t Subconverter 'Restarting Subconverter service' + stop + sleep 2s + start +} diff --git a/toml11/Makefile b/toml11/Makefile new file mode 100644 index 000000000..b817b5d9b --- /dev/null +++ b/toml11/Makefile @@ -0,0 +1,37 @@ +# SPDX-License-Identifier: GPL-3.0-only +# +# Copyright (C) 2021 ImmortalWrt.org + +include $(TOPDIR)/rules.mk + +PKG_NAME:=toml11 +PKG_VERSION:=3.7.1 +PKG_RELEASE:=$(AUTORELEASE) + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/ToruNiina/toml11/tar.gz/v$(PKG_VERSION)? +PKG_HASH:=afeaa9aa0416d4b6b2cd3897ca55d9317084103077b32a852247d8efd4cf6068 + +PKG_LICENSE:=MIT +PKG_LICENSE_FILES:=LICENSE + +PKG_BUILD_PARALLEL:=1 +CMAKE_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +include $(INCLUDE_DIR)/cmake.mk + +define Package/toml11 + SECTION:=lib + CATEGORY:=Libraries + TITLE:=C++11 header-only toml parser/encoder + URL:=https://github.com/ToruNiina/toml11 + BUILDONLY:=1 +endef + +define Package/toml11/description + toml11 is a C++11 (or later) header-only toml parser/encoder + depending only on C++ standard library. +endef + +$(eval $(call BuildPackage,toml11)) diff --git a/wxbase/Makefile b/wxbase/Makefile new file mode 100644 index 000000000..c34635863 --- /dev/null +++ b/wxbase/Makefile @@ -0,0 +1,125 @@ +# +# Copyright (C) 2007-2009 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=wxbase +PKG_VERSION:=2.8.12 +PKG_RELEASE:=2 + +PKG_SOURCE:=wxGTK-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:=@SF/wxwindows +PKG_HASH:=f4193c29fb0e790c9a5c8936f082377a7e51c76bccafe41f4f9da7ca15c0ef1a + +PKG_BUILD_DIR:=$(BUILD_DIR)/wxGTK-$(PKG_VERSION) +PKG_CHECK_FORMAT_SECURITY:=0 +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/libwxbase + SECTION:=libs + CATEGORY:=Libraries + TITLE:=Cross-platform C++ framework + URL:=http://www.wxwidgets.org/ + DEPENDS:=+libexpat +libstdcpp +zlib +libpthread +endef + +define Package/libwxbase/description + wxBase contains most of the non-GUI classes from the wxWindows cross- + -platform C++ framework. There are 2 categories: generally useful portable + code (date/time handling, command line parsing, regular expression support) + and wrappers for the OS objects (files, directories, sockets, threads, + etc.) allowing you to write portable programs easily. +endef + +TARGET_CFLAGS += $(FPIC) + +CONFIGURE_ARGS+= \ + --enable-shared \ + --disable-rpath \ + --with-gnu-ld \ + --disable-gui \ + --disable-monolithic \ + --enable-plugins \ + --disable-universal \ + --disable-nanox \ + --disable-gtk2 \ + --disable-gpe \ + --disable-optimise \ + --disable-debug \ + --disable-stl \ + --disable-omf \ + --disable-debug_flag \ + --disable-debug_info \ + --disable-debug_gdb \ + --disable-debug_cntxt \ + --disable-mem_tracing \ + --disable-profile \ + --disable-no_rtti \ + --disable-no_exceptions \ + --disable-compat22 \ + --disable-compat24 \ + --enable-intl \ + --disable-backtrace \ + --enable-exceptions \ + --disable-sound \ + --enable-largefile \ + --enable-unicode \ + \ + --without-gtk \ + --without-motif \ + --without-mac \ + --without-cocoa \ + --without-wine \ + --without-msw \ + --without-pm \ + --without-mgl \ + --without-microwin \ + --without-x11 \ + --without-libpng \ + --without-libjpeg \ + --without-libtiff \ + --without-libxpm \ + --without-libmspack \ + --without-sdl \ + --without-gnomeprint \ + --without-opengl \ + --without-dmalloc \ + --with-regex="sys" \ + --with-zlib="sys" \ + --without-odbc \ + --with-expat="sys" \ + --without-gtk-prefix \ + --without-x \ + --without-libiconv-prefix \ + --without-sdl-prefix \ + --without-cppunit-prefix \ + --disable-precomp-headers + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_BUILD_DIR)/wx-config $(1)/usr/bin/ + $(SED) "s,$(PKG_BUILD_DIR),$(STAGING_DIR)/usr,g" $(1)/usr/bin/wx-config + $(SED) 's,-I$$$${includedir}/wx-2.8,-I$(STAGING_DIR)/usr/include/wx-2.8,g' $(1)/usr/bin/wx-config + $(SED) 's,-I$$$${libdir}/wx/include,-I$(STAGING_DIR)/usr/lib/wx/include,g' $(1)/usr/bin/wx-config + + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/wx-2.8 $(1)/usr/include/ + + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libwx_*.so* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/wx $(1)/usr/lib/ +endef + +define Package/libwxbase/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libwx_*.so.* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,libwxbase)) diff --git a/wxbase/patches/fix-install-pointer.patch b/wxbase/patches/fix-install-pointer.patch new file mode 100644 index 000000000..c472bfad9 --- /dev/null +++ b/wxbase/patches/fix-install-pointer.patch @@ -0,0 +1,13 @@ +diff --git a/wx-config.in b/wx-config.in +index b185bbb..0a9a341 100755 +--- a/wx-config.in ++++ b/wx-config.in +@@ -937,7 +937,7 @@ fi + + is_monolithic() { [ "x@MONOLITHIC@" = "x1" ]; } + is_static() { [ -n "$this_linkage" ]; } +-is_installed() { [ -z "$this_prefix" ]; } ++is_installed() { [ "$this_prefix" ]; } + + + # Is the user after a support utility? diff --git a/wxbase/patches/wxGTK-2.8.12-abicheck.patch b/wxbase/patches/wxGTK-2.8.12-abicheck.patch new file mode 100644 index 000000000..97055ba46 --- /dev/null +++ b/wxbase/patches/wxGTK-2.8.12-abicheck.patch @@ -0,0 +1,15 @@ +diff -up wxGTK-2.8.12/src/common/appbase.cpp.abicheck wxGTK-2.8.12/src/common/appbase.cpp +--- wxGTK-2.8.12/src/common/appbase.cpp.abicheck 2015-03-12 17:15:18.000000000 +0100 ++++ wxGTK-2.8.12/src/common/appbase.cpp 2015-03-12 17:15:57.000000000 +0100 +@@ -424,10 +424,7 @@ bool wxAppConsole::CheckBuildOptions(con + msg.Printf(_T("Mismatch between the program and library build versions detected.\nThe library used %s,\nand %s used %s."), + lib.c_str(), progName.c_str(), prog.c_str()); + +- wxLogFatalError(msg.c_str()); +- +- // normally wxLogFatalError doesn't return +- return false; ++ wxLogWarning(msg.c_str()); + } + #undef wxCMP +