2022年9月12日 星期一

【IT Notes】RHCSA考題:SELinux與防火牆修改

 這題算是簡單好解的題目,記錄的目的主要是怎麼安裝可是環境,讓要練習的時候可以直接開始,所以就紀錄一下,以便今後還有需要的時候省點力。

ㄧ.設定考題環境

[root@node1 ~]# getenforce

Enforcing

[root@node1 ~]# yum -y install httpd

[root@node1 ~]# vim /etc/httpd/conf/httpd.conf 

Listen 82

[root@node1 ~]# echo "test page" > /var/www/html/index.html

[root@node1 ~]# systemctl enable --now httpd   

[root@node1 ~]# systemctl status httpd       

   

二.解題方式

[root@node1 ~]# systemctl restart httpd  \\啟用網頁伺服器,發現出錯
Job for httpd.service failed because the control process exited with e
rror code.
See "systemctl status httpd.service" and "journalctl -xe" for details.
[root@node1 ~]# semanage port -a -t http_port_t -p tcp 82 \\添加selinux的82 port
[root@node1 ~]# semanage port -l | grep http
[root@node1 ~]# systemctl start httpd 
[root@node1 ~]# systemctl status httpd 
[root@node1 ~]# systemctl enable httpd --now  \\開機時啟動網頁伺服器
[root@node1 ~]# firewall-cmd --add-port=82/tcp --permanent \\防火牆添加 82 port
success
[root@node1 ~]# firewall-cmd --reload  
success
[root@node1 ~]# curl node1:82 \\驗證網頁
test page

或者是開firefox,輸入網址http:node1:82看看結果,有顯示出來的話就是成功了。

沒有留言:

張貼留言

【IT Notes】透過api移轉Gmail到Exchange

 在雲端裡面串接api不是一件很好學的技術,第一次有機會學習到將GWS的Gmail信件全部轉移到M365的Exchange,其實方法很多種,像以前用的pst檔匯出轉移的方式等,但透過api串接,可以批次和排程轉移,是非常方便且準確的作法。唯一讓人感到困難的是學習成本不小,通常需要...