IPFire远程SSL访问设置教程

本教程以设置xxx.pfchina.org域名访问为例,介绍在IPFire防火墙安装ssl证书,通过外网远程访问IPFire防火墙的方法。

前提条件:WAN接口必须是公网IP。

修改默认端口

博主所在的区域,IPFire默认444访问端口被运营商关闭了,需要修改为其他可用端口,本文使用8443端口。在IPFire的Web配置界面,没有修改访问端口的选项,需要手动修改以下文件:

/etc/httpd/conf/vhosts.d/ipfire-interface.conf
/etc/httpd/conf/vhosts.d/ipfire-interface-ssl.conf
/etc/httpd/conf/listen.conf

将以上文件里的444端口修改为8443,修改完成以后,重启apache:

/etc/init.d/apache restart

添加防火墙规则

在防火墙上,添加一条规则,放开WAN接口8443端口的访问。

  • 源:标准网络(红色)
  • 目标:firewall RED
  • 协议:tcp,
  • 目标端口:8443
    保存并应用更改。

添加完成后下图所示:


使用https://wan ip:8443测试,检查是否能正常远程访问IPFire防火墙。

添加域名解析

登录CloudFlare,添加一条DNS解析记录。将xxx.pfchina.org指向IPFire的WAN接口IP。

修改主机名、域名

进入IPFire的shell环境下,运行setup命令修改防火墙的主机名和域名,主机名修改为xxx,域名修改为pfchina.org。


安装ACEM

运行以下命令,安装acme.sh。

curl https://get.acme.sh | sh -s [email protected]

导入CF帐号和KEY

运营商封掉了443和80端口,ACME挑战类型可以使用DNS-01方式,申请证书需要导入CloudFlare的帐号和KEY。

export CF_Email="[email protected]"
export CF_Key="f586ab52047a8d9594ffb23a3ac642c84af51"

申请证书

运行以下命令,申请证书:

/root/.acme.sh/acme.sh --issue --dns dns_cf -d xxx.pfchina.org -d www.xxx.pfchina.org

申请成功会显示以下内容:

[Sat Jun 29 03:42:22 PM CST 2024] Your cert is in: /root/.acme.sh/xxx.pfchina.org_ecc/xxx.pfchina.org.cer
[Sat Jun 29 03:42:22 PM CST 2024] Your cert key is in: /root/.acme.sh/xxx.pfchina.org_ecc/xxx.pfchina.org.key
[Sat Jun 29 03:42:22 PM CST 2024] The intermediate CA cert is in: /root/.acme.sh/xxx.pfchina.org_ecc/ca.cer
[Sat Jun 29 03:42:22 PM CST 2024] And the full chain certs is there: /root/.acme.sh/xxx.pfchina.org_ecc/fullchain.cer

修改IPFire默认证书

为保障挂锁成功,需要将防火墙的默认自签名证书更改为我们申请的证书。

打开/etc/httpd/conf/vhosts.d/ipfire-interface-ssl.conf文件,找到SSLEngine on行,将证书和密钥修改为申请的域名证书,并将server-ecdsa密钥和证书删除。如下所示:

SSLEngine on
SSLProtocol all -SSLv3 -TLSv1 -TLSv1.1
SSLCipherSuite AESGCM+EECDH:CHACHA20+EECDH:@STRENGTH:+aRSA
SSLHonorCipherOrder on
SSLCompression off
SSLSessionTickets off
SSLCertificateFile /root/.acme.sh/xxx.pfchina.org_ecc/xxx.pfchina.org.cer
SSLCertificateKeyFile /root/.acme.sh/xxx.pfchina.org_ecc/xxx.pfchina.org.key

修改完成以后,重启apache:

/etc/init.d/apache restart

浏览器输入https://xxx.pfchina.org:8443,访问防火墙检查是否挂锁成功。

注意事项

在升级核心后,需要重新设置默认端口和默认证书位置。

其他修改

1.修改IPFire徽标对应的链接
/srv/web/ipfire/html/themes/ipfire/include/functions.pl
搜索:https://www.ipfire.org 替换即可。

2.去除赞助提示
/srv/web/ipfire/html/themes/ipfire/include/functions.pl
在216、217行,删除有ipfire链接的两行即可。

3.修改菜单内容
/var/ipfire/menu.d目录对应了各级菜单的显示内容。

其他文章:

IPFire防火墙汉化包

暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