From 35a429c4ca1923b3e87531f34ca64133d4a82efc Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Tue, 2 Jul 2019 22:34:59 +0200 Subject: Add Debian packaging and LGPL license. --- debian/changelog | 5 +++++ debian/compat | 1 + debian/control | 23 +++++++++++++++++++++++ debian/copyright | 35 +++++++++++++++++++++++++++++++++++ debian/rules | 28 ++++++++++++++++++++++++++++ 5 files changed, 92 insertions(+) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules (limited to 'debian') diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 000000000..2b24a8f9e --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +vyos-smoketest (1.0.0) unstable; urgency=medium + + * Initial release + + -- Daniil Baturin Tue, 02 Jul 2019 22:29:53 +0200 diff --git a/debian/compat b/debian/compat new file mode 100644 index 000000000..ec635144f --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 diff --git a/debian/control b/debian/control new file mode 100644 index 000000000..97f8b27ea --- /dev/null +++ b/debian/control @@ -0,0 +1,23 @@ +Source: vyos-smoketest +Section: contrib/net +Priority: extra +Maintainer: VyOS Package Maintainers +Build-Depends: debhelper (>= 9), + quilt, + python3, + python3-setuptools, + quilt, + python3-lxml, + python3-nose, + python3-coverage +Standards-Version: 3.9.6 + +Package: vyos-smoketest +Architecture: all +Depends: python3, + ${python3:Depends}, + ${shlibs:Depends}, + ${misc:Depends}, + vyos-1x +Description: VyOS build sanity checking toolkit + VyOS build sanity checking toolkit diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 000000000..a3260a7a1 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,35 @@ +This package was debianized by Daniil Baturin on +Tue, 02 Jul 2019 22:24:20 +0200 + +It's original content from the GIT repository + +Upstream Author: + + + +Copyright: + + Copyright (C) 2019 VyOS maintainers and contributors + All Rights Reserved. + +License: + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +This program 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. + +A copy of the GNU General Public License is available as +`/usr/share/common-licenses/GPL' in the Debian GNU/Linux distribution +or on the World Wide Web at `http://www.gnu.org/copyleft/lgpl.html'. +You can also obtain it by writing to the Free Software Foundation, +Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +MA 02110-1301, USA. + +The Debian packaging is (C) 2019, Daniil Baturin and +is licensed under the GPL, see above. diff --git a/debian/rules b/debian/rules new file mode 100755 index 000000000..4ccc23e86 --- /dev/null +++ b/debian/rules @@ -0,0 +1,28 @@ +#!/usr/bin/make -f + +DIR := debian/vyos-smoketest +VYOS_SBIN_DIR := usr/sbin/ +VYOS_BIN_DIR := usr/bin/ +VYOS_LIBEXEC_DIR := usr/libexec/vyos +VYOS_DATA_DIR := /usr/share/vyos +VYOS_CFG_TMPL_DIR := /opt/vyatta/share/vyatta-cfg/templates +VYOS_OP_TMPL_DIR := /opt/vyatta/share/vyatta-op/templates + +MIGRATION_SCRIPTS_DIR := /opt/vyatta/etc/config-migrate/migrate/ + +SBINDIR := $(DIR)/usr/sbin + +%: + dh $@ --with python3, --with quilt + +override_dh_auto_build: + make all + +override_dh_auto_install: + # Install smoke test scripts + mkdir -p $(DIR)/$(VYOS_LIBEXEC_DIR)/tests/smoke/ + cp -r scripts/* $(DIR)/$(VYOS_LIBEXEC_DIR)/tests/smoke + + # Install system programs + mkdir -p $(SBINDIR) + cp -r bin/* $(SBINDIR) -- cgit v1.2.3 From ae2c359c2938466001359823d4b2a97bd360a889 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sat, 28 Dec 2019 09:43:50 +0100 Subject: Debian: install binary to /usr/bin --- debian/rules | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'debian') diff --git a/debian/rules b/debian/rules index 4ccc23e86..526fb8537 100755 --- a/debian/rules +++ b/debian/rules @@ -1,7 +1,6 @@ #!/usr/bin/make -f DIR := debian/vyos-smoketest -VYOS_SBIN_DIR := usr/sbin/ VYOS_BIN_DIR := usr/bin/ VYOS_LIBEXEC_DIR := usr/libexec/vyos VYOS_DATA_DIR := /usr/share/vyos @@ -10,8 +9,6 @@ VYOS_OP_TMPL_DIR := /opt/vyatta/share/vyatta-op/templates MIGRATION_SCRIPTS_DIR := /opt/vyatta/etc/config-migrate/migrate/ -SBINDIR := $(DIR)/usr/sbin - %: dh $@ --with python3, --with quilt @@ -24,5 +21,5 @@ override_dh_auto_install: cp -r scripts/* $(DIR)/$(VYOS_LIBEXEC_DIR)/tests/smoke # Install system programs - mkdir -p $(SBINDIR) - cp -r bin/* $(SBINDIR) + mkdir -p $(DIR)/$(VYOS_BIN_DIR) + cp -r bin/* $(DIR)/$(VYOS_BIN_DIR) -- cgit v1.2.3 From a9eb356dd479330d23e598ac76521cc67356b963 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 5 Feb 2020 22:33:05 +0100 Subject: user: add test for adding/deleting system users --- debian/control | 1 + scripts/cli/test_system_login.py | 80 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100755 scripts/cli/test_system_login.py (limited to 'debian') diff --git a/debian/control b/debian/control index 97f8b27ea..7dde84d3e 100644 --- a/debian/control +++ b/debian/control @@ -9,6 +9,7 @@ Build-Depends: debhelper (>= 9), quilt, python3-lxml, python3-nose, + python3-paramiko, python3-coverage Standards-Version: 3.9.6 diff --git a/scripts/cli/test_system_login.py b/scripts/cli/test_system_login.py new file mode 100755 index 000000000..c804a6117 --- /dev/null +++ b/scripts/cli/test_system_login.py @@ -0,0 +1,80 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2019-2020 VyOS maintainers and contributors +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 or later as +# published by the Free Software Foundation. +# +# This program 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 . + +import os +import re +import unittest + +from paramiko import SSHClient, WarningPolicy + +import vyos.config +import vyos.configsession +import vyos.util as util + +base_path = ['system', 'login'] +users = ['vyos1', 'vyos2'] + +class TestSystemLoginServer(unittest.TestCase): + def setUp(self): + self.session = vyos.configsession.ConfigSession(os.getpid()) + env = self.session.get_session_env() + self.config = vyos.config.Config(session_env=env) + + def tearDown(self): + # Delete SNNP configuration + for user in users: + self.session.delete(base_path + ['user', user]) + + self.session.commit() + + def test_user(self): + """ Check if user can be created and we can SSH to localhost """ + + for user in users: + name = "VyOS Roxx " + user + home_dir = "/tmp/" + user + + self.session.set(base_path + ['user', user, 'authentication', 'plaintext-password', user]) + self.session.set(base_path + ['user', user, 'full-name', 'VyOS Roxx']) + self.session.set(base_path + ['user', user, 'home-directory', home_dir]) + + self.session.commit() + + # check if we can login via SSH + for user in users: + # check if homedir has been created + self.assertTrue(os.path.isdir("/tmp/" + user)) + + ssh = SSHClient() + ssh.set_missing_host_key_policy(WarningPolicy) + + try: + ssh.connect('localhost', username=user, password=user) + stdin, stdout, stderr = ssh.exec_command('who') + print(stdout.read().decode()) + except Exception as e: + print(e) + self.assertTrue(False) + + ssh.close() + + # check if homedir has been created + # this can only be done after we have connected via ssh and + # pam_mkhomedir was executes + self.assertTrue(os.path.isdir("/tmp/" + user)) + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.3 From 6aea18a15f96c733505fc7587ac35e263c165549 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 7 Feb 2020 19:07:35 +0100 Subject: Debian: move python3-paramiko from Build-Depends to Depends Commit a9eb356 ("user: add test for adding/deleting system users") added python3-paramiko to the list of build dependencies, but its a runtime dependency. --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'debian') diff --git a/debian/control b/debian/control index 7dde84d3e..41a0338db 100644 --- a/debian/control +++ b/debian/control @@ -9,13 +9,13 @@ Build-Depends: debhelper (>= 9), quilt, python3-lxml, python3-nose, - python3-paramiko, python3-coverage Standards-Version: 3.9.6 Package: vyos-smoketest Architecture: all Depends: python3, + python3-paramiko, ${python3:Depends}, ${shlibs:Depends}, ${misc:Depends}, -- cgit v1.2.3 From 189b724dd7e5f4a5be4137809376127298bf9d25 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Sun, 9 Feb 2020 13:00:07 +0100 Subject: login: remove ssh test --- debian/control | 1 - scripts/cli/test_system_login.py | 25 ------------------------- 2 files changed, 26 deletions(-) (limited to 'debian') diff --git a/debian/control b/debian/control index 41a0338db..97f8b27ea 100644 --- a/debian/control +++ b/debian/control @@ -15,7 +15,6 @@ Standards-Version: 3.9.6 Package: vyos-smoketest Architecture: all Depends: python3, - python3-paramiko, ${python3:Depends}, ${shlibs:Depends}, ${misc:Depends}, diff --git a/scripts/cli/test_system_login.py b/scripts/cli/test_system_login.py index c804a6117..b14b52603 100755 --- a/scripts/cli/test_system_login.py +++ b/scripts/cli/test_system_login.py @@ -18,8 +18,6 @@ import os import re import unittest -from paramiko import SSHClient, WarningPolicy - import vyos.config import vyos.configsession import vyos.util as util @@ -53,28 +51,5 @@ class TestSystemLoginServer(unittest.TestCase): self.session.commit() - # check if we can login via SSH - for user in users: - # check if homedir has been created - self.assertTrue(os.path.isdir("/tmp/" + user)) - - ssh = SSHClient() - ssh.set_missing_host_key_policy(WarningPolicy) - - try: - ssh.connect('localhost', username=user, password=user) - stdin, stdout, stderr = ssh.exec_command('who') - print(stdout.read().decode()) - except Exception as e: - print(e) - self.assertTrue(False) - - ssh.close() - - # check if homedir has been created - # this can only be done after we have connected via ssh and - # pam_mkhomedir was executes - self.assertTrue(os.path.isdir("/tmp/" + user)) - if __name__ == '__main__': unittest.main() -- cgit v1.2.3 From 23257105b68cb26fe16638928ab490fe3ea99164 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 23 Jun 2020 08:13:24 +0200 Subject: Debian: cleanup runtime dependencies Depends field of package vyos-smoketest: substitution variable ${shlibs:Depends} used, but is not defined --- debian/control | 1 - 1 file changed, 1 deletion(-) (limited to 'debian') diff --git a/debian/control b/debian/control index 97f8b27ea..ada46a4c1 100644 --- a/debian/control +++ b/debian/control @@ -16,7 +16,6 @@ Package: vyos-smoketest Architecture: all Depends: python3, ${python3:Depends}, - ${shlibs:Depends}, ${misc:Depends}, vyos-1x Description: VyOS build sanity checking toolkit -- cgit v1.2.3