2023年11月15日 星期三

Linux ACL 目錄/檔案權限繼承

Reference:
Linux ACL 檔案權限設定 setfacl、getfacl 指令使用教學與範例
 
有一台 NAS 的 NFS share 預設值會啟用 ACL,但預設權限是 770 (rwxrwx---)。
通常預設權限是 755,這個預設權限造成同 group 的帳號可以修改!
 
把 NAS ACL 設定關閉後,新建的目錄/檔案會按照帳號的 umask 權限,但之前已經產生的檔案必須自己修改。
 
查詢 ACL 指令:
getfacl <filename> 

移除 ACL 指令(含子目錄):
setfacl -bR <filename>

移除 group 寫入檔案權限指令(含子目錄):
chmod -R g-w .

找出目錄下有 group 寫入權限的檔案指令(排除symbolic links):
find . -perm -g+w ! -type l

2023年11月14日 星期二

Hyper-V Replica

Reference:
 
設定 Hyper-V Replica 必須有 https 憑證。
自己產生憑證的指令(10年有效期):
New-SelfSignedCertificate -DnsName "hostname" -CertStoreLocation "cert:\LocalMachine\My" -TestRoot -NotAfter (Get-Date).AddMonths(120)

狀況:
來源主機 BLADE-33,目的主機 BLADE-38
(注意) 目的主機的Windows版本必須 大於/等於 來源主機

步驟:
  • 在 BLADE-33, BLADE-38 各自產生憑證。將中繼憑證 CertReq Test Root 複製到 受信任的根憑證。

2023年11月10日 星期五

網站資安風險 Cloud Metadata Potentially Exposed

Reference:

狀況:OWASP ZAP掃描出高風險
High Cloud Metadata Potentially Exposed
Description The Cloud Metadata Attack attempts to abuse a misconfigured NGINX server in order to access the instance metadata maintained by cloud service providers such as AWS, GCP and Azure.
 
All of these providers provide metadata via an internal unroutable IP address '169.254.169.254' - this can be exposed by incorrectly configured NGINX servers and accessed by using this IP address in the Host header field.
 
URL https://xxx.com.tw/latest/meta-data/
Method GET
Parameter  
Attack 169.254.169.254
Evidence  
Instances 1
Solution Do not trust any user data in NGINX configs. In this case it is probably the use of the $host variable which is set from the 'Host' header and can be controlled by an attacker.
Reference https://www.nginx.com/blog/trust-no-one-perils-of-trusting-user-input/
CWE Id  
WASC Id  
Plugin Id 90034

2023年8月30日 星期三

RockyLinux 9.2 sensmail allow relay

#安裝sendmail
yum install sendmail

#修改設定
cd /etc/mail
vi sendmail.cf
將這一行mark起來(allow remote connect)
#O DaemonPortOptions=Port=smtp,Addr=127.0.0.1, Name=MTA

vi relay-domains
新增要寄信的IP,Ex: 192.168.10.29

#啟動sendmail
systemctl start sendmail
systemctl enable sendmail

#開啟防火牆
firewall-cmd --permanent --add-port=25/tcp
firewall-cmd --reload