Compare commits

...
Sign in to create a new pull request.

5 commits

Author SHA1 Message Date
Vitezslav Crhonek
897a78ebf8 Add 'sscg' SSL files generation test 2026-01-12 11:21:31 +01:00
Vitezslav Crhonek
901f747d52 Fix bogus 'sscg' arguments 2026-01-12 11:21:27 +01:00
Vitezslav Crhonek
724b68ff80 Update post-quantum support test 2026-01-08 14:55:13 +01:00
Mamoru TASAKA
7df5ef0bbe Support rdoc 6.16 and above (for ruby4.0) 2026-01-03 09:58:06 +09:00
Vitezslav Crhonek
d198b44b1b Update OpenSSL certificates set up, fix and enable ruby binding again 2025-11-12 07:56:03 +01:00
9 changed files with 297 additions and 17 deletions

View file

@ -1,12 +1,73 @@
diff -up openwsman-2.7.2/bindings/ruby/extconf.rb.orig openwsman-2.7.2/bindings/ruby/extconf.rb
--- openwsman-2.7.2/bindings/ruby/extconf.rb.orig 2022-12-28 16:43:03.000000000 +0100
+++ openwsman-2.7.2/bindings/ruby/extconf.rb 2023-08-09 12:50:21.361216733 +0200
@@ -32,7 +32,7 @@ swig = find_executable("swig")
--- openwsman-2.8.1/bindings/ruby/extconf.rb.orig 2025-11-11 11:49:59.880195434 +0100
+++ openwsman-2.8.1/bindings/ruby/extconf.rb 2025-11-11 11:50:46.870685458 +0100
@@ -5,20 +5,41 @@
require 'mkmf'
# $CFLAGS = "#{$CFLAGS} -Werror"
+# libwsman requires 'int facility' to be defined by the application
+# Add syslog.h for LOG_DAEMON constant
+$CFLAGS = "#{$CFLAGS} -include syslog.h"
+
# requires wsman, wsman_client, and libxml2
+# Use CPATH and LIBRARY_PATH environment variables set by the build system
+if ENV['CPATH']
+ ENV['CPATH'].split(':').each do |path|
+ $CPPFLAGS = "#{$CPPFLAGS} -I#{path}"
+ end
+end
+if ENV['LIBRARY_PATH']
+ ENV['LIBRARY_PATH'].split(':').each do |path|
+ $LDFLAGS = "#{$LDFLAGS} -L#{path}"
+ end
+end
-unless have_library('wsman', 'wsman_create_doc')
+# Custom test for libwsman that includes facility definition
+unless try_link("#include <syslog.h>\n#include <wsman-soap-envelope.h>\nint facility = LOG_DAEMON;\nint main() {\n wsman_create_doc(\"test\");\n return 0;\n}", '-lwsman')
STDERR.puts "Cannot find wsman_create_doc() in libwsman"
STDERR.puts "Is openwsman-devel installed ?"
exit 1
end
+# Explicitly add libwsman to linker flags since we used try_link instead of have_library
+$libs = append_library($libs, "wsman")
find_header 'wsman-xml-api.h', '/usr/include/openwsman'
-unless have_library('wsman_client', 'wsmc_create')
+# Custom test for libwsman_client that includes facility definition
+unless try_link("#include <syslog.h>\n#include <wsman-client-api.h>\nint facility = LOG_DAEMON;\nint main() {\n wsmc_create(\"localhost\", 80, \"/wsman\", \"http\", \"user\", \"pass\");\n return 0;\n}", '-lwsman_client -lwsman')
STDERR.puts "Cannot find wsmc_create() in libwsman_client"
STDERR.puts "Is openwsman-devel installed ?"
exit 1
end
+# Explicitly add libwsman_client to linker flags since we used try_link instead of have_library
+$libs = append_library($libs, "wsman_client")
find_header 'wsman-client-api.h', '/usr/include/openwsman'
unless have_library('xml2', 'xmlNewDoc')
@@ -28,12 +49,25 @@
end
find_header 'libxml/parser.h', '/usr/include/libxml2'
+# Check for Ruby 3.3+ IO types
+have_type('rb_io_t', 'ruby/io.h')
+have_header 'ruby/thread.h'
+
swig = find_executable("swig")
raise "SWIG not found" unless swig
major, minor, path = RUBY_VERSION.split(".")
-raise "SWIG failed to run" unless system("#{swig} -ruby -autorename -DRUBY_VERSION=#{major}#{minor} -I. -I/usr/include/openwsman -o openwsman_wrap.c openwsman.i")
+raise "SWIG failed to run" unless system("#{swig} -ruby -autorename -DRUBY_VERSION=#{major}#{minor} -I. -I/usr/include/openwsman -I/builddir/build/BUILD/openwsman-2.8.1-build/openwsman-2.8.1/include -o openwsman_wrap.c openwsman.i")
+
+# Build SWIG include paths from CPATH environment variable
+swig_includes = "-I. -I/usr/include/openwsman"
+if ENV['CPATH']
+ ENV['CPATH'].split(':').each do |path|
+ swig_includes += " -I#{path}"
+ end
+end
+raise "SWIG failed to run" unless system("#{swig} -ruby -autorename -DRUBY_VERSION=#{major}#{minor} #{swig_includes} -o openwsman_wrap.c openwsman.i")
$CPPFLAGS = "-I/usr/include/openwsman -I.."
create_makefile('_openwsman')
+

