New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

check-cert

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

check-cert

Check https certificate valid and notify

  • 2.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8
increased by33.33%
Maintainers
1
Weekly downloads
 
Created
Source

check-cert

检查 https 证书是否临近过期时间,可以 js 调用或者 cli 通过管道(企业微信或Telegram)发送通知

Installation

npm i -g check-cert # cli 建议 -g

Usage

async function main() {
  const checkCert = require('./')
  const leftDays = await checkCert('uedsky.com')
  console.log(leftDays)
}
main()

Cli Usage

check-cert <host> [--days 15] [...curlOpts]

<host> 指定要检查的域名
[days] 临近多少天后发送提醒,默认 15
[curlOpts] curl 参数,发送通知

示例:配置 crontab -e 每天凌晨3点检查

# 企业微信通知
0 9 * * * PATH=/ur/home/.nvm/versions/node/v8.9.1/bin:$PATH check-cert uedsky.com 'https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=<key>' -H 'Content-Type: application/json' -d '{"msgtype":"markdown","markdown":{"content":"请注意,$CHECK_CERT_HOST 的 HTTPS 证书将于 <font color=\"warning\">$CHECK_CERT_DAYS</font> 天后过期!"}}' >> /tmp/check-cert.log 2>&1
# telegram 通知
0 9 * * * PATH=/home/wgdahu/.nvm/versions/node/v10.14.1/bin:$PATH check-cert api.pocketchess.cn --days 90 'https://api.telegram.org/bot<token>/sendMessage?chat_id=xxx&parse_mode=Markdown' -d 'text=请注意, $CHECK_CERT_HOST 的 HTTPS 证书将于 *$CHECK_CERT_DAYS* 天后过期!' --socks5 sdb2:5678 >> /tmp/check-cert.log 2>&1

Keywords

FAQs

Package last updated on 01 Oct 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc