AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-454136

jdmayfield's questions

Martin Hope
jdmayfield
Asked: 2022-04-21 17:38:10 +0800 CST

OpenSSH - sshd_config - 允许 sftp-chroot 和普通 ssh 登录同一个用户

  • 0

希望不是一个骗局,但找不到这个问题的答案......我发现了这个,表面上看起来是一样的,但是很老,唯一的答案没有回答实际的问题: 设置用户作为 sftp 的 chroot 用户,但允许用户登录 SSH

我已经通过 sftp 为组 'sftp_users' 中的用户成功设置了一个工作 ChrootDirectory 环境。它运行良好,所有适当的权限等,限制对仅 sftp 的访问,并且它们可以在 ChrootDirectory 内的子目录中 rw。这对于非特权用户来说非常有用,不允许 ssh 访问并且只允许 rw 在 ChrootDirectory 内的子文件夹中。

我希望有更多的特权用户仍然能够正常使用 ssh,但是当通过 sftp 登录时将拥有 ChrootDirectory 环境。这不是一个安全问题,因为它们被认为是私有的,并且 obvi 可以在其正常用户权限内浏览 ssh 中的文件系统。问题是,当他们在 sftp 下登录而不阻止 ssh 登录时,我没有看到 Chroot 的方法。这更多是为了标准化和方便,所以当他们 sftp 时,他们就像只使用 sftp 的用户一样到达他们的 Chrooted 位置。

我认为如果我将他们的 shell 保留为默认值(不是 /bin/false 或 nologin),这将起作用。不幸的是,当他们在 sftp_only 组中时,它根本不允许他们 ssh 进入,只有 sftp。除了拥有两个单独的帐户之外,是否有解决此问题的方法——一个添加到“sftp_users”,一个不在该组中?到目前为止,我只能找到有关限制 sftp Chroot 并同时禁止 ssh(如果它们在该组中)的文档。

示例用户是“测试”。'test' 在 sftp_users 组中,因此可以通过 sftp 登录并被 Chroot 到他指定的文件夹('/sftp/test')并读取或写入绑定安装在 '/sftp/test/home' 的主文件夹. 这一切都有效。但是即使他的 shell 仍然在 /etc/passwd 中设置为 /bin/bash,如果添加到 sftp_users 组,'test' 也无法通过 ssh 登录。删除该组中的成员,他可以同时执行这两项操作,但不能在 sftp 下进行 Chroot。

不在组 'sftp_users' 中的用户仍然可以通过 ssh 或 sftp 登录,但在 sftp 下没有 Chroot。

有没有办法匹配使用的协议,和/或可能为不同的组设置额外的匹配?我只是在他们通过 sftp 登录时寻找 chroot。通过 ssh 的非 chroot 对这些用户来说很好。

以下是我的 sshd_config:

Port XXXX
#ListenAddress ::
#ListenAddress 0.0.0.0

Protocol 2

HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key

SyslogFacility AUTH
LogLevel INFO

LoginGraceTime 120
PermitRootLogin no
StrictModes yes

PubkeyAuthentication yes

IgnoreRhosts yes
HostbasedAuthentication no

PermitEmptyPasswords no

ChallengeResponseAuthentication no

X11Forwarding yes
X11DisplayOffset 10
PrintMotd yes
PrintLastLog yes

ClientAliveCountMax 10
ClientAliveInterval 3600
TCPKeepAlive no

#Banner /etc/issue.net

AcceptEnv LANG LC_*

Subsystem sftp /usr/lib/openssh/sftp-server -u 0027

UsePAM yes
PasswordAuthentication yes



Match Group sftp_users
  ChrootDirectory /sftp/%u
  ForceCommand internal-sftp -u 0027
  X11Forwarding no
  AllowTcpForwarding no
  PasswordAuthentication yes
ssh sftp
  • 1 个回答
  • 449 Views
Martin Hope
jdmayfield
Asked: 2019-06-13 17:37:33 +0800 CST

