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