summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzhaokun <[email protected]>2024-06-06 11:58:58 +0800
committerzhaokun <[email protected]>2024-06-06 11:58:58 +0800
commitf2c24fac6726a8f509f42c5d210b3a35c481d290 (patch)
treec7e12354731c12755edbaa23a4241a7195c633cd
parentcbd28566c5ad7c34846e372146be706adb2d0e7a (diff)
add update ca and curl py file
-rw-r--r--install_curl.py20
-rw-r--r--mail_file/mail_test_english.txt1
-rw-r--r--mail_file/subjectEnglish.txt5
-rw-r--r--start.sh4
-rw-r--r--start_gunicorn.sh3
-rw-r--r--tsg_ca.txt22
-rw-r--r--update_tsg_ca.py22
7 files changed, 74 insertions, 3 deletions
diff --git a/install_curl.py b/install_curl.py
new file mode 100644
index 0000000..b49558f
--- /dev/null
+++ b/install_curl.py
@@ -0,0 +1,20 @@
+# -*- coding: UTF-8 -*-
+import os
+import subprocess
+
+def install_curl():
+ try:
+ subprocess.check_call(["wget", "https://curl.se/download/curl-7.68.0.tar.gz"])
+ subprocess.check_call(["tar", "-xzvf", "curl-7.68.0.tar.gz"])
+ os.chdir("/opt/curl-7.68.0")
+ subprocess.check_call(["export", "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/ssl/lib"])
+ subprocess.check_call(["./configure", "--prefix=/usr/local/curl/", "--without-nss", "--with-ssl=/usr/local/ssl/"])
+ subprocess.check_call(["make && make install"])
+ subprocess.check_call(["mv", "/usr/bin/curl", "/usr/bin/curl.bak"])
+ subprocess.check_call(["ln", "-s", "/usr/local/curl/bin/curl", "/usr/bin/curl"])
+ print("Install curl successfully.")
+ except:
+ print("Fail to install curl.")
+
+if __name__ == '__main__':
+ install_curl() \ No newline at end of file
diff --git a/mail_file/mail_test_english.txt b/mail_file/mail_test_english.txt
new file mode 100644
index 0000000..707d5e1
--- /dev/null
+++ b/mail_file/mail_test_english.txt
@@ -0,0 +1 @@
+halashaogusina
diff --git a/mail_file/subjectEnglish.txt b/mail_file/subjectEnglish.txt
new file mode 100644
index 0000000..850d049
--- /dev/null
+++ b/mail_file/subjectEnglish.txt
@@ -0,0 +1,5 @@
+Subject: Bestman
diff --git a/start.sh b/start.sh
index a55d221..1c9625f 100644
--- a/start.sh
+++ b/start.sh
@@ -5,7 +5,7 @@
if [[ "$(command -v python3)" == "" ]]; then
echo "No python3, start to installing."
yum -y update
- yum install -y net-tools wget python3-devel python3 python3-pip pciutils bind-utils
+ yum install -y net-tools wget python3-devel python3 python3-pip pciutils bind-utils curl
pip3 install --no-cache-dir scapy
pip3 install --no-cache-dir PyYAML
pip3 install --no-cache-dir requests
@@ -27,6 +27,8 @@ git checkout develop
find . -type f -name "*.py" -exec chmod 777 {} \;
python3 /opt/traffic_replay/install_trex.py
+python3 /opt/traffic_replay/install_curl.py
+python3 /opt/traffic_replay/update_tsg_ca.py
python3 /opt/traffic_replay/kill_gunicorn.py
# python3 /opt/traffic_replay/kill_start.py
# python3 /opt/traffic_replay/app.py
diff --git a/start_gunicorn.sh b/start_gunicorn.sh
index 2a71ee4..a62594f 100644
--- a/start_gunicorn.sh
+++ b/start_gunicorn.sh
@@ -1,6 +1,5 @@
#!/bin/sh
-python3 /opt/traffic_replay/install_trex.py
-# python3 /opt/traffic_replay/app.py
+python3 /opt/traffic_replay/kill_gunicorn.py
gunicorn -c gunicorn.conf.py app:app &
# /usr/local/bin/supervisord -c /opt/traffic_replay/supervisor.conf \ No newline at end of file
diff --git a/tsg_ca.txt b/tsg_ca.txt
new file mode 100644
index 0000000..0615ea1
--- /dev/null
+++ b/tsg_ca.txt
@@ -0,0 +1,22 @@
+#TSG CA
+-----BEGIN CERTIFICATE-----
+MIIDeTCCAmGgAwIBAgIJAKkZA2wHOYFDMA0GCSqGSIb3DQEBCwUAMC0xDzANBgNV
+BAMMBlRTRyBDQTEaMBgGA1UECgwRTWFzZXJhdGkgU29sdXRpb24wHhcNMjIwMjE2
+MDg0OTMyWhcNNDIwMjExMDg0OTMyWjAtMQ8wDQYDVQQDDAZUU0cgQ0ExGjAYBg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_ca.py b/update_tsg_ca.py
new file mode 100644
index 0000000..ec2523a
--- /dev/null
+++ b/update_tsg_ca.py
@@ -0,0 +1,22 @@
+# -*- coding: UTF-8 -*-
+import os
+import subprocess
+
+def update_tsg_ca():
+ try:
+ tsg_ca_file = 'tsg_ca.txt'
+ # 读取证书文件内容
+ with open(tsg_ca_file, 'r') as cert_file:
+ cert_content = cert_file.read()
+ # 将证书内容追加到ca-bundle.crt文件中
+ with open('/etc/pki/tls/certs/ca-bundle.crt', 'a') as ca_bundle:
+ ca_bundle.write(cert_content)
+ ca_bundle.write('\n')
+ # 更新证书信任库
+ # subprocess.run(['sudo', 'update-ca-trust', 'extract'])
+ print("Update TSG CA successfully.")
+ except:
+ print("Fail to update TSG CA.")
+
+if __name__ == '__main__':
+ update_tsg_ca() \ No newline at end of file