[精讚] [會員登入]
2329

[Centos7] selinux 修改網頁連線的埠號

想把網頁改到非標準的80埠,在selinux上要如何修改?

分享此文連結 //n.sfs.tw/12931

分享連結 [Centos7] selinux 修改網頁連線的埠號@新精讚
(文章歡迎轉載,務必尊重版權註明連結來源)
2019-10-24 20:08:36 最後編修
2018-11-29 15:06:36 By 張○○
 

自動目錄

 

想把網頁改到非標準的80埠,例如5353埠,在selinux上要如何修改?

一、前置作業

  首先在網頁的設定上監聽要改為監聽5353埠 --略。

  防火牆5353埠打開

# firewall-cmd --zone=public --add-port=5353/tcp --permanent

 

二、安裝semanage

  請參考 [Centos7] 安裝 semanage (selinux工具程式)

三、檢查目前網頁的

查看模組(例如apache)
# semanage module -l

Module Name               Priority  Language

abrt                      100       pp    
accountsd                 100       pp    
acct                      100       pp    
afs                       100       pp    
...

該模組的設定會放在 /etc/selinux/targeted/active/modules

但這是編過的檔案

查看埠號類型
# semanage port -l
SELinux Port Type              Proto    Port Number

afs3_callback_port_t           tcp      7001
afs3_callback_port_t           udp      7001
afs_bos_port_t                 udp      7007
afs_fs_port_t                  tcp      2040
afs_fs_port_t                  udp      7000, 7005
afs_ka_port_t                  udp      7004
afs_pt_port_t                  tcp      7002

...

和http有關的埠號
# semanage port -l | grep 'http'
http_cache_port_t              tcp      8080, 8118, 8123, 10001-10010
http_cache_port_t              udp      3130
http_port_t                    tcp      80, 81, 443, 488, 8008, 8009, 8443, 9000
pegasus_http_port_t            tcp      5988
pegasus_https_port_t           tcp      5989

把5353埠加入http_port_t的type中

# semanage port -a -t http_port_t -p tcp 5353

這樣子就可以了

 

延伸閱讀

[MySQL/Mariadb] 修改預設的連線埠號3306

 

END

你可能感興趣的文章

[Rocky Linux9] 安裝docker+ docker compose+ apache+ maraidb+ php7 Rocky Linux(Centos9) 下安裝docker及docker compose

[Centos7] 安裝sphinx+php7 在centos7上安裝sphinx,在PHP7上運作正確

[bc] linux 的計算機 bc 設定小數位數、計算π、次方根 linux 的計算機 bc 設定小數位數、計算π、次方根

[BASH] 自建檔案拷背程式--把指定的檔案拷背到指定的位置。 Git 是很好用的版本控制程式,但我沒辦法使用。 原因就是資安。用SHELL自建簡易的GIT

安裝SPHINX支援中文 新版本的 sphinx 和舊版不同,網路上很多範例和教學是不能用的。此文是安裝和設定方法分享

[Centos7] audit 服務 在紅帽和suse的linux中有一個audit這樣的daemon,寫入的是核心層的記錄。

隨機好文

使用Google尋找你的手機 這近發現google竟然可以用來找android的手機,而且不需要經過什麼設定或安裝軟體。

HP SAS硬碟leds燈號說明 HP SAS硬碟leds燈號(hp g7/g6系統適用)說明

[jQuery] select 元件的取值及給值 html中的元件select,在jquery中要如何使用?

SELinux 常用指令和檔案 在Redhat系列中,Centos5以後加入了selinux,他並沒有這麼可怕,不必每次看到Selinux ,就想把他

[Freebsd] 使用 ADSL 撥接上網 Freebsd上要使用 ADSL 撥接上網,該如何設定?