mirror of
https://github.com/elitak/nixos-infect.git
synced 2024-12-22 08:08:29 +03:00
fix: Authorized keys parsing and extraction (#187)
* add support for SK authorized keys nixos-infect incorrectly handles * Update nixos-infect * Replace space with [[:space:]] * Fix possible security issue
This commit is contained in:
parent
095fcbc28d
commit
bbe94a1175
1 changed files with 1 additions and 1 deletions
|
@ -26,7 +26,7 @@ makeConf() {
|
||||||
local IFS=$'\n'
|
local IFS=$'\n'
|
||||||
for trypath in /root/.ssh/authorized_keys /home/$SUDO_USER/.ssh/authorized_keys $HOME/.ssh/authorized_keys; do
|
for trypath in /root/.ssh/authorized_keys /home/$SUDO_USER/.ssh/authorized_keys $HOME/.ssh/authorized_keys; do
|
||||||
[[ -r "$trypath" ]] \
|
[[ -r "$trypath" ]] \
|
||||||
&& keys=$(sed -E 's/^.*((ssh|ecdsa)-[^[:space:]]+)[[:space:]]+([^[:space:]]+)([[:space:]]*.*)$/\1 \3\4/' "$trypath") \
|
&& keys=$(sed -E 's/^[^#].*[[:space:]]((sk-ssh|sk-ecdsa|ssh|ecdsa)-[^[:space:]]+)[[:space:]]+([^[:space:]]+)([[:space:]]*.*)$/\1 \3\4/' "$trypath") \
|
||||||
&& [[ ! -z "$keys" ]] \
|
&& [[ ! -z "$keys" ]] \
|
||||||
&& break
|
&& break
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in a new issue