diff -Nru libconfig-model-openssh-perl-2.8.4.2/Changes libconfig-model-openssh-perl-2.8.4.3/Changes --- libconfig-model-openssh-perl-2.8.4.2/Changes 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/Changes 2021-05-07 15:29:55.000000000 +0000 @@ -1,3 +1,13 @@ +2.8.4.3 2021-05-07 + + Bug fixes: + * Keep order of Host and Match sections (fix #6) + * No longer use content of /etc/ssh/ssh_config as upstream + default values for ~/.ssh/config. See commit + 766442b log for details + * Fix crash when starting with empty user file (fix #5) + * docs : fix typos and grammar + 2.8.4.2 2021-01-13 Update: diff -Nru libconfig-model-openssh-perl-2.8.4.2/contrib/lib/ParseMan.pm libconfig-model-openssh-perl-2.8.4.3/contrib/lib/ParseMan.pm --- libconfig-model-openssh-perl-2.8.4.2/contrib/lib/ParseMan.pm 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/contrib/lib/ParseMan.pm 2021-05-07 15:29:55.000000000 +0000 @@ -93,7 +93,7 @@ ); } -my $ssh_host = 'type=hash index_type=string cargo type=node ' +my $ssh_host = 'type=hash index_type=string ordered=1 cargo type=node ' .'config_class_name=Ssh::HostElement'; my $ssh_forward = 'type=list cargo type=node config_class_name="Ssh::PortForward"'; my $uniline = 'type=leaf value_type=uniline'; diff -Nru libconfig-model-openssh-perl-2.8.4.2/contrib/ssh-fixup.yaml libconfig-model-openssh-perl-2.8.4.3/contrib/ssh-fixup.yaml --- libconfig-model-openssh-perl-2.8.4.2/contrib/ssh-fixup.yaml 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/contrib/ssh-fixup.yaml 2021-05-07 15:29:55.000000000 +0000 @@ -12,11 +12,6 @@ backend: OpenSsh::Ssh config_dir: ~/.ssh file: config - default_layer: - config_dir: /etc/ssh - file: ssh_config - os_config_dir: - darwin: /etc Ssh::HostElement: element: __skip_order: 1 diff -Nru libconfig-model-openssh-perl-2.8.4.2/debian/changelog libconfig-model-openssh-perl-2.8.4.3/debian/changelog --- libconfig-model-openssh-perl-2.8.4.2/debian/changelog 2021-01-17 13:57:01.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/debian/changelog 2021-09-06 15:57:57.000000000 +0000 @@ -1,3 +1,18 @@ +libconfig-model-openssh-perl (2.8.4.3-2) unstable; urgency=medium + + * re-released to unstable + + -- Dominique Dumont Mon, 06 Sep 2021 17:57:57 +0200 + +libconfig-model-openssh-perl (2.8.4.3-1) experimental; urgency=medium + + * Import upstream version 2.8.4.3. + * Keep order of Host and Match sections (fix gh #6) + * Fix crash when starting with empty user file (fix gh #5) + * add patch to fix man page format + + -- Dominique Dumont Sun, 09 May 2021 16:24:04 +0200 + libconfig-model-openssh-perl (2.8.4.2-1) unstable; urgency=medium [ Debian Janitor ] diff -Nru libconfig-model-openssh-perl-2.8.4.2/debian/patches/fix-man-page libconfig-model-openssh-perl-2.8.4.3/debian/patches/fix-man-page --- libconfig-model-openssh-perl-2.8.4.2/debian/patches/fix-man-page 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/debian/patches/fix-man-page 2021-09-06 15:57:57.000000000 +0000 @@ -0,0 +1,32 @@ +Description: Fix man page formatting + Patch files to avoid messages like: + . + W: libconfig-model-openssh-perl: groff-message usr/share/man/man3/Config::Model::models::Ssh.3pm.gz 739: warning [p 7, 0.7i]: can't break line + . + The tricks is that 3pm files are generated from pod files which are + generated from model files (in Perl). + . + So this patch is applied on these model files. +Forwarded: on-going +--- a/lib/Config/Model/models/Ssh/HostElement.pl ++++ b/lib/Config/Model/models/Ssh/HostElement.pl +@@ -760,7 +760,7 @@ + gss-curve25519-sha256- + + The default is +-\x{201c}gss-group14-sha256-,gss-group16-sha512-,gss-nistp256-sha256-,gss-curve25519-sha256-,gss-gex-sha1-,gss-group14-sha1-\x{201d}. ++\x{201c}gss-group14-sha256-, gss-group16-sha512-, gss-nistp256-sha256-, gss-curve25519-sha256-, gss-gex-sha1-, gss-group14-sha1-\x{201d}. + This option only applies to connections using GSSAPI.", + 'type' => 'leaf', + 'value_type' => 'uniline' +--- a/lib/Config/Model/models/Sshd.pl ++++ b/lib/Config/Model/models/Sshd.pl +@@ -260,7 +260,7 @@ + gss-curve25519-sha256- + + The default is +-\x{201c}gss-group14-sha256-,gss-group16-sha512-,gss-nistp256-sha256-,gss-curve25519-sha256-,gss-gex-sha1-,gss-group14-sha1-\x{201d}. ++\x{201c}gss-group14-sha256-, gss-group16-sha512-, gss-nistp256-sha256-, gss-curve25519-sha256-, gss-gex-sha1-, gss-group14-sha1-\x{201d}. + This option only applies to connections using GSSAPI.", + 'type' => 'leaf', + 'value_type' => 'uniline' diff -Nru libconfig-model-openssh-perl-2.8.4.2/debian/patches/series libconfig-model-openssh-perl-2.8.4.3/debian/patches/series --- libconfig-model-openssh-perl-2.8.4.2/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/debian/patches/series 2021-09-06 15:57:57.000000000 +0000 @@ -0,0 +1 @@ +fix-man-page diff -Nru libconfig-model-openssh-perl-2.8.4.2/lib/Config/Model/Backend/OpenSsh/Role/MatchBlock.pm libconfig-model-openssh-perl-2.8.4.3/lib/Config/Model/Backend/OpenSsh/Role/MatchBlock.pm --- libconfig-model-openssh-perl-2.8.4.2/lib/Config/Model/Backend/OpenSsh/Role/MatchBlock.pm 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/lib/Config/Model/Backend/OpenSsh/Role/MatchBlock.pm 2021-05-07 15:29:55.000000000 +0000 @@ -11,7 +11,7 @@ use warnings; package Config::Model::Backend::OpenSsh::Role::MatchBlock ; -$Config::Model::Backend::OpenSsh::Role::MatchBlock::VERSION = '2.8.4.2'; +$Config::Model::Backend::OpenSsh::Role::MatchBlock::VERSION = '2.8.4.3'; use Mouse::Role ; requires qw(current_node write_node_content write_line); @@ -122,7 +122,7 @@ =head1 VERSION -version 2.8.4.2 +version 2.8.4.3 =head1 SYNOPSIS diff -Nru libconfig-model-openssh-perl-2.8.4.2/lib/Config/Model/Backend/OpenSsh/Role/Reader.pm libconfig-model-openssh-perl-2.8.4.3/lib/Config/Model/Backend/OpenSsh/Role/Reader.pm --- libconfig-model-openssh-perl-2.8.4.2/lib/Config/Model/Backend/OpenSsh/Role/Reader.pm 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/lib/Config/Model/Backend/OpenSsh/Role/Reader.pm 2021-05-07 15:29:55.000000000 +0000 @@ -11,7 +11,7 @@ use warnings; package Config::Model::Backend::OpenSsh::Role::Reader ; -$Config::Model::Backend::OpenSsh::Role::Reader::VERSION = '2.8.4.2'; +$Config::Model::Backend::OpenSsh::Role::Reader::VERSION = '2.8.4.3'; use 5.10.1; use Config::Model 2.128; @@ -50,6 +50,8 @@ my $config_root = $args{object} || croak __PACKAGE__," read_ssh_file: undefined config root object"; + return 0 unless $args{file_path}->is_file; + $logger->info("loading config file ".$args{file_path}); my @lines = $args{file_path}->lines_utf8 ; @@ -151,7 +153,7 @@ =head1 VERSION -version 2.8.4.2 +version 2.8.4.3 =head1 SYNOPSIS diff -Nru libconfig-model-openssh-perl-2.8.4.2/lib/Config/Model/Backend/OpenSsh/Role/Writer.pm libconfig-model-openssh-perl-2.8.4.3/lib/Config/Model/Backend/OpenSsh/Role/Writer.pm --- libconfig-model-openssh-perl-2.8.4.2/lib/Config/Model/Backend/OpenSsh/Role/Writer.pm 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/lib/Config/Model/Backend/OpenSsh/Role/Writer.pm 2021-05-07 15:29:55.000000000 +0000 @@ -11,7 +11,7 @@ use warnings; package Config::Model::Backend::OpenSsh::Role::Writer ; -$Config::Model::Backend::OpenSsh::Role::Writer::VERSION = '2.8.4.2'; +$Config::Model::Backend::OpenSsh::Role::Writer::VERSION = '2.8.4.3'; use Mouse::Role ; with 'Config::Model::Backend::OpenSsh::Role::MatchBlock'; @@ -37,13 +37,16 @@ $logger->info("writing config file $args{file_path}"); - my $result = $self->write_global_comment('#') ; + my $comment = $self->write_global_comment('#') ; - $result .= $self->write_node_content($config_root,$args{ssh_mode}); + my $result = $self->write_node_content($config_root,$args{ssh_mode}); - $args{file_path}->spew_utf8($result); + if ($result) { + $args{file_path}->spew_utf8($comment.$result); + return 1; + } - return 1; + return 0; } @@ -144,7 +147,7 @@ =head1 VERSION -version 2.8.4.2 +version 2.8.4.3 =head1 SYNOPSIS diff -Nru libconfig-model-openssh-perl-2.8.4.2/lib/Config/Model/Backend/OpenSsh/Sshd.pm libconfig-model-openssh-perl-2.8.4.3/lib/Config/Model/Backend/OpenSsh/Sshd.pm --- libconfig-model-openssh-perl-2.8.4.2/lib/Config/Model/Backend/OpenSsh/Sshd.pm 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/lib/Config/Model/Backend/OpenSsh/Sshd.pm 2021-05-07 15:29:55.000000000 +0000 @@ -11,7 +11,7 @@ use warnings; package Config::Model::Backend::OpenSsh::Sshd ; -$Config::Model::Backend::OpenSsh::Sshd::VERSION = '2.8.4.2'; +$Config::Model::Backend::OpenSsh::Sshd::VERSION = '2.8.4.3'; use Mouse ; extends "Config::Model::Backend::Any" ; @@ -57,7 +57,7 @@ =head1 VERSION -version 2.8.4.2 +version 2.8.4.3 =head1 SYNOPSIS diff -Nru libconfig-model-openssh-perl-2.8.4.2/lib/Config/Model/Backend/OpenSsh/Ssh.pm libconfig-model-openssh-perl-2.8.4.3/lib/Config/Model/Backend/OpenSsh/Ssh.pm --- libconfig-model-openssh-perl-2.8.4.2/lib/Config/Model/Backend/OpenSsh/Ssh.pm 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/lib/Config/Model/Backend/OpenSsh/Ssh.pm 2021-05-07 15:29:55.000000000 +0000 @@ -11,7 +11,7 @@ use warnings; package Config::Model::Backend::OpenSsh::Ssh ; -$Config::Model::Backend::OpenSsh::Ssh::VERSION = '2.8.4.2'; +$Config::Model::Backend::OpenSsh::Ssh::VERSION = '2.8.4.3'; use Mouse ; use 5.10.1; extends "Config::Model::Backend::Any" ; @@ -155,7 +155,7 @@ =head1 VERSION -version 2.8.4.2 +version 2.8.4.3 =head1 SYNOPSIS @@ -163,23 +163,23 @@ =head1 DESCRIPTION -This calls provides a backend to read and write ssh client configuration files. +This module provides a backend to read and write ssh client configuration files. =head1 STOP -The documentation provides on the reader and writer of OpenSsh configuration files. -These details are not needed for the basic usages explained in L. +The documentation provides details on the module used to read and +write OpenSsh configuration files. These details are not needed for +the basic usages explained in L. =head1 Methods -These read/write functions are part of C read/write backend. -They are -declared in Ssh configuration model and are called back when needed to read the -configuration file and write it back. +These read/write functions are part of C read/write +backend. They are declared in Ssh configuration model and are called +back when needed to read and write the configuration file. =head2 read (object => , config_dir => ...) -Read F in C and load the data in the +Reads F in C and load the data in the C configuration tree. =head2 write (object => , config_dir => ...) diff -Nru libconfig-model-openssh-perl-2.8.4.2/lib/Config/Model/models/Ssh.pl libconfig-model-openssh-perl-2.8.4.3/lib/Config/Model/models/Ssh.pl --- libconfig-model-openssh-perl-2.8.4.2/lib/Config/Model/models/Ssh.pl 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/lib/Config/Model/models/Ssh.pl 2021-05-07 15:29:55.000000000 +0000 @@ -53,6 +53,7 @@ See I for more information on patterns.', 'index_type' => 'string', + 'ordered' => '1', 'type' => 'hash' }, 'Match', @@ -113,6 +114,7 @@ of the local user running L (this keyword may be useful in system-wide B files).', 'index_type' => 'string', + 'ordered' => '1', 'type' => 'hash' } ], @@ -127,13 +129,6 @@ 'auto_create' => '1', 'backend' => 'OpenSsh::Ssh', 'config_dir' => '~/.ssh', - 'default_layer' => { - 'config_dir' => '/etc/ssh', - 'file' => 'ssh_config', - 'os_config_dir' => { - 'darwin' => '/etc' - } - }, 'file' => 'config' } } diff -Nru libconfig-model-openssh-perl-2.8.4.2/lib/Config/Model/OpenSsh.pm libconfig-model-openssh-perl-2.8.4.3/lib/Config/Model/OpenSsh.pm --- libconfig-model-openssh-perl-2.8.4.2/lib/Config/Model/OpenSsh.pm 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/lib/Config/Model/OpenSsh.pm 2021-05-07 15:29:55.000000000 +0000 @@ -11,7 +11,7 @@ use warnings; package Config::Model::OpenSsh ; -$Config::Model::OpenSsh::VERSION = '2.8.4.2'; +$Config::Model::OpenSsh::VERSION = '2.8.4.3'; use Config::Model 2.111; 1; @@ -30,46 +30,46 @@ =head1 VERSION -version 2.8.4.2 +version 2.8.4.3 =head1 SYNOPSIS =head2 invoke editor -The following will launch a graphical editor (if L +The following launches a graphical editor (if L is installed): - sudo cme edit sshd + sudo cme edit sshd =head2 command line -This command will add a C section in C<~/.ssh/config>: +This command adds a C section in C<~/.ssh/config>: cme modify ssh Host:Foo ForwardX11=yes =head2 programmatic -This code snippet will remove the C section added above: +This code snippet removes the C section added above: use Config::Model ; - my $model = Config::Model -> new ( ) ; + my $model = Config::Model->new() ; my $inst = $model->instance (root_class_name => 'Ssh'); - $inst -> config_root ->load("Host~Foo") ; + $inst -> config_root->load("Host~Foo") ; $inst->write_back() ; =head1 DESCRIPTION -This module provides a configuration editors (and models) for the -configuration files of OpenSSH. (C, F +This module provides a configuration editor (and models) for the +configuration files of OpenSSH. (C, C and C<~/.ssh/config>). This module can also be used to modify safely the -content of these configuration files from a Perl programs. +content of these configuration files from a Perl program. -Once this module is installed, you can edit C -with run (as root) : +Once this module is installed, you can edit C +with (as root) : - # cme edit sshd + # cme edit sshd To edit F, run (as root): diff -Nru libconfig-model-openssh-perl-2.8.4.2/MANIFEST libconfig-model-openssh-perl-2.8.4.3/MANIFEST --- libconfig-model-openssh-perl-2.8.4.2/MANIFEST 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/MANIFEST 2021-05-07 15:29:55.000000000 +0000 @@ -47,13 +47,10 @@ t/author-critic.t t/custom_sshd.t t/custom_sshd_match.t -t/model_tests.d/ssh-examples/bad-forward/system_ssh_config t/model_tests.d/ssh-examples/bad-forward/user_ssh_config -t/model_tests.d/ssh-examples/bad-pref-auth/system_ssh_config t/model_tests.d/ssh-examples/bad-pref-auth/user_ssh_config -t/model_tests.d/ssh-examples/basic/system_ssh_config t/model_tests.d/ssh-examples/basic/user_ssh_config -t/model_tests.d/ssh-examples/legacy/system_ssh_config +t/model_tests.d/ssh-examples/delete-user-file/user_ssh_config t/model_tests.d/ssh-examples/legacy/user_ssh_config t/model_tests.d/ssh-test-conf.pl t/model_tests.d/sshd-examples/bad-password-authentication/system_sshd_config diff -Nru libconfig-model-openssh-perl-2.8.4.2/META.json libconfig-model-openssh-perl-2.8.4.3/META.json --- libconfig-model-openssh-perl-2.8.4.2/META.json 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/META.json 2021-05-07 15:29:55.000000000 +0000 @@ -81,8 +81,8 @@ "web" : "http://github.com/dod38fr/config-model-openssh.git" } }, - "version" : "2.8.4.2", - "x_generated_by_perl" : "v5.32.0", + "version" : "2.8.4.3", + "x_generated_by_perl" : "v5.32.1", "x_serialization_backend" : "Cpanel::JSON::XS version 4.25", "x_spdx_expression" : "LGPL-2.1" } diff -Nru libconfig-model-openssh-perl-2.8.4.2/META.yml libconfig-model-openssh-perl-2.8.4.3/META.yml --- libconfig-model-openssh-perl-2.8.4.2/META.yml 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/META.yml 2021-05-07 15:29:55.000000000 +0000 @@ -42,7 +42,7 @@ bugtracker: https://github.com/dod38fr/config-model-openssh/issues homepage: https://github.com/dod38fr/config-model/wiki repository: git://github.com/dod38fr/config-model-openssh.git -version: 2.8.4.2 -x_generated_by_perl: v5.32.0 +version: 2.8.4.3 +x_generated_by_perl: v5.32.1 x_serialization_backend: 'YAML::Tiny version 1.73' x_spdx_expression: LGPL-2.1 diff -Nru libconfig-model-openssh-perl-2.8.4.2/t/model_tests.d/ssh-examples/bad-forward/system_ssh_config libconfig-model-openssh-perl-2.8.4.3/t/model_tests.d/ssh-examples/bad-forward/system_ssh_config --- libconfig-model-openssh-perl-2.8.4.2/t/model_tests.d/ssh-examples/bad-forward/system_ssh_config 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/t/model_tests.d/ssh-examples/bad-forward/system_ssh_config 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -# Site-wide defaults for some commonly used options. For a comprehensive -# list of available options, their meanings and defaults, please see the -# ssh_config(5) man page. - -Host * - Port 22 - Ciphers 3des-cbc - SendEnv LANG LC_* - HashKnownHosts yes - GSSAPIAuthentication yes - GSSAPIDelegateCredentials no diff -Nru libconfig-model-openssh-perl-2.8.4.2/t/model_tests.d/ssh-examples/bad-pref-auth/system_ssh_config libconfig-model-openssh-perl-2.8.4.3/t/model_tests.d/ssh-examples/bad-pref-auth/system_ssh_config --- libconfig-model-openssh-perl-2.8.4.2/t/model_tests.d/ssh-examples/bad-pref-auth/system_ssh_config 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/t/model_tests.d/ssh-examples/bad-pref-auth/system_ssh_config 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -# Site-wide defaults for some commonly used options. For a comprehensive -# list of available options, their meanings and defaults, please see the -# ssh_config(5) man page. - -Host * - Port 22 - Ciphers 3des-cbc - SendEnv LANG LC_* - HashKnownHosts yes - GSSAPIAuthentication yes - GSSAPIDelegateCredentials no diff -Nru libconfig-model-openssh-perl-2.8.4.2/t/model_tests.d/ssh-examples/basic/system_ssh_config libconfig-model-openssh-perl-2.8.4.3/t/model_tests.d/ssh-examples/basic/system_ssh_config --- libconfig-model-openssh-perl-2.8.4.2/t/model_tests.d/ssh-examples/basic/system_ssh_config 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/t/model_tests.d/ssh-examples/basic/system_ssh_config 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -# Site-wide defaults for some commonly used options. For a comprehensive -# list of available options, their meanings and defaults, please see the -# ssh_config(5) man page. - -Host * - Port 22 - Ciphers 3des-cbc - SendEnv LANG LC_* - HashKnownHosts yes - GSSAPIAuthentication yes - GSSAPIDelegateCredentials no diff -Nru libconfig-model-openssh-perl-2.8.4.2/t/model_tests.d/ssh-examples/basic/user_ssh_config libconfig-model-openssh-perl-2.8.4.3/t/model_tests.d/ssh-examples/basic/user_ssh_config --- libconfig-model-openssh-perl-2.8.4.2/t/model_tests.d/ssh-examples/basic/user_ssh_config 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/t/model_tests.d/ssh-examples/basic/user_ssh_config 2021-05-07 15:29:55.000000000 +0000 @@ -14,6 +14,13 @@ GSSAPIAuthentication yes GSSAPIDelegateCredentials no +Host picos +ForwardX11 yes +HostName localhost +Port 20022 +User ocad +ControlPersist YES + # foo bar big # comment Host foo.*,*.bar @@ -34,11 +41,4 @@ LocalForward all.com/22080 2001:0db8:85a3:0000:0000:8a2e:0370:7334/80 User k0013 -Host picos -ForwardX11 yes -HostName localhost -Port 20022 -User ocad -ControlPersist YES - diff -Nru libconfig-model-openssh-perl-2.8.4.2/t/model_tests.d/ssh-examples/delete-user-file/user_ssh_config libconfig-model-openssh-perl-2.8.4.3/t/model_tests.d/ssh-examples/delete-user-file/user_ssh_config --- libconfig-model-openssh-perl-2.8.4.2/t/model_tests.d/ssh-examples/delete-user-file/user_ssh_config 1970-01-01 00:00:00.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/t/model_tests.d/ssh-examples/delete-user-file/user_ssh_config 2021-05-07 15:29:55.000000000 +0000 @@ -0,0 +1,42 @@ + +Host * +# ForwardAgent no +# ForwardX11 no + Port 1022 +# Protocol 2,1 +# Cipher 3des + Ciphers aes192-cbc,aes128-cbc +# PermitLocalCommand no + SendEnv LANG LC_* + HashKnownHosts yes + GSSAPIAuthentication yes + GSSAPIDelegateCredentials no + +# foo bar big +# comment +Host foo.*,*.bar + # for and bar have X11 + ForwardX11 yes + SendEnv FOO BAR + +Host *.gre.hp.com +ForwardX11 yes +User tester + +Host picosgw +ForwardAgent yes +HostName sshgw.truc.bidule +IdentityFile ~/.ssh/%r +LocalForward 20022 10.3.244.4:22 +# IPv6 example +LocalForward all.com/22080 2001:0db8:85a3:0000:0000:8a2e:0370:7334/80 +User k0013 + +Host picos +ForwardX11 yes +HostName localhost +Port 20022 +User ocad +ControlPersist YES + + diff -Nru libconfig-model-openssh-perl-2.8.4.2/t/model_tests.d/ssh-examples/legacy/system_ssh_config libconfig-model-openssh-perl-2.8.4.3/t/model_tests.d/ssh-examples/legacy/system_ssh_config --- libconfig-model-openssh-perl-2.8.4.2/t/model_tests.d/ssh-examples/legacy/system_ssh_config 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/t/model_tests.d/ssh-examples/legacy/system_ssh_config 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -# Site-wide defaults for some commonly used options. For a comprehensive -# list of available options, their meanings and defaults, please see the -# ssh_config(5) man page. - -Host * - Port 22 - Ciphers 3des-cbc - SendEnv LANG LC_* - HashKnownHosts yes - GSSAPIAuthentication yes - GSSAPIDelegateCredentials no diff -Nru libconfig-model-openssh-perl-2.8.4.2/t/model_tests.d/ssh-test-conf.pl libconfig-model-openssh-perl-2.8.4.3/t/model_tests.d/ssh-test-conf.pl --- libconfig-model-openssh-perl-2.8.4.2/t/model_tests.d/ssh-test-conf.pl 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/t/model_tests.d/ssh-test-conf.pl 2021-05-07 15:29:55.000000000 +0000 @@ -17,12 +17,8 @@ : '/home/joe'; # Ssh backend excepts both system and user files -my @setup = ( +my %setup = ( setup => { - 'system_ssh_config' => { - 'darwin' => '/etc/ssh_config', - 'default' => '/etc/ssh/ssh_config', - }, 'user_ssh_config' => "$home_for_test/.ssh/config" } ); @@ -30,13 +26,10 @@ my @tests = ( { name => 'basic', - @setup, + %setup, check => [ - 'Host:"*" Port' => {qw/mode layered value 22/}, 'Host:"*" Port' => '1022', - # user value will completely override layered values - 'Host:"*" Ciphers' => { qw/mode layered value/, '3des-cbc' }, 'Host:"*" Ciphers' => { qw/mode user value/, 'aes192-cbc,aes128-cbc' }, 'Host:"*" Ciphers' => 'aes192-cbc,aes128-cbc', @@ -55,7 +48,7 @@ }, { name => 'legacy', - @setup, + %setup, load_check => 'skip', log4perl_load_warnings => [ [ 'User', @@ -65,18 +58,44 @@ }, { name => 'bad-forward', - @setup, + %setup, load_check => 'skip', load => 'Host:"foo.*,*.bar" LocalForward:0 port=20022', log4perl_load_warnings => [ [ 'User', warn => qr/value '20022\+' does not match regexp/ ] ], }, { - name => 'bad-pref-auth', - @setup, - load_check => 'skip', - log4perl_load_warnings => [ - [ 'User', ( warn => qr/Unexpected authentication method/) , ] - ], + name => 'bad-pref-auth', + %setup, + load_check => 'skip', + log4perl_load_warnings => [ + [ 'User', ( warn => qr/Unexpected authentication method/) , ] + ], + }, + { + name => 'no-user-file', + }, + { + name => 'check-host-order', + data_from => 'basic', + %setup, + file_contents_like => { + # check that picos is still before foo + "/home/joe/.ssh/config" => qr/Host\s+picos.*?Host\s+foo/s + } + }, + { + name => 'delete-user-file', + setup => { + 'user_ssh_config' => "$home_for_test/.ssh/config" + }, + # this removes all custom data from test file. Hence the user + # file is deleted + load => 'Host:.clear', + file_check_sub => sub { + my $list_ref = shift ; + # user config removed because load cleared all user data + pop @$list_ref ; + } }, ); diff -Nru libconfig-model-openssh-perl-2.8.4.2/t/ssh_config.t libconfig-model-openssh-perl-2.8.4.3/t/ssh_config.t --- libconfig-model-openssh-perl-2.8.4.2/t/ssh_config.t 2021-01-13 18:31:47.000000000 +0000 +++ libconfig-model-openssh-perl-2.8.4.3/t/ssh_config.t 2021-05-07 15:29:55.000000000 +0000 @@ -27,30 +27,6 @@ my $ssh_file = $ssh_path->child('ssh_config'); $ssh_file->spew(@orig); -# special global variable used only for tests -my $joe_home = $^O eq 'darwin' ? '/Users/joe' - : '/home/joe' ; ; -Config::Model::BackendMgr::_set_test_home($joe_home) ; - -# set up Joe's environment -my $joe_ssh = $wr_root->child($joe_home.'/.ssh'); -$joe_ssh->mkpath; - -my $joe_config = $joe_ssh->child('config'); -$joe_config->spew("Host mine.bar\n\nIdentityFile ~/.ssh/mine\n") ; - -sub read_user_ssh { - my $file = shift ; - my $clean = sub { - my $l = shift; - chomp $l; - $l =~ s/\s+/ /g; - return $l; - }; - my @res = grep {/\w/} map { $clean->($_) ;} grep { not /##/ } $file->lines ; - return @res ; -} - print "Test from directory $wr_root\n" if $trace ; note "Running test like root (no layered config)" ; @@ -97,66 +73,6 @@ is_deeply([split /\n/,$dump2],[split /\n/,$dump], "check if both root_ssh dumps are identical") ; -SKIP: { - skip "user tests when test is run as root", 12 - if $EUID == 0 ; - - note "Running test like user with layered config"; - - my $user_inst = $model->instance ( - root_class_name => 'Ssh', - instance_name => 'user_ssh_instance', - root_dir => $wr_root, - ); - - ok($user_inst,"Read user .ssh/config and created instance") ; - - my @joe_orig = read_user_ssh($joe_config) ; - - my $user_cfg = $user_inst -> config_root ; - - $dump = $user_cfg->dump_tree (mode => 'full' ); - print $dump if $trace ; - - like($dump,qr/Host:"foo\.\*,\*\.bar"/,"check root Host pattern") ; - like($dump,qr/Host:"?mine.bar"?/,"check user Host pattern") ; - - $user_inst->write_back() ; - ok(1,"wrote user .ssh/config data in $joe_config") ; - - ok($joe_config->is_file,"Found $joe_config") ; - - # compare original and written file - my @joe_written = read_user_ssh($joe_config) ; - eq_or_diff(\@joe_written,\@joe_orig,"check user .ssh/config files") ; - - # write some data - $user_cfg->load('EnableSSHKeysign=1') ; - $user_inst->write_back() ; - unshift @joe_orig,'EnableSSHKeysign yes'; - @joe_written = read_user_ssh($joe_config) ; - eq_or_diff(\@joe_written,\@joe_orig,"check user .ssh/config files after modif") ; - - # run test on tricky element - warning_like { - $user_inst->load( check => 'skip', step => 'Host:"*" IPQoS="foo bar baz"') ; - } qr/skipping value/ ,"too many fields warning"; - warning_like { - $user_inst->load( check => 'skip', step => 'Host:"*" IPQoS="foo"') ; - } qr/skipping/ ,"bad fields warning"; - ok($user_inst->has_error,"check errors count") ; - like($user_inst->error_messages,qr/"af11"/,"check error message") ; - - $user_inst->load('Host:"*" IPQoS="af11 af12"') ; - - # fix is pending - my $expect = $Config::Model::VERSION > 2.046 ? 0 : 1 ; - is($user_inst->has_error,$expect,"check error count after fix") ; - - # check if config has warnings - is($user_inst->has_warning,0,"check if warnings are left"); -} - done_testing; __END__