v3.31.2: the SCP81 TLS-PSK Python floor, documented and guarded
release / release (push) Waiting to run
release / release (push) Waiting to run
ssl's TLS-PSK callbacks (PskTlsServer) exist only since Python 3.13 - the first CI run on 3.12 errored in all 20 PSK tests, and the docs confirm "Added in version 3.13". - PskTlsServer._make_context raises a clear RuntimeError naming the requirement instead of AttributeError; a source pin keeps the guard. - tests/test_scp81.py skips PskTlsServerTest where the callbacks are missing (it runs on 3.13+), so contributors on 3.9-3.12 no longer see 20 failures. - The READMEs state the requirement, and the Windows notes now strongly recommend Python 3.13: pyscard has wheels up to 3.13, and on 3.14 pyscard and some pysim dependency wheels are unavailable and build from source (MSVC). setup.bat and setup.sh print the same guidance. - Version strings + the PWA cache bumped together (simple-v457). 998 Python + 953 frontend green.
This commit is contained in:
@@ -738,9 +738,9 @@ The bundled Python server wraps [pySim](https://osmocom.org/projects/pysim/wiki)
|
|||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
|
|
||||||
- **Python 3.9+** with `pip`, and **Git**
|
- **Python 3.9+** with `pip`, and **Git** — the app runs on 3.9+, but the **SCP81 TLS-PSK listener needs Python 3.13+** (`ssl`'s PSK callbacks).
|
||||||
- **Smart card reader** (PC/SC or serial/FTDI) — PC/SC is preferable (`pcsc-lite` + `ccid` on Linux). `pyscard` has no Linux wheels, so it builds from source: install the PC/SC header package too (`libpcsclite-dev` on Debian/Ubuntu, `pcsc-lite-devel` on Fedora; on Arch `pcsclite` includes them).
|
- **Smart card reader** (PC/SC or serial/FTDI) — PC/SC is preferable (`pcsc-lite` + `ccid` on Linux). `pyscard` has no Linux wheels, so it builds from source: install the PC/SC header package too (`libpcsclite-dev` on Debian/Ubuntu, `pcsc-lite-devel` on Fedora; on Arch `pcsclite` includes them).
|
||||||
- **Windows** — use Python 3.9–3.13 (3.13 recommended): `pyscard` ships precompiled wheels for these versions. On 3.14 it builds from source (needs MSVC C++ Build Tools). The SMPP bridge (`smpp.twisted3`) is intentionally skipped on Windows.
|
- **Windows** — use **Python 3.13 (strongly recommended)**: `pyscard` has precompiled wheels up to 3.13 and the SCP81 TLS-PSK listener needs 3.13+. On 3.14 `pyscard` and some pysim dependency wheels are not available and build from source (needs MSVC C++ Build Tools). 3.9–3.12 run the app but not the SCP81 PSK listener. The SMPP bridge (`smpp.twisted3`) is intentionally skipped on Windows.
|
||||||
|
|
||||||
### Scripts
|
### Scripts
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -722,9 +722,9 @@ PWA проверяет версию сервера при подключении
|
|||||||
|
|
||||||
### Требования
|
### Требования
|
||||||
|
|
||||||
- **Python 3.9+** с `pip`, и **Git**
|
- **Python 3.9+** с `pip`, и **Git** — приложение работает на 3.9+, но **SCP81 TLS-PSK-слушателю нужен Python 3.13+** (PSK-callback'и `ssl`).
|
||||||
- **Смарт-картридер** (PC/SC или serial/FTDI) — предпочтителен PC/SC (`pcsc-lite` + `ccid` на Linux). У `pyscard` нет Linux-wheel, поэтому он собирается из исходников: поставьте и пакет с заголовками PC/SC (`libpcsclite-dev` в Debian/Ubuntu, `pcsc-lite-devel` в Fedora; в Arch они входят в `pcsclite`).
|
- **Смарт-картридер** (PC/SC или serial/FTDI) — предпочтителен PC/SC (`pcsc-lite` + `ccid` на Linux). У `pyscard` нет Linux-wheel, поэтому он собирается из исходников: поставьте и пакет с заголовками PC/SC (`libpcsclite-dev` в Debian/Ubuntu, `pcsc-lite-devel` в Fedora; в Arch они входят в `pcsclite`).
|
||||||
- **Windows** — используйте Python 3.9–3.13 (рекомендуется 3.13): у `pyscard` есть готовые wheel. На 3.14 он собирается из исходников (нужны MSVC C++ Build Tools). SMPP-мост (`smpp.twisted3`) в Windows сознательно не ставится.
|
- **Windows** — используйте **Python 3.13 (настоятельно рекомендуется)**: у `pyscard` есть готовые wheel до 3.13, и SCP81 TLS-PSK-слушателю нужен 3.13+. На 3.14 wheel для `pyscard` и части зависимостей pysim отсутствуют, они собираются из исходников (нужны MSVC C++ Build Tools). 3.9–3.12 запускают приложение, но не SCP81 PSK-слушатель. SMPP-мост (`smpp.twisted3`) в Windows сознательно не ставится.
|
||||||
|
|
||||||
### Скрипты
|
### Скрипты
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -1943,7 +1943,7 @@
|
|||||||
// ===== Version =====
|
// ===== Version =====
|
||||||
// Single source of truth for the PWA version: shown in the header and used
|
// Single source of truth for the PWA version: shown in the header and used
|
||||||
// by the server version check in pysimConnect().
|
// by the server version check in pysimConnect().
|
||||||
const SIMPLE_VERSION = '3.31.1';
|
const SIMPLE_VERSION = '3.31.2';
|
||||||
document.getElementById('app-version').textContent = 'v' + SIMPLE_VERSION;
|
document.getElementById('app-version').textContent = 'v' + SIMPLE_VERSION;
|
||||||
|
|
||||||
// ===== view history (the browser Back/Forward buttons) =====
|
// ===== view history (the browser Back/Forward buttons) =====
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
const CACHE = 'simple-v456';
|
const CACHE = 'simple-v457';
|
||||||
const URLS = [
|
const URLS = [
|
||||||
'index.html',
|
'index.html',
|
||||||
'help.html',
|
'help.html',
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "pysim-simple-server"
|
name = "pysim-simple-server"
|
||||||
version = "3.31.1"
|
version = "3.31.2"
|
||||||
description = "HTTP REST server wrapping pysim for the SIMple PWA"
|
description = "HTTP REST server wrapping pysim for the SIMple PWA"
|
||||||
license = { text = "GPL-2.0-or-later" }
|
license = { text = "GPL-2.0-or-later" }
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.9"
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ DATA records to it.
|
|||||||
|
|
||||||
import socket
|
import socket
|
||||||
import ssl
|
import ssl
|
||||||
|
import sys
|
||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@@ -252,6 +253,11 @@ class PskTlsServer:
|
|||||||
# SSLV3_ALERT_UNEXPECTED_MESSAGE on the post-handshake
|
# SSLV3_ALERT_UNEXPECTED_MESSAGE on the post-handshake
|
||||||
# NewSessionTicket record (verified live 2026-09-15).
|
# NewSessionTicket record (verified live 2026-09-15).
|
||||||
ctx.options |= ssl.OP_NO_TICKET
|
ctx.options |= ssl.OP_NO_TICKET
|
||||||
|
if not hasattr(ctx, 'set_psk_server_callback'):
|
||||||
|
# ssl's TLS-PSK callbacks exist only since Python 3.13.
|
||||||
|
raise RuntimeError(
|
||||||
|
'TLS-PSK requires Python 3.13+ (ssl.SSLContext.set_psk_server_callback '
|
||||||
|
'is missing in %s)' % sys.version.split()[0])
|
||||||
ctx.set_psk_server_callback(self._psk_cb)
|
ctx.set_psk_server_callback(self._psk_cb)
|
||||||
return ctx
|
return ctx
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ from osmocom.tlv import BER_TLV_IE
|
|||||||
from osmocom.utils import rpad
|
from osmocom.utils import rpad
|
||||||
|
|
||||||
|
|
||||||
VERSION = '3.31.1'
|
VERSION = '3.31.2'
|
||||||
|
|
||||||
MAX_ENVELOPE_SEGMENTS = 5 # max SMS segments for outgoing C-APDU in ENVELOPE
|
MAX_ENVELOPE_SEGMENTS = 5 # max SMS segments for outgoing C-APDU in ENVELOPE
|
||||||
|
|
||||||
|
|||||||
@@ -44,11 +44,14 @@ call "%VENV_DIR%\Scripts\activate.bat"
|
|||||||
REM Upgrade pip
|
REM Upgrade pip
|
||||||
python -m pip install --upgrade pip -q
|
python -m pip install --upgrade pip -q
|
||||||
|
|
||||||
REM pyscard has precompiled wheels for Python 3.9-3.13.
|
REM Python 3.13 is strongly recommended: pyscard ships precompiled wheels up
|
||||||
REM On Python 3.14 pip builds it from source (requires Microsoft C++ Build Tools).
|
REM to 3.13, the SCP81 TLS-PSK listener needs 3.13+, and on 3.14 pyscard and
|
||||||
echo Note: pyscard ships precompiled wheels for Python 3.9-3.13.
|
REM some pysim dependency wheels are unavailable (source builds need MSVC).
|
||||||
echo Python 3.14 will build pyscard from source and require
|
echo Note: Python 3.13 is strongly recommended.
|
||||||
echo Microsoft C++ Build Tools ("Desktop development with C++").
|
echo pyscard has precompiled wheels up to 3.13 and the SCP81 TLS-PSK
|
||||||
|
echo listener needs 3.13+. On Python 3.14 pyscard and some pysim
|
||||||
|
echo dependency wheels are unavailable; those build from source and
|
||||||
|
echo require Microsoft C++ Build Tools ("Desktop development with C++").
|
||||||
echo.
|
echo.
|
||||||
|
|
||||||
REM Install pysim dependencies first, then pysim itself (without the SMPP
|
REM Install pysim dependencies first, then pysim itself (without the SMPP
|
||||||
|
|||||||
@@ -52,6 +52,14 @@ else
|
|||||||
echo " Fedora: sudo dnf install pcsc-lite pcsc-lite-ccid pcsc-lite-devel"
|
echo " Fedora: sudo dnf install pcsc-lite pcsc-lite-ccid pcsc-lite-devel"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# The SCP81 TLS-PSK listener uses ssl's PSK callbacks, added in Python 3.13.
|
||||||
|
PY_MINOR=$(echo "$PY_VER" | cut -d. -f2)
|
||||||
|
if [ "${PY_VER%.*}" = "3" ] && [ "$PY_MINOR" -lt 13 ]; then
|
||||||
|
echo "Note: the SCP81 TLS-PSK listener needs Python 3.13+ (this is $PY_VER);"
|
||||||
|
echo " the rest of the app works normally."
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "=== Setup complete ==="
|
echo "=== Setup complete ==="
|
||||||
echo "Run ./start.sh to start the server."
|
echo "Run ./start.sh to start the server."
|
||||||
@@ -5,6 +5,7 @@ terminal's Data available notification (TS 102 223 7.5.10).
|
|||||||
Synthetic PSK only; no live card data.
|
Synthetic PSK only; no live card data.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import inspect
|
||||||
import socket
|
import socket
|
||||||
import ssl
|
import ssl
|
||||||
import sys
|
import sys
|
||||||
@@ -80,6 +81,18 @@ class HttpParseTest(unittest.TestCase):
|
|||||||
self.assertTrue(body.startswith(b'64\r\n'))
|
self.assertTrue(body.startswith(b'64\r\n'))
|
||||||
|
|
||||||
|
|
||||||
|
class PskGuardTest(unittest.TestCase):
|
||||||
|
"""On Python < 3.13 the listener must explain the requirement, not raise
|
||||||
|
AttributeError (the PSK tests themselves are skipped there)."""
|
||||||
|
|
||||||
|
def test_the_context_names_the_python_requirement(self):
|
||||||
|
src = inspect.getsource(scp81.PskTlsServer._make_context)
|
||||||
|
self.assertIn("hasattr(ctx, 'set_psk_server_callback')", src)
|
||||||
|
self.assertIn('Python 3.13+', src)
|
||||||
|
|
||||||
|
|
||||||
|
@unittest.skipUnless(hasattr(ssl.SSLContext, 'set_psk_server_callback'),
|
||||||
|
'TLS-PSK requires Python 3.13+')
|
||||||
class PskTlsServerTest(unittest.TestCase):
|
class PskTlsServerTest(unittest.TestCase):
|
||||||
def _client_ctx(self, identity=IDENT, psk=PSK):
|
def _client_ctx(self, identity=IDENT, psk=PSK):
|
||||||
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
|
||||||
|
|||||||
Reference in New Issue
Block a user