diff --git a/example/Vagrantfile b/example/Vagrantfile index dad908b..8c5691b 100644 --- a/example/Vagrantfile +++ b/example/Vagrantfile @@ -64,24 +64,21 @@ Vagrant.configure("2") do |config| # Ansible, Chef, Docker, Puppet and Salt are also available. Please see the # documentation for more information about their specific syntax and use. - config.vm.provision "file", source: "../torch.conf", destination: "~/torch/" - config.vm.provision "file", source: "../torch-agent.py", destination: "~/torch/" - config.vm.provision "file", source: "../torch.service", destination: "~/torch/" - config.vm.provision "file", source: "../install-ubuntu2004.sh", destination: "~/torch/" - + config.vm.provision "file", source: "torch-agent_0.0.1-1_all.deb", destination: "~/" config.vm.provision "file", source: "agent-config", destination: "~/torch-conf" config.vm.provision "shell", inline: <<-SHELL - - sudo -- sh -c "echo '10.0.2.2 mqtt.example.com' >> /etc/hosts" - cd torch - sudo ./install-ubuntu2004.sh - - sudo cp -f ../torch-conf/* /etc/torch/ + sudo -- sh -c "echo '10.0.2.2 mqtt.example.com' >> /etc/hosts" + + sudo apt update + sudo apt install -y ./torch-agent_0.0.1-1_all.deb + + sudo cp -f torch-conf/* /etc/torch/ sudo chown -R torch /etc/torch - sudo systemctl restart torch + sudo systemctl enable torch-agent + sudo systemctl start torch-agent SHELL end diff --git a/example/torch-agent_0.0.1-1_all.deb b/example/torch-agent_0.0.1-1_all.deb new file mode 100644 index 0000000..3082955 Binary files /dev/null and b/example/torch-agent_0.0.1-1_all.deb differ diff --git a/torch-agent-0.0.1/debian/.debhelper/generated/torch-agent/installed-by-dh_install b/torch-agent-0.0.1/debian/.debhelper/generated/torch-agent/installed-by-dh_install new file mode 100644 index 0000000..a2905db --- /dev/null +++ b/torch-agent-0.0.1/debian/.debhelper/generated/torch-agent/installed-by-dh_install @@ -0,0 +1,2 @@ +./debian/src/usr/share/torch-agent +./debian/src/etc/torch diff --git a/torch-agent-0.0.1/debian/.debhelper/generated/torch-agent/installed-by-dh_installdocs b/torch-agent-0.0.1/debian/.debhelper/generated/torch-agent/installed-by-dh_installdocs new file mode 100644 index 0000000..e69de29 diff --git a/torch-agent-0.0.1/debian/.debhelper/generated/torch-agent/postinst.service b/torch-agent-0.0.1/debian/.debhelper/generated/torch-agent/postinst.service new file mode 100644 index 0000000..4f984b0 --- /dev/null +++ b/torch-agent-0.0.1/debian/.debhelper/generated/torch-agent/postinst.service @@ -0,0 +1,27 @@ +# Automatically added by dh_installsystemd/12.10ubuntu1 +if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then + if deb-systemd-helper debian-installed 'torch-agent.service'; then + # This will only remove masks created by d-s-h on package removal. + deb-systemd-helper unmask 'torch-agent.service' >/dev/null || true + + if deb-systemd-helper --quiet was-enabled 'torch-agent.service'; then + # Create new symlinks, if any. + deb-systemd-helper enable 'torch-agent.service' >/dev/null || true + fi + fi + + # Update the statefile to add new symlinks (if any), which need to be cleaned + # up on purge. Also remove old symlinks. + deb-systemd-helper update-state 'torch-agent.service' >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_installsystemd/12.10ubuntu1 +if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then + if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + if [ -n "$2" ]; then + deb-systemd-invoke try-restart 'torch-agent.service' >/dev/null || true + fi + fi +fi +# End automatically added section diff --git a/torch-agent-0.0.1/debian/.debhelper/generated/torch-agent/prerm.service b/torch-agent-0.0.1/debian/.debhelper/generated/torch-agent/prerm.service new file mode 100644 index 0000000..b57cbab --- /dev/null +++ b/torch-agent-0.0.1/debian/.debhelper/generated/torch-agent/prerm.service @@ -0,0 +1,5 @@ +# Automatically added by dh_installsystemd/12.10ubuntu1 +if [ -d /run/systemd/system ] && [ "$1" = remove ]; then + deb-systemd-invoke stop 'torch-agent.service' >/dev/null || true +fi +# End automatically added section diff --git a/torch-agent-0.0.1/debian/README.Debian b/torch-agent-0.0.1/debian/README.Debian new file mode 100644 index 0000000..699fb17 --- /dev/null +++ b/torch-agent-0.0.1/debian/README.Debian @@ -0,0 +1,6 @@ +torch-agent for Debian +--------------------- + + + + -- Benjamin Dweck Tue, 06 Oct 2020 15:53:02 +0200 diff --git a/torch-agent-0.0.1/debian/README.source b/torch-agent-0.0.1/debian/README.source new file mode 100644 index 0000000..88e9ee1 --- /dev/null +++ b/torch-agent-0.0.1/debian/README.source @@ -0,0 +1,10 @@ +torch-agent for Debian +--------------------- + + + + + + -- Benjamin Dweck Tue, 06 Oct 2020 15:53:02 +0200 + diff --git a/torch-agent-0.0.1/debian/changelog b/torch-agent-0.0.1/debian/changelog new file mode 100644 index 0000000..880b70d --- /dev/null +++ b/torch-agent-0.0.1/debian/changelog @@ -0,0 +1,5 @@ +torch-agent (0.0.1-1) unstable; urgency=medium + + * Initial release + + -- Benjamin Dweck Tue, 06 Oct 2020 15:53:02 +0200 diff --git a/torch-agent-0.0.1/debian/control b/torch-agent-0.0.1/debian/control new file mode 100644 index 0000000..4052515 --- /dev/null +++ b/torch-agent-0.0.1/debian/control @@ -0,0 +1,16 @@ +Source: torch-agent +Section: net +Priority: optional +Maintainer: Benjamin Dweck +Build-Depends: debhelper-compat (= 12) +Standards-Version: 4.4.1 +Homepage: https://rudefox.io +#Vcs-Browser: https://salsa.debian.org/debian/torch-agent +#Vcs-Git: https://salsa.debian.org/debian/torch-agent.git + +Package: torch-agent +Architecture: all +Depends: ssh, tor, python3-pip, ${misc:Depends} +Description: TORch is a solution for creating an SSH-via-Tor + backdoor on a remote device as a means of fallback remote + management and initial headless device configuration. \ No newline at end of file diff --git a/torch-agent-0.0.1/debian/copyright b/torch-agent-0.0.1/debian/copyright new file mode 100644 index 0000000..b1e631f --- /dev/null +++ b/torch-agent-0.0.1/debian/copyright @@ -0,0 +1,23 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: torch-agent +Upstream-Contact: bjdweck@gmail.com +Source: https://rudefox.io + +Files: debian/* +Copyright: 2020 Benjamin Dweck +License: GPL-2+ + This package 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 2 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 + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". \ No newline at end of file diff --git a/torch-agent-0.0.1/debian/debhelper-build-stamp b/torch-agent-0.0.1/debian/debhelper-build-stamp new file mode 100644 index 0000000..50c918c --- /dev/null +++ b/torch-agent-0.0.1/debian/debhelper-build-stamp @@ -0,0 +1 @@ +torch-agent diff --git a/torch-agent-0.0.1/debian/files b/torch-agent-0.0.1/debian/files new file mode 100644 index 0000000..ea349cd --- /dev/null +++ b/torch-agent-0.0.1/debian/files @@ -0,0 +1,2 @@ +torch-agent_0.0.1-1_all.deb net optional +torch-agent_0.0.1-1_amd64.buildinfo net optional diff --git a/torch-agent-0.0.1/debian/manpage.1.ex b/torch-agent-0.0.1/debian/manpage.1.ex new file mode 100644 index 0000000..d43cc54 --- /dev/null +++ b/torch-agent-0.0.1/debian/manpage.1.ex @@ -0,0 +1,56 @@ +.\" Hey, EMACS: -*- nroff -*- +.\" (C) Copyright 2020 Benjamin Dweck , +.\" +.\" First parameter, NAME, should be all caps +.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection +.\" other parameters are allowed: see man(7), man(1) +.TH Torch-agent SECTION "October 6 2020" +.\" Please adjust this date whenever revising the manpage. +.\" +.\" Some roff macros, for reference: +.\" .nh disable hyphenation +.\" .hy enable hyphenation +.\" .ad l left justify +.\" .ad b justify to both left and right margins +.\" .nf disable filling +.\" .fi enable filling +.\" .br insert line break +.\" .sp insert n+1 empty lines +.\" for manpage-specific macros, see man(7) +.SH NAME +torch-agent \- program to do something +.SH SYNOPSIS +.B torch-agent +.RI [ options ] " files" ... +.br +.B bar +.RI [ options ] " files" ... +.SH DESCRIPTION +This manual page documents briefly the +.B torch-agent +and +.B bar +commands. +.PP +.\" TeX users may be more comfortable with the \fB\fP and +.\" \fI\fP escape sequences to invode bold face and italics, +.\" respectively. +\fBtorch-agent\fP is a program that... +.SH OPTIONS +These programs follow the usual GNU command line syntax, with long +options starting with two dashes (`-'). +A summary of options is included below. +For a complete description, see the Info files. +.TP +.B \-h, \-\-help +Show summary of options. +.TP +.B \-v, \-\-version +Show version of program. +.SH SEE ALSO +.BR bar (1), +.BR baz (1). +.br +The programs are documented fully by +.IR "The Rise and Fall of a Fooish Bar" , +available via the Info system. diff --git a/torch-agent-0.0.1/debian/manpage.sgml.ex b/torch-agent-0.0.1/debian/manpage.sgml.ex new file mode 100644 index 0000000..ceaeb33 --- /dev/null +++ b/torch-agent-0.0.1/debian/manpage.sgml.ex @@ -0,0 +1,154 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + FIRSTNAME"> + SURNAME"> + + October 6 2020"> + + SECTION"> + bjdweck@gmail.com"> + + Torch-agent"> + + + Debian"> + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2003 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + program to do something + + + + &dhpackage; + + + + + + + + DESCRIPTION + + This manual page documents briefly the + &dhpackage; and bar + commands. + + This manual page was written for the &debian; distribution + because the original program does not have a manual page. + Instead, it has documentation in the &gnu; + Info format; see below. + + &dhpackage; is a program that... + + + + OPTIONS + + These programs follow the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + Info files. + + + + + + + + Show summary of options. + + + + + + + + Show version of program. + + + + + + SEE ALSO + + bar (1), baz (1). + + The programs are documented fully by The Rise and + Fall of a Fooish Bar available via the + Info system. + + + AUTHOR + + This manual page was written by &dhusername; &dhemail; for + the &debian; system (and may be used by others). Permission is + granted to copy, distribute and/or modify this document under + the terms of the &gnu; General Public License, Version 2 any + later version published by the Free Software Foundation. + + + On Debian systems, the complete text of the GNU General Public + License can be found in /usr/share/common-licenses/GPL. + + + +
+ + diff --git a/torch-agent-0.0.1/debian/manpage.xml.ex b/torch-agent-0.0.1/debian/manpage.xml.ex new file mode 100644 index 0000000..13a18ba --- /dev/null +++ b/torch-agent-0.0.1/debian/manpage.xml.ex @@ -0,0 +1,291 @@ + +.
will be generated. You may view the +manual page with: nroff -man .
| less'. A typical entry +in a Makefile or Makefile.am is: + +DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/docbook-xsl/manpages/docbook.xsl +XP = xsltproc -''-nonet -''-param man.charmap.use.subset "0" + +manpage.1: manpage.xml + $(XP) $(DB2MAN) $< + +The xsltproc binary is found in the xsltproc package. The XSL files are in +docbook-xsl. A description of the parameters you can use can be found in the +docbook-xsl-doc-* packages. Please remember that if you create the nroff +version in one of the debian/rules file targets (such as build), you will need +to include xsltproc and docbook-xsl in your Build-Depends control field. +Alternatively use the xmlto command/package. That will also automatically +pull in xsltproc and docbook-xsl. + +Notes for using docbook2x: docbook2x-man does not automatically create the +AUTHOR(S) and COPYRIGHT sections. In this case, please add them manually as + ... . + +To disable the automatic creation of the AUTHOR(S) and COPYRIGHT sections +read /usr/share/doc/docbook-xsl/doc/manpages/authors.html. This file can be +found in the docbook-xsl-doc-html package. + +Validation can be done using: `xmllint -''-noout -''-valid manpage.xml` + +General documentation about man-pages and man-page-formatting: +man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/ + +--> + + + + + + + + + + + + + +]> + + + + &dhtitle; + &dhpackage; + + + &dhfirstname; + &dhsurname; + Wrote this manpage for the Debian system. +
+ &dhemail; +
+
+
+ + 2007 + &dhusername; + + + This manual page was written for the Debian system + (and may be used by others). + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU General Public License, + Version 2 or (at your option) any later version published by + the Free Software Foundation. + On Debian systems, the complete text of the GNU General Public + License can be found in + /usr/share/common-licenses/GPL. + +
+ + &dhucpackage; + &dhsection; + + + &dhpackage; + program to do something + + + + &dhpackage; + + + + + + + + + this + + + + + + + + this + that + + + + + &dhpackage; + + + + + + + + + + + + + + + + + + + DESCRIPTION + This manual page documents briefly the + &dhpackage; and bar + commands. + This manual page was written for the Debian distribution + because the original program does not have a manual page. + Instead, it has documentation in the GNU + info + 1 + format; see below. + &dhpackage; is a program that... + + + OPTIONS + The program follows the usual GNU command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. For a complete description, see the + + info + 1 + files. + + + + + + + Does this and that. + + + + + + + Show summary of options. + + + + + + + Show version of program. + + + + + + FILES + + + /etc/foo.conf + + The system-wide configuration file to control the + behaviour of &dhpackage;. See + + foo.conf + 5 + for further details. + + + + ${HOME}/.foo.conf + + The per-user configuration file to control the + behaviour of &dhpackage;. See + + foo.conf + 5 + for further details. + + + + + + ENVIRONMENT + + + FOO_CONF + + If used, the defined file is used as configuration + file (see also ). + + + + + + DIAGNOSTICS + The following diagnostics may be issued + on stderr: + + + Bad configuration file. Exiting. + + The configuration file seems to contain a broken configuration + line. Use the option, to get more info. + + + + + &dhpackage; provides some return codes, that can + be used in scripts: + + Code + Diagnostic + + 0 + Program exited successfully. + + + 1 + The configuration file seems to be broken. + + + + + + BUGS + The program is currently limited to only work + with the foobar library. + The upstreams BTS can be found + at . + + + SEE ALSO + + + bar + 1 + , + baz + 1 + , + foo.conf + 5 + + The programs are documented fully by The Rise and + Fall of a Fooish Bar available via the + info + 1 + system. + +
+ diff --git a/torch-agent-0.0.1/debian/postinst b/torch-agent-0.0.1/debian/postinst new file mode 100644 index 0000000..ed588b4 --- /dev/null +++ b/torch-agent-0.0.1/debian/postinst @@ -0,0 +1,77 @@ +#!/bin/sh +# postinst script for torch-agent +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +USER="torch" +GROUP="debian-tor" + +TORRC="/etc/tor/torrc" + +configure_tor_controller() { + + TORRC_CHANGED=0 + + if ! grep -q "^ControlPort [0-9]\+" $TORRC; then + sed -i '/^#ControlPort 9051/s/^#//' $TORRC + TORRC_CHANGED=1 + fi + + if ! grep -q "^CookieAuthentication 1" $TORRC; then + sed -i '/^#CookieAuthentication 1/s/^#//' $TORRC + TORRC_CHANGED=1 + fi + + if ! grep -q "^CookieAuthFileGroupReadable 1" $TORRC; then + echo "CookieAuthFileGroupReadable 1" >> $TORRC + TORRC_CHANGED=1 + fi + + if [ $TORRC_CHANGED -eq 1 ]; then + systemctl reload tor + fi +} + +case "$1" in + configure) + + if ! getent passwd $USER >/dev/null ; then + useradd -r -g $GROUP $USER + fi + + chown $USER /etc/torch + chown $USER /etc/torch/torch.conf + chown $USER /usr/share/torch-agent/torch-agent.py + + configure_tor_controller + ;; + + 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 diff --git a/torch-agent-0.0.1/debian/postrm b/torch-agent-0.0.1/debian/postrm new file mode 100644 index 0000000..b95016c --- /dev/null +++ b/torch-agent-0.0.1/debian/postrm @@ -0,0 +1,49 @@ +#!/bin/sh +# postrm script for torch-agent +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +USER="torch" + +case "$1" in + purge|abort-install) + rm -rf /etc/torch + rm -f /usr/share/torch-agent/torch-agent.py + if [ -x "$(command -v deluser)" ]; then + deluser --quiet --system $USER > /dev/null || true + else + echo >&2 "not removing $USER system account because deluser command was not found" + fi + ;; + remove) + ;; + upgrade|failed-upgrade|abort-upgrade|disappear) + ;; + + *) + 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 diff --git a/torch-agent-0.0.1/debian/preinst b/torch-agent-0.0.1/debian/preinst new file mode 100755 index 0000000..3e46feb --- /dev/null +++ b/torch-agent-0.0.1/debian/preinst @@ -0,0 +1,39 @@ +#!/bin/sh +# preinst script for torch-agent +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +case "$1" in + install|upgrade) + + sudo -H pip3 install stem paho-mqtt PySocks + + mkdir -p /etc/torch + mkdir -p /usr/share/torch-agent + ;; + + abort-upgrade) + ;; + + *) + echo "preinst 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 diff --git a/torch-agent-0.0.1/debian/prerm.ex b/torch-agent-0.0.1/debian/prerm.ex new file mode 100644 index 0000000..55eee78 --- /dev/null +++ b/torch-agent-0.0.1/debian/prerm.ex @@ -0,0 +1,38 @@ +#!/bin/sh +# prerm script for torch-agent +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + + +case "$1" in + remove|upgrade|deconfigure) + ;; + + failed-upgrade) + ;; + + *) + echo "prerm 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 diff --git a/torch-agent-0.0.1/debian/rules b/torch-agent-0.0.1/debian/rules new file mode 100755 index 0000000..a82715a --- /dev/null +++ b/torch-agent-0.0.1/debian/rules @@ -0,0 +1,32 @@ +#!/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 +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + + +%: + dh $@ + +override_dh_installsystemd: + dh_installsystemd --no-start --no-enable + +override_dh_installinit: + # --no-enable only on init-system-helpers (>= 1.51) + #dh_installinit --no-start --no-enable + dh_installinit --no-start --no-enable + +# dh_make generated override targets +# This is example for Cmake (See https://bugs.debian.org/641051 ) +#override_dh_auto_configure: +# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) + diff --git a/torch-agent-0.0.1/debian/salsa-ci.yml.ex b/torch-agent-0.0.1/debian/salsa-ci.yml.ex new file mode 100644 index 0000000..260ebbe --- /dev/null +++ b/torch-agent-0.0.1/debian/salsa-ci.yml.ex @@ -0,0 +1,11 @@ +# For more information on what jobs are run see: +# https://salsa.debian.org/salsa-ci-team/pipeline +# +# To enable the jobs, go to your repository (at salsa.debian.org) +# and click over Settings > CI/CD > Expand (in General pipelines). +# In "Custom CI config path" write debian/salsa-ci.yml and click +# in "Save Changes". The CI tests will run after the next commit. +--- +include: + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml + - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml diff --git a/torch-agent-0.0.1/debian/source/format b/torch-agent-0.0.1/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/torch-agent-0.0.1/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/torch-agent-0.0.1/debian/source/include-binaries b/torch-agent-0.0.1/debian/source/include-binaries new file mode 100755 index 0000000..d233ebf --- /dev/null +++ b/torch-agent-0.0.1/debian/source/include-binaries @@ -0,0 +1,2 @@ +debian/src/usr/share/torch-agent/torch-agent.py +debian/src/etc/torch/torch.conf \ No newline at end of file diff --git a/torch-agent-0.0.1/debian/src/etc/torch/torch.conf b/torch-agent-0.0.1/debian/src/etc/torch/torch.conf new file mode 100755 index 0000000..d9d0afd --- /dev/null +++ b/torch-agent-0.0.1/debian/src/etc/torch/torch.conf @@ -0,0 +1,19 @@ +[tor] +ProxyPort = 9050 +ControllerPort = 9051 + +[ssh] +Port = 22 + +[mqtt] +BrokerHost = mqtt.example.com # OR example1i3uyrbfoi3fi.onion +BrokerPort = 1883 +ClientID = my-client +Topic = example/topic + +### Options for Using TLS + +#RequireCertificate = true +#CaFile = ca.crt +#CertFile = client.crt +#KeyFile = client.key \ No newline at end of file diff --git a/torch-agent-0.0.1/debian/src/usr/share/torch-agent/torch-agent.py b/torch-agent-0.0.1/debian/src/usr/share/torch-agent/torch-agent.py new file mode 100755 index 0000000..98fd542 --- /dev/null +++ b/torch-agent-0.0.1/debian/src/usr/share/torch-agent/torch-agent.py @@ -0,0 +1,98 @@ +from stem.control import Controller +import stem.connection +import paho.mqtt.client as mqtt +import ssl +import socks +import socket +import json +import configparser +import argparse +from datetime import datetime +from os import environ + +parser = argparse.ArgumentParser(description='Broadcast SSH hidden service hostname via MQTT') + +parser.add_argument('--config-dir', nargs='?', dest='configPath', default='/etc/torch', + help='configuration directory (default: /etc/torch)') + +args = parser.parse_args() + +configPath = args.configPath + +if "TORCH_CONFIG_DIR" in environ: + configPath = environ.get("TORCH_CONFIG_DIR") + +if not configPath.endswith("/"): + configPath = configPath + "/" + +print("Using torch configuration path: " + configPath) + +config = configparser.ConfigParser() +config.read(configPath + "torch.conf") + +torProxyPort = config['tor'].getint('ProxyPort', fallback = 9050) +torControllerPort = config['tor'].getint('ControllerPort', fallback = 9051) + +sshPort = config['ssh'].getint('Port', fallback = 22) + +mqttConfig = config['mqtt'] +mqttBrokerHost = mqttConfig.get('BrokerHost', fallback = "localhost") +mqttBrokerPort = mqttConfig.getint('BrokerPort', fallback = 1883) +clientID = mqttConfig.get('ClientID', fallback = socket.gethostname()) +mqttTopic = mqttConfig.get('Topic', fallback = "torch/%s/onion_url" % (clientID)) + +mqttRequireCertificate = mqttConfig.getboolean( + 'RequireCertificate', + fallback = False) + +mqttCaFile = configPath + mqttConfig.get('CaFile') +mqttCertFile = configPath + mqttConfig.get('CertFile') +mqttKeyFile = configPath + mqttConfig.get('KeyFile') + +with Controller.from_port(port = torControllerPort) as controller: + + protocolInfo = stem.connection.get_protocolinfo(controller) + + stem.connection.authenticate_safecookie( + controller, + protocolInfo.cookie_path) + + print("Connected to Tor on port %s" % (torControllerPort)) + + service = controller.create_ephemeral_hidden_service( + sshPort, + detached = True) + + onionAddress = "%s.onion" % (service.service_id) + + print("Created Tor Hidden Service for local port %s at %s" % (sshPort, onionAddress)) + +payload = { + 'clientId': clientID, + 'timestamp': datetime.now().strftime("%d-%b-%Y (%H:%M:%S.%f)"), + 'onionAddress': onionAddress, + 'sshPort': sshPort + } + +client = mqtt.Client() +protocol = "mqtt" + +if mqttRequireCertificate: + client.tls_set( + ca_certs = mqttCaFile, + certfile = mqttCertFile, + keyfile = mqttKeyFile, + cert_reqs=ssl.CERT_REQUIRED) + protocol = "mqtts" + +if mqttBrokerHost.endswith(".onion"): + client.proxy_set(proxy_type=socks.SOCKS5, proxy_addr="localhost", proxy_port=torProxyPort) + client.tls_insecure_set(True) + +client.connect(mqttBrokerHost, mqttBrokerPort, 60) +client.publish(mqttTopic, json.dumps(payload)) +print("Connected to MQTT Broker at %s://%s:%s/%s" % (protocol, mqttBrokerHost, mqttBrokerPort, mqttTopic)) +print("Published payload: " + json.dumps(payload)) + +client.disconnect() +print("Disconnected from MQTT Broker") diff --git a/torch-agent-0.0.1/debian/torch-agent-docs.docs b/torch-agent-0.0.1/debian/torch-agent-docs.docs new file mode 100644 index 0000000..efea0a6 --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent-docs.docs @@ -0,0 +1,2 @@ +README.Debian +README.source diff --git a/torch-agent-0.0.1/debian/torch-agent.cron.d.ex b/torch-agent-0.0.1/debian/torch-agent.cron.d.ex new file mode 100644 index 0000000..0910f88 --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent.cron.d.ex @@ -0,0 +1,4 @@ +# +# Regular cron jobs for the torch-agent package +# +0 4 * * * root [ -x /usr/bin/torch-agent_maintenance ] && /usr/bin/torch-agent_maintenance diff --git a/torch-agent-0.0.1/debian/torch-agent.debhelper.log b/torch-agent-0.0.1/debian/torch-agent.debhelper.log new file mode 100644 index 0000000..e15a197 --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent.debhelper.log @@ -0,0 +1 @@ +dh_installsystemd diff --git a/torch-agent-0.0.1/debian/torch-agent.doc-base.EX b/torch-agent-0.0.1/debian/torch-agent.doc-base.EX new file mode 100644 index 0000000..25a60ee --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent.doc-base.EX @@ -0,0 +1,20 @@ +Document: torch-agent +Title: Debian torch-agent Manual +Author: +Abstract: This manual describes what torch-agent is + and how it can be used to + manage online manuals on Debian systems. +Section: unknown + +Format: debiandoc-sgml +Files: /usr/share/doc/torch-agent/torch-agent.sgml.gz + +Format: postscript +Files: /usr/share/doc/torch-agent/torch-agent.ps.gz + +Format: text +Files: /usr/share/doc/torch-agent/torch-agent.text.gz + +Format: HTML +Index: /usr/share/doc/torch-agent/html/index.html +Files: /usr/share/doc/torch-agent/html/*.html diff --git a/torch-agent-0.0.1/debian/torch-agent.install b/torch-agent-0.0.1/debian/torch-agent.install new file mode 100644 index 0000000..0e631be --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent.install @@ -0,0 +1,2 @@ +debian/src/usr/share/torch-agent /usr/share/ +debian/src/etc/torch /etc/ \ No newline at end of file diff --git a/torch-agent-0.0.1/debian/torch-agent.postrm.debhelper b/torch-agent-0.0.1/debian/torch-agent.postrm.debhelper new file mode 100644 index 0000000..bc043aa --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent.postrm.debhelper @@ -0,0 +1,19 @@ +# Automatically added by dh_installsystemd/12.10ubuntu1 +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_installsystemd/12.10ubuntu1 +if [ "$1" = "remove" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper mask 'torch-agent.service' >/dev/null || true + fi +fi + +if [ "$1" = "purge" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper purge 'torch-agent.service' >/dev/null || true + deb-systemd-helper unmask 'torch-agent.service' >/dev/null || true + fi +fi +# End automatically added section diff --git a/torch-agent-0.0.1/debian/torch-agent.service b/torch-agent-0.0.1/debian/torch-agent.service new file mode 100644 index 0000000..6816b64 --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent.service @@ -0,0 +1,13 @@ +[Unit] +Description=TORch Agent: MQTT Publisher for Tor Hidden SSH Service URL +After=tor.service ssh.service +Requires=tor.service ssh.service + +[Service] +Environment=PYTHONUNBUFFERED=1 +ExecStart=/usr/bin/python3 /usr/share/torch-agent/torch-agent.py +User=torch +Group=debian-tor + +[Install] +WantedBy=multi-user.target ssh.service tor.service \ No newline at end of file diff --git a/torch-agent-0.0.1/debian/torch-agent.substvars b/torch-agent-0.0.1/debian/torch-agent.substvars new file mode 100644 index 0000000..978fc8b --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent.substvars @@ -0,0 +1,2 @@ +misc:Depends= +misc:Pre-Depends= diff --git a/torch-agent-0.0.1/debian/torch-agent/DEBIAN/conffiles b/torch-agent-0.0.1/debian/torch-agent/DEBIAN/conffiles new file mode 100644 index 0000000..e976293 --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent/DEBIAN/conffiles @@ -0,0 +1 @@ +/etc/torch/torch.conf diff --git a/torch-agent-0.0.1/debian/torch-agent/DEBIAN/control b/torch-agent-0.0.1/debian/torch-agent/DEBIAN/control new file mode 100644 index 0000000..495161f --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent/DEBIAN/control @@ -0,0 +1,12 @@ +Package: torch-agent +Version: 0.0.1-1 +Architecture: all +Maintainer: Benjamin Dweck +Installed-Size: 29 +Depends: ssh, tor, python3-pip +Section: net +Priority: optional +Homepage: https://rudefox.io +Description: TORch is a solution for creating an SSH-via-Tor + backdoor on a remote device as a means of fallback remote + management and initial headless device configuration. diff --git a/torch-agent-0.0.1/debian/torch-agent/DEBIAN/md5sums b/torch-agent-0.0.1/debian/torch-agent/DEBIAN/md5sums new file mode 100644 index 0000000..392bfd4 --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent/DEBIAN/md5sums @@ -0,0 +1,5 @@ +1e2c6dfcdaab533fa279eef51cdaa500 lib/systemd/system/torch-agent.service +de899b3b2dbb67f357d153425a8421cd usr/share/doc/torch-agent/README.Debian +507827efdf54541d719f3a27e1a1db5f usr/share/doc/torch-agent/changelog.Debian.gz +7d50b1cef77999609862e52053d3ed74 usr/share/doc/torch-agent/copyright +94f2830be2c7420e0f1c4556fc08f1ec usr/share/torch-agent/torch-agent.py diff --git a/torch-agent-0.0.1/debian/torch-agent/DEBIAN/postinst b/torch-agent-0.0.1/debian/torch-agent/DEBIAN/postinst new file mode 100755 index 0000000..2d04f0e --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent/DEBIAN/postinst @@ -0,0 +1,104 @@ +#!/bin/sh +# postinst script for torch-agent +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `configure' +# * `abort-upgrade' +# * `abort-remove' `in-favour' +# +# * `abort-remove' +# * `abort-deconfigure' `in-favour' +# `removing' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +USER="torch" +GROUP="debian-tor" + +TORRC="/etc/tor/torrc" + +configure_tor_controller() { + + TORRC_CHANGED=0 + + if ! grep -q "^ControlPort [0-9]\+" $TORRC; then + sed -i '/^#ControlPort 9051/s/^#//' $TORRC + TORRC_CHANGED=1 + fi + + if ! grep -q "^CookieAuthentication 1" $TORRC; then + sed -i '/^#CookieAuthentication 1/s/^#//' $TORRC + TORRC_CHANGED=1 + fi + + if ! grep -q "^CookieAuthFileGroupReadable 1" $TORRC; then + echo "CookieAuthFileGroupReadable 1" >> $TORRC + TORRC_CHANGED=1 + fi + + if [ $TORRC_CHANGED -eq 1 ]; then + systemctl reload tor + fi +} + +case "$1" in + configure) + + if ! getent passwd $USER >/dev/null ; then + useradd -r -g $GROUP $USER + fi + + chown $USER /etc/torch + chown $USER /etc/torch/torch.conf + chown $USER /usr/share/torch-agent/torch-agent.py + + configure_tor_controller + ;; + + 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. + +# Automatically added by dh_installsystemd/12.10ubuntu1 +if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then + if deb-systemd-helper debian-installed 'torch-agent.service'; then + # This will only remove masks created by d-s-h on package removal. + deb-systemd-helper unmask 'torch-agent.service' >/dev/null || true + + if deb-systemd-helper --quiet was-enabled 'torch-agent.service'; then + # Create new symlinks, if any. + deb-systemd-helper enable 'torch-agent.service' >/dev/null || true + fi + fi + + # Update the statefile to add new symlinks (if any), which need to be cleaned + # up on purge. Also remove old symlinks. + deb-systemd-helper update-state 'torch-agent.service' >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_installsystemd/12.10ubuntu1 +if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then + if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true + if [ -n "$2" ]; then + deb-systemd-invoke try-restart 'torch-agent.service' >/dev/null || true + fi + fi +fi +# End automatically added section + + +exit 0 diff --git a/torch-agent-0.0.1/debian/torch-agent/DEBIAN/postrm b/torch-agent-0.0.1/debian/torch-agent/DEBIAN/postrm new file mode 100755 index 0000000..e24684a --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent/DEBIAN/postrm @@ -0,0 +1,68 @@ +#!/bin/sh +# postrm script for torch-agent +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `remove' +# * `purge' +# * `upgrade' +# * `failed-upgrade' +# * `abort-install' +# * `abort-install' +# * `abort-upgrade' +# * `disappear' +# +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +USER="torch" + +case "$1" in + purge|abort-install) + rm -rf /etc/torch + rm -f /usr/share/torch-agent/torch-agent.py + if [ -x "$(command -v deluser)" ]; then + deluser --quiet --system $USER > /dev/null || true + else + echo >&2 "not removing $USER system account because deluser command was not found" + fi + ;; + remove) + ;; + upgrade|failed-upgrade|abort-upgrade|disappear) + ;; + + *) + 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. + +# Automatically added by dh_installsystemd/12.10ubuntu1 +if [ -d /run/systemd/system ]; then + systemctl --system daemon-reload >/dev/null || true +fi +# End automatically added section +# Automatically added by dh_installsystemd/12.10ubuntu1 +if [ "$1" = "remove" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper mask 'torch-agent.service' >/dev/null || true + fi +fi + +if [ "$1" = "purge" ]; then + if [ -x "/usr/bin/deb-systemd-helper" ]; then + deb-systemd-helper purge 'torch-agent.service' >/dev/null || true + deb-systemd-helper unmask 'torch-agent.service' >/dev/null || true + fi +fi +# End automatically added section + + +exit 0 diff --git a/torch-agent-0.0.1/debian/torch-agent/DEBIAN/preinst b/torch-agent-0.0.1/debian/torch-agent/DEBIAN/preinst new file mode 100755 index 0000000..8e3fed9 --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent/DEBIAN/preinst @@ -0,0 +1,39 @@ +#!/bin/sh +# preinst script for torch-agent +# +# see: dh_installdeb(1) + +set -e + +# summary of how this script can be called: +# * `install' +# * `install' +# * `upgrade' +# * `abort-upgrade' +# for details, see https://www.debian.org/doc/debian-policy/ or +# the debian-policy package + +case "$1" in + install|upgrade) + + sudo -H pip3 install stem paho-mqtt PySocks + + mkdir -p /etc/torch + mkdir -p /usr/share/torch-agent + ;; + + abort-upgrade) + ;; + + *) + echo "preinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + + + +exit 0 diff --git a/torch-agent-0.0.1/debian/torch-agent/DEBIAN/prerm b/torch-agent-0.0.1/debian/torch-agent/DEBIAN/prerm new file mode 100755 index 0000000..d6934ef --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent/DEBIAN/prerm @@ -0,0 +1,7 @@ +#!/bin/sh +set -e +# Automatically added by dh_installsystemd/12.10ubuntu1 +if [ -d /run/systemd/system ] && [ "$1" = remove ]; then + deb-systemd-invoke stop 'torch-agent.service' >/dev/null || true +fi +# End automatically added section diff --git a/torch-agent-0.0.1/debian/torch-agent/etc/torch/torch.conf b/torch-agent-0.0.1/debian/torch-agent/etc/torch/torch.conf new file mode 100755 index 0000000..d9d0afd --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent/etc/torch/torch.conf @@ -0,0 +1,19 @@ +[tor] +ProxyPort = 9050 +ControllerPort = 9051 + +[ssh] +Port = 22 + +[mqtt] +BrokerHost = mqtt.example.com # OR example1i3uyrbfoi3fi.onion +BrokerPort = 1883 +ClientID = my-client +Topic = example/topic + +### Options for Using TLS + +#RequireCertificate = true +#CaFile = ca.crt +#CertFile = client.crt +#KeyFile = client.key \ No newline at end of file diff --git a/torch-agent-0.0.1/debian/torch-agent/lib/systemd/system/torch-agent.service b/torch-agent-0.0.1/debian/torch-agent/lib/systemd/system/torch-agent.service new file mode 100644 index 0000000..6816b64 --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent/lib/systemd/system/torch-agent.service @@ -0,0 +1,13 @@ +[Unit] +Description=TORch Agent: MQTT Publisher for Tor Hidden SSH Service URL +After=tor.service ssh.service +Requires=tor.service ssh.service + +[Service] +Environment=PYTHONUNBUFFERED=1 +ExecStart=/usr/bin/python3 /usr/share/torch-agent/torch-agent.py +User=torch +Group=debian-tor + +[Install] +WantedBy=multi-user.target ssh.service tor.service \ No newline at end of file diff --git a/torch-agent-0.0.1/debian/torch-agent/usr/share/doc/torch-agent/README.Debian b/torch-agent-0.0.1/debian/torch-agent/usr/share/doc/torch-agent/README.Debian new file mode 100644 index 0000000..699fb17 --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent/usr/share/doc/torch-agent/README.Debian @@ -0,0 +1,6 @@ +torch-agent for Debian +--------------------- + + + + -- Benjamin Dweck Tue, 06 Oct 2020 15:53:02 +0200 diff --git a/torch-agent-0.0.1/debian/torch-agent/usr/share/doc/torch-agent/changelog.Debian.gz b/torch-agent-0.0.1/debian/torch-agent/usr/share/doc/torch-agent/changelog.Debian.gz new file mode 100644 index 0000000..87dac02 Binary files /dev/null and b/torch-agent-0.0.1/debian/torch-agent/usr/share/doc/torch-agent/changelog.Debian.gz differ diff --git a/torch-agent-0.0.1/debian/torch-agent/usr/share/doc/torch-agent/copyright b/torch-agent-0.0.1/debian/torch-agent/usr/share/doc/torch-agent/copyright new file mode 100644 index 0000000..b1e631f --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent/usr/share/doc/torch-agent/copyright @@ -0,0 +1,23 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: torch-agent +Upstream-Contact: bjdweck@gmail.com +Source: https://rudefox.io + +Files: debian/* +Copyright: 2020 Benjamin Dweck +License: GPL-2+ + This package 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 2 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 + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". \ No newline at end of file diff --git a/torch-agent-0.0.1/debian/torch-agent/usr/share/torch-agent/torch-agent.py b/torch-agent-0.0.1/debian/torch-agent/usr/share/torch-agent/torch-agent.py new file mode 100755 index 0000000..98fd542 --- /dev/null +++ b/torch-agent-0.0.1/debian/torch-agent/usr/share/torch-agent/torch-agent.py @@ -0,0 +1,98 @@ +from stem.control import Controller +import stem.connection +import paho.mqtt.client as mqtt +import ssl +import socks +import socket +import json +import configparser +import argparse +from datetime import datetime +from os import environ + +parser = argparse.ArgumentParser(description='Broadcast SSH hidden service hostname via MQTT') + +parser.add_argument('--config-dir', nargs='?', dest='configPath', default='/etc/torch', + help='configuration directory (default: /etc/torch)') + +args = parser.parse_args() + +configPath = args.configPath + +if "TORCH_CONFIG_DIR" in environ: + configPath = environ.get("TORCH_CONFIG_DIR") + +if not configPath.endswith("/"): + configPath = configPath + "/" + +print("Using torch configuration path: " + configPath) + +config = configparser.ConfigParser() +config.read(configPath + "torch.conf") + +torProxyPort = config['tor'].getint('ProxyPort', fallback = 9050) +torControllerPort = config['tor'].getint('ControllerPort', fallback = 9051) + +sshPort = config['ssh'].getint('Port', fallback = 22) + +mqttConfig = config['mqtt'] +mqttBrokerHost = mqttConfig.get('BrokerHost', fallback = "localhost") +mqttBrokerPort = mqttConfig.getint('BrokerPort', fallback = 1883) +clientID = mqttConfig.get('ClientID', fallback = socket.gethostname()) +mqttTopic = mqttConfig.get('Topic', fallback = "torch/%s/onion_url" % (clientID)) + +mqttRequireCertificate = mqttConfig.getboolean( + 'RequireCertificate', + fallback = False) + +mqttCaFile = configPath + mqttConfig.get('CaFile') +mqttCertFile = configPath + mqttConfig.get('CertFile') +mqttKeyFile = configPath + mqttConfig.get('KeyFile') + +with Controller.from_port(port = torControllerPort) as controller: + + protocolInfo = stem.connection.get_protocolinfo(controller) + + stem.connection.authenticate_safecookie( + controller, + protocolInfo.cookie_path) + + print("Connected to Tor on port %s" % (torControllerPort)) + + service = controller.create_ephemeral_hidden_service( + sshPort, + detached = True) + + onionAddress = "%s.onion" % (service.service_id) + + print("Created Tor Hidden Service for local port %s at %s" % (sshPort, onionAddress)) + +payload = { + 'clientId': clientID, + 'timestamp': datetime.now().strftime("%d-%b-%Y (%H:%M:%S.%f)"), + 'onionAddress': onionAddress, + 'sshPort': sshPort + } + +client = mqtt.Client() +protocol = "mqtt" + +if mqttRequireCertificate: + client.tls_set( + ca_certs = mqttCaFile, + certfile = mqttCertFile, + keyfile = mqttKeyFile, + cert_reqs=ssl.CERT_REQUIRED) + protocol = "mqtts" + +if mqttBrokerHost.endswith(".onion"): + client.proxy_set(proxy_type=socks.SOCKS5, proxy_addr="localhost", proxy_port=torProxyPort) + client.tls_insecure_set(True) + +client.connect(mqttBrokerHost, mqttBrokerPort, 60) +client.publish(mqttTopic, json.dumps(payload)) +print("Connected to MQTT Broker at %s://%s:%s/%s" % (protocol, mqttBrokerHost, mqttBrokerPort, mqttTopic)) +print("Published payload: " + json.dumps(payload)) + +client.disconnect() +print("Disconnected from MQTT Broker") diff --git a/torch-agent-0.0.1/debian/watch.ex b/torch-agent-0.0.1/debian/watch.ex new file mode 100644 index 0000000..888e752 --- /dev/null +++ b/torch-agent-0.0.1/debian/watch.ex @@ -0,0 +1,38 @@ +# Example watch control file for uscan +# Rename this file to "watch" and then you can run the "uscan" command +# to check for upstream updates and more. +# See uscan(1) for format + +# Compulsory line, this is a version 4 file +version=4 + +# PGP signature mangle, so foo.tar.gz has foo.tar.gz.sig +#opts="pgpsigurlmangle=s%$%.sig%" + +# HTTP site (basic) +#http://example.com/downloads.html \ +# files/torch-agent-([\d\.]+)\.tar\.gz debian uupdate + +# Uncomment to examine an FTP server +#ftp://ftp.example.com/pub/torch-agent-(.*)\.tar\.gz debian uupdate + +# SourceForge hosted projects +# http://sf.net/torch-agent/ torch-agent-(.*)\.tar\.gz debian uupdate + +# GitHub hosted projects +#opts="filenamemangle=s%(?:.*?)?v?(\d[\d.]*)\.tar\.gz%-$1.tar.gz%" \ +# https://github.com//torch-agent/tags \ +# (?:.*?/)?v?(\d[\d.]*)\.tar\.gz debian uupdate + +# PyPI +# https://pypi.debian.net/torch-agent/torch-agent-(.+)\.(?:zip|tgz|tbz|txz|(?:tar\.(?:gz|bz2|xz))) + +# Direct Git +# opts="mode=git" http://git.example.com/torch-agent.git \ +# refs/tags/v([\d\.]+) debian uupdate + + + + +# Uncomment to find new files on GooglePages +# http://example.googlepages.com/foo.html torch-agent-(.*)\.tar\.gz diff --git a/torch-agent_0.0.1-1.debian.tar.xz b/torch-agent_0.0.1-1.debian.tar.xz new file mode 100644 index 0000000..309aabe Binary files /dev/null and b/torch-agent_0.0.1-1.debian.tar.xz differ diff --git a/torch-agent_0.0.1-1.dsc b/torch-agent_0.0.1-1.dsc new file mode 100644 index 0000000..a62bfe5 --- /dev/null +++ b/torch-agent_0.0.1-1.dsc @@ -0,0 +1,35 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA512 + +Format: 3.0 (quilt) +Source: torch-agent +Binary: torch-agent +Architecture: all +Version: 0.0.1-1 +Maintainer: Benjamin Dweck +Homepage: https://rudefox.io +Standards-Version: 4.4.1 +Build-Depends: debhelper-compat (= 12) +Package-List: + torch-agent deb net optional arch=all +Checksums-Sha1: + 75a6ce9e0ad9f4ed0d2d31348c9db1238bd4f39d 9788 torch-agent_0.0.1.orig.tar.xz + 4b3e734647e0e62bbb17c1ed5dbbd853462613f9 9636 torch-agent_0.0.1-1.debian.tar.xz +Checksums-Sha256: + 30c630f9fdbaea2337a3e8701e753ef45a094b9403e77f9a42b2bd2ca63e8dc5 9788 torch-agent_0.0.1.orig.tar.xz + 0ffd62a08673dfc3d0a7544eb62398b8fd3bd0aa71bfd19c1a8dd816c430ec1b 9636 torch-agent_0.0.1-1.debian.tar.xz +Files: + 267a824b2a18ef73dcda05da7e99a4b5 9788 torch-agent_0.0.1.orig.tar.xz + ee6afe9f8ff5b6cade07a66f9075c505 9636 torch-agent_0.0.1-1.debian.tar.xz + +-----BEGIN PGP SIGNATURE----- + +iQFGBAEBCgAwFiEEFNiF9i0uBB0TW5u+27VgOYC/OIMFAl988dMSHGJqZHdlY2tA +Z21haWwuY29tAAoJENu1YDmAvziDfVkIAIKkS0PLQsDNUu3cJ+3UY1PboECjQdSb +0SpNuS61gRFJED9yoRg9XO5DMnpfp1qhVoZF0/wJSfel4Mbvyf8KPTpDYja9ZAkH +sjFwfqmvB2Po2VAE64ym/j7HCOGSMle6+f+NrcpDiEi592UzHR6iFi6iy8YwjhDa +xFmUJp4tPu62IUqOtASOMuQHGsY2c0j18Ev5Su0Z303MmfEp+bc/Y99lISU8cwHs +xPxOhsPCVj55E1wEi6hFeCy7sxh28W796fqOuCWKLYjIbIk2VRZC7clZ/dLn3hHk +RoXsSsBM5eFTK7uGKAOXCe1+AHZgsdnOU8XxnbvDMMbHYaaz7rnTNrw= +=pqDg +-----END PGP SIGNATURE----- diff --git a/torch-agent_0.0.1-1_all.deb b/torch-agent_0.0.1-1_all.deb new file mode 100644 index 0000000..3082955 Binary files /dev/null and b/torch-agent_0.0.1-1_all.deb differ diff --git a/torch-agent_0.0.1-1_amd64.buildinfo b/torch-agent_0.0.1-1_amd64.buildinfo new file mode 100644 index 0000000..8859537 --- /dev/null +++ b/torch-agent_0.0.1-1_amd64.buildinfo @@ -0,0 +1,195 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA512 + +Format: 1.0 +Source: torch-agent +Binary: torch-agent +Architecture: all source +Version: 0.0.1-1 +Checksums-Md5: + 0abbdb3e83d948e0076ba9298c5f5502 1397 torch-agent_0.0.1-1.dsc + 526fa2edc26efa17ce067b6b8b7780b5 5200 torch-agent_0.0.1-1_all.deb +Checksums-Sha1: + e88b32f193b3a57dd8717d02c643b6096b11e468 1397 torch-agent_0.0.1-1.dsc + 816e7a65d14e02df230346565496a2bfb4ace2ad 5200 torch-agent_0.0.1-1_all.deb +Checksums-Sha256: + 9b9a4486d39a88c09e1bd648560cd0c70cbba0e40bed9305e540e551db31d55e 1397 torch-agent_0.0.1-1.dsc + 1560cd30b4944162d0ea4f2e4c5402527d06587c98a907820c36ec455633aede 5200 torch-agent_0.0.1-1_all.deb +Build-Origin: Ubuntu +Build-Architecture: amd64 +Build-Date: Wed, 07 Oct 2020 00:38:11 +0200 +Build-Tainted-By: + merged-usr-via-symlinks + usr-local-has-libraries + usr-local-has-programs +Installed-Build-Depends: + autoconf (= 2.69-11.1), + automake (= 1:1.16.1-4ubuntu6), + autopoint (= 0.19.8.1-10build1), + autotools-dev (= 20180224.1), + base-files (= 11ubuntu5.1), + base-passwd (= 3.5.47), + bash (= 5.0-6ubuntu1.1), + binutils (= 2.34-6ubuntu1), + binutils-common (= 2.34-6ubuntu1), + binutils-x86-64-linux-gnu (= 2.34-6ubuntu1), + bsdmainutils (= 11.1.2ubuntu3), + bsdutils (= 1:2.34-0.1ubuntu9), + build-essential (= 12.8ubuntu1), + bzip2 (= 1.0.8-2), + coreutils (= 8.30-3ubuntu2), + cpp (= 4:9.3.0-1ubuntu2), + cpp-9 (= 9.3.0-10ubuntu2), + dash (= 0.5.10.2-6), + debconf (= 1.5.73), + debhelper (= 12.10ubuntu1), + debianutils (= 4.9.1), + dh-autoreconf (= 19), + dh-strip-nondeterminism (= 1.7.0-1), + diffutils (= 1:3.7-3), + dpkg (= 1.19.7ubuntu3), + dpkg-dev (= 1.19.7ubuntu3), + dwz (= 0.13-5), + file (= 1:5.38-4), + findutils (= 4.7.0-1ubuntu1), + g++ (= 4:9.3.0-1ubuntu2), + g++-9 (= 9.3.0-10ubuntu2), + gawk (= 1:5.0.1+dfsg-1), + gcc (= 4:9.3.0-1ubuntu2), + gcc-10-base (= 10-20200411-0ubuntu1), + gcc-9 (= 9.3.0-10ubuntu2), + gcc-9-base (= 9.3.0-10ubuntu2), + gettext (= 0.19.8.1-10build1), + gettext-base (= 0.19.8.1-10build1), + grep (= 3.4-1), + groff-base (= 1.22.4-4build1), + gzip (= 1.10-0ubuntu4), + hostname (= 3.23), + init-system-helpers (= 1.57), + install-info (= 6.7.0.dfsg.2-5), + intltool-debian (= 0.35.0+20060710.5), + libacl1 (= 2.2.53-6), + libarchive-zip-perl (= 1.67-2), + libasan5 (= 9.3.0-10ubuntu2), + libatomic1 (= 10-20200411-0ubuntu1), + libattr1 (= 1:2.4.48-5), + libaudit-common (= 1:2.8.5-2ubuntu6), + libaudit1 (= 1:2.8.5-2ubuntu6), + libbinutils (= 2.34-6ubuntu1), + libblkid1 (= 2.34-0.1ubuntu9), + libbsd0 (= 0.10.0-1), + libbz2-1.0 (= 1.0.8-2), + libc-bin (= 2.31-0ubuntu9), + libc-dev-bin (= 2.31-0ubuntu9), + libc6 (= 2.31-0ubuntu9), + libc6-dev (= 2.31-0ubuntu9), + libcap-ng0 (= 0.7.9-2.1build1), + libcc1-0 (= 10-20200411-0ubuntu1), + libcroco3 (= 0.6.13-1), + libcrypt-dev (= 1:4.4.10-10ubuntu4), + libcrypt1 (= 1:4.4.10-10ubuntu4), + libctf-nobfd0 (= 2.34-6ubuntu1), + libctf0 (= 2.34-6ubuntu1), + libdb5.3 (= 5.3.28+dfsg1-0.6ubuntu2), + libdebconfclient0 (= 0.251ubuntu1), + libdebhelper-perl (= 12.10ubuntu1), + libdpkg-perl (= 1.19.7ubuntu3), + libelf1 (= 0.176-1.1build1), + libffi7 (= 3.3-4), + libfile-stripnondeterminism-perl (= 1.7.0-1), + libgcc-9-dev (= 9.3.0-10ubuntu2), + libgcc-s1 (= 10-20200411-0ubuntu1), + libgcrypt20 (= 1.8.5-5ubuntu1), + libgdbm-compat4 (= 1.18.1-5), + libgdbm6 (= 1.18.1-5), + libglib2.0-0 (= 2.64.3-1~ubuntu20.04.1), + libgmp10 (= 2:6.2.0+dfsg-4), + libgomp1 (= 10-20200411-0ubuntu1), + libgpg-error0 (= 1.37-1), + libicu66 (= 66.1-2ubuntu2), + libisl22 (= 0.22.1-1), + libitm1 (= 10-20200411-0ubuntu1), + liblsan0 (= 10-20200411-0ubuntu1), + liblz4-1 (= 1.9.2-2), + liblzma5 (= 5.2.4-1ubuntu1), + libmagic-mgc (= 1:5.38-4), + libmagic1 (= 1:5.38-4), + libmount1 (= 2.34-0.1ubuntu9), + libmpc3 (= 1.1.0-1), + libmpfr6 (= 4.0.2-1), + libpam-modules (= 1.3.1-5ubuntu4), + libpam-modules-bin (= 1.3.1-5ubuntu4), + libpam-runtime (= 1.3.1-5ubuntu4), + libpam0g (= 1.3.1-5ubuntu4), + libpcre2-8-0 (= 10.34-7), + libpcre3 (= 2:8.39-12build1), + libperl5.30 (= 5.30.0-9build1), + libpipeline1 (= 1.5.2-2build1), + libquadmath0 (= 10-20200411-0ubuntu1), + libreadline8 (= 8.0-4), + libseccomp2 (= 2.4.3-1ubuntu3.20.04.3), + libselinux1 (= 3.0-1build2), + libsigsegv2 (= 2.12-2), + libsmartcols1 (= 2.34-0.1ubuntu9), + libstdc++-9-dev (= 9.3.0-10ubuntu2), + libstdc++6 (= 10-20200411-0ubuntu1), + libsub-override-perl (= 0.09-2), + libsystemd0 (= 245.4-4ubuntu3.2), + libtinfo6 (= 6.2-0ubuntu2), + libtool (= 2.4.6-14), + libtsan0 (= 10-20200411-0ubuntu1), + libubsan1 (= 10-20200411-0ubuntu1), + libuchardet0 (= 0.0.6-3build1), + libudev1 (= 245.4-4ubuntu3.2), + libunistring2 (= 0.9.10-2), + libuuid1 (= 2.34-0.1ubuntu9), + libxml2 (= 2.9.10+dfsg-5), + libzstd1 (= 1.4.4+dfsg-3), + linux-libc-dev (= 5.4.0-47.51), + login (= 1:4.8.1-1ubuntu5.20.04), + lsb-base (= 11.1.0ubuntu2), + m4 (= 1.4.18-4), + make (= 4.2.1-1.2), + man-db (= 2.9.1-1), + mawk (= 1.3.4.20200120-2), + ncurses-base (= 6.2-0ubuntu2), + ncurses-bin (= 6.2-0ubuntu2), + patch (= 2.7.6-6), + perl (= 5.30.0-9build1), + perl-base (= 5.30.0-9build1), + perl-modules-5.30 (= 5.30.0-9build1), + po-debconf (= 1.0.21), + readline-common (= 8.0-4), + sed (= 4.7-1), + sensible-utils (= 0.0.12+nmu1), + sysvinit-utils (= 2.96-2.1ubuntu1), + tar (= 1.30+dfsg-7), + tzdata (= 2020a-0ubuntu0.20.04), + util-linux (= 2.34-0.1ubuntu9), + xz-utils (= 5.2.4-1ubuntu1), + zlib1g (= 1:1.2.11.dfsg-2ubuntu1) +Environment: + DEB_BUILD_OPTIONS="parallel=4" + LANG="en_US.UTF-8" + LC_ADDRESS="en_US.UTF-8" + LC_IDENTIFICATION="en_US.UTF-8" + LC_MEASUREMENT="en_US.UTF-8" + LC_MONETARY="en_US.UTF-8" + LC_NAME="en_US.UTF-8" + LC_NUMERIC="en_US.UTF-8" + LC_PAPER="en_US.UTF-8" + LC_TELEPHONE="en_US.UTF-8" + LC_TIME="en_US.UTF-8" + SOURCE_DATE_EPOCH="1601992382" + +-----BEGIN PGP SIGNATURE----- + +iQFGBAEBCgAwFiEEFNiF9i0uBB0TW5u+27VgOYC/OIMFAl988dQSHGJqZHdlY2tA +Z21haWwuY29tAAoJENu1YDmAvziDbhIH/RLtAHLasxrim/3qkhGJAUApkzoIhxEZ +feWBwQ5nncKnt9vNRaQVOuQ4GWVRcpNtEQGWc+6/XE9U28XcOMZ/DMlvt8laFOCp +w4mmTpzFUnskXaNHqNEP3en85Opb7eeQCOJjuvEvUmo8lk5jtASXcxT7pNcDlb3X +NAXUyO22s81SHB1TnnwXOfIKLV5duo0pSJxZ+QwKoQtfYIuyHNvilvr8DaoKiltp +a2EjwyBWPfdJHHnKcv2Zyye65eQOr3VE8dP6k5OQWcuC2bHh84YgwyN6cmgWaELt +XlCu5sA5TPzNbO0gyVOtMBnyZ3B9tQ80Yzu/UWIiVTfTUzyMF8nugNI= +=l2RV +-----END PGP SIGNATURE----- diff --git a/torch-agent_0.0.1-1_amd64.changes b/torch-agent_0.0.1-1_amd64.changes new file mode 100644 index 0000000..dd04e34 --- /dev/null +++ b/torch-agent_0.0.1-1_amd64.changes @@ -0,0 +1,49 @@ +-----BEGIN PGP SIGNED MESSAGE----- +Hash: SHA512 + +Format: 1.8 +Date: Tue, 06 Oct 2020 15:53:02 +0200 +Source: torch-agent +Binary: torch-agent +Architecture: source all +Version: 0.0.1-1 +Distribution: unstable +Urgency: medium +Maintainer: Benjamin Dweck +Changed-By: Benjamin Dweck +Description: + torch-agent - TORch is a solution for creating an SSH-via-Tor +Changes: + torch-agent (0.0.1-1) unstable; urgency=medium + . + * Initial release +Checksums-Sha1: + e88b32f193b3a57dd8717d02c643b6096b11e468 1397 torch-agent_0.0.1-1.dsc + 75a6ce9e0ad9f4ed0d2d31348c9db1238bd4f39d 9788 torch-agent_0.0.1.orig.tar.xz + 4b3e734647e0e62bbb17c1ed5dbbd853462613f9 9636 torch-agent_0.0.1-1.debian.tar.xz + 816e7a65d14e02df230346565496a2bfb4ace2ad 5200 torch-agent_0.0.1-1_all.deb + d6de1f688aefa348cbcb38513c0418731a32be6c 6115 torch-agent_0.0.1-1_amd64.buildinfo +Checksums-Sha256: + 9b9a4486d39a88c09e1bd648560cd0c70cbba0e40bed9305e540e551db31d55e 1397 torch-agent_0.0.1-1.dsc + 30c630f9fdbaea2337a3e8701e753ef45a094b9403e77f9a42b2bd2ca63e8dc5 9788 torch-agent_0.0.1.orig.tar.xz + 0ffd62a08673dfc3d0a7544eb62398b8fd3bd0aa71bfd19c1a8dd816c430ec1b 9636 torch-agent_0.0.1-1.debian.tar.xz + 1560cd30b4944162d0ea4f2e4c5402527d06587c98a907820c36ec455633aede 5200 torch-agent_0.0.1-1_all.deb + 98ac5666f20bfc2c3a7f803db6ac769df8be8f7f9a65742651c988e7104e5c34 6115 torch-agent_0.0.1-1_amd64.buildinfo +Files: + 0abbdb3e83d948e0076ba9298c5f5502 1397 net optional torch-agent_0.0.1-1.dsc + 267a824b2a18ef73dcda05da7e99a4b5 9788 net optional torch-agent_0.0.1.orig.tar.xz + ee6afe9f8ff5b6cade07a66f9075c505 9636 net optional torch-agent_0.0.1-1.debian.tar.xz + 526fa2edc26efa17ce067b6b8b7780b5 5200 net optional torch-agent_0.0.1-1_all.deb + 22b4edf1ac9a92dd878357a8ea5ba939 6115 net optional torch-agent_0.0.1-1_amd64.buildinfo + +-----BEGIN PGP SIGNATURE----- + +iQFGBAEBCgAwFiEEFNiF9i0uBB0TW5u+27VgOYC/OIMFAl988dQSHGJqZHdlY2tA +Z21haWwuY29tAAoJENu1YDmAvziDZJEH/0jFrjHV/crXnpwtzLt81CBJPTs84Uhp +crgNc1Dh6cul4a78mIlNMr/aTTAHUqV0PuOAuNsrsNZA0LBPH9Fa/sFuQAQVp8UC +TFffl9gt+s8UnR+JyYVW29PU/bLyrFeZPYYOrH/4xJ1houxgtAFgUh3B40cbX/26 +CKyR4xMOFdtccSsZVJkPewrTHKDF1hibh4isK53/mHeCUnrlzosoZn873ZallEFD +tgbnmfMfx+ILlraz5L5UqghMZp+v8UqGuFV8D2EOC0XyRcpCpqlkioflUmL1AHML +KBqLg28oKmF56wyGfZgygzTUt/5tWTehjNwn36Ro+ZKbDMy1topS6aw= +=ufxl +-----END PGP SIGNATURE----- diff --git a/torch-agent_0.0.1.orig.tar.xz b/torch-agent_0.0.1.orig.tar.xz new file mode 100644 index 0000000..d37703c Binary files /dev/null and b/torch-agent_0.0.1.orig.tar.xz differ