Commit dd9e35c6 authored by nextime's avatar nextime

Create comprehensive wsssh-server Debian package for wssshd

- Package wssshd as PyInstaller binary for easy deployment
- Include comprehensive init script with wssshd user/group support
- Create postinst/postrm scripts for user/group management
- Set up proper directory structure (/var/lib/wssshd, /var/log/wssshd, /etc/wssshd)
- Integrate with Debian init system and rc2.d
- Include configuration examples and documentation
- Create /etc/default/wssshd for service control
- Set up proper permissions and ownership
- Enable secure daemon operation with dedicated user/group
- Include PyInstaller spec file for reproducible builds
parent b5e9067b
wsssh-server (1.3.4-1) unstable; urgency=medium
* Initial release of wsssh-server Debian package
* Package wssshd as PyInstaller binary for easy deployment
* Include comprehensive init script with service management
* Create wssshd user and group for secure daemon operation
* Set up proper directory structure and permissions
* Integrate with Debian init system and rc2.d
* Include configuration examples and documentation
-- Stefy Lanza <stefy@nexlab.net> Mon, 13 Sep 2025 19:17:00 +0200
\ No newline at end of file
13
\ No newline at end of file
Source: wsssh-server
Section: net
Priority: optional
Maintainer: Stefy Lanza <stefy@nexlab.net>
Build-Depends: debhelper-compat (= 13), python3, python3-pip, python3-setuptools
Standards-Version: 4.6.2
Homepage: https://github.com/stefy/wsssh
Vcs-Browser: https://github.com/stefy/wsssh
Vcs-Git: https://github.com/stefy/wsssh.git
Package: wsssh-server
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, python3, python3-websockets, python3-flask, python3-flask-login, python3-flask-sqlalchemy, python3-pty, adduser
Description: WebSocket SSH Server (wssshd)
A modern SSH tunneling system that provides WebSocket-based SSH/SCP access
to registered client machines. This package contains the server component
that handles WebSocket connections and manages SSH tunnels.
.
The wssshd server provides:
- WebSocket SSH tunnel management
- Client registration and authentication
- Web-based management interface
- Secure tunnel establishment between clients and servers
.
This is the server component of the WebSocket SSH system.
\ No newline at end of file
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: wsssh-server
Upstream-Contact: Stefy Lanza <stefy@nexlab.net>
Source: https://github.com/stefy/wsssh
Files: *
Copyright: 2024 Stefy Lanza <stefy@nexlab.net> and SexHack.me
License: GPL-3.0+
Files: debian/*
Copyright: 2024 Stefy Lanza <stefy@nexlab.net>
License: GPL-3.0+
License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".
\ No newline at end of file
#!/bin/sh
# postinst script for wsssh-server
set -e
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> `abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <package-being-installed> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
configure)
# Create wssshd user and group if they don't exist
if ! getent group wssshd >/dev/null 2>&1; then
addgroup --system wssshd
fi
if ! getent passwd wssshd >/dev/null 2>&1; then
adduser --system --ingroup wssshd --home /var/lib/wssshd \
--no-create-home --shell /bin/false wssshd
fi
# Create wssshd home directory
if [ ! -d /var/lib/wssshd ]; then
mkdir -p /var/lib/wssshd
chown wssshd:wssshd /var/lib/wssshd
chmod 755 /var/lib/wssshd
fi
# Create log directory
if [ ! -d /var/log/wssshd ]; then
mkdir -p /var/log/wssshd
chown wssshd:wssshd /var/log/wssshd
chmod 755 /var/log/wssshd
fi
# Create configuration directory
if [ ! -d /etc/wssshd ]; then
mkdir -p /etc/wssshd
chown wssshd:wssshd /etc/wssshd
chmod 755 /etc/wssshd
fi
# Create /etc/default/wssshd if it doesn't exist
if [ ! -f /etc/default/wssshd ]; then
cat > /etc/default/wssshd << EOF
# WebSocket SSH Server (wssshd) configuration
# Set to Y, 1, TRUE, true, YES, or yes to enable the service
START=no
# Additional configuration can be done in /etc/wssshd.conf
EOF
chmod 644 /etc/default/wssshd
fi
# Create example configuration file if it doesn't exist
if [ ! -f /etc/wssshd.conf.example ]; then
if [ -f /usr/share/wsssh/wssshd.conf.example ]; then
cp /usr/share/wsssh/wssshd.conf.example /etc/wssshd.conf.example
chmod 644 /etc/wssshd.conf.example
fi
fi
# Set up init script
if [ -x /etc/init.d/wssshd ]; then
update-rc.d wssshd defaults >/dev/null 2>&1 || true
fi
# Set proper permissions on binary
if [ -f /usr/bin/wssshd ]; then
chown wssshd:wssshd /usr/bin/wssshd
chmod 755 /usr/bin/wssshd
fi
# Create database directory if it doesn't exist
if [ ! -d /var/lib/wssshd/db ]; then
mkdir -p /var/lib/wssshd/db
chown wssshd:wssshd /var/lib/wssshd/db
chmod 755 /var/lib/wssshd/db
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
\ No newline at end of file
#!/bin/sh
# postrm script for wsssh-server
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
case "$1" in
purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
# Stop the service if it's running
if [ -x /etc/init.d/wssshd ]; then
invoke-rc.d wssshd stop >/dev/null 2>&1 || true
fi
# Remove init script symlinks
if [ -x /etc/init.d/wssshd ]; then
update-rc.d wssshd remove >/dev/null 2>&1 || true
fi
# Remove user and group on purge
if [ "$1" = "purge" ]; then
# Remove wssshd user and group
if getent passwd wssshd >/dev/null 2>&1; then
deluser wssshd || true
fi
if getent group wssshd >/dev/null 2>&1; then
delgroup wssshd || true
fi
# Remove configuration and data directories
rm -rf /var/lib/wssshd
rm -rf /var/log/wssshd
rm -rf /etc/wssshd
# Remove configuration files
rm -f /etc/default/wssshd
rm -f /etc/wssshd.conf
rm -f /etc/wssshd.conf.example
fi
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0
\ No newline at end of file
#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
%:
dh $@
override_dh_auto_configure:
# Create PyInstaller spec file for wssshd
cat > wssshd.spec << EOF
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(
['../wssshd.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[
'websockets',
'flask',
'flask_login',
'flask_sqlalchemy',
'ssl',
'asyncio',
'configparser',
'argparse',
'signal',
'os',
'sys',
'json',
'subprocess',
'pty',
'select',
'termios',
'fcntl',
'stat',
'threading',
'time',
'uuid',
'socket',
'netdb',
'errno',
'pysqlite3'
],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='wssshd',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
EOF
override_dh_auto_build:
# Build PyInstaller binary
pip3 install pyinstaller
pyinstaller --clean --onefile wssshd.spec
override_dh_auto_install:
# Install PyInstaller binary
install -m 755 dist/wssshd debian/wsssh-server/usr/bin/
# Install init script
install -m 755 ../wssshd.init debian/wsssh-server/etc/init.d/wssshd
# Install configuration files
install -m 644 debian/wssshd.default debian/wsssh-server/etc/default/wssshd
install -m 644 ../wssshd.conf.example debian/wsssh-server/usr/share/wsssh/
# Install web templates and static files
mkdir -p debian/wsssh-server/usr/share/wsssh/templates
mkdir -p debian/wsssh-server/usr/share/wsssh/logos
cp -r ../templates/* debian/wsssh-server/usr/share/wsssh/templates/
cp -r ../logos/* debian/wsssh-server/usr/share/wsssh/logos/
# Create wssshd user directories
mkdir -p debian/wsssh-server/var/lib/wssshd
mkdir -p debian/wsssh-server/var/log/wssshd
mkdir -p debian/wsssh-server/etc/wssshd
override_dh_auto_clean:
rm -rf build dist *.spec
dh_auto_clean
\ No newline at end of file
# WebSocket SSH Server (wssshd) configuration
# Set to Y, 1, TRUE, true, YES, or yes to enable the service
START=no
# Additional configuration can be done in /etc/wssshd.conf
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment