sulu: 2.2.1

This commit is contained in:
Vivek Kumar Dutta 2023-05-19 17:33:22 +05:30
parent 2c51c4e23e
commit 69d2a50e2e
No known key found for this signature in database
GPG key ID: 65C818099F37097D
5 changed files with 29 additions and 17 deletions

View file

@ -5,11 +5,11 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=sulu-base
PKG_VERSION:=2.2.0
PKG_VERSION:=2.2.1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu.git
PKG_SOURCE_VERSION:=1edef130673d186c9ffe030b9a1a3614974c1fad
PKG_SOURCE_VERSION:=c10972cca9b1938738dc45846f33545d1c7dcbdc
PKG_MIRROR_HASH:=skip
SULU_MOD:=core

View file

@ -5,12 +5,12 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=sulu-builder
PKG_VERSION:=2.2.0
PKG_VERSION:=2.2.1
PKG_RELEASE:=1
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/websdk/sulu-builder.git
PKG_SOURCE_VERSION:=8797cb3efffdfac3d27a6d665f271b13d07d8335
PKG_SOURCE_VERSION:=926a1c05140ce321058ae586a5f3b7e232571a13
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
PKG_BUILD_DIR:=$(BUILD_DIR)/sulu-$(PKG_VERSION)/sulu-builder-$(PKG_SOURCE_VERSION)

View file

@ -1,4 +1,5 @@
config global 'global'
option role_based_access '1'
option SessionMode 'Require'
list user 'admin'
list user 'user'

View file

@ -8,7 +8,7 @@ location /sitemap.xml {
return 200 "User-agent: *\nDisallow: /\n";
}
location /ws {
location /wss {
proxy_pass_request_headers on;
proxy_cache off;
proxy_http_version 1.1;
@ -29,13 +29,11 @@ location /ws {
location / {
autoindex on;
expires -1;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,Content-Type,Range';
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
@ -45,6 +43,7 @@ location / {
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,Content-Type,Range' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
}
expires -1;
add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0';
}

View file

@ -53,6 +53,11 @@ function _get_sulu_root()
echo "${root:-/sulu}"
}
function _get_sulu_session_mode()
{
echo "$(uci -q get sulu.global.SessionMode)"
}
function _get_usp_upstream_port()
{
local port
@ -94,10 +99,11 @@ function update_nginx_template()
function generate_sulu_conn_config()
{
local rbac users SCONFIG
local rbac users SCONFIG session
rbac="${1}"
users="$(_get_sulu_users)"
session="$(_get_sulu_session_mode)"
SCONFIG="$(_get_sulu_root)/config/connectionConfig.json"
json_init;
@ -110,8 +116,12 @@ function generate_sulu_conn_config()
json_add_object 'rbac';
json_add_string 'toId' "$(_get_endpoint_id)";
json_add_int 'port' "$(_get_sulu_tls_port)";
json_add_string 'path' "/ws";
json_add_boolean 'useSession' 1;
json_add_string 'path' "/wss";
if [ "${session}" = "Require" ]; then
json_add_boolean 'useSession' 1;
fi
json_add_string 'protocol' 'wss';
json_add_array 'auth';
json_close_array;
@ -132,7 +142,7 @@ function generate_sulu_conn_config()
json_add_string 'fromId' 'proto::interop-usp-controller';
json_add_string 'toId' "$(_get_endpoint_id)";
json_add_int 'port' "$(_get_sulu_tls_port)";
json_add_string 'path' "/ws";
json_add_string 'path' "/wss";
json_add_string 'protocol' 'wss';
json_add_string 'publishEndpoint' "/usp/endpoint";
json_add_string 'subscribeEndpoint' "/usp/controller";
@ -210,7 +220,7 @@ function _update_obuspa_config()
function _remove_obuspa_config()
{
local restart
local restart session
restart=0
if [ "$(uci_get obuspa localmqtt)" == "mqtt" ]; then
@ -229,10 +239,11 @@ function _remove_obuspa_config()
}
function _update_obuspa_config_rbac() {
local agent users restart
local agent users restart session
agent="$(_get_agent_id)"
users="$(_get_sulu_users)"
session="$(_get_sulu_session_mode)"
restart=0
for f in ${users}; do
@ -267,11 +278,12 @@ function _update_obuspa_config_rbac() {
uci_set obuspa ${sec} Topic "/usp/${agent}/${f}/controller"
uci_set obuspa ${sec} mqtt "mqtt_sulu_$f"
uci_set obuspa ${sec} assigned_role_name "$f"
uci_set obuspa ${sec} SessionMode "Require"
restart=1
fi
if ! uci_get obuspa ${sec} SessionMode >/dev/null 2>&1; then
uci_set obuspa ${sec} SessionMode "Require"
obMode="$(uci_get obuspa ${sec} SessionMode)"
if [ "${session}" != "${obMode}" ]; then
uci_set obuspa ${sec} SessionMode "${session}"
restart=1
fi
done