不關閉 SELinux 解決 Linux 無法啟動網路服務的問題
不關閉 SELinux 解決 Linux 無法啟動網路服務的問題

自從Linux進入某版本後,多了SELinux的設定,也就是安全增強式Linux,坦白說是個麻煩的東西,若習慣SELinux加入之前的使用,就會覺得SELinux很麻煩,最簡單...

semanage - Unix, Linux Command

semanageisusedtoconfigurecertainelementsofSELinuxpolicywithoutrequiringmodificationtoorrecompilationfrompolicysources.ThisincludesthemappingfromLinuxusernamestoSELinuxuseridentities(whichcontrolstheinitialsecuritycontext

** 本站引用參考文章部分資訊,基於少量部分引用原則,為了避免造成過多外部連結,保留參考來源資訊而不直接連結,也請見諒 **

RHEL 6: semanage SELinux 命令找不到 - 枯木的Linux专栏

2012年5月31日 - RHEL 6: semanage SELinux Command Not Found. You need to use the yum command to find out which package provides file called ...

RHEL 6: semanage SELinux Command Not Found

2011年5月13日 - Explains how to install semanage command - SELinux Policy Management tool under CentOS / RHEL / Fedora / Scientific Linux.

HowTos/SELinux

A full list of ports that services are permitted access by SELinux can be obtained with: # semanage port -l 5.6. Gathering Audit Logs In Permissive Mode When a program is being denied an operation repeatedly by SELinux, it is sometimes easier to continue

5.6.2. Persistent Changes

Two utilities read these files. The setfiles utility is used when a file system is relabeled and the restorecon utility restores the default SELinux contexts.

5.7.2. Persistent Changes: semanage fcontext

The /usr/sbin/semanage fcontext command changes the SELinux context for files. When using targeted policy, changes made with this command are added to ...

semanage(8): SELinux Policy Management tool

semanage is used to configure certain elements of SELinux policy without requiring modification to or recompilation from policy sources. ... Name semanage - SELinux Policy Management tool Synopsis

zh-tw/HowTos/SELinux

3. SELinux 政策 正如我們所說,SELinux 遵從最小權限這個理念;在預設情況下一切均被拒絕,而系統的每部份有一個政策來允許它存取所需的功能。這個描述用來形容 strict(嚴格型) 政策最為貼切。不過要令這類政策適用於企業級 Linux 可能會應用到的各個 ...

GlobalConfigurationFiles

/etc/selinux/semanage.conf File The semanage.config(5) file controls the configuration and actions of the semanage(8) and semodule(8) set of commands using the following parameters ...

[Centos7] 安裝semanage (selinux工具程式) @新精讚

2017年5月7日 - 安裝selinux的工具程式semanage. ... policycoreutils-python-2.5-8.el7.x86_64 : SELinux policy core python utilities. Repo : base. Matched from:

SELinux/semanage

SELinux/semanage From FedoraProject &lt; SELinux Jump to: navigation, search semanage(8) semanage(8) NAME semanage - SELinux Policy Management tool SYNOPSIS semanage {login|user|port|interface|fcontext ... </p></div><div class=compText aUrl lh-l ><p class


不關閉 SELinux 解決 Linux 無法啟動網路服務的問題

不關閉 SELinux 解決 Linux 無法啟動網路服務的問題

自從 Linux 進入某版本後,多了 SELinux 的設定,也就是安全增強式 Linux,坦白說是個麻煩的東西,若習慣 SELinux 加入之前的使用,就會覺得 SELinux 很麻煩,最簡單的方式就是修改 /etc/sysconfig/selinux 的檔案,將 SELINUX 的設定改成 SELINUX=disabled,不過這樣做安全上比較有疑慮,建議的做法就是使用 semanage 的指令來增加網路服務需要監聽的 Port。

舉例來說 SSH 預設監聽 22 Port 的風險高,因為網路上太多 Try 密碼的工具會不斷嘗試登入,萬一你用的密碼太過簡單,就有可能整台主機被入侵後淪陷,所以架好一台 Linux 主機之後,SSH 當然需要馬上改 Port,對我來說這是安全的第一陣線。相對的很多網路服務都有被攻擊的風險,也可以透過改監聽 Port 的方式來避免不必要的攻擊,反正私有服務自己知道怎麼連線就好。

在 SELinux 的架構之下很多 Port 是不給 Listen 的,譬如說你改 SSH 為 6000 Port 可能就無法順利啟動,而 Linux 連線管理最重要的就是 SSH 管理 Port,不通怎麼怎麼可以呢?尤其像是 Google Cloud Platform 的管理都是以 SSH 為主,網路一定得通啊!!!以我自己的示範為例,當 SSH 受限制無法啟動的時候,會出現「Job for sshd.service failed because a configured resource limit was exceeded」的訊息,可能就是你 SSH 設定檔中的 Listen Port 被限制了!!!

解決方法也非簡單,首先安裝 semanage 可以透過「yum install policycoreutils-python」來安裝,之後透過指令「semanage port -a -t ssh_port_t -p tcp 6000」來允許 SSH 服務監聽 6000 Port。而每個服務 type 也會有所不同,以 http 為例可以透過「semanage port -l

grep http」來查看 type 的種類,之後就能依照不同的 type 來下指令囉!!!

什麼是 SELinux?安全增強式Linux(SELinux, Security-Enhanced Linux)是一種強制存取控制(mandatory access control)的實現。它的作法是以最小權限原則(principle of least privilege)為基礎,在Linux核心中使用Linux安全模組(Linux Security Modules)。它並非一個Linux發行版,而是一組可以套用在類Unix作業系統(如Linux、BSD等)的修改。

SELinux semanage
哇哇
哇哇

SELinux semanage 相關文章

糟糕!怎麼會沒有~會努力加油的!