View file

@ -0,0 +1,102 @@
diff -up openwsman-2.8.1/etc/owsmangencert.sh.cmake.orig openwsman-2.8.1/etc/owsmangencert.sh.cmake
--- openwsman-2.8.1/etc/owsmangencert.sh.cmake.orig 2025-01-23 10:23:52.000000000 +0100
+++ openwsman-2.8.1/etc/owsmangencert.sh.cmake 2025-10-17 10:16:34.482996406 +0200
@@ -1,10 +1,74 @@
-#!/bin/sh
-
#!/bin/sh -e
CERTFILE=@WSMANCONF_DIR@/servercert.pem
KEYFILE=@WSMANCONF_DIR@/serverkey.pem
CNFFILE=@WSMANCONF_DIR@/ssleay.cnf
+CAFILE=@WSMANCONF_DIR@/ca.crt
+DAYS=365
+
+function create_ssl_cnf
+{
+ # Get minimum RSA key length at current security level
+ # This workarounds openssl not enforcing min. key length enforced by current security level
+ KEYSIZE=`grep min_rsa_size /etc/crypto-policies/state/CURRENT.pol | cut -d ' ' -f 3`
+
+ # Create OpenSSL configuration files for generating certificates
+ echo "[ req ]" > $CNFFILE
+ echo "default_bits = $KEYSIZE" >> $CNFFILE
+ echo "default_keyfile = privkey.pem" >> $CNFFILE
+ echo "distinguished_name = req_distinguished_name" >> $CNFFILE
+
+ echo "[ req_distinguished_name ]" >> $CNFFILE
+ echo "countryName = Country Name (2 letter code)" >> $CNFFILE
+ echo "countryName_default = GB" >> $CNFFILE
+ echo "countryName_min = 2" >> $CNFFILE
+ echo "countryName_max = 2" >> $CNFFILE
+
+ echo "stateOrProvinceName = State or Province Name (full name)" >> $CNFFILE
+ echo "stateOrProvinceName_default = Some-State" >> $CNFFILE
+
+ echo "localityName = Locality Name (eg, city)" >> $CNFFILE
+
+ echo "organizationName = Organization Name (eg, company; recommended)" >> $CNFFILE
+ echo "organizationName_max = 64" >> $CNFFILE
+
+ echo "organizationalUnitName = Organizational Unit Name (eg, section)" >> $CNFFILE
+ echo "organizationalUnitName_max = 64" >> $CNFFILE
+
+ echo "commonName = server name (eg. ssl.domain.tld; required!!!)" >> $CNFFILE
+ echo "commonName_max = 80" >> $CNFFILE
+
+ echo "emailAddress = Email Address" >> $CNFFILE
+ echo "emailAddress_max = 85" >> $CNFFILE
+}
+
+function selfsign_sscg()
+{
+ sscg --quiet \
+ --lifetime "$DAYS" \
+ --cert-key-file "$KEYFILE" \
+ --cert-file "$CERTFILE" \
+ --ca-file "$CAFILE"
+}
+
+function selfsign_openssl()
+{
+
+ echo
+ echo creating selfsigned certificate
+ echo "replace it with one signed by a certification authority (CA)"
+ echo
+ echo enter your ServerName at the Common Name prompt
+ echo
+
+ # use special .cnf, because with normal one no valid selfsigned
+ # certificate is created
+
+ openssl req -days $DAYS $@ -config $CNFFILE \
+ -new -x509 -nodes -out $CERTFILE \
+ -keyout $KEYFILE
+ chmod 600 $KEYFILE
+}
if [ "$1" != "--force" -a -f $KEYFILE ]; then
echo "$KEYFILE exists! Use \"$0 --force.\""
@@ -15,18 +79,7 @@ if [ "$1" = "--force" ]; then
shift
fi
-echo
-echo creating selfsigned certificate
-echo "replace it with one signed by a certification authority (CA)"
-echo
-echo enter your ServerName at the Common Name prompt
-echo
-
-# use special .cnf, because with normal one no valid selfsigned
-# certificate is created
-
-openssl req -days 365 $@ -config $CNFFILE \
- -newkey rsa:2048 -x509 -nodes -out $CERTFILE \
- -keyout $KEYFILE
-chmod 600 $KEYFILE
+create_ssl_cnf
+# If sscg fails, try openssl
+selfsign_sscg || selfsign_openssl

