DSO Alt/Az Calculator 만들기 (진행중)

매번 대상의 시간대별 고도를 수동으로 적기가 귀찮아서
날짜와 대상을 입력하면 자동으로 시간대별 고도와 일몰, 일출 시각, 천문박명을 계산해주는 계산기를 만들었다.

 

Flask로 간단한 웹서버를 만들고 외부접속이 가능하게 포트포워딩까지 해뒀는데
어느순간부터 아무 작업도 하지 않는데도 이상하게 CPU 점유율이 100%을 찍고 있길래 로그를 살펴봤더니

이런 정체불명의 IP로부터 희한한 데이터값을 입력으로 받고 있었다.

챗지피티한테 어떻게 해야할지 물어봤다.

That’s a very valid concern — even small Flask apps running on a Raspberry Pi can attract unwanted traffic if they’re exposed to the internet. Here’s what likely happened and what you should do next.

🔍 Why Suspicious Access Happened

Even if you change the port (like to 8080), port scanners constantly sweep the internet looking for open services. Once they find something responding (especially on 0.0.0.0:8080), they may:

  • Probe your app with malformed or automated requests

  • Try to exploit known vulnerabilities (e.g., in Flask debug mode)

  • Look for login forms, file uploads, etc.

Changing the port does not secure your app.

1. NEVER expose Flask’s dev server directly

You’re running this:

python3 app.py

Which runs Flask’s internal development server. It’s not safe for public use.

Use a reverse proxy like Nginx + Gunicorn, or at minimum, restrict access.

챗지피티가 시키는대로 하기에는 생각보다 일이 좀 복잡해지는 것 같아서 우선은 URL에 query string 조건을 추가해뒀다. Query string 없이 접근하면 아래와 같이 접근이 차단된다.

Forbidden

You don’t have the permission to access the requested resource. It is either read-protected or not readable by the server.

 

고작 이거 하나 돌리자고 로그인 시스템을 만들긴 너무 귀찮으니 당분간 이렇게 운영해보고 문제가 생기면 다른 방법을 찾아봐야겠다.

This entry was posted in Raspberry Pi. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *