Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Health check endpoint without authorization #61

Open
8666 opened this issue Apr 23, 2024 · 7 comments · May be fixed by #70
Open

Health check endpoint without authorization #61

8666 opened this issue Apr 23, 2024 · 7 comments · May be fixed by #70
Labels
enhancement New feature or request

Comments

@8666
Copy link

8666 commented Apr 23, 2024

I want to use this gateway for sending messages when the internet is down so it is critical for me to monitor that it is up in meantime. As there is no SSL implementation, I do not use to send the authorization every few minutes just for this kind of checks.

Can you add a simple endpoint that will return 200 if the application is up and SIM is available? Thanks

@capcom6
Copy link
Owner

capcom6 commented Apr 24, 2024

Hello,

Thank you for reaching out and for the suggestion regarding the health check endpoint.

To better address your request, could you please provide a bit more detail about your specific use case?

From your description, I understand that you are utilizing the Local Server mode and have a monitoring system in place to check the Internet connection. This system is set up to send SMS messages through the SMS gateway when the connection fails, and both are on the same local network. If my understanding is not accurate, kindly correct me.

I am also interested in knowing more about how you plan to use the health check endpoint. Would you be accessing it from within the same local network? Moreover, what measures are you prepared to take if you determine that the SMS gateway is not operational? Do you have the means to programmatically restart the device, or would you simply issue an alternative notification?

Regarding the implementation of a health check endpoint, there are some considerations to keep in mind. It's important to note that not all issues can be detected without actually attempting to send an SMS. A 200 status code could indicate that the app is running and the SIM card is recognized, and perhaps even that the mobile network signal is present, but it may not guarantee that SMS messages can be sent successfully due to potential issues on the mobile operator's end.

Your detailed input on the above points will help in assessing the practicality and design of this feature.

@capcom6 capcom6 added the enhancement New feature or request label Apr 24, 2024
@8666
Copy link
Author

8666 commented Apr 24, 2024

I am sending notifications to myself over other chat platforms from my home automation when the Internet is OK. However if internet is down and I am not home I have no idea what is happening and would try to relay the messages over SMS (SIM in local network).

Locally I also have monitoring server that checks many things and I can also test if the app is running. If the Android device is down or app is not running I would be able to fix it while at home. I understand that the check will not guarantee SMS delivery but I want to prevent issues that are dependent/resolvable by me.

@capcom6
Copy link
Owner

capcom6 commented Apr 25, 2024

Since all of your devices are located within a local network, the absence of SSL/TLS support and the use of clear text communication should not pose a significant security issue. To simply check if the app is running, you can make a request without credentials; receiving any response, even with a 401 code, will indicate that the app is active. Often, verifying that the app is running is sufficient, as other checks may not provide a definitive capability to send messages.

You might also want to look at #52, which describes the successful use of the same phone as both an SMS and Internet gateway. This setup allows you to configure a backup Internet connection through the same phone and use the app in Cloud Mode. Cloud Mode offers several advantages, such as eliminating the need to keep the SMS gateway app running in the foreground on your device, unlike in Local Mode. The app will start automatically when a push notification is received.

I understand the value of your feature request and I will add it to my backlog. The ideas mentioned above can serve as a temporary workaround in the meantime.

@8666
Copy link
Author

8666 commented Apr 25, 2024

I was not aware that the app is not working if it is not in foreground mode. In my case it works fine, just there is another kiosk web app that stays on the top so I do not see the SMS gateway interface.

It is a workaround to use the unauthorized mode as OK state.

I was also looking into the idea of getting 4g usb stick and use the sim as internet backup (openwrt and others support that + sms sending with some commands), but this was more convenient for now

@capcom6
Copy link
Owner

capcom6 commented Apr 25, 2024

I apologize for any confusion. The term "foreground" in the context of Android also means that the app shows a persistent notification icon in the status bar, which indicates that the app is active. This prevents the operating system from shutting down the app when it's running in the background.

Therefore, in Local Mode the app should continue to work properly even if its user interface is not currently visible on the screen.

@8666
Copy link
Author

8666 commented Apr 25, 2024

I changed my monitoring system to look for Unauthorized and Access to SMS Gateway in the response. Suppose this is good enough

./check_http -H IP -p 8080 -d "Access to SMS Gateway" -e "Unauthorized"

@capcom6
Copy link
Owner

capcom6 commented Apr 25, 2024

Thank you for your feedback! I will keep the issue open as a reminder to implement the health check endpoint feature.

If you have any further questions, please feel free to ask.

@capcom6 capcom6 linked a pull request May 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants