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-11164

rwired's questions

Martin Hope
rwired
Asked: 2013-01-26 02:47:41 +0800 CST

Apache mod_substitute 无法通过 SSL 工作

  • 0

我正在迁移一个网络服务器,并且遇到了 Apache mod_substitute 的问题。在旧服务器上一切正常,对 HTTP 和 HTTPS 请求都进行了正确的替换。

在新服务器上,仅对 HTTP 请求进行替换。新服务器具有与旧服务器相同的文件结构和相同的操作系统 (CentOS 5.6)。服务器之间的 Apache 配置存在一些差异,但我无法弄清楚可能导致问题的原因。我试过 LogLevel 调试但没有用。

一些 conf 文件以查看差异:(删除注释以节省空间)

旧服务器(有效)

conf.d/ssl.conf

LoadModule ssl_module modules/mod_ssl.so
SSLRandomSeed startup builtin
SSLRandomSeed connect builtin
<IfDefine SSL>
Listen 443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
SSLPassPhraseDialog  builtin
SSLSessionCache         dbm:/etc/httpd/logs/ssl_scache
SSLSessionCacheTimeout  300
SSLMutex  file:/etc/httpd/logs/ssl_mutex
</IfDefine>

新服务器(mod_substitute 不对 https:// 请求执行任何操作)

conf.d/ssl.conf

LoadModule ssl_module modules/mod_ssl.so
Listen 443
AddType application/x-x509-ca-cert .crt
AddType application/x-pkcs7-crl    .crl
SSLPassPhraseDialog  builtin
SSLSessionCache         shmcb:/var/cache/mod_ssl/scache(512000)
SSLSessionCacheTimeout  300
SSLMutex default
SSLRandomSeed startup file:/dev/urandom  256
SSLRandomSeed connect builtin
SSLCryptoDevice builtin

相关的 VHosts 部分(在两个服务器上相同),https:// 页面页面确实显示(并且证书信息是正确的),只有 mod_substitute 无法将 .com 链接转换为新服务器上的 .de 链接(而在旧服务器上它工作正常)。

<VirtualHost 10.0.0.11:443>
  SuexecUserGroup myuser myuser

  DocumentRoot /home/myuser/mydomain.de/html
  ServerName mydomain.de

  ServerAlias www.mydomain.de ftp.mydomain.de mail.mydomain.de
  ServerAdmin webmaster@mydomain.de

  # subdomain logic
  RewriteEngine On
  RewriteOptions inherit
  RewriteCond %{HTTP_HOST} !^www\.mydomain\.de [NC]
  RewriteCond %{HTTP_HOST} !^mydomain\.de [NC]
  RewriteCond %{HTTP_HOST} ^([A-Z0-9a-z-.]+)\.mydomain\.de [NC]
  RewriteCond %{DOCUMENT_ROOT}/%1 -d
  RewriteRule ^(.+) %{HTTP_HOST}/$1 [C]
  RewriteRule ^([0-9A-Za-z-.]+)\.mydomain\.de/?(.*)$ %{DOCUMENT_ROOT}/$1/$2 [L]

  RewriteCond %{HTTP_HOST} ^www\.([A-Z0-9a-z-.]+)\.mydomain\.de [NC]
  RewriteCond %{DOCUMENT_ROOT}/%1 -d
  RewriteRule ^(.+) %{HTTP_HOST}/$1 [C]
  RewriteRule ^www\.([0-9A-Za-z-.]+)\.mydomain\.de/?(.*)$ %{DOCUMENT_ROOT}/$1/$2 [L]
  # end subdomain logic

  LogLevel debug
  ErrorLog /home/myuser/var/mydomain.de/logs/error_ssl.log
  CustomLog /home/myuser/var/mydomain.de/logs/transfer.log combined

  # php: default  don't edit between this and the "end php" comment below
  <IfModule mod_suphp.c>
    suPHP_Engine On
    suPHP_UserGroup myuser myuser
    AddHandler x-httpd-php .php
    suPHP_AddHandler x-httpd-php .php
    suPHP_ConfigPath /home/myuser/etc
  </IfModule>

  <IfModule !mod_suphp.c>
    <IfModule mod_php5.c>
      php_admin_flag engine On
    </IfModule>
    <IfModule mod_php4.c>
      php_admin_flag engine On
    </IfModule>
  </IfModule>
  # end php

  # cgi: 1 don't edit between this and the "end cgi" comment below
  <Directory /home/myuser/mydomain.de/html>
    AllowOverride  All
  </Directory>

  <Location />
    Options +ExecCGI
  </Location>
  ScriptAlias /cgi-bin/ /home/myuser/mydomain.de/html/cgi-bin/
  # end cgi

  <IfModule mod_substitute.c>
    <Location />
      AddOutputFilterByType SUBSTITUTE text/html
      Substitute "s|http://www.mydomain.com/|http://www.mydomain.de/|niq"
      Substitute "s|http://www.mydomain.com|http://www.mydomain.de/|niq"
      Substitute "s|http://mydomain.com/|http://www.mydomain.de/|niq"
      Substitute "s|http://mydomain.com|http://www.mydomain.de/|niq"
      Substitute "s|https://www.mydomain.com/|https://mydomain.de/|niq"
      Substitute "s|https://www.mydomain.com|https://mydomain.de/|niq"
      Substitute "s|https://mydomain.com/|https://mydomain.de/|niq"
      Substitute "s|https://mydomain.com|https://mydomain.de/|niq"
    </Location>
  </IfModule>

 #.com.au is the primary (CN) certificate for all country domains (multi-domain certificate)
 SSLEngine on
  SSLCipherSuite SSLv3:HIGH:MEDIUM:!SSLv2:!ADH:!aNULL:!eNULL:!NULL:!LOW
  SSLCACertificatePath /home/myuser/var/mydomain.com.au/ssl
  SSLCertificateKeyFile /home/myuser/var/mydomain.com.au/ssl/mydomain.com.au.priv.key
  SSLCertificateFile /home/myuser/var/mydomain.com.au/ssl/mydomain.com.au.crt
  SSLCACertificateFile /home/myuser/var/mydomain.com.au/ssl/mydomain.com.au.chain.crt
  SSLOptions +ExportCertData +StrictRequire
  SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
</VirtualHost>
linux
  • 1 个回答
  • 3383 Views
Martin Hope
rwired
Asked: 2009-08-12 20:08:41 +0800 CST

服务器更改后,使用 PuTTY 的 SSH 隧道不再有效

  • 5

编辑(澄清)

              Windows Client                  Remote Linux Server
 |----------------------------------|       |---------------------|
 ____________            ____________            ____________  
|            |          |            |          |            | 
| Firefox    | -------> | PuTTY      | -------> | sshd       | ---> (The Internet)
|____________|          |____________|          |____________| 
Network settings:    Interactive SSH Session     sshd_config
Manual Proxy:        (manual login)              posted below 
SOCKS Host:          Configuration Settings:
localhost:9870       Connection|SSH|Tunnels
                     set to D9870

在我们的 ISP 将服务器更改为新服务器之前,上述配置运行良好。“完全没问题”是指我可以浏览整个互联网,包括通常在中国被屏蔽的网站。当我登录到另一台服务器上的另一个SSH 会话作为测试时,它仍然可以正常工作(生产网络服务器,我不能为此目的)。在所有情况下,手动 SSH 登录都可以正常工作。

我需要弄清楚为什么它不适用于新服务器,因为该服务器的唯一目的是为我们公司提供此功能。

以前的帖子

我们的服务器提供商最近更改了我们的服务器和 IP 地址。旧服务器的硬盘已移至新服务器,除了 IP 地址更改之外,配置应该是相同的。

在迁移之前,我在 Windows 机器上使用 PuTTY 将网络流量作为 SOCKS 代理通过服务器使用设置为 9870 的动态端口进行隧道传输。迁移之后,我重新配置 PuTTY 以指向新 IP。但是隧道不再起作用(在 Firefox 中请求页面时超时)。

我无法访问旧服务器。但是新服务器上的 sshd_config 是:

#       $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $

# This is the sshd server system-wide configuration file.  See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented.  Uncommented options change a
# default value.

#Port 22
#Protocol 2,1
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768

# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile     .ssh/authorized_keys

# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
PasswordAuthentication yes

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes

# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# "PermitRootLogin without-password". If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
#UsePAM no
UsePAM yes

# Accept locale-related environment variables
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem       sftp    /usr/libexec/openssh/sftp-server

编辑:-

到目前为止,我已经尝试了回复中的所有建议。还是行不通。托管服务器的数据中心的防火墙是否有可能阻止 ssh 隧道?我已经尝试将 D80 作为我在 PuTTY 中的动态端口,但这也不起作用(应该吗?)。该服务器主要是一个网络服务器,但目前我们没有在其上运行任何网站,尽管 Apache 正在运行。

我查看了 putty.log,虽然我不太明白,但有以下部分:

Event Log: Opened channel for session
Event Log: Local port 9870 SOCKS dynamic forwarding
Outgoing packet type 98 / 0x62 (SSH2_MSG_CHANNEL_REQUEST)
  00000000  00 00 00 00 00 00 00 07 70 74 79 2d 72 65 71 01  ........pty-req.
  00000010  00 00 00 05 78 74 65 72 6d 00 00 00 50 00 00 00  ....xterm...P...
  00000020  18 00 00 00 00 00 00 00 00 00 00 00 10 03 00 00  ................
  00000030  00 7f 80 00 00 96 00 81 00 00 96 00 00           .............
Outgoing raw data
  00000000  ed 9b 4d c5 0c 7f c4 67 e7 ad 96 3f 5a fd 26 fb  ..M....g...?Z.&.
  00000010  48 27 cd e9 b9 bd 4f 52 2c e0 d3 4e de 62 5d ab  H'....OR,..N.b].
  00000020  c0 10 51 a9 80 8e 68 9c 6d 4c bf ab 75 e9 e1 7a  ..Q...h.mL..u..z
  00000030  bf 66 e3 ff 6f 94 fe f9 9e 78 3d b5 e0 a6 8c fd  .f..o....x=.....
  00000040  61 5b 69 b4 ec 7c 30 a0 29 87 9c 2c d2 94 57 bd  a[i..|0.)..,..W.
  00000050  6e 4b 9c 6c d0 39 cc 46 66 3c 5d 7d dc 37 76 cf  nK.l.9.Ff<]}.7v.
  00000060  9b c7 24 46                                      ..$F
