Created
June 22, 2019 04:27
-
-
Save pluser/dff8ac3c444b9dba542184a4e780567b to your computer and use it in GitHub Desktop.
Periodically renew ip restriction for coreserver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Register myown IP Address to coreserver | |
After=network.target | |
Requires=network.target | |
[Service] | |
Type=oneshot | |
ExecStart=/root/register-login-ip-coreserver.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Register myown IP Address to coreserver | |
[Timer] | |
OnBootSec=15min | |
OnUnitActiveSec=1w | |
[Install] | |
WantedBy=timers.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
account=XXXXXXXX | |
server_name=sXXXX.coreserver.jp | |
api_secret_key=xxxxxxxxxxxxxxxxxxxxxxxxxxxx | |
end_point=https://api.coreserver.jp/v1/tool/ssh_ip_allow | |
ip_addr=$(curl -s ifconfig.me) | |
curl --silent --http1.1\ | |
-d "account=${account}" -d "server_name=${server_name}" \ | |
-d "api_secret_key=${api_secret_key}" \ | |
-d "param[addr]=${ip_addr}" \ | |
-X POST \ | |
${end_point} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment