旅游大巴车开上阳明公园
下午约四点钟,我沿着水泥阶梯上东山岭。看到梯顶站着一排人。有戴帽的、有背小包的,成群结队,似乎是外来和平旅游的人。果然,我走到阳明公园,大路豁口处停着一辆大巴车。车身印有“梁野旅游”的字样,是“闽F”打头的车牌号。我在公园转了一小圈,看到旅游人群中,中老人占多数,他们是直接坐车到公园,不是爬666级"天梯"上来的。
下午约四点钟,我沿着水泥阶梯上东山岭。看到梯顶站着一排人。有戴帽的、有背小包的,成群结队,似乎是外来和平旅游的人。果然,我走到阳明公园,大路豁口处停着一辆大巴车。车身印有“梁野旅游”的字样,是“闽F”打头的车牌号。我在公园转了一小圈,看到旅游人群中,中老人占多数,他们是直接坐车到公园,不是爬666级"天梯"上来的。
问题:在 debian 11 里安装 hestiacp 1.8.12 面板后,点击 文件管理器 图标,然后前端提示出错 Unknown Error ,无法显示文件列表
尝试:/var/log/hestia/nginx-error.log 的相应错误信息是:
[error] 608#0: *367 FastCGI sent in stderr: "PHP message: PHP Fatal error: Uncaught League\Flysystem\Sftp\Connectio nErrorException: Could not login with username: tester, host: 127.0.0.1 in /usr/local/hestia/web/fm/vendor/league/flysystem-sftp/src/Sftp Adapter.php:244
Stack trace:
#0 /usr/local/hestia/web/fm/vendor/league/flysystem-sftp/src/SftpAdapter.php(207): League\Flysystem\Sftp\SftpAdapter->login()
#1 /usr/local/hestia/web/fm/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php(650): League\Flysystem\Sftp\SftpAdapter->connect( )
#2 /usr/local/hestia/web/fm/vendor/league/flysystem-sftp/src/SftpAdapter.php(360): League\Flysystem\Adapter\AbstractFtpAdapter->getConne ction()
#3 /usr/local/hestia/web/fm/vendor/league/flysystem/src/Adapter/AbstractFtpAdapter.php(338): League\Flysystem\Sftp\SftpAdapter->listDire ctoryContents()
#4 /usr/local/hestia/web/fm/vendor/league/flysystem/src/Filesystem.php(272): League\Flysystem\Adapter\AbstractFtpAdapter->listContents()
#5 /usr/local/hestia/web/fm/backend/Services/Storage/Filesystem.php(266): League\Flysys" while reading response header from upstream, cl ient: 113.75.31.223, server: _, request: "POST /fm/?r=/getdir HTTP/2.0", upstream: "fastcgi://unix:/run/hestia-php.sock:", host:
详细检查 /etc/ssh/sshd_config 的文件内容。其中,PubkeyAuthentication no 如果有这一行,需要注释或删除掉,因为 文件管理器 是需要使用 key 来验证登录的。
参考:https://hestiacp.com/docs/server-administration/file-manager.html
问题:setup.exe /Unattend:x:\temp\Unattend.xml 后,在约 60% 的进度条,弹框提示安装失败
过程:查看 Panther\setuperr.log 文件内容,有如:
2024-12-06 19:41:00, Error WpxXmlDocument::ReportError (onecore\base\ntsetup\wpx\core\xml.cpp:157) - 0xc00ce50d:
2024-12-06 19:41:00, Error Invalid XML (line 196, position 142): A semi colon character was expected.
2024-12-06 19:41:00, Error WpxXmlDocument::LoadXml (onecore\base\ntsetup\wpx\core\xml.cpp:266) - 0x8007000d:
2024-12-06 19:41:00, Error The given data cannot be parsed
2024-12-06 19:41:00, Error WpxGetAnswerFileType (onecore\base\ntsetup\wpx\file\getfiletype.cpp:54) - 0x8007000d:
2024-12-06 19:41:00, Error Couldn't parse answer file contents as XML
查看相应的 Unattend.xml 内容,是:
<RunSynchronousCommand wcm:action="add">
<Description>finish</Description>
<Order>9</Order>
<Path>cmd /c echo cmd /c %windir%\setup\scripts\wget.exe -O- "http://10.8.8.8/dcimgr?func=osinstall.finish&id=1wJj42
pYVdjzzB9" >> %windir%\setup\scripts\SetupComplete.cmd</Path>
<WillReboot>OnRequest</WillReboot>
</RunSynchronousCommand>
而 DCIM 的 UnattendEFI.xml 文件内容是:
<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserData>
<AcceptEula>true</AcceptEula>
</UserData>
<DiskConfiguration>
<WillShowUI>OnError</WillShowUI>
<Disk wcm:action="add">
<CreatePartitions>
<CreatePartition wcm:action="add">
<Order>1</Order>
<Size>400</Size>
<Type>EFI</Type>
</CreatePartition>
<CreatePartition wcm:action="add">
<Order>2</Order>
<Type>MSR</Type>
<Size>128</Size>
</CreatePartition>
<CreatePartition wcm:action="add">
<Order>3</Order>
<Extend>true</Extend>
<Type>Primary</Type>
</CreatePartition>
</CreatePartitions>
<ModifyPartitions>
<ModifyPartition wcm:action="add">
<Format>FAT32</Format>
<Label>System</Label>
<Order>1</Order>
<PartitionID>1</PartitionID>
</ModifyPartition>
<ModifyPartition wcm:action="add">
<Order>2</Order>
<PartitionID>3</PartitionID>
<Label>Windows</Label>
<Letter>C</Letter>
<Format>NTFS</Format>
</ModifyPartition>
</ModifyPartitions>
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
</Disk>
</DiskConfiguration>
<ImageInstall>
<OSImage>
<InstallTo>
<DiskID>0</DiskID>
<PartitionID>3</PartitionID>
</InstallTo>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/INDEX</Key>
<Value>2</Value>
</MetaData>
</InstallFrom>
<WillShowUI>OnError</WillShowUI>
<InstallToAvailablePartition>false</InstallToAvailablePartition>
</OSImage>
</ImageInstall>
</component>
<component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SetupUILanguage>
<UILanguage>en-US</UILanguage>
</SetupUILanguage>
<InputLocale>0409:00000409</InputLocale>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
<UILanguageFallback>en-US</UILanguageFallback>
<UserLocale>en-US</UserLocale>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<UserAccounts>
<AdministratorPassword>
<Value>($PASS)</Value>
</AdministratorPassword>
</UserAccounts>
<OOBE>
<HideEULAPage>true</HideEULAPage>
</OOBE>
</component>
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<InputLocale>en-US</InputLocale>
<SystemLocale>en-US</SystemLocale>
<UILanguage>en-US</UILanguage>
<UserLocale>en-US</UserLocale>
</component>
</settings>
<settings pass="offlineServicing">
</settings>
<settings pass="specialize">
<component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Interfaces>
<Interface wcm:action="add">
<Ipv4Settings>
<DhcpEnabled>false</DhcpEnabled>
<RouterDiscoveryEnabled>false</RouterDiscoveryEnabled>
</Ipv4Settings>
<Ipv6Settings>
<DhcpEnabled>false</DhcpEnabled>
<RouterDiscoveryEnabled>false</RouterDiscoveryEnabled>
</Ipv6Settings>
<Identifier>($WIN_MAC)</Identifier>
<UnicastIpAddresses>
<IpAddress wcm:action="add" wcm:keyValue="1">($IP)/($NETMASK_SHORT)</IpAddress>
<IpAddress wcm:action="add" wcm:keyValue="2">($IPv6)/($NETMASKv6)</IpAddress>
</UnicastIpAddresses>
<Routes>
<Route wcm:action="add">
<Identifier>1</Identifier>
<Metric>10</Metric>
<NextHopAddress>($GATEWAYv4)</NextHopAddress>
<Prefix>0.0.0.0/0</Prefix>
</Route>
<Route wcm:action="add">
<Identifier>2</Identifier>
<Metric>10</Metric>
<NextHopAddress>($GATEWAYv6)</NextHopAddress>
<Prefix>::/0</Prefix>
</Route>
</Routes>
</Interface>
<!--Interface wcm:action="add">
<Ipv4Settings>
<DhcpEnabled>false</DhcpEnabled>
<RouterDiscoveryEnabled>false</RouterDiscoveryEnabled>
</Ipv4Settings>
<Ipv6Settings>
<DhcpEnabled>false</DhcpEnabled>
<RouterDiscoveryEnabled>false</RouterDiscoveryEnabled>
</Ipv6Settings>
<Identifier>Ethernet 2</Identifier>
</Interface-->
</Interfaces>
</component>
<component name="Microsoft-Windows-DNS-Client" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Interfaces>
<Interface wcm:action="add">
<Identifier>($WIN_MAC)</Identifier>
<DNSDomain>($HOSTNAME)</DNSDomain>
<DNSServerSearchOrder>
<IpAddress wcm:action="add" wcm:keyValue="1">($NAMESERVER)</IpAddress>
</DNSServerSearchOrder>
<DisableDynamicUpdate>false</DisableDynamicUpdate>
<EnableAdapterDomainNameRegistration>false</EnableAdapterDomainNameRegistration>
</Interface>
</Interfaces>
</component>
<component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<fDenyTSConnections>false</fDenyTSConnections>
</component>
<component name="Microsoft-Windows-TerminalServices-RDP-WinStationExtensions" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<UserAuthentication>0</UserAuthentication>
</component>
<component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<FirewallGroups>
<FirewallGroup wcm:action="add" wcm:keyValue="RemoteDesktop">
<Active>true</Active>
<Group>@FirewallAPI.dll,-28752</Group>
<Profile>all</Profile>
</FirewallGroup>
</FirewallGroups>
</component>
<component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<RunSynchronous>
<RunSynchronousCommand wcm:action="add">
<Description>Delete route</Description>
<Order>1</Order>
<Path>cmd /c echo IF "($IPv4)"=="" (route delete 0.0.0.0/0) ELSE IF "($IPv6)"=="" (route delete ::/0) >> %windir%\setup\scripts\SetupComplete.cmd</Path>
<WillReboot>OnRequest</WillReboot>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Description>Change EFI boot order</Description>
<Order>2</Order>
<Path>cmd /c echo cmd /c %windir%\setup\scripts\boot_order_changer.exe setfirstid __EFIBOOT__ >> %windir%\setup\scripts\SetupComplete.cmd</Path>
<WillReboot>OnRequest</WillReboot>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Description>Disable Network Discovery</Description>
<Order>3</Order>
<Path>cmd /c echo cmd /c %windir%\System32\WindowsPowerShell\v1.0\powershell.exe -command "& {&'Disable-NetFirewallRule' –DisplayName '@FirewallAPI.dll,-32752'}" >> %windir%\setup\scripts\SetupComplete.cmd</Path>
<WillReboot>OnRequest</WillReboot>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Description>Setting multiple nameservers</Description>
<Order>4</Order>
<Path>cmd /c echo cmd /c %windir%\setup\scripts\nameservers.cmd ($NAMESERVERS) >> %windir%\setup\scripts\SetupComplete.cmd</Path>
<WillReboot>OnRequest</WillReboot>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Description>Enable language</Description>
<Order>5</Order>
<Path>cmd /c %windir%\System32\WindowsPowerShell\v1.0\powershell.exe %windir%\setup\scripts\lang.ps1 "($LANG)" >>%windir%\setup\scripts\lang.log 2>&1</Path>
<WillReboot>Never</WillReboot>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Description>finish</Description>
<Order>6</Order>
<Path>cmd /c echo cmd /c %windir%\setup\scripts\wget.exe -O- "($FINISH)" >> %windir%\setup\scripts\SetupComplete.cmd</Path>
<WillReboot>OnRequest</WillReboot>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Description>Postinstall script listener</Description>
<Order>7</Order>
<Path>cmd /c IF "($HAS_RECIPE)"=="1" (echo cmd /c %windir%\System32\WindowsPowerShell\v1.0\powershell.exe %windir%\setup\scripts\winrm_listener.ps1 "($HOSTNAME)" "($LOCATIONIP)") >> %windir%\setup\scripts\SetupComplete.cmd</Path>
<WillReboot>OnRequest</WillReboot>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Description>Change EFI boot order 2</Description>
<Order>8</Order>
<Path>cmd /c %windir%\setup\scripts\boot_order_changer.exe setfirstid __EFIBOOT__ >> %windir%\setup\scripts\efi.log</Path>
<WillReboot>OnRequest</WillReboot>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Description>Put key</Description>
<Order>9</Order>
<Path>cmd /c echo ($PRODUCTKEY) >> %windir%\setup\key</Path>
<WillReboot>OnRequest</WillReboot>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Description>Activating windows</Description>
<Order>10</Order>
<Path>cmd /c echo cmd /c %windir%\setup\scripts\activate.cmd >> %windir%\setup\scripts\SetupComplete.cmd</Path>
<WillReboot>OnRequest</WillReboot>
</RunSynchronousCommand>
<RunSynchronousCommand wcm:action="add">
<Description>TZ setup</Description>
<Order>11</Order>
<Path>cmd /c IF NOT "($TIMEZONE)" == "()" ( IF NOT "($TIMEZONE)" == "" (tzutil /s "($TIMEZONE)"))</Path>
<WillReboot>OnRequest</WillReboot>
</RunSynchronousCommand>
</RunSynchronous>
</component>
</settings>
<cpi:offlineImage cpi:source="catalog:c:/distr/7601.17514.101119-1850_x64fre_server_eval_en-us-grmsxeval_en_dvd/sources/install_windows server 2008 r2 serverstandard.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
</unattend>
网上查得,在 xml 文件中,& 的符号要转义。尝试使用 CData 来表达 URL 的变量 ($FINISH) 。但实践中,使用了 CData 后,网址末尾多出来了个分号 ; 符号。无奈,最后将 URL 的变量拆成两部分,前边一部分写固定,后边用变量 ($AUTH_ID) 的组合。
参考:
需求:有一个简单的 web 表单,让未登录的访客 注册 邮箱
思路:iredadmin 里,有 Create 的类,照它样子,复制出一个 Register 类来;同样,模仿着添加好 web 访问的路径 和 html 表单
环境:debian 12 里安装好的 iredmail - 1.7.1 SQL 版本
请注意,我不会 Python ,这是我在 Poe GPT 帮助下,简单制作的,仅用于测试。
步骤:
文件内容:iRedAdmin-2.6/controllers/sql/urls.py 中,添加 访问路径 :
'/register', 'controllers.sql.basic.Register',
文件内容:iRedAdmin-2.6/controllers/sql/basic.py 中,添加 Register 的类 :
from libs import iredpwd
from libs.sqllib import general as sql_lib_general
class Register:
def GET(self):
available_domains = ['iredmail.demo.anqun.org', 'imap.demo.2xinxian.top', 'example.net'] # 示例域名列表
form = web.input()
return web.render(
'register.html',
available_domains=available_domains,
msg=form.get('msg'),
)
def POST(self):
form = web.input()
domain = form.get('domainName', '').strip().lower()
username = form.get('username', '').strip().lower()
newpw = form.get('newpw', '').strip()
confirmpw = form.get('confirmpw', '').strip()
cn = form.get('cn', '').strip() # 获取可选的显示名称
if not username or not newpw or not confirmpw or not domain:
return web.seeother(f'/register?msg=INVALID_INPUT')
if newpw != confirmpw:
return web.seeother(f'/register?msg=PASSWORDS_DO_NOT_MATCH')
# 生成密码哈希
pwscheme = 'SSHA512'
passwd_hash = iredpwd.generate_password_hash(newpw, pwscheme=pwscheme)
result = self.add_user(domain, username, passwd_hash, cn) # 将 cn 传递给 add_user
if result[0]:
return web.seeother(f'/register?msg=CREATED')
else:
return web.seeother(f'/register?msg={web.urlquote(result[1])}')
def add_user(self, domain, username, password, cn):
mail = f"{username}@{domain}"
if sql_lib_general.is_email_exists(mail):
return (False, 'ALREADY_EXISTS')
record = {
'domain': domain,
'username': mail,
'password': password,
'active': 1,
'name': cn
}
try:
_wrap = SQLWrap()
conn = _wrap.conn
conn.insert('mailbox', **record)
return (True, )
except Exception as e:
return (False, repr(e))
创建模板文件 iRedAdmin-2.6/templates/default/register.html
{% extends "layout.html" %}
{% block title %}{{ _('Add mail user') }}{% endblock title %}
{% block navlinks_create %}class="active"{% endblock %}
{% block main %}
{# Show system message #}
{% if msg %}
{% if msg.startswith('PW_') %}
{% set _pw_errors = msg.split(',') %}
{% for _err in _pw_errors %}
{{ user_msg_handler(_err) }}
{% endfor %}
{% else %}
{# {{ user_msg_handler(msg) }} #}
<p>{{ msg }}</p>
{% endif %}
{% endif %}
<div class="content-box">
<div class="box-body">
<div class="box-header clear">
<ul class="tabs clear">
<li class="active"><a href="#user_add"><i class="fa fa-plus"></i> {{ _('User') }}</a>
</ul>
<h2>{{ _('Add mail user') }}</h2>
</div>
<div id="user_add" class="box-wrap clear">
<form name="form_add_user" method="post" action="{{ctx.homepath}}/register">
<div class="form-field clear">
<h4 class="size-250 fl-space">{{ _('Mail Domain') }} <span class="required">*</span></h4>
<span class="clean-padding">
<select name="domainName" id="domainSelect" required>
{% for domain in available_domains %}
<option value="{{ domain }}">{{ domain }}</option>
{% endfor %}
</select>
</span>
</div>
<div class="form-field clear">
<h4 class="size-250 fl-space">{{ _('Mail Address') }} <span class="required">*</span></h4>
<span class="clean-padding">
<input type="text" size="35" name="username" value="" autocomplete="off" class="text fl-space" required />@
</span>
</div>
<div class="form-field clear">
<h4 class="size-250 fl-space">{{ _('Password') }} <span class="required">*</span></h4>
<span class="clean-padding">
<input type="password" name="newpw" required class="text fl-space" />
</span>
</div>
<div class="form-field clear">
<h4 class="size-250 fl-space">{{ _('Confirm Password') }} <span class="required">*</span></h4>
<span class="clean-padding">
<input type="password" name="confirmpw" required class="text fl-space" />
</span>
</div>
<div class="form-field clear">
<h4 class="size-250 fl-space">{{ _('Display Name (Optional)') }}</h4>
<span class="clean-padding">
<input type="text" name="cn" value="" autocomplete="off" class="text fl-space" />
</span>
</div>
<div class="form-field clear">
<span>
<input type="submit" name="submit_add_user" value="{{ _('Add') }}" class="button green"/>
</span>
</div>
</form>
</div>{# -- End box-wrap -- #}
</div>{# -- End content-box -- #}
</div>{# -- End box-body -- #}
{% endblock main %}
参考:
问题:从 example@aliyun.com 发往 mailcow 邮局,被打回了。提示:554.5.7.1 this message does not meet our delivery requirements in replay to end of data command
步骤:登录到 mailcow 管理 web 界面,查看 rspamd 的 “日志” 。可以看到发自 example@aliyun.com 的邮件被邮局拒收(reject)了。点击查看详细,在各项扣分中,如 FREEMAIL_POLICY_FAILURE (16) 这一项就被扣了 16 分?相比较,从 example@qq.com 发过来的,没有这个扣分项。难道 aliyun.com 或由 阿里云 托管的邮局 不如 qq.com 的“知名”?
FREEMAIL_POLICY_FAILURE (16)
DMARC_POLICY_QUARANTINE (8) [aliyun.com : SPF not aligned (relaxed), No valid DKIM, quarantine]
FORGED_W_BAD_POLICY (3)
TO_EXCESS_BASE64 (1.5)
MV_CASE (0.5)
CTE_CASE (0.5)
ONCE_RECEIVED (0.2)
MIME_BASE64_TEXT (0.1)
RWL_MAILSPIKE_VERYGOOD (-0.2) [54.207.22.56:from]
R_SPF_ALLOW (-0.2) [+ip4:54.207.22.56]
MIME_GOOD (-0.1) [multipart/alternative, text/plain]
MX_GOOD (-0.01) []
尝试:将 aliyun.com 添加到全局的 header-from 白名单中。再次测试,能正常收到邮件了。