1
0
mirror of https://github.com/limosek/zaf-plugins.git synced 2024-11-01 08:17:19 +01:00
limosek-zaf-plugins/openssh/control.zaf

68 lines
1.1 KiB
Plaintext
Raw Normal View History

2016-04-04 13:59:26 +02:00
Plugin: openssh
Description::
Plugin which will discover openssh config options and will return their values.
::
Version: 0.2
2016-04-04 13:59:26 +02:00
Url: https://raw.githubusercontent.com/limosek/zaf-plugins/master/openssh
Web: https://github.com/limosek/zaf-plugins/
Maintainer: Lukas Macura <lukas@macura.cz>
# Dependencies
Depends-dpkg: dash
2016-11-28 14:42:01 +01:00
Depends-opkg: busybox
2016-04-04 13:59:26 +02:00
Depends-rpm: grep
Depends-bin: grep tr sort uniq
2016-04-04 13:59:26 +02:00
Item discovery:
Description::
Discovery of enabled openssh config options
::
Type: script
Parameters: sshd_config_file
Script::
#!/bin/sh
. $ZAF_LIB_DIR/preload.sh
if [ -n "$1" ]; then
cfg="$1"
else
cfg=/etc/ssh/sshd_config
fi
grep -v '^#' "$cfg" | tr -s '\n' | \
while read opt; do
[ -n "$opt" ] && echo $opt
done | sort | uniq | zaf_discovery '{#OPTION}'
2016-04-04 13:59:26 +02:00
::
/Item
Item option_value:
Description::
Value of enabled openssh config option
::
Parameters: sshd_config_file optionname
Type: string
Script::
#!/bin/sh
. $ZAF_LIB_DIR/preload.sh
if [ -n "$2" ]; then
cfg="$1"
opt="$2"
shift
else
cfg=/etc/ssh/sshd_config
opt="$1"
fi
[ -n "$opt" ] && { grep "^$opt " $cfg | cut -d ' ' -f 2- ; } || zaf_err "OptionName missing"
::
/Item