|
|
84dac3 |
From 1c936bb38d39b238001364e1a7ee5479bdfff053 Mon Sep 17 00:00:00 2001
|
|
|
84dac3 |
From: Dominic Cleal <dcleal@redhat.com>
|
|
|
84dac3 |
Date: Fri, 12 Jun 2015 11:01:57 +0100
|
|
|
84dac3 |
Subject: [PATCH] Sshd: revert Sshd module to 1.1.0-compatible, add Sshd_140
|
|
|
84dac3 |
|
|
|
84dac3 |
In order to keep the default sshd config lens compatible with 1.1.0,
|
|
|
84dac3 |
the lens from 1.4.0 has been kept in the Sshd_140 module and is not
|
|
|
84dac3 |
loaded by default. Use aug_transform, augtool --transform etc. to use
|
|
|
84dac3 |
it instead of Sshd.
|
|
|
84dac3 |
---
|
|
|
84dac3 |
lenses/sshd.aug | 52 ++++++---------
|
|
|
84dac3 |
lenses/sshd_140.aug | 141 +++++++++++++++++++++++++++++++++++++++++
|
|
|
84dac3 |
lenses/tests/test_sshd.aug | 56 ----------------
|
|
|
84dac3 |
lenses/tests/test_sshd_140.aug | 136 +++++++++++++++++++++++++++++++++++++++
|
|
|
84dac3 |
tests/Makefile.am | 1 +
|
|
|
84dac3 |
5 files changed, 298 insertions(+), 88 deletions(-)
|
|
|
84dac3 |
create mode 100644 lenses/sshd_140.aug
|
|
|
84dac3 |
create mode 100644 lenses/tests/test_sshd_140.aug
|
|
|
84dac3 |
|
|
|
84dac3 |
diff --git a/lenses/sshd.aug b/lenses/sshd.aug
|
|
|
84dac3 |
index 55f6c4f7..785102ec 100644
|
|
|
84dac3 |
--- a/lenses/sshd.aug
|
|
|
84dac3 |
+++ b/lenses/sshd.aug
|
|
|
84dac3 |
@@ -70,55 +70,41 @@ module Sshd =
|
|
|
84dac3 |
|
|
|
84dac3 |
let sep = Util.del_ws_spc
|
|
|
84dac3 |
|
|
|
84dac3 |
- let indent = del /[ \t]*/ " "
|
|
|
84dac3 |
-
|
|
|
84dac3 |
let key_re = /[A-Za-z0-9]+/
|
|
|
84dac3 |
- - /MACs|Match|AcceptEnv|Subsystem|Ciphers|KexAlgorithms|(Allow|Deny)(Groups|Users)/i
|
|
|
84dac3 |
+ - /MACs|Match|AcceptEnv|Subsystem|(Allow|Deny)(Groups|Users)/
|
|
|
84dac3 |
|
|
|
84dac3 |
let comment = Util.comment
|
|
|
84dac3 |
- let comment_noindent = Util.comment_noindent
|
|
|
84dac3 |
let empty = Util.empty
|
|
|
84dac3 |
|
|
|
84dac3 |
- let array_entry (kw:regexp) (sq:string) =
|
|
|
84dac3 |
+ let array_entry (k:string) =
|
|
|
84dac3 |
let value = store /[^ \t\n]+/ in
|
|
|
84dac3 |
- [ key kw . [ sep . seq sq . value]* . eol ]
|
|
|
84dac3 |
+ [ key k . [ sep . seq k . value]* . eol ]
|
|
|
84dac3 |
|
|
|
84dac3 |
let other_entry =
|
|
|
84dac3 |
let value = store /[^ \t\n]+([ \t]+[^ \t\n]+)*/ in
|
|
|
84dac3 |
[ key key_re . sep . value . eol ]
|
|
|
84dac3 |
|
|
|
84dac3 |
- let accept_env = array_entry /AcceptEnv/i "AcceptEnv"
|
|
|
84dac3 |
+ let accept_env = array_entry "AcceptEnv"
|
|
|
84dac3 |
|
|
|
84dac3 |
- let allow_groups = array_entry /AllowGroups/i "AllowGroups"
|
|
|
84dac3 |
- let allow_users = array_entry /AllowUsers/i "AllowUsers"
|
|
|
84dac3 |
- let deny_groups = array_entry /DenyGroups/i "DenyGroups"
|
|
|
84dac3 |
- let deny_users = array_entry /DenyUsers/i "DenyUsers"
|
|
|
84dac3 |
+ let allow_groups = array_entry "AllowGroups"
|
|
|
84dac3 |
+ let allow_users = array_entry "AllowUsers"
|
|
|
84dac3 |
+ let deny_groups = array_entry "DenyGroups"
|
|
|
84dac3 |
+ let deny_users = array_entry "DenyUsers"
|
|
|
84dac3 |
|
|
|
84dac3 |
let subsystemvalue =
|
|
|
84dac3 |
let value = store (/[^ \t\n](.*[^ \t\n])?/) in
|
|
|
84dac3 |
[ key /[A-Za-z0-9\-]+/ . sep . value . eol ]
|
|
|
84dac3 |
|
|
|
84dac3 |
let subsystem =
|
|
|
84dac3 |
- [ key /Subsystem/i . sep . subsystemvalue ]
|
|
|
84dac3 |
+ [ key "Subsystem" . sep . subsystemvalue ]
|
|
|
84dac3 |
|
|
|
84dac3 |
- let list (kw:regexp) (sq:string) =
|
|
|
84dac3 |
- let value = store /[^, \t\n]+/ in
|
|
|
84dac3 |
- [ key kw . sep .
|
|
|
84dac3 |
- [ seq sq . value ] .
|
|
|
84dac3 |
- ([ seq sq . Util.del_str "," . value])* .
|
|
|
84dac3 |
+ let macs =
|
|
|
84dac3 |
+ let mac_value = store /[^, \t\n]+/ in
|
|
|
84dac3 |
+ [ key "MACs" . sep .
|
|
|
84dac3 |
+ [ seq "macs" . mac_value ] .
|
|
|
84dac3 |
+ ([ seq "macs" . Util.del_str "," . mac_value])* .
|
|
|
84dac3 |
eol ]
|
|
|
84dac3 |
|
|
|
84dac3 |
- let macs = list /MACs/i "MACs"
|
|
|
84dac3 |
-
|
|
|
84dac3 |
- let ciphers = list /Ciphers/i "Ciphers"
|
|
|
84dac3 |
-
|
|
|
84dac3 |
- let kexalgorithms = list /KexAlgorithms/i "KexAlgorithms"
|
|
|
84dac3 |
-
|
|
|
84dac3 |
- let entry = accept_env | allow_groups | allow_users
|
|
|
84dac3 |
- | deny_groups | subsystem | deny_users
|
|
|
84dac3 |
- | macs | ciphers | kexalgorithms
|
|
|
84dac3 |
- | other_entry
|
|
|
84dac3 |
-
|
|
|
84dac3 |
let condition_entry =
|
|
|
84dac3 |
let value = store /[^ \t\n]+/ in
|
|
|
84dac3 |
[ sep . key /[A-Za-z0-9]+/ . sep . value ]
|
|
|
84dac3 |
@@ -126,15 +112,17 @@ module Sshd =
|
|
|
84dac3 |
let match_cond =
|
|
|
84dac3 |
[ label "Condition" . condition_entry+ . eol ]
|
|
|
84dac3 |
|
|
|
84dac3 |
- let match_entry = indent . (entry | comment_noindent)
|
|
|
84dac3 |
- | empty
|
|
|
84dac3 |
+ let match_entry =
|
|
|
84dac3 |
+ ( comment | empty | (Util.indent . other_entry) )
|
|
|
84dac3 |
|
|
|
84dac3 |
let match =
|
|
|
84dac3 |
- [ key /Match/i . match_cond
|
|
|
84dac3 |
+ [ key "Match" . match_cond
|
|
|
84dac3 |
. [ label "Settings" . match_entry+ ]
|
|
|
84dac3 |
]
|
|
|
84dac3 |
|
|
|
84dac3 |
- let lns = (entry | comment | empty)* . match*
|
|
|
84dac3 |
+ let lns = (comment | empty | accept_env | allow_groups | allow_users
|
|
|
84dac3 |
+ | deny_groups | subsystem | deny_users | macs
|
|
|
84dac3 |
+ | other_entry ) * . match*
|
|
|
84dac3 |
|
|
|
84dac3 |
let xfm = transform lns (incl "/etc/ssh/sshd_config")
|
|
|
84dac3 |
|
|
|
84dac3 |
diff --git a/lenses/sshd_140.aug b/lenses/sshd_140.aug
|
|
|
84dac3 |
new file mode 100644
|
|
|
84dac3 |
index 00000000..8a7f176f
|
|
|
84dac3 |
--- /dev/null
|
|
|
84dac3 |
+++ b/lenses/sshd_140.aug
|
|
|
84dac3 |
@@ -0,0 +1,141 @@
|
|
|
84dac3 |
+(*
|
|
|
84dac3 |
+Module: Sshd_140
|
|
|
84dac3 |
+ Parses /etc/ssh/sshd_config
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ This module is compatible with Augeas 1.4.0, but is not loaded by default.
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+Author: David Lutterkort lutter@redhat.com
|
|
|
84dac3 |
+ Dominique Dumont dominique.dumont@hp.com
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+About: Reference
|
|
|
84dac3 |
+ sshd_config man page.
|
|
|
84dac3 |
+ See http://www.openbsd.org/cgi-bin/man.cgi?query=sshd_config&sektion=5
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+About: License
|
|
|
84dac3 |
+ This file is licensed under the LGPL v2+.
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+About: Lens Usage
|
|
|
84dac3 |
+ Sample usage of this lens in augtool:
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ * Get your current setup
|
|
|
84dac3 |
+ > print /files/etc/ssh/sshd_config
|
|
|
84dac3 |
+ ...
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ * Set X11Forwarding to "no"
|
|
|
84dac3 |
+ > set /files/etc/ssh/sshd_config/X11Forwarding "no"
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ More advanced usage:
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ * Set a Match section
|
|
|
84dac3 |
+ > set /files/etc/ssh/sshd_config/Match[1]/Condition/User "foo"
|
|
|
84dac3 |
+ > set /files/etc/ssh/sshd_config/Match[1]/Settings/X11Forwarding "yes"
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ Saving your file:
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ > save
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+About: CAVEATS
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ In sshd_config, Match blocks must be located at the end of the file.
|
|
|
84dac3 |
+ This means that any new "global" parameters (i.e. outside of a Match
|
|
|
84dac3 |
+ block) must be written before the first Match block. By default,
|
|
|
84dac3 |
+ Augeas will write new parameters at the end of the file.
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ I.e. if you have a Match section and no ChrootDirectory parameter,
|
|
|
84dac3 |
+ this command:
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ > set /files/etc/ssh/sshd_config/ChrootDirectory "foo"
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ will be stored in a new node after the Match section and Augeas will
|
|
|
84dac3 |
+ refuse to save sshd_config file.
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ To create a new parameter as the right place, you must first create
|
|
|
84dac3 |
+ a new Augeas node before the Match section:
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ > ins ChrootDirectory before /files/etc/ssh/sshd_config/Match
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ Then, you can set the parameter
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ > set /files/etc/ssh/sshd_config/ChrootDirectory "foo"
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+About: Configuration files
|
|
|
84dac3 |
+ This lens applies to /etc/ssh/sshd_config
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+*)
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+module Sshd_140 =
|
|
|
84dac3 |
+ let eol = del /[ \t]*\n/ "\n"
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let sep = Util.del_ws_spc
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let indent = del /[ \t]*/ " "
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let key_re = /[A-Za-z0-9]+/
|
|
|
84dac3 |
+ - /MACs|Match|AcceptEnv|Subsystem|Ciphers|KexAlgorithms|(Allow|Deny)(Groups|Users)/i
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let comment = Util.comment
|
|
|
84dac3 |
+ let comment_noindent = Util.comment_noindent
|
|
|
84dac3 |
+ let empty = Util.empty
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let array_entry (kw:regexp) (sq:string) =
|
|
|
84dac3 |
+ let value = store /[^ \t\n]+/ in
|
|
|
84dac3 |
+ [ key kw . [ sep . seq sq . value]* . eol ]
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let other_entry =
|
|
|
84dac3 |
+ let value = store /[^ \t\n]+([ \t]+[^ \t\n]+)*/ in
|
|
|
84dac3 |
+ [ key key_re . sep . value . eol ]
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let accept_env = array_entry /AcceptEnv/i "AcceptEnv"
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let allow_groups = array_entry /AllowGroups/i "AllowGroups"
|
|
|
84dac3 |
+ let allow_users = array_entry /AllowUsers/i "AllowUsers"
|
|
|
84dac3 |
+ let deny_groups = array_entry /DenyGroups/i "DenyGroups"
|
|
|
84dac3 |
+ let deny_users = array_entry /DenyUsers/i "DenyUsers"
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let subsystemvalue =
|
|
|
84dac3 |
+ let value = store (/[^ \t\n](.*[^ \t\n])?/) in
|
|
|
84dac3 |
+ [ key /[A-Za-z0-9\-]+/ . sep . value . eol ]
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let subsystem =
|
|
|
84dac3 |
+ [ key /Subsystem/i . sep . subsystemvalue ]
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let list (kw:regexp) (sq:string) =
|
|
|
84dac3 |
+ let value = store /[^, \t\n]+/ in
|
|
|
84dac3 |
+ [ key kw . sep .
|
|
|
84dac3 |
+ [ seq sq . value ] .
|
|
|
84dac3 |
+ ([ seq sq . Util.del_str "," . value])* .
|
|
|
84dac3 |
+ eol ]
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let macs = list /MACs/i "MACs"
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let ciphers = list /Ciphers/i "Ciphers"
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let kexalgorithms = list /KexAlgorithms/i "KexAlgorithms"
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let entry = accept_env | allow_groups | allow_users
|
|
|
84dac3 |
+ | deny_groups | subsystem | deny_users
|
|
|
84dac3 |
+ | macs | ciphers | kexalgorithms
|
|
|
84dac3 |
+ | other_entry
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let condition_entry =
|
|
|
84dac3 |
+ let value = store /[^ \t\n]+/ in
|
|
|
84dac3 |
+ [ sep . key /[A-Za-z0-9]+/ . sep . value ]
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let match_cond =
|
|
|
84dac3 |
+ [ label "Condition" . condition_entry+ . eol ]
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let match_entry = indent . (entry | comment_noindent)
|
|
|
84dac3 |
+ | empty
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let match =
|
|
|
84dac3 |
+ [ key /Match/i . match_cond
|
|
|
84dac3 |
+ . [ label "Settings" . match_entry+ ]
|
|
|
84dac3 |
+ ]
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let lns = (entry | comment | empty)* . match*
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+(* Local Variables: *)
|
|
|
84dac3 |
+(* mode: caml *)
|
|
|
84dac3 |
+(* End: *)
|
|
|
84dac3 |
diff --git a/lenses/tests/test_sshd.aug b/lenses/tests/test_sshd.aug
|
|
|
84dac3 |
index 5954e16f..788a12f0 100644
|
|
|
84dac3 |
--- a/lenses/tests/test_sshd.aug
|
|
|
84dac3 |
+++ b/lenses/tests/test_sshd.aug
|
|
|
84dac3 |
@@ -1,4 +1,3 @@
|
|
|
84dac3 |
-(* Module: Test_sshd *)
|
|
|
84dac3 |
module Test_sshd =
|
|
|
84dac3 |
|
|
|
84dac3 |
let accept_env = "Protocol 2
|
|
|
84dac3 |
@@ -75,61 +74,6 @@ Match User sarko Group pres.*
|
|
|
84dac3 |
Match User bush Group pres.* Host white.house.*
|
|
|
84dac3 |
Banner /etc/welcome.txt\n"
|
|
|
84dac3 |
|
|
|
84dac3 |
-(* Test: Sshd.lns
|
|
|
84dac3 |
- Indent when adding to a Match group *)
|
|
|
84dac3 |
- test Sshd.lns put match_blocks after
|
|
|
84dac3 |
- set "Match[1]/Settings/PermitRootLogin" "yes";
|
|
|
84dac3 |
- set "Match[1]/Settings/#comment" "a comment" =
|
|
|
84dac3 |
-"X11Forwarding yes
|
|
|
84dac3 |
-Match User sarko Group pres.*
|
|
|
84dac3 |
- Banner /etc/bienvenue.txt
|
|
|
84dac3 |
- X11Forwarding no
|
|
|
84dac3 |
- PermitRootLogin yes
|
|
|
84dac3 |
- # a comment
|
|
|
84dac3 |
-Match User bush Group pres.* Host white.house.*
|
|
|
84dac3 |
-Banner /etc/welcome.txt\n"
|
|
|
84dac3 |
-
|
|
|
84dac3 |
-
|
|
|
84dac3 |
-(* Test: Sshd.lns
|
|
|
84dac3 |
- Parse Ciphers and KexAlgorithms as lists (GH issue #69) *)
|
|
|
84dac3 |
-test Sshd.lns get "Ciphers aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes128-ctr
|
|
|
84dac3 |
-KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1\n" =
|
|
|
84dac3 |
- { "Ciphers"
|
|
|
84dac3 |
- { "1" = "aes256-gcm@openssh.com" }
|
|
|
84dac3 |
- { "2" = "aes128-gcm@openssh.com" }
|
|
|
84dac3 |
- { "3" = "aes256-ctr" }
|
|
|
84dac3 |
- { "4" = "aes128-ctr" }
|
|
|
84dac3 |
- }
|
|
|
84dac3 |
- { "KexAlgorithms"
|
|
|
84dac3 |
- { "1" = "diffie-hellman-group-exchange-sha256" }
|
|
|
84dac3 |
- { "2" = "diffie-hellman-group14-sha1" }
|
|
|
84dac3 |
- { "3" = "diffie-hellman-group-exchange-sha1" }
|
|
|
84dac3 |
- }
|
|
|
84dac3 |
-
|
|
|
84dac3 |
-(* Test: Sshd.lns
|
|
|
84dac3 |
- Keys are case-insensitive *)
|
|
|
84dac3 |
-test Sshd.lns get "ciPheRs aes256-gcm@openssh.com,aes128-ctr
|
|
|
84dac3 |
-maTcH User foo
|
|
|
84dac3 |
- x11forwarding no\n" =
|
|
|
84dac3 |
- { "ciPheRs"
|
|
|
84dac3 |
- { "1" = "aes256-gcm@openssh.com" }
|
|
|
84dac3 |
- { "2" = "aes128-ctr" }
|
|
|
84dac3 |
- }
|
|
|
84dac3 |
- { "maTcH"
|
|
|
84dac3 |
- { "Condition"
|
|
|
84dac3 |
- { "User" = "foo" }
|
|
|
84dac3 |
- }
|
|
|
84dac3 |
- { "Settings"
|
|
|
84dac3 |
- { "x11forwarding" = "no" }
|
|
|
84dac3 |
- }
|
|
|
84dac3 |
- }
|
|
|
84dac3 |
-
|
|
|
84dac3 |
-(* Test: Sshd.lns
|
|
|
84dac3 |
- Allow AllowGroups in Match groups (GH issue #75) *)
|
|
|
84dac3 |
-test Sshd.lns get "Match User foo
|
|
|
84dac3 |
-AllowGroups users\n" =
|
|
|
84dac3 |
- { "Match" { "Condition" { "User" = "foo" } }
|
|
|
84dac3 |
- { "Settings" { "AllowGroups" { "1" = "users" } } } }
|
|
|
84dac3 |
|
|
|
84dac3 |
(* Local Variables: *)
|
|
|
84dac3 |
(* mode: caml *)
|
|
|
84dac3 |
diff --git a/lenses/tests/test_sshd_140.aug b/lenses/tests/test_sshd_140.aug
|
|
|
84dac3 |
new file mode 100644
|
|
|
84dac3 |
index 00000000..056c53f9
|
|
|
84dac3 |
--- /dev/null
|
|
|
84dac3 |
+++ b/lenses/tests/test_sshd_140.aug
|
|
|
84dac3 |
@@ -0,0 +1,136 @@
|
|
|
84dac3 |
+(* Module: Test_sshd_140 *)
|
|
|
84dac3 |
+module Test_sshd_140 =
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let accept_env = "Protocol 2
|
|
|
84dac3 |
+AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
|
|
|
84dac3 |
+AcceptEnv LC_IDENTIFICATION LC_ALL\n"
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ test Sshd_140.lns get accept_env =
|
|
|
84dac3 |
+ { "Protocol" = "2" }
|
|
|
84dac3 |
+ { "AcceptEnv"
|
|
|
84dac3 |
+ { "1" = "LC_PAPER" }
|
|
|
84dac3 |
+ { "2" = "LC_NAME" }
|
|
|
84dac3 |
+ { "3" = "LC_ADDRESS" }
|
|
|
84dac3 |
+ { "4" = "LC_TELEPHONE" }
|
|
|
84dac3 |
+ { "5" = "LC_MEASUREMENT" } }
|
|
|
84dac3 |
+ { "AcceptEnv"
|
|
|
84dac3 |
+ { "6" = "LC_IDENTIFICATION" }
|
|
|
84dac3 |
+ { "7" = "LC_ALL" } }
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ test Sshd_140.lns get "HostKey /etc/ssh/ssh_host_rsa_key
|
|
|
84dac3 |
+HostKey /etc/ssh/ssh_host_dsa_key\n" =
|
|
|
84dac3 |
+ { "HostKey" = "/etc/ssh/ssh_host_rsa_key" }
|
|
|
84dac3 |
+ { "HostKey" = "/etc/ssh/ssh_host_dsa_key" }
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ test Sshd_140.lns put accept_env after
|
|
|
84dac3 |
+ rm "AcceptEnv";
|
|
|
84dac3 |
+ rm "AcceptEnv";
|
|
|
84dac3 |
+ set "Protocol" "1.5";
|
|
|
84dac3 |
+ set "X11Forwarding" "yes"
|
|
|
84dac3 |
+ = "Protocol 1.5\nX11Forwarding yes\n"
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ test Sshd_140.lns get "AuthorizedKeysFile %h/.ssh/authorized_keys\n" =
|
|
|
84dac3 |
+ { "AuthorizedKeysFile" = "%h/.ssh/authorized_keys" }
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ test Sshd_140.lns get "Subsystem sftp /usr/lib/openssh/sftp-server\n" =
|
|
|
84dac3 |
+ { "Subsystem"
|
|
|
84dac3 |
+ { "sftp" = "/usr/lib/openssh/sftp-server" } }
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ test Sshd_140.lns get "Subsystem sftp-test /usr/lib/openssh/sftp-server\n" =
|
|
|
84dac3 |
+ { "Subsystem"
|
|
|
84dac3 |
+ { "sftp-test" = "/usr/lib/openssh/sftp-server" } }
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ let match_blocks = "X11Forwarding yes
|
|
|
84dac3 |
+Match User sarko Group pres.*
|
|
|
84dac3 |
+ Banner /etc/bienvenue.txt
|
|
|
84dac3 |
+ X11Forwarding no
|
|
|
84dac3 |
+Match User bush Group pres.* Host white.house.*
|
|
|
84dac3 |
+Banner /etc/welcome.txt
|
|
|
84dac3 |
+"
|
|
|
84dac3 |
+ test Sshd_140.lns get match_blocks =
|
|
|
84dac3 |
+ { "X11Forwarding" = "yes"}
|
|
|
84dac3 |
+ { "Match"
|
|
|
84dac3 |
+ { "Condition" { "User" = "sarko" }
|
|
|
84dac3 |
+ { "Group" = "pres.*" } }
|
|
|
84dac3 |
+ { "Settings" { "Banner" = "/etc/bienvenue.txt" }
|
|
|
84dac3 |
+ { "X11Forwarding" = "no" } } }
|
|
|
84dac3 |
+ { "Match"
|
|
|
84dac3 |
+ { "Condition" { "User" = "bush" }
|
|
|
84dac3 |
+ { "Group" = "pres.*" }
|
|
|
84dac3 |
+ { "Host" = "white.house.*" } }
|
|
|
84dac3 |
+ { "Settings" { "Banner" = "/etc/welcome.txt" } } }
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+ test Sshd_140.lns put match_blocks after
|
|
|
84dac3 |
+ insb "Subsystem" "/Match[1]";
|
|
|
84dac3 |
+ set "/Subsystem/sftp" "/usr/libexec/openssh/sftp-server"
|
|
|
84dac3 |
+ = "X11Forwarding yes
|
|
|
84dac3 |
+Subsystem sftp /usr/libexec/openssh/sftp-server
|
|
|
84dac3 |
+Match User sarko Group pres.*
|
|
|
84dac3 |
+ Banner /etc/bienvenue.txt
|
|
|
84dac3 |
+ X11Forwarding no
|
|
|
84dac3 |
+Match User bush Group pres.* Host white.house.*
|
|
|
84dac3 |
+Banner /etc/welcome.txt\n"
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+(* Test: Sshd_140.lns
|
|
|
84dac3 |
+ Indent when adding to a Match group *)
|
|
|
84dac3 |
+ test Sshd_140.lns put match_blocks after
|
|
|
84dac3 |
+ set "Match[1]/Settings/PermitRootLogin" "yes";
|
|
|
84dac3 |
+ set "Match[1]/Settings/#comment" "a comment" =
|
|
|
84dac3 |
+"X11Forwarding yes
|
|
|
84dac3 |
+Match User sarko Group pres.*
|
|
|
84dac3 |
+ Banner /etc/bienvenue.txt
|
|
|
84dac3 |
+ X11Forwarding no
|
|
|
84dac3 |
+ PermitRootLogin yes
|
|
|
84dac3 |
+ # a comment
|
|
|
84dac3 |
+Match User bush Group pres.* Host white.house.*
|
|
|
84dac3 |
+Banner /etc/welcome.txt\n"
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+(* Test: Sshd_140.lns
|
|
|
84dac3 |
+ Parse Ciphers and KexAlgorithms as lists (GH issue #69) *)
|
|
|
84dac3 |
+test Sshd_140.lns get "Ciphers aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes128-ctr
|
|
|
84dac3 |
+KexAlgorithms diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1\n" =
|
|
|
84dac3 |
+ { "Ciphers"
|
|
|
84dac3 |
+ { "1" = "aes256-gcm@openssh.com" }
|
|
|
84dac3 |
+ { "2" = "aes128-gcm@openssh.com" }
|
|
|
84dac3 |
+ { "3" = "aes256-ctr" }
|
|
|
84dac3 |
+ { "4" = "aes128-ctr" }
|
|
|
84dac3 |
+ }
|
|
|
84dac3 |
+ { "KexAlgorithms"
|
|
|
84dac3 |
+ { "1" = "diffie-hellman-group-exchange-sha256" }
|
|
|
84dac3 |
+ { "2" = "diffie-hellman-group14-sha1" }
|
|
|
84dac3 |
+ { "3" = "diffie-hellman-group-exchange-sha1" }
|
|
|
84dac3 |
+ }
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+(* Test: Sshd_140.lns
|
|
|
84dac3 |
+ Keys are case-insensitive *)
|
|
|
84dac3 |
+test Sshd_140.lns get "ciPheRs aes256-gcm@openssh.com,aes128-ctr
|
|
|
84dac3 |
+maTcH User foo
|
|
|
84dac3 |
+ x11forwarding no\n" =
|
|
|
84dac3 |
+ { "ciPheRs"
|
|
|
84dac3 |
+ { "1" = "aes256-gcm@openssh.com" }
|
|
|
84dac3 |
+ { "2" = "aes128-ctr" }
|
|
|
84dac3 |
+ }
|
|
|
84dac3 |
+ { "maTcH"
|
|
|
84dac3 |
+ { "Condition"
|
|
|
84dac3 |
+ { "User" = "foo" }
|
|
|
84dac3 |
+ }
|
|
|
84dac3 |
+ { "Settings"
|
|
|
84dac3 |
+ { "x11forwarding" = "no" }
|
|
|
84dac3 |
+ }
|
|
|
84dac3 |
+ }
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+(* Test: Sshd_140.lns
|
|
|
84dac3 |
+ Allow AllowGroups in Match groups (GH issue #75) *)
|
|
|
84dac3 |
+test Sshd_140.lns get "Match User foo
|
|
|
84dac3 |
+AllowGroups users\n" =
|
|
|
84dac3 |
+ { "Match" { "Condition" { "User" = "foo" } }
|
|
|
84dac3 |
+ { "Settings" { "AllowGroups" { "1" = "users" } } } }
|
|
|
84dac3 |
+
|
|
|
84dac3 |
+(* Local Variables: *)
|
|
|
84dac3 |
+(* mode: caml *)
|
|
|
84dac3 |
+(* End: *)
|
|
|
84dac3 |
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
|
84dac3 |
index b4563540..387ac7d2 100644
|
|
|
84dac3 |
--- a/tests/Makefile.am
|
|
|
84dac3 |
+++ b/tests/Makefile.am
|
|
|
84dac3 |
@@ -189,6 +189,7 @@ lens_tests = \
|
|
|
84dac3 |
lens-squid.sh \
|
|
|
84dac3 |
lens-ssh.sh \
|
|
|
84dac3 |
lens-sshd.sh \
|
|
|
84dac3 |
+ lens-sshd_140.sh \
|
|
|
84dac3 |
lens-sssd.sh \
|
|
|
84dac3 |
lens-stunnel.sh \
|
|
|
84dac3 |
lens-subversion.sh \
|
|
|
84dac3 |
--
|
|
|
7b8067 |
2.14.3
|
|
|
84dac3 |
|