View file

@ -0,0 +1,33 @@
diff -up openwsman-2.8.1/bindings/openwsman.i.orig openwsman-2.8.1/bindings/openwsman.i
--- openwsman-2.8.1/bindings/openwsman.i.orig 2025-01-23 10:23:52.000000000 +0100
+++ openwsman-2.8.1/bindings/openwsman.i 2025-10-21 16:56:01.025576984 +0200
@@ -105,15 +105,8 @@ SWIGINTERNINLINE SV *SWIG_From_double S
#if HAVE_RUBY_THREAD_H /* New threading model */
#include <ruby/thread.h>
#endif
-#if RUBY_VERSION > 18
- #if HAVE_RB_IO_T
- #define rb_fptr_t rb_io_t
- #else
- #define rb_fptr_t struct rb_io
- #endif
-#else
- #define rb_fptr_t struct OpenFile
-#endif
+/* Use rb_io_t for Ruby 1.9+ */
+#define rb_fptr_t rb_io_t
%}
%typemap(in) FILE* {
@@ -122,11 +115,7 @@ SWIGINTERNINLINE SV *SWIG_From_double S
Check_Type($input, T_FILE);
GetOpenFile($input, fptr);
/*rb_io_check_writable(fptr);*/
-#if RUBY_VERSION > 18
$1 = rb_io_stdio_file(fptr);
-#else
- $1 = GetReadFile(fptr);
-#endif
}
#endif /* SWIGRUBY */

View file

@ -0,0 +1,18 @@
diff -urp '--exclude=*~' openwsman-2.8.1.orig/bindings/ruby/rdoc_parser_swig.rb openwsman-2.8.1/bindings/ruby/rdoc_parser_swig.rb
--- openwsman-2.8.1.orig/bindings/ruby/rdoc_parser_swig.rb 2026-01-02 23:43:41.804273994 +0900
+++ openwsman-2.8.1/bindings/ruby/rdoc_parser_swig.rb 2026-01-02 23:56:06.991238037 +0900
@@ -377,7 +377,13 @@ class RDoc::Parser::SWIG < RDoc::Parser
find_modifiers comment, meth_obj if comment
#meth_obj.params = params
- meth_obj.start_collecting_tokens
+ # https://github.com/ruby/rdoc/pull/1471 changes the parameter for
+ # RDoc::TokenStream.start_collecting_tokens
+ if meth_obj.method(:start_collecting_tokens).arity == 1
+ meth_obj.start_collecting_tokens :ruby
+ else
+ meth_obj.start_collecting_tokens
+ end
begin
RDoc::const_get "RubyToken"
tk = RDoc::RubyToken::Token.new nil, 1, 1

View file

@ -0,0 +1,29 @@
--- openwsman-2.8.1/bindings/ruby/rdoc_parser_swig.rb 2025-01-23 10:23:52.000000000 +0100
+++ openwsman-2.8.1/bindings/ruby/rdoc_parser_swig.rb 2025-11-10 15:00:00.000000000 +0100
@@ -108,10 +108,24 @@ class RDoc::Parser::SWIG < RDoc::Parser
##
# Prepare to parse a SWIG file
- def initialize(top_level, file_name, content, options, stats)
- super
+ def initialize(top_level, file_name, content, options, stats = nil)
+ # RDoc 6.6+ (Ruby 3.3+) removed the stats parameter from Parser.initialize
+ # Check the arity of the parent class initialize method to determine which API we're using
+ parent_arity = RDoc::Parser.instance_method(:initialize).arity
+
+ if parent_arity == 4 || parent_arity == -5
+ # RDoc 6.6+: only pass 4 arguments to super
+ super(top_level, file_name, content, options)
+ # Create a dummy stats object for compatibility
+ @stats = Object.new
+ def @stats.method_missing(m, *args); end
+ else
+ # Older RDoc: pass all 5 arguments including stats
+ super(top_level, file_name, content, options, stats)
+ @stats = stats
+ end
@known_classes = RDoc::KNOWN_CLASSES.dup
@content = handle_tab_width handle_ifdefs_in(@content)
@renames = {} # maps old_name => [ new_name, args ]
@aliases = {} # maps name => [ alias_name, args ]