Incoming raw data
  00000000  30 ae 0c b2 25 a9 c1 73 47 1f 2d 6a 5e 5b 7f 88  0...%..sG.-j^[..
  00000010  99 99 0c 28 ff 87 5b 0e 82 61 f5 33 81 3d 8a 7d  ...(..[..a.3.=.}
  00000020  d6 b7 3d 6f                                      ..=o
Incoming packet type 99 / 0x63 (SSH2_MSG_CHANNEL_SUCCESS)
  00000000  00 00 01 00      ............

在我看来,远程服务器接受了端口转发。

进一步编辑:-

我尝试使用 PuTTY (D9870) 中完全相同的 SSH 隧道设置连接到我经常通过 SSH 连接的另一台服务器

这立即奏效(Firefox 将 PuTTY 视为 SOCKS 代理),我立即能够访问在我的位置 [中国] 被阻止的站点。

这个测试最有趣的是,下面的受访者在服务器上规定的netstat -an --inet测试也没有显示 127.0.0.1:9870。

我想我需要清楚地指出,我正在为 PuTTY/Firefox 客户端使用 Windows 机器。我正在尝试使用远程 Linux 服务器来传输网络流量,这样我就可以安全地访问在中国被封锁的网站。在我看来,建议的 netstat 测试应该在我的 Windows 机器上运行(在这种情况下,它使用了错误的 netstat 语法)。

ssh putty
  • 6 个回答
  • 20885 Views
Martin Hope
rwired
Asked: 2009-07-17 21:38:22 +0800 CST

如何使 Windows 关机脚本更早运行

  • 1

在 W2k3 的组策略编辑器中添加的关机脚本在关机序列中的哪个时间运行?

我有几个 3rd 方应用程序,它们在启动时运行,但在关机期间总是产生一般异常。我制作了一个带有几个 TASKKILL /F /IM 行的 .BAT 文件,当我直接运行它时,它确实成功地关闭了这些应用程序,无一例外。

但是在关闭机器时我仍然会遇到异常。稍后在关机序列中,屏幕上的消息显示“正在运行关机脚本”。理想情况下,我希望我的 .BAT 在关闭过程的其余部分之前首先运行。否则,总是需要有人在服务器上才能关闭应用程序错误对话框。

windows-server-2003
  • 1 个回答
  • 1219 Views
Martin Hope
rwired
Asked: 2009-07-14 08:57:35 +0800 CST

W2k3 BSOD IRQL_NOT_LESS_OR_EQUAL

  • 0

我在启动期间(在鼠标光标或 CTRL-ALT-DEL 登录出现之前)在 w2k3 机器上得到 BSOD,或者如果我足够幸运机器启动,但迟早会出现相同的 BSOD。

消息是:

IRQL_NOT_LESS_OR_EQUAL

我无法获得停止代码,因为屏幕消失得太快并重新启动(它从不转储核心)。暂停没有保持蓝屏。

事件查看器在崩溃前没有显示异常活动。正在启动的服务和正在发生的活动等在崩溃之间有很大的不同。

Bootlog 表明加载蓝牙驱动程序后发生了一次崩溃。我不需要这些,所以删除了它们,但问题仍然存在。

我怀疑记忆。2 个插槽中有 2 个 512MB simms。我从任一插槽中删除了每个,并且只用一半的内存启动。我还为两个模拟人生交换了插槽,并且一次尝试了一个。在所有情况下,蓝屏死机都继续发生(主要是在启动时)。我觉得这排除了坏内存,因为我发现 2 个内存模块和/或 2 个插槽同时坏的可能性很小。

但是我确实运行了memtest,它报告了内存错误 -可能是主板上的内存控制器模块吗?

在此问题开始之前,尚未将新的驱动程序或应用程序添加到系统中。这台机器已经运行了 5 年,没有发生太多事故。

我已经完成了完整的系统清理、磁盘扫描(完整)、reg-check、检查 CMOS 设置,并删除了许多旧应用程序和垃圾,希望能对其进行调整。我还移除了 CD-ROM 驱动器(使用不多),将硬盘驱动器重新插入它的 IDE 插槽,拔下并重新插入所有东西,并物理清理了它的内脏。检查的风扇都在工作。

问题持续存在!

windows-server-2003 bsod
  • 6 个回答
  • 5764 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