我目前正在为多个客户端运行 OpenVPN 服务器。所有流量都通过 VPN 定向(它被设置为网关;推送“重定向网关 def1”)。
到目前为止,一切正常。但是,我想将几台服务器连接到这个虚拟专用网络,而这些服务器不使用 OVPN 守护程序作为网关。
这些服务器必须可以从它们的 WAN 和它们的 LAN IP 地址访问。某些服务只能从 LAN 端访问。
对于客户端,有没有办法忽略推送重定向网关选项?
亲切的问候,图因斯拉克
根据主机名复制文件的最佳方法是什么?
我需要将内容不同但文件名相同的文件复制到多台机器上。
我有几个文件:
file.role1
file.role2
file.role3
Run Code Online (Sandbox Code Playgroud)
根据主机名和/或角色,我想file.roleX
将其复制并重命名为file
谢谢。
我有一个处理各种客户端的 VPN 服务器;有些只支持 ipv4,有些支持 ipv4 和 ipv6,有些只支持 ipv6。其中一些客户端正在漫游,因此理想情况下,如果可用,它们应该连接到 ipv6,如果不可用,则回退到 ipv4。
在我当前的设置中,OpenVPN 侦听 ipv4 和 ipv6:
proto udp
proto udp6
dev tun
Run Code Online (Sandbox Code Playgroud)
我的第一个问题在这里:虽然这似乎有效,但将两个 proto 放在一个配置文件中是否安全和正确?
我的客户在配置中有两个远程实例:
remote vpn.domain.tld port udp6
remote vpn.domain.tld port udp
Run Code Online (Sandbox Code Playgroud)
我的问题也在这里,因为这似乎有效(首先尝试 udp6,如果失败将回退到 udp),这是一个很好的方法吗?
由于更新到 Debian Buster,date
在终端上运行以 AM/PM 格式显示时钟,而不是 24 小时时钟。这是新的,发生在所有更新的安装中。
Docker 容器:
yeri@b9b3e889fd76 ~ $ date
Thu 01 Aug 2019 11:28:25 PM +08
Run Code Online (Sandbox Code Playgroud)
本地主机:
liana ~ # date
Thu 01 Aug 2019 11:32:44 PM +08
Run Code Online (Sandbox Code Playgroud)
数字海洋:
ui0 ~ # date
Thu 01 Aug 2019 05:33:11 PM CEST
Run Code Online (Sandbox Code Playgroud)
这很烦人,我没有要求这样做 - 但是找不到更改它的设置。
我唯一能想到的是语言环境设置为美国;但之前的情况也是如此(Debian 9):
ui0 ~ # cat /etc/default/locale
# File generated by update-locale
LANG=en_US.UTF-8
Run Code Online (Sandbox Code Playgroud)
yeri@b9b3e889fd76 ~ $ locale
LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8" …
Run Code Online (Sandbox Code Playgroud) 我目前使用 nginx 作为反向代理并启用缓存。
但是,主站点有两种不同的布局,具体取决于用户代理(移动与否)。
我试过类似的东西:
# mobile users
if ($http_user_agent ~* '(iPhone|iPod|mobile|Android|2.0\ MMP|240x320|AvantGo|BlackBerry|Blazer|Cellphone|Danger|DoCoMo|Elaine/3.0|EudoraWeb|hiptop|IEMobile)') {
set $iphone_request '1';
}
if ($iphone_request = '1') {
proxy_cache mobile;
}
if ($iphone_request = '') {
proxy_cache site;
}
proxy_cache_key "$scheme://$host$request_uri";
proxy_pass http://real-site.tld;
Run Code Online (Sandbox Code Playgroud)
但是,nginx 给出了一个错误,指出不能在 if 结构中使用 proxy_cache。
根据浏览器的不同,还有其他方法可以从不同的缓存中提供服务吗?
谢谢,图因斯拉克
由于搞砸了,我必须重新生成客户端和服务器证书。
据我所知,主证书是自动生成的。
所以我在客户端生成了密钥:
MASTER # puppet cert clean --all
Notice: Revoked certificate with serial 2
Notice: Revoked certificate with serial 6
Notice: Removing file Puppet::SSL::Certificate puppet.x.com at '/var/lib/puppet/ssl/ca/signed/puppet.x.com.pem'
Notice: Removing file Puppet::SSL::Certificate puppet.x.com at '/var/lib/puppet/ssl/certs/puppet.x.com.pem'
Notice: Removing file Puppet::SSL::Key puppet.x.com at '/var/lib/puppet/ssl/private_keys/puppet.x.com.pem'
Notice: Removing file Puppet::SSL::Certificate efikamx-9ba3ab.x.com at '/var/lib/puppet/ssl/ca/signed/efikamx-9ba3ab.x.com.pem'
Notice: Removing file Puppet::SSL::Certificate efikamx-9ba3ab.x.com at '/var/lib/puppet/ssl/certs/efikamx-9ba3ab.x.com.pem'
puppet agent --no-daemonize --onetime --verbose --waitforcert 60
notice: Did not receive certificate
info: Caching certificate for efikamx-561a37.botnet.corp.flatturtle.com
err: Could not retrieve catalog from remote …
Run Code Online (Sandbox Code Playgroud) 我在 Bind 的主从配置中偶然发现了一个奇怪的错误。
该区域在主站上运行良好,但在从站上我收到了这些错误:
21-May-2014 19:06:07.573 general: info: zone example.com/IN: refresh: failure trying master 1.2.3.4#53 (source 0.0.0.0#0): unexpected end of input
Run Code Online (Sandbox Code Playgroud)
这是我的绑定文件的样子:
@ IN SOA ns1.example.com. admin.example.com. (
2014052116 ; Serial
28800 ; Refresh
180 ; Retry
604800 ; Expire
21600 ) ; Minimum
86400 IN A 1.2.3.4
86400 IN MX 10 mail.example.com.
86400 IN MX 20 mail2.example.com.
86400 IN NS ns1.example.com.
86400 IN NS ns2.example.com.
86400 IN NS ns3.example.com.
86400 IN NS ns1.example.net.
86400 IN NS ns2.example.net.
86400 IN …
Run Code Online (Sandbox Code Playgroud) 我的服务器在 IPv4 和 IPv6 上运行。Docker 在(本地)IPv4 地址(即 192.168.100.1/24)上运行。我没有在内部启用 IPv6,daemon.json
因为我知道这会带来很多问题,并且需要我拥有完整的 IPv6 /64 范围可用。
例如,反向代理 nginx docker 容器正在运行superuser.one
,该 IP 可通过 IPv4 和 IPv6 访问。
# dig superuser.one +short a
85.17.140.73
# dig superuser.one +short aaaa
2001:1af8:4200:a003:1:aaaa:0:123
Run Code Online (Sandbox Code Playgroud)
IPv6 正在运行:
# ping6 superuser.one -c 1
PING superuser.one(2001:1af8:4200:a003:1:aaaa:0:123 (2001:1af8:4200:a003:1:aaaa:0:123)) 56 data bytes
64 bytes from 2001:1af8:4200:a003:1:aaaa:0:123 (2001:1af8:4200:a003:1:aaaa:0:123): icmp_seq=1 ttl=57 time=19.5 ms
--- superuser.one ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 19.526/19.526/19.526/0.000 ms …
Run Code Online (Sandbox Code Playgroud) 我有一台运行 Wireguard 的服务器(因此需要masquerade
)和一个在端口 2525 上运行的容器。
我有以下iptables
规则:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 25 -j DNAT --to-destination 172.18.0.1:2525
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
Run Code Online (Sandbox Code Playgroud)
直接连接时server:2525
,Docker 容器能够看到我的真实 IP 地址 ( 1.2.3.4
)。当连接到 port 时server:25
,Docker 容器会看到由以下内容提供的本地 IP docker network
:
Apr 07 12:45:46 mx postfix/smtpd[87]: lost connection after CONNECT from unknown[172.18.0.1]
Apr 07 12:45:46 mx postfix/smtpd[87]: disconnect from unknown[172.18.0.1] commands=0/0
Run Code Online (Sandbox Code Playgroud)
如何确保 Docker 容器在连接到端口 25 时(而不仅仅是在连接到端口 2525 时)正确地看到公共 IP …
我最近将一台 HP 服务器从一个二手 CPU 插槽(4 核 + HT = 8 核)升级到 2 个二手 CPU 插槽(16 核)。
但是,我只能为 VM 分配 8 个内核。当设置 16 时,它在“新 VM 向导”中默认返回 8,当从现有 VM 更改它时,它显示红色警告:“比物理 CPU 多的 VCPU 可能导致 VM 性能降低”。单击确定仍将其默认为 8 核而不是 16 核。
然而,我的 xenhost (dom0) 确实分配了 16 个 CPU,并且实际上可以识别它们。
我想知道为什么我无法向一台机器添加超过 8 个 vCPU。
在进行服务器升级之前,我也能够分配 8 个 vCPU,因此它不能与 HT 相关。
我试图让这样的东西在我的 Puppet 清单中工作:
if $hostname == 'host1' || $hostname == 'host2' {
# Modified config.txt for portrait mode.
file { '/boot/config.txt' :
ensure => present,
mode => '0755',
source => 'puppet://puppet/files/boot/config.txt.portrait',
}
} else {
# Normal config.txt for landscape mode.
file { '/boot/config.txt' :
ensure => present,
mode => '0755',
source => 'puppet://puppet/files/boot/config.txt.landscape',
}
}
Run Code Online (Sandbox Code Playgroud)
然而,这失败了。根据主机名,包含不同文件的最佳方法是什么?
如何在没有扩展名的情况下在 nginx 服务器上请求 html 页面?
即:example.com/about 应该返回 example.com/about.html。对于所有 html 页面都应该如此。
我有一些类似的事情:
try_files $uri $uri.html;
index index.html;
Run Code Online (Sandbox Code Playgroud)
这是有效的,但是访问 example.com/ 会导致 403 Forbidden:
2015/01/20 19:26:11 [error] 32618#0: *373061 access forbidden by rule
Run Code Online (Sandbox Code Playgroud)
访问不存在的页面 (example.com/bla) 会导致重定向循环:
2015/01/20 19:26:57 [error] 32620#0: *373065 rewrite or internal redirection cycle while internally redirecting to "/bla.html.html.html.html.html.html.html.html.html.html.html"
Run Code Online (Sandbox Code Playgroud)
更新了完整的 nginx 配置:
server {
listen [::]:80;
server_name example.com;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
root /var/www/example/;
try_files $uri $uri.html /index.html =404;
index index.html;
expires max;
autoindex off;
# deny access to .htaccess files, …
Run Code Online (Sandbox Code Playgroud) 我有一个 WordPress 博客,我想将所有请求重定向到某个帖子/页面,不包括 js、css(和图像)。
所以 example.com/some-post/ 必须(暂时)重定向到 exmaple.com/catch-all/
我正在玩这个,但似乎不太好用(我不确定我是否需要使用 $uri):
if ($uri !~ \.css$) {
set $redi C;
}
if ($uri !~ \.js$) {
set $redi "($redi)J";
}
if ($uri !~ /catch-all/$) {
set $redi "($redi)P";
}
if ($redi = CJP) {
rewrite ^(.*)$ https://example.com/catch-all/ last;
return 302;
}
Run Code Online (Sandbox Code Playgroud)