View file

@ -18,14 +18,14 @@
%global with_perl 0
%global with_python 0
%else
%global with_ruby 0
%global with_ruby 1
%global with_perl 1
%global with_python 1
%endif
Name: openwsman
Version: 2.8.1
Release: 10%{?dist}
Release: 13%{?dist}
Summary: Open source Implementation of WS-Management
License: BSD-3-Clause AND MIT
@ -51,6 +51,10 @@ Patch4: openwsman-2.6.5-http-status-line.patch
Patch5: openwsman-2.6.8-update-ssleay-conf.patch
Patch6: openwsman-2.7.2-gcc15-fix.patch
Patch7: openwsman-2.8.1-post-quantum.patch
Patch8: openwsman-2.7.2-ssl-certs-gen-changes.patch
Patch9: openwsman-2.8.1-rdoc-ruby34.patch
Patch10: openwsman-2.8.1-fix-ruby-io.patch
Patch11: openwsman-2.8.1-rdoc-6_16.patch
BuildRequires: make
BuildRequires: swig
BuildRequires: libcurl-devel libxml2-devel pam-devel sblim-sfcc-devel
@ -417,6 +421,16 @@ fi
%endif
%changelog
* Thu Jan 08 2026 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.8.1-13
- Fix bogus 'sscg' arguments
* Fri Jan 02 2026 Mamoru TASAKA <mtasaka@fedoraproject.org> - 2.8.1-12
- Support rdoc 6.16 and above (for ruby4.0)
* Wed Nov 12 2025 Vitezslav Crhonek <vcrhonek@redhat.com> - 2.8.1-11
- Update OpenSSL certificates set up
- Fix ruby binding, enable it
* Fri Sep 19 2025 Python Maint <python-maint@redhat.com> - 2.8.1-10
- Rebuilt for Python 3.14.0rc3 bytecode

View file

@ -52,17 +52,17 @@ rm -rf /etc/openwsman/{servercert,serverkey}.pem
# update genOpenPegasusSSLCerts to generate a new key using ML-DSA-65
# and issue a self-signed certificate for localhost using this key
patch /etc/openwsman/owsmangencert.sh << 'EOF'
--- /etc/openwsman/owsmangencert.sh.orig 2025-06-25 04:03:22.295778704 -0400
+++ /etc/openwsman/owsmangencert.sh 2025-06-25 04:05:12.181435542 -0400
@@ -26,7 +26,7 @@
# certificate is created
--- owsmangencert.sh.orig 2026-01-08 03:50:31.852413993 -0500
+++ owsmangencert.sh 2026-01-08 03:52:41.883088457 -0500
@@ -65,7 +65,7 @@
# certificate is created
openssl req -days 365 $@ -config $CNFFILE \
- -newkey rsa:2048 -x509 -nodes -out $CERTFILE \
+ -newkey mldsa65 -x509 -nodes -out $CERTFILE \
-keyout $KEYFILE
chmod 600 $KEYFILE
openssl req -days $DAYS $@ -config $CNFFILE \
- -new -x509 -nodes -out $CERTFILE \
+ -newkey mldsa65 -x509 -nodes -out $CERTFILE \
-keyout $KEYFILE
chmod 600 $KEYFILE
}
EOF
(echo CZ; echo "Czech Republic"; echo Brno; echo "Red Hat"; echo "Core Services"; echo localhost; echo joe@example.com; ) | /etc/openwsman/owsmangencert.sh

View file

@ -0,0 +1,6 @@
summary: Service works with 'sscg' generated SSL certificates
author: Vitezslav Crhonek <vcrhonek@redhat.com>
contact: Vitezslav Crhonek <vcrhonek@redhat.com>
require: sscg
duration: 10m
test: ./runtest.sh

View file

@ -0,0 +1,17 @@
#!/bin/sh -ux
# remove previously generated SSL files
rm -rf /etc/openwsman/{servercert,serverkey}*.pem /etc/openwsman/ca.crt
# remove SSL fallback to relly really just on sscg
cp /etc/openwsman/owsmangencert.sh /etc/openwsman/test-script.sh
sed -i 's/^selfsign_sscg ||.*/selfsign_sscg/' /etc/openwsman/test-script.sh
# generate new SSL files using sscg
/etc/openwsman/test-script.sh
# check that SSL files were generated
[ -f /etc/openwsman/servercert.pem ] && [ -f /etc/openwsman/serverkey.pem ] || { echo "Error: SSL files missing"; exit 1; }
# try to start the service
systemctl start openwsmand