mirror of
https://github.com/m8tin/cis.git
synced 2026-08-01 11:47:31 +02:00
using regex from base module
This commit is contained in:
@@ -91,7 +91,7 @@ function composition.start() {
|
|||||||
_COMPOSITION_HOME_FILE="${CIS[COMPOSITIONS]:?"Missing CIS_COMPOSITIONS"}${_COMPOSITION}/home"
|
_COMPOSITION_HOME_FILE="${CIS[COMPOSITIONS]:?"Missing CIS_COMPOSITIONS"}${_COMPOSITION}/home"
|
||||||
|
|
||||||
# The regex should ensure a path starts and ends with a '/' and it should limit the allowed set of characters
|
# The regex should ensure a path starts and ends with a '/' and it should limit the allowed set of characters
|
||||||
base.set _COMPOSITION_HOME "$(head -n 1 "${_COMPOSITION_HOME_FILE}" 2> /dev/null)" '^/([a-zA-Z0-9\._-]+/)*$' optional
|
base.set _COMPOSITION_HOME "$(head -n 1 "${_COMPOSITION_HOME_FILE}" 2> /dev/null)" "${REGEX[FULLDIRPATH]}" optional
|
||||||
readonly _COMPOSITION _COMPOSITION_FILE_BACKUP _COMPOSITION_HOME _COMPOSITION_HOME_FILE
|
readonly _COMPOSITION _COMPOSITION_FILE_BACKUP _COMPOSITION_HOME _COMPOSITION_HOME_FILE
|
||||||
|
|
||||||
local _COMPOSITION_FILE
|
local _COMPOSITION_FILE
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ source /cis/core/base.module.sh
|
|||||||
function ssh.onHostRun() {
|
function ssh.onHostRun() {
|
||||||
local _REMOTE_HOST _COMMAND
|
local _REMOTE_HOST _COMMAND
|
||||||
base.set _REMOTE_HOST "${1:?"FQDN of server missing: e.g. host.example.net[:port]"}" '^([a-zA-Z0-9][a-zA-Z0-9@.-]*)+(:[0-9]+)?$'
|
base.set _REMOTE_HOST "${1:?"FQDN of server missing: e.g. host.example.net[:port]"}" '^([a-zA-Z0-9][a-zA-Z0-9@.-]*)+(:[0-9]+)?$'
|
||||||
base.set _COMMAND "${2:?"COMMAND missing"}" '[-a-zA-Z0-9\|/_:,.]+'
|
base.set _COMMAND "${2:?"COMMAND missing"}" "${REGEX[COMMAND]}"
|
||||||
|
|
||||||
local _REMOTE_USER _REMOTE_HOSTNAME_FQDN _REMOTE_PORT _SOCKET
|
local _REMOTE_USER _REMOTE_HOSTNAME_FQDN _REMOTE_PORT _SOCKET
|
||||||
_REMOTE_USER="@${_REMOTE_HOST}" #Ensures leading '@'
|
_REMOTE_USER="@${_REMOTE_HOST}" #Ensures leading '@'
|
||||||
|
|||||||
Reference in New Issue
Block a user