ALT Linux sysadmins discussion
 help / color / mirror / Atom feed
From: Alexander Yereschenko <ave4600@gmail.com>
To: ALT Linux sysadmins' discussion <sysadmins@lists.altlinux.org>
Subject: [Sysadmins] SSH вход по ключу и паролю в зависимости от интерфейса
Date: Mon, 7 Dec 2015 20:36:04 +0300
Message-ID: <5665C384.4000203@gmail.com> (raw)

Доброе!

Спросил на форуме
https://forum.altlinux.org/index.php?topic=2659.msg272543#msg272543
Но продублирую и здесь

Хочется странного: на машинке, которая работает и как шлюз в инет, стоит
nx-server. Хочется настроить shhd так, чтобы извне для себя (для
админства) был доступ только по ключу, а из локалки и (самое главное -
тут, как я понял, без вариантов) для nx с локалхоста - по паролю.

Настроил доступ по ключу - работает.

В sshd_config c помощью:
====
ListenAddress 192.168.0.1:22
ListenAddress 127.0.0.1:22
ListenAddress внешний_IP:другой_порт
====
сделал для доступа снаружи нестандартный порт.

По образцу на http://www.opennet.ru/openforum/vsluhforumID10/4945.html
Добавил в sshd_config :
(глобально запрещаем вход по паролю, но с локалки и локалхоста разрешаем)
====
PasswordAuthentication no
.....
Match User user@192.168.0.*
          PasswordAuthentication yes
Match User user@127.0.0.1
          PasswordAuthentication yes
====
Но почему-то доступ существует только по ключу. Соответственно,
авторизация через nx не работает.
Куда копать? Как осуществить желаемое?

Т.е. стоит задача сделать по-умолчанию доступ только по ключу, но при
этом доступ от localhost должен быть по паролю.
Как я понимаю описания, nx-клиент коннектится к серверу через ssh по
ключу как пользователь nx (это судя по логам проходит), а потом уже
nx-сервер от имени конкретного пользователя (в данном случае user)
коннектится локально через ssh, а вот тут он умеет только по паролю. И
вот это уже и не проходит, так как sshd тупо ждет только ключ, не смотря
на запись Match. Ну и с локалки user тоже не может войти по паролю.

-- 
Alexander



             reply	other threads:[~2015-12-07 17:36 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07 17:36 Alexander Yereschenko [this message]
2015-12-07 17:57 ` Евгений Терешков
2015-12-08  3:19 ` В.А. Илларионов
2015-12-09 14:59   ` Alexander Yereschenko
2015-12-09 15:16     ` Michael Shigorin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5665C384.4000203@gmail.com \
    --to=ave4600@gmail.com \
    --cc=sysadmins@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux sysadmins discussion

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sysadmins/0 sysadmins/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sysadmins sysadmins/ http://lore.altlinux.org/sysadmins \
		sysadmins@lists.altlinux.org sysadmins@lists.altlinux.ru sysadmins@lists.altlinux.com
	public-inbox-index sysadmins

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sysadmins


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git