From 795c04e6dff5bdfbd75ea91586a619c7a587cca1 Mon Sep 17 00:00:00 2001 From: stefano Date: Thu, 9 May 2024 13:11:35 +0200 Subject: [PATCH] Updated README.md for BSD Cafe Fork Signed-off-by: stefano --- README.md | 117 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 67 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 47c4a08..4a131bc 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,29 @@ -# CheckMyIP (TelnetMyIP.com) ![CheckMyIP][logo] +# CheckMyIP - [myip.bsd.cafe](https://myip.bsd.cafe) + A Telnet, SSH and Simple HTTP Based Public IP Address Lookup Service ----------------------------------------- + ### USAGE -- TELNET: `telnet telnetmyip.com` -- SSH: `ssh sshmyip.com` - - Your SSH client may require you to enter a username. You can use anything you want (`ssh -limrootbitch telnetmyip.com`) -- CURL: `curl telnetmyip.com` -- WGET: `wget -qO- telnetmyip.com` + +- **TELNET**: + - Default: `telnet myip.bsd.cafe` + - IPv4: `telnet myip4.bsd.cafe` + - IPv6: `telnet myip6.bsd.cafe` +- **SSH**: + - Default: `ssh myip.bsd.cafe` + - IPv4: `ssh myip4.bsd.cafe` + - IPv6: `ssh myip6.bsd.cafe` + - Your SSH client may require you to enter a username. You can use anything you want (`ssh -l imrootbitch myip.bsd.cafe`) +- **CURL**: + - Default: `curl -L myip.bsd.cafe` + - IPv4: `curl -L myip4.bsd.cafe` + - IPv6: `curl -L myip6.bsd.cafe` +- **WGET**: + - Default: `wget -qO- myip.bsd.cafe` + - IPv4: `wget -qO- myip4.bsd.cafe` + - IPv6: `wget -qO- myip6.bsd.cafe` ----------------------------------------- ### VERSION ### @@ -26,25 +41,20 @@ The version of CheckMyIP documented here is: **v1.3.0** ----------------------------------------- ### WHAT IS CHECKMYIP ### -Everybody has used a service like [WhatIsMyIP.com](https://www.whatismyip.com/) before. If you are an IT engineer or even an amateur technology enthusiast, then you have probably had a reason to check to see your public IP address. This service works great when a browser is available, but at times it is not. We often find ourselves logged into a remote Linux machine or a network switch/router which has a command line and terminal clients (Telnet and SSH), but no browser. The CheckMyIP app and the **TelnetMyIP.com** and **SSHMyIP.com** public services were created with this in mind. +Everybody has used a service like [WhatIsMyIP.com](https://www.whatismyip.com/) before. If you are an IT engineer or even an amateur technology enthusiast, then you have probably had a reason to check to see your public IP address. This service works great when a browser is available, but at times it is not. We often find ourselves logged into a remote *BSD or Linux machine or a network switch/router which has a command line and terminal clients (Telnet and SSH), but no browser. The CheckMyIP app and the **myip.bsd.cafe** public services were created with this in mind. ----------------------------------------- ### HOW TO USE ### -Using the public **TelnetMyIP.com** and **SSHMyIP.com** services is pretty easy: simply connect to them with a terminal client. You can use a telnet client with TCP port 23 (`telnet telnetmyip.com`), a SSH client with TCP port 22 (`ssh sshmyip.com`), or CURL (`curl telnetmyip.com`). The SSH connection requires no authentication, but your SSH client may require you to enter a username, you can use anything you want as it gets ignored anyways(`ssh -limrootbitch telnetmyip.com`). +Using the public **myip.bsd.cafe** service is pretty easy: simply connect to them with a terminal client. You can use a telnet client with TCP port 23 (`telnet myip.bsd.cafe`), a SSH client with TCP port 22 (`ssh myip.bsd.cafe`), or CURL (`curl -L myip.bsd.cafe`). The SSH connection requires no authentication, but your SSH client may require you to enter a username, you can use anything you want as it gets ignored anyways(`ssh -limrootbitch myip.bsd.cafe`). -You can also browse to the HTTP version of the service at [TelnetMyIP.com](http://telnetmyip.com/) which will return a JSON reply with your IP information. +You can also browse to the HTTP version of the service at [myip.bsd.cafe](https://myip.bsd.cafe/) which will return a JSON reply with your IP information. To enable the use of this service as a simple API, the response is formatted as a JSON document. See the [Using the API](#using-the-api) section for information on how to leverage the API. -**Note:** _You can also connect to_ `ipv4.telnetmyip.com` _or_ `ipv6.telnetmyip.com` _if you want to check a specific IP stack._ - -**Note:** _The DNS records for_ `telnetmyip.com` _and_ `sshmyip.com` _point to the same services._ - - ----------------------------------------- ### USING THE API ### -The CheckMyIP code contains the `CheckMyIP_Client` class which is an API client example which can be used to query a CheckMyIP server (like telnetmyip.com). Below is an example of how you can use it. +The CheckMyIP code contains the `CheckMyIP_Client` class which is an API client example which can be used to query a CheckMyIP server (like myip.bsd.cafe). Below is an example of how you can use it. ``` from checkmyip import CheckMyIP_Client @@ -60,54 +70,61 @@ print("\nI used port number %s\n" % ipdict["port"]) ### INSTALL PROCESS ### If you would rather set up your own private instance of CheckMyIP, then you can follow the below instructions to set it up for yourself. -Change Linux SSH Port to TCP 222 and reboot -``` -sudo sed -i --follow-symlinks 's/#Port 22/Port 222/g' /etc/ssh/sshd_config -shutdown -r now +Install Dependencies (for example, on a FreeBSD jail) + +``` +pkg install python39 py39-gssapi py39-paramiko ``` -Install Dependencies +Clone Repo and install + ``` -sudo apt install python3-pip -sudo -H pip3 install paramiko -sudo apt install python3-gssapi +git clone https://brew.bsd.cafe/BSDCafe/checkmyip +cp checkmyip/checkmyip.py /usr/local/bin +chmod a+rx /usr/local/bin/checkmyip.py ``` -Clone Repo -``` -git clone https://github.com/PackeTsar/checkmyip.git +Create Service (`vi /usr/local/etc/rc.d/checkmyip`) + ``` +#!/bin/sh -Create Service (`sudo nano /etc/systemd/system/checkmyip.service`) -``` -[Unit] -Description=CheckMyIP Service -After=network-online.target -Wants=network-online.target +# PROVIDE: checkmyip +# REQUIRE: DAEMON +# KEYWORD: shutdown -[Service] -Type=simple +. /etc/rc.subr -PIDFile=/var/tmp/checkmyip.pid -WorkingDirectory=/home/ubuntu/checkmyip +name="checkmyip" +rcvar=checkmyip_enable -ExecStart=/usr/bin/python3 checkmyip.py +load_rc_config $name -Restart=on-failure -RestartSec=30 -PrivateTmp=true +: ${checkmyip_enable:=no} +: ${checkmyip_user:="nobody"} -[Install] -WantedBy=multi-user.target +pidfile="/var/run/${name}.pid" +command="/usr/local/bin/checkmyip.py" +command_interpreter="/usr/local/bin/python3.9" +command_args="&" +start_precmd="checkmyip_precmd" + +checkmyip_precmd() { + install -o ${checkmyip_user} -g ${checkmyip_user} /dev/null ${pidfile} +} + +run_rc_command "$1" ``` Finish and Start Up Service ``` -sudo systemctl daemon-reload -sudo systemctl enable checkmyip -sudo systemctl start checkmyip -sudo systemctl status checkmyip +chmod a+rx /usr/local/etc/rc.d/checkmyip +mkdir /var/log/checkmyip +chown nobody:nobody /var/log/checkmyip + +service checkmyip enable +service checkmyip start ``` @@ -130,9 +147,9 @@ sudo systemctl status checkmyip ### CONTRIBUTING ### If you would like to help out by contributing code or reporting issues, please do! -Visit the GitHub page (https://github.com/packetsar/checkmyip) and either report an issue or fork the project, commit some changes, and submit a pull request. +Visit the BSD Cafe Brew page (https://brew.bsd.cafe/BSDCafe/checkmyip) and either report an issue or fork the project, commit some changes, and submit a pull request. + +Original code by [John W Kerns](https://github.com/packetsar/checkmyip) -[twitter-logo]: http://www.packetsar.com/wp-content/uploads/twitter-logo-35.png -[twitter]: https://twitter.com/TelnetMyIP [logo]: /checkmyip_icon-100.gif -[whatismyip]: https://www.whatismyip.com/ +[whatismyip]: https://www.whatismyip.com/ \ No newline at end of file