Summary: | "Неправильно" дополняются хосты для ssh/scp | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | Sisyphus | Reporter: | Sir Raorn <raorn> | ||||||||
Component: | zsh | Assignee: | Fr. Br. George <george> | ||||||||
Status: | CLOSED FIXED | QA Contact: | qa-sisyphus | ||||||||
Severity: | enhancement | ||||||||||
Priority: | P3 | CC: | arseny, george, mike | ||||||||
Version: | unstable | ||||||||||
Hardware: | all | ||||||||||
OS: | Linux | ||||||||||
Attachments: |
|
Description
Sir Raorn
2004-11-02 10:41:44 MSK
There's a few problems with what you propose. First, it is to fail when ~/.ssh/known_hosts is nonexistent. Second, I'm not sure I want to override hosts style for all commands, not just for ssh and scp. Anyway, this is going to get too complicated for /etc/zshrc. Maybe there should be a separate file, perhaps in /etc/zshrc.d. Separate file должен быть в районе /usr/share/zsh/Completion/Unix/_sshhosts, но у меня сходу не получилось научить _ssh_hosts брать hosts из ~/.ssh/known_hosts... Будем надеяться, что LATER кто-ньдь что-ньдь сделает. Например я разберусь с zsh Completion System... LATER наступило. Патчи в аттачах. Created attachment 983 [details]
Патч для /usr/share/zsh/Completion/Unix/_ssh
Created attachment 984 [details]
/usr/share/zsh/Completion/Unix/_known_hosts
Из ~/.zsh/functions почему-то не autoload'ится. Почему - пока не понял.
Смысл такой: Перебираем ssh_config в составе /etc/ssh/ssh_config /etc/ssh2/ssh_config /etc/openssh/ssh_config $HOME/.ssh/config $HOME/.ssh/config, из каждого файла выцепляем параметры: 1. Host с non-pattern аргументом, добавляем к списку вариантов. 2. Global/UserKnownHostsFile, если не определено, используем /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 /etc/known_hosts /etc/known_hosts2 $HOME/.ssh/known_hosts $HOME/.ssh/known_hosts2, и выдираем из этих файлов хосты. Created attachment 985 [details]
/usr/share/zsh/Completion/Unix/_known_hosts
о та! $HOME/.ssh/known_hosts listed twice in "for" loop condition. Did you mean $HOME/.ssh/known_hosts2? I mean "config2". - for f in /etc/ssh/ssh_config /etc/ssh2/ssh_config /etc/openssh/ssh_config $HOME/.ssh/config $HOME/.ssh/config; do + for f in /etc/ssh/ssh_config /etc/ssh2/ssh_config /etc/openssh/ssh_config $HOME/.ssh/config $HOME/.ssh/config2; do ? (In reply to comment #10) > I mean "config2". My mistake. ~/.ssh2/config. I think these paths must be sanitized. I've loooked into /etc/bash_completion(_known_hosts) and added /etc/openssh/. I'm not sure where "popular" ssh implementations keeps their configs. Original list: Config: /etc/ssh/ssh_config ~/.ssh/config ~/.ssh2/config Global known_hosts: /etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2 /etc/known_hosts /etc/known_hosts2 /etc/ssh2/knownhosts/*pub User known_hosts: ~/.ssh/known_hosts ~/.ssh/known_hosts2 ~/.ssh2/hostkeys/*pub knownhosts/hostkeys directories is not supported (yet?). Also missing /usr/local/etc/ paths that can be used on *BSD. P.S. Is there any way to determine ssh config/known_hosts file at runtime? Fixed in zsh-4.3.0-alt0.2. |