diff --git a/osect_sensor/Application/edge_cron/common/common_config.py b/osect_sensor/Application/edge_cron/common/common_config.py old mode 100644 new mode 100755 index 8c2e034..a44c132 --- a/osect_sensor/Application/edge_cron/common/common_config.py +++ b/osect_sensor/Application/edge_cron/common/common_config.py @@ -86,3 +86,6 @@ SEND_REQUST_TIMEOUT = 180 """ ログ送信時のタイムアウト値 """ + +IS_CLOSED_NETWORK = True +""" ログ送信時のタイムアウト値 """ diff --git a/osect_sensor/Application/edge_cron/cron/management/commands/pcap_to_log_to_server.py b/osect_sensor/Application/edge_cron/cron/management/commands/pcap_to_log_to_server.py index 2e1c933..9f806fb 100755 --- a/osect_sensor/Application/edge_cron/cron/management/commands/pcap_to_log_to_server.py +++ b/osect_sensor/Application/edge_cron/cron/management/commands/pcap_to_log_to_server.py @@ -47,6 +47,7 @@ API_URL, LABEL_ID, CLIENT_CERTIFICATE_PATH, + IS_CLOSED_NETWORK, ) # from common.common_function import pcap2log @@ -147,17 +148,21 @@ def handle(self, *args, **options): # logger.info("sleep " + str(sleep_time) + "s") try: - # コア網チェック - with serial.Serial('/dev/ttyUSB1', baudrate=115200, timeout=1) as sara: - sara.write(b'at\r\n') - b=sara.read(16) - cnum=b.decode().split("\n") - - if "OK\r" in cnum: + if IS_CLOSED_NETWORK: + # コア網チェック + with serial.Serial('/dev/ttyUSB1', baudrate=115200, timeout=1) as sara: + sara.write(b'at\r\n') + b=sara.read(16) + cnum=b.decode().split("\n") + + if "OK\r" in cnum: + # ログ送信 + send_server(tar_list) + else: + logger.error("can not send compressed file. Unable to connect to closed network. ") + else: # ログ送信 send_server(tar_list) - else: - logger.error("can not send compressed file. Unable to connect to closed network. ") except Exception as e: logger.error("can not send compressed file. " + str(e)) diff --git a/osect_sensor/README.md b/osect_sensor/README.md old mode 100644 new mode 100755 index fcc0cb4..1416c3d --- a/osect_sensor/README.md +++ b/osect_sensor/README.md @@ -201,6 +201,39 @@ NTT Comから提供されたクライアント証明書を以下に格納しま $ ~/osect_sensor/keys/client.pem ``` +### 3.5. ログ送信方式の設定 + +有線経由でログを送信する場合は以下の設定をします。 + +設定ファイル: + +```bash +$ vi Application/edge_cron/common/common_config.py +``` + +変更箇所: + +```python +IS_CLOSED_NETWORK = True +↓ +IS_CLOSED_NETWORK = False +``` + +設定ファイル: + +```bash +$ vi docker-compose.yml +``` + +変更箇所: + +```yml + devices: + - "/dev/ttyUSB1:/dev/ttyUSB1" +↓ +(削除) +``` + ## 4. コンテナの構築・起動 コンテナを構築、起動します。