如何保护我的服务器免受 CVE-2019-10149 - Exim - 已修补或未修补 - 如何拒绝发送给 RCPT ${run 的邮件

  • 2

参考最近公布的 Exim 漏洞 CVE-2019-10149,我正在 Ubuntu 18.04.2 LTS 上运行据称已修补的 Exim v. 4.90_1(构建于 2019 年 6 月 4 日)。

尽管据说它已被修补,但根据 Canonical 的说法,我收到了很多以 Frozen 消息结尾的漏洞利用尝试。

这有点令人担忧。

有没有办法拒绝以“$”开头的收件人的邮件?

我如何测试以确保这些漏洞利用不起作用?

ubuntu
  • 2 个回答
  • 1089 Views
Martin Hope
jdmayfield
Asked: 2018-04-25 08:57:09 +0800 CST

如何让祈祷网络邮件在 HTTPS 上运行?

  • 1

我似乎无法让 Prayer Webmail 运行 https 端口。我在 Ubuntu 16.04.2 上运行 Exim4+Dovecot。

它在不安全的 http 端口上运行良好——除了它是不安全的(我将端口 8888 用于 http,将端口 8843 用于 https)。

该端口在防火墙中打开。如果我在 8843 上设置一个套接字,我可以连接到它,测试防火墙。

我已经尝试了几个不同的端口,所以不是这样。

在运行时,我没有得到明显的错误。我遵循了我能找到的所有文档,它在配置文件中对我来说看起来是正确的,但它只会打开 http 端口。如果我禁用了pray.cf 中的http 端口,它将不会像它所说的那样运行,或者没有配置为打开的端口。

它能够很好地加载 .key 和 .crt 文件(如果我更改某些内容,它会因错误而关闭,所以它不能)。

有人知道如何让它在 https 上运行吗?

这是我的 pray.cf 配置:

prefix      = "/usr/share/prayer"
var_prefix  = "/var/run/prayer"

prayer_user           = "prayer"
prayer_group          = "nogroup"

prayer_background     = TRUE

file_perms            = 0640

directory_perms       = 0750





imapd_user_map      = ""

imapd_server        = localhost/notls

prefs_folder_name   = ".prayer"



accountd_user_map   = ""



accountd_timeout    = 2m


sieved_timeout      = 9m

sieve_maxsize       = 32k









hostname         = "example.com"

use_http_port    8888
use_https_port   8843

#ssl_default_port = 8843



fatal_dump_core = FALSE
log_debug  =  TRUE

fix_client_ipaddr = FALSE




limit_vm = 150m
recips_max_msg     = 250
recips_max_session = 1000
sending_allow_dir = "${var_prefix}/sending/allow"
sending_block_dir = "${var_prefix}/sending/block"



http_max_method_size = 32k
http_max_hdr_size    = 64k

http_max_body_size   = 15m

http_min_servers     = 4
http_max_servers     = 16
http_max_connections = 20

http_cookie_use_port = FALSE

http_timeout_idle    = 10s
http_timeout_icons   = 60s
http_timeout_session = 5m
icon_expire_timeout  = 7d





ssl_cert_file       = "/etc/prayer/server.crt"
ssl_privatekey_file = "/etc/prayer/server.key"

ssl_rsakey_lifespan = 15m
ssl_rsakey_freshen  = 15m

ssl_cipher_list = "ECDHE-RSA-AES128-SHA256:AES128-GCM-SHA256:RC4:HIGH:!MD5:!aNULL:!EDH:!EXP"

ssl_server_preference = T




session_idle_time       = 10m
session_timeout         = 30m
session_timeout_compose = 2h

stream_checkpoint       = T
stream_ping_interval    = 20m
stream_misc_timeout = 15m 

log_ping_interval  = 10m
db_ping_interval   = 30m

login_template      = "login"
login_banner        = "WebMAIL"
login_service_name  = "example.com"

list_addr_maxlen    = 30
list_subject_maxlen = 30
change_max_folders  = 20

use_ispell_language  british   "British English"
use_ispell_language  american  "American English"

draft_att_single_max = 10M
draft_att_total_max  = 10M

fix_from_address = FALSE

spam_purge_name = "spam_purge"
spam_purge_prefix = "# Spam Purge Timeout:"
spam_purge_timeout = 60


sendmail_path       = /usr/lib/sendmail


ispell_path         = /usr/bin/ispell





ssl_encouraged      = FALSE
ssl_redirect        = FALSE
ssl_required        = FALSE

icon_dir            = "$prefix/icons"
static_dir          = "$prefix/static"
bin_dir             = "/usr/sbin"
log_dir             = "/var/log/prayer"
lock_dir            = "$var_prefix"
socket_dir          = "$var_prefix/sockets"
socket_split_dir    = TRUE
init_socket_name    = init
ssl_session_dir     = "$var_prefix/ssl_scache"
tmp_dir             = "$var_prefix/tmp"
pid_dir             = "$var_prefix"




template_path = "/etc/prayer/templates"
template_set  = "old"
template_use_compiled = TRUE

template old  "Traditional"
template cam  "Cambridge House Style"


theme blue description           "Web Safe Blue"
theme blue fgcolor               "#000000"       # Black
theme blue fgcolor_link          "#0000ff"       # Dark    Blue
theme blue bgcolor               "#ccffff"       # Light   Blue 
theme blue bgcolor_banner        "#66ffff"       # Darkish Blue
theme blue bgcolor_row1          "#ccffff"       # Light   Blue
theme blue bgcolor_row2          "#99ffff"       # Middle  Blue
theme blue bgcolor_status        "#ffffcc"       # Yellow
theme blue bgcolor_status_none   "#ccffcc"       # Green
theme blue fgcolor_quote1        "#800000"       # Brick Red
theme blue fgcolor_quote2        "#008000"       # Green
theme blue fgcolor_quote3        "#000080"       # Blue
theme blue fgcolor_quote4        "#ff0000"       # Orange

theme green description          "Web Safe Green"
theme green fgcolor              "#000000"       # Black
theme green fgcolor_link         "#0000ff"       # Dark    Blue
theme green bgcolor              "#ccffcc"       # Light   Green
theme green bgcolor_banner       "#99ff99"       # Middle  Green
theme green bgcolor_row1         "#ccffcc"       # Light   Green
theme green bgcolor_row2         "#99ff99"       # Middle  Green
theme green bgcolor_status       "#ffffcc"       # Yellow
theme green bgcolor_status_none  "#ccffff"       # Light   Blue
theme green fgcolor_quote1       "#800000"       # Brick Red
theme green fgcolor_quote2       "#008000"       # Green
theme green fgcolor_quote3       "#000080"       # Blue
theme green fgcolor_quote4       "#ff0000"       # Orange

theme yellow description         "Web Safe Yellow"
theme yellow fgcolor             "#000000"       # Black
theme yellow fgcolor_link        "#0000ff"       # Dark   Blue
theme yellow bgcolor             "#ffffcc"       # Light  Yellow
theme yellow bgcolor_banner      "#ffff66"       # Middle Yellow
theme yellow bgcolor_row1        "#ffffcc"       # Light  Yellow
theme yellow bgcolor_row2        "#ffff66"       # Middle Yellow
theme yellow bgcolor_status      "#ccffff"       # Light  Blue
theme yellow bgcolor_status_none "#ccffcc"       # Green
theme yellow fgcolor_quote1      "#800000"       # Brick Red
theme yellow fgcolor_quote2      "#008000"       # Green
theme yellow fgcolor_quote3      "#000080"       # Blue
theme yellow fgcolor_quote4      "#ff0000"       # Orange

theme gray description          "Shades of Gray" # NB: Not Web safe!
theme gray fgcolor              "#000000"        # Black
theme gray fgcolor_link         "#0000ff"        # Dark   Blue
theme gray bgcolor              "#eeeeee"        # Light  gray
theme gray bgcolor_banner       "#cccccc"        # Dark   gray
theme gray bgcolor_row1         "#eeeeee"        # Light  gray
theme gray bgcolor_row2         "#dddddd"        # Middle gray
theme gray bgcolor_status       "#ffffcc"        # Yellow
theme gray bgcolor_status_none  "#ccffcc"        # Green
theme gray fgcolor_quote1        "#800000"       # Brick Red
theme gray fgcolor_quote2        "#008000"       # Green
theme gray fgcolor_quote3        "#000080"       # Blue
theme gray fgcolor_quote4        "#ff0000"       # Orange

theme high description          "High Constrast" # Yuck!
theme high fgcolor              "#000000"        # Black
theme high fgcolor_link         "#0000ff"        # Dark  Blue
theme high bgcolor              "#ffffff"        # Very, very white
theme high bgcolor_banner       "#cccccc"        # Dark gray
theme high bgcolor_row1         "#ffffff"        # Very, very white
theme high bgcolor_row2         "#cccccc"        # Dark gray
theme high bgcolor_status       "#ffffcc"        # Yellow
theme high bgcolor_status_none  "#ccffcc"        # Green
theme high fgcolor_quote1        "#800000"       # Brick Red
theme high fgcolor_quote2        "#008000"       # Green
theme high fgcolor_quote3        "#000080"       # Blue
theme high fgcolor_quote4        "#ff0000"       # Orange

theme help description          "Default Help Text theme"
theme help fgcolor              "#000000"        # Black
theme help fgcolor_link         "#0000ff"        # Dark Blue
theme help bgcolor              "#ffffcc"        # Yellow
theme help bgcolor_banner       "#66ffff"        # Darkish Blue
theme help bgcolor_row1         "#ccffff"        # Light   Blue
theme help bgcolor_row2         "#99ffff"        # Middle  Blue
theme help bgcolor_status       "#ccffff"        # Light   Blue
theme help bgcolor_status_none  "#ccffcc"        # Green
theme help fgcolor_quote1        "#800000"       # Brick Red
theme help fgcolor_quote2        "#008000"       # Green
theme help fgcolor_quote3        "#000080"       # Blue
theme help fgcolor_quote4        "#ff0000"       # Orange

theme_default_main  = gray
theme_default_help  = help



confirm_logout      = TRUE
confirm_expunge     = FALSE
confirm_rm          = TRUE
expunge_on_exit     = FALSE

msgs_per_page       = 10
msgs_per_page_max   = 50
msgs_per_page_min   = 4

abook_per_page      = 10
abook_per_page_max  = 50
abook_per_page_min  = 4

suppress_dotfiles   = TRUE

maildir             = ""

use_namespace       = TRUE

personal_hierarchy  = ""

hiersep             = "/"

dualuse             = FALSE

postponed_folder    = "Drafts"
sent_mail_folder    = "Sent"


ispell_language     = "american"

small_cols          = 80
small_rows          = 14
large_cols          = 80
large_rows          = 24

sort_mode           = ARRIVAL

sort_reverse        = FALSE

abook_sort_mode     = ORDERED

abook_sort_reverse        = FALSE

line_wrap_len       = 76

line_wrap_advanced  = FALSE

line_wrap_on_reply  = TRUE

line_wrap_on_spell  = TRUE

line_wrap_on_send   = TRUE

use_sent_mail       = TRUE

use_mark_persist    = FALSE

use_search_zoom     = TRUE

use_agg_unmark      = TRUE

use_icons           = TRUE

use_tail_banner     = TRUE

use_cookie          = TRUE

use_substitution    = FALSE

use_http_1_1        = TRUE

use_pipelining      = TRUE

use_persist         = TRUE

use_short           = TRUE

use_gzip            = TRUE

html_inline         = TRUE

html_remote_images  = FALSE

html_inline_auto    = TRUE

preserve_mimetype   = TRUE
ubuntu
  • 1 个回答
  • 210 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve