如何抑制/控制 Wagon-FTP Maven 扩展的日志记录?

发布于 2024-10-09 21:56:01 字数 1187 浏览 3 评论 0原文

我正在通过 FTP 部署 Maven 站点,使用 Wagon-FTP。工作正常,但输出充满了 FTP 连接/身份验证详细信息,这有效地向每个人公开了登录名和密码(特别是如果该项目是开源的并且其 CI 协议可公开访问):

[...]
[INFO] 
[INFO] --- maven-site-plugin:3.0-beta-3:deploy (default-deploy) @ rempl ---
Reply received: 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 09:08. Server port: 21.
220 You will be disconnected after 15 minutes of inactivity.

Command sent: USER ****

Reply received: 331 User **** OK. Password required

Command sent: PASS ********

Reply received: 230-User **** has group access to: ***
230 OK. Current restricted directory is /
[...]

是否可以抑制此日志记录?或者配置它...这是我的 pom.xml 的一部分,其中使用了 Wagon-FTP:

[...]
<build>
    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ftp</artifactId>
            <version>1.0-beta-7</version>
        </extension>
    </extensions>
    [...]
</build>
[...]

I'm deploying Maven site by FTP, using Wagon-FTP. Works fine, but output is full of FTP connection/authentication details, which effectively expose logins and passwords to everybody (especially if the project is open source and its CI protocols are publicly accessible):

[...]
[INFO] 
[INFO] --- maven-site-plugin:3.0-beta-3:deploy (default-deploy) @ rempl ---
Reply received: 220---------- Welcome to Pure-FTPd [privsep] [TLS] ----------
220-You are user number 1 of 50 allowed.
220-Local time is now 09:08. Server port: 21.
220 You will be disconnected after 15 minutes of inactivity.

Command sent: USER ****

Reply received: 331 User **** OK. Password required

Command sent: PASS ********

Reply received: 230-User **** has group access to: ***
230 OK. Current restricted directory is /
[...]

Is it possible to suppress this logging? Or configure it... This is a section of my pom.xml, where Wagon-FTP is used:

[...]
<build>
    <extensions>
        <extension>
            <groupId>org.apache.maven.wagon</groupId>
            <artifactId>wagon-ftp</artifactId>
            <version>1.0-beta-7</version>
        </extension>
    </extensions>
    [...]
</build>
[...]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

绮筵 2024-10-16 21:56:01

不可能,基本上它与 maven 站点插件有关,而不是 wagon ftp (这只是 apache-commons-net ftp 客户端的一个简单适配器)。请参阅 AbstractDeployPlugin 的来源 来自第 310 行。

   Debug debug = new Debug();

   wagon.addSessionListener( debug );

   wagon.addTransferListener( debug ); 

其中 Debug 正在使用标准输出。

恕我直言,如果 Wagon 源代码中不需要,最好的解决方案是使用更复杂的 SessionListener 或标志来避免 addSessionListener(debug) 。

Not possible, and basically it is related to maven site plugin and not the wagon ftp (which is only a simple adapter for the apache-commons-net ftp client). See the source of AbstractDeployPlugin from line 310.

   Debug debug = new Debug();

   wagon.addSessionListener( debug );

   wagon.addTransferListener( debug ); 

Where Debug is using the standard output.

IMHO the nice solution would be to use a more sophisticated SessionListener or a flag to avoid addSessionListener(debug) if not needed in the Wagon source.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文