Hadoop漏洞修復
CVE-2021-33036: Hadoop YARN REST API 未授權訪問導致遠端程式碼執行漏洞
Cluster Overview 未授權訪問漏洞
Hadoop 未授權訪問漏洞
修復方法1
修復方法1
1、進入hadoop配置檔案目錄,建立金鑰檔案 cd /home/flink/hadoop-3.3.2/etc/hadoop echo "hadoop" > hadoop-http-auth-signature-secret 2、備份core-site.xml檔案,在配置檔案configuration塊中新增如下配置項,hadoop.http.authentication.signature.secret.file配置對應金鑰檔案路徑是否完整可訪問到。 <configuration> <property> <name>hadoop.http.filter.initializers</name> <value>org.apache.hadoop.security.AuthenticationFilterInitializer</value> </property> <property> <name>hadoop.http.authentication.type</name> <value>simple</value> </property> <property> <name>hadoop.http.authentication.token.validity</name> <value>3600</value> </property> <property> <name>hadoop.http.authentication.signature.secret.file</name> <value>/home/flink/hadoop-3.3.2/etc/hadoop/hadoop-http-auth-signature-secret</value> </property> <property> <name>hadoop.http.authentication.cookie.domain</name> <value></value> </property> <property> <name>hadoop.http.authentication.simple.anonymous.allowed</name> <value>false</value> </property> </configuration>
修復方法2
下載jersey-server-1.19.jar
#公司內網下載 wget http://10.130.36.117/Deploymentpackage/jersey-server-1.19.jar CSDN地址下載:https://download.csdn.net/download/zhao138969/89487778
修改方法2
1、#備份原有jersey-server-1.19.jar檔案 cd /home/flink/hadoop-3.3.2/share/hadoop/common/lib/ mv jersey-server-1.19.jar jersey-server-1.19.jar_bak cd /home/flink/hadoop-3.3.2/share/hadoop/hdfs/lib/ mv jersey-server-1.19.jar jersey-server-1.19.jar_bak 2、上傳加固的jersey-server-1.19.jar到對應目錄下 cd /home/flink/hadoop-3.3.2/share/hadoop/common/lib/ rz -be jersey-server-1.19.jar cd /home/flink/hadoop-3.3.2/share/hadoop/hdfs/lib/ rz -be jersey-server-1.19.jar
重啟Hadoop叢集
stop-dfs.sh start-dfs.sh
驗證方法
#在瀏覽器中進行訪問 http://ip:50070 #出現錯誤 http://ip:50070?user.name=hadoop #訪問正確
Flink漏洞修復
Apache Flink任意 Jar 包上傳導致遠端程式碼執行漏洞
Apache Flink未授權訪問漏洞
修改方法
修改方法
1、建立cer目錄然後,生產證書。 cd /home/flink/flink-1.15.2/conf/cer #建立證書,密碼並設定為Ccod@2024 keytool -genkeypair -alias ca -keystore ca.keystore -dname "CN=Sample CA" -storepass ca_keystore_password -keypass ca_key_password -keyalg RSA -keysize 4096 -ext "bc=ca:true" keytool -exportcert -keystore ca.keystore -alias ca -storepass ca_keystore_password -file ca.cer keytool -importcert -keystore ca.truststore -alias ca -storepass Ccod@2024 -file ca.cer -noprompt keytool -genkeypair -alias flink.rest -keystore rest.signed.keystore -dname "CN=flink.company.org" -ext "SAN=dns:flink.company.org" -storepass Ccod@2024 -keypass Ccod@2024 -keyalg RSA -keysize 4096 keytool -certreq -alias flink.rest -keystore rest.signed.keystore -storepass Ccod@2024 -keypass Ccod@2024 -file rest.csr keytool -gencert -alias ca -keystore ca.keystore -storepass ca_keystore_password -keypass ca_key_password -ext "SAN=dns:flink.company.org,10.130.47.192" -infile rest.csr -outfile rest.cer keytool -importcert -keystore rest.signed.keystore -storepass Ccod@2024 -file ca.cer -alias ca -noprompt keytool -importcert -keystore rest.signed.keystore -storepass Ccod@2024 -keypass Ccod@2024 -file rest.cer -alias flink.rest -noprompt 2、 修改flink配置檔案 cp flink-conf.yaml flink-conf.yaml_bak vim flink-conf.yaml #以下配置項 security.ssl.rest.authentication-enabled: false security.ssl.internal.enabled: false security.ssl.verify-hostname: false security.ssl.rest.enabled: true security.ssl.rest.keystore: /home/flink/flink-1.15.2/conf/cer/rest.signed.keystore security.ssl.rest.truststore: /home/flink/flink-1.15.2/conf/cer/ca.truststore security.ssl.rest.key-password: Ccod@2024 security.ssl.rest.truststore-password: Ccod@2024 security.ssl.rest.keystore-password: Ccod@2024 web.submit.enabled: false web.cancel.enabled: false jobmanager.web.submit.enable: false #該配置項配置上後,則無法透過web頁面提交jar任務,只有透過命令來啟動job任務。 3、重啟flink start-cluster.sh stop-cluster.sh 4、命令列啟動flink job task flink run -d -c com.channelsoft.flinkstatics.job.ServiceDetailJob -p 3 ./flink-statics-1.1.1.3-SNAPSHOT-jar-with-dependencies.jar -zookeeper 10.130.47.192:2181 5、登入flink https:ip/8180埠