{"id":19621569,"url":"https://github.com/pkg6/ssl-certificate","last_synced_at":"2025-02-26T19:15:57.393Z","repository":{"id":258072681,"uuid":"872771986","full_name":"pkg6/ssl-certificate","owner":"pkg6","description":"Generate certificates by calling the go function, use the simplest command to generate certificates, and complete automatic deployment","archived":false,"fork":false,"pushed_at":"2024-10-24T10:45:58.000Z","size":40,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-10-24T20:51:29.245Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pkg6.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-15T03:40:16.000Z","updated_at":"2024-10-24T10:44:05.000Z","dependencies_parsed_at":"2024-10-26T13:20:06.153Z","dependency_job_id":null,"html_url":"https://github.com/pkg6/ssl-certificate","commit_stats":null,"previous_names":["pkg6/ssl-certificate"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fssl-certificate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fssl-certificate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fssl-certificate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pkg6%2Fssl-certificate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pkg6","download_url":"https://codeload.github.com/pkg6/ssl-certificate/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240917723,"owners_count":19878308,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T11:23:34.204Z","updated_at":"2025-02-26T19:15:57.373Z","avatar_url":"https://github.com/pkg6.png","language":"Go","readme":"## Using the Command Line\n\n### sh install or uninstall\n\n~~~\ncurl -sSL https://raw.githubusercontent.com/izhiqiang/sh/main/install-pkg.sh | bash -s jq\n\n// install\ncurl -sSL https://raw.githubusercontent.com/pkg6/ssl-certificate/main/install.sh | bash\n// uinstall\ncurl -sSL https://raw.githubusercontent.com/pkg6/ssl-certificate/main/uninstall.sh | bash\n~~~\n\n### ssl-certificate-local\n\n~~~\ngo install github.com/pkg6/ssl-certificate/cli/ssl-certificate-local@latest\nssl-certificate-local --domain=ssl.zhiqiang.wang --webroot=/data/wwwroot/ssl.zhiqiang.wang --path=/etc/nginx/ssl/ --command=\"servcie nginx reload\"\n~~~\n\n## Nginx SSL configuration (partial)\n\n~~~\nlisten 443 ssl;\nssl_certificate /etc/nginx/ssl/ssl.zhiqiang.wang.cer;\nssl_certificate_key /etc/nginx/ssl/ssl.zhiqiang.wang.key;\nssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;\nssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;\nssl_prefer_server_ciphers on;\nssl_session_cache shared:SSL:10m;\nssl_session_timeout 10m;\n~~~\n\n## Using SSL certificate for function calls\n\n### download\n\n~~~\ngo get github.com/pkg6/ssl-certificate\n~~~\n\n### Case code\n\n~~~\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\tcertificate \"github.com/pkg6/ssl-certificate\"\n\t\"github.com/pkg6/ssl-certificate/deployer\"\n\t\"github.com/pkg6/ssl-certificate/providers\"\n\t\"github.com/pkg6/ssl-certificate/registrations\"\n)\n\nfunc main() {\n\t//---------------------generate start-------------------------------\n\tconfig := \u0026certificate.Config{\n\t\tDomains: []string{\"ssl.zhiqiang.wang\"},\n\t\tProvider: \u0026providers.Config{\n\t\t\t//Name: providers.NameALiYun,\n\t\t\t//Config: \u0026providers.AliYunAccess{\n\t\t\t//\tAccessKeyId:     \"****************\",\n\t\t\t//\tAccessKeySecret: \"****************\",\n\t\t\t//},\n\t\t\tName: providers.NameHTTP,\n\t\t\tConfig: \u0026providers.HTTPAccess{\n\t\t\t\tPath: \"/data/wwwroot/ssl.zhiqiang.wang\",\n\t\t\t},\n\t\t},\n\t\tRegistration: \u0026registrations.Config{\n\t\t\tProvider: registrations.LetsencryptSSL,\n\t\t},\n\t}\n\tssl, err := certificate.SSLCertificateByConfig(config)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"certificate：%s\\n\", ssl.Certificate)\n\tfmt.Printf(\"privateKey：%s\\n\", ssl.PrivateKey)\n\tfmt.Printf(\"IssuerCertificate：%s\\n\", ssl.IssuerCertificate)\n\t//---------------------generate end-------------------------------\n\n\t//---------------------deployer start-------------------------------\n\tcertificate.Deployer(context.Background(), \u0026deployer.Config{\n\t\t//Name: deployer.Local,\n\t\t//Options: \u0026deployer.Options{Access: deployer.LocalAccess{\n\t\t//\tCertPath:     \"/etc/nginx/etc/ssl.zhiqiang.wang.cer\",\n\t\t//\tKeyPath:      \"/etc/nginx/etc/ssl.zhiqiang.wang.key\",\n\t\t//\tAfterCommand: \"service nginx reload\",\n\t\t//}},\n\t\t//\n\t\t//Name: deployer.SSH,\n\t\t//Options: \u0026deployer.Options{Access: deployer.SSHAccess{\n\t\t//\tHost:         \"127.0.0.1\",\n\t\t//\tUsername:     \"ubuntu\",\n\t\t//\tPassword:     \"123456\",\n\t\t//\tCertPath:     \"/etc/nginx/etc/ssl.zhiqiang.wang.cer\",\n\t\t//\tKeyPath:      \"/etc/nginx/etc/ssl.zhiqiang.wang.key\",\n\t\t//\tAfterCommand: \"service nginx reload\",\n\t\t//}},\n\t\t//Name: deployer.OSS,\n\t\t//Options: \u0026deployer.Options{Access: deployer.ALiYunOSSAccess{\n\t\t//\tAccessKeyId:     \"***********************\",\n\t\t//\tAccessKeySecret: \"***********************\",\n\t\t//\t//https://help.aliyun.com/zh/oss/user-guide/regions-and-endpoints\n\t\t//\tEndpoint: \"oss-cn-hangzhou.aliyuncs.com\",\n\t\t//\tBucket:   \"test\",\n\t\t//\tDomain:   \"ssl.zhiqiang.wang\",\n\t\t//}},\n\t\t//Name: deployer.ALiYunCDN,\n\t\t//Options: \u0026deployer.Options{Access: deployer.ALiYunCDNAccess{\n\t\t//\tAccessKeyId:     \"***********************\",\n\t\t//\tAccessKeySecret: \"***********************\",\n\t\t//\tEndpoint:        \"cdn.aliyuncs.com\",\n\t\t//\tRegion:          \"cn-hangzhou\",\n\t\t//\tDomain:          \"ssl.zhiqiang.wang\",\n\t\t//}},\n\t\t//Name: deployer.ALiYunDCDN,\n\t\tOptions: \u0026deployer.Options{Access: deployer.ALiYunDCDNAccess{\n\t\t\tAccessKeyId:     \"***********************\",\n\t\t\tAccessKeySecret: \"***********************\",\n\t\t\tEndpoint:        \"dcdn.aliyuncs.com\",\n\t\t\tRegion:          \"cn-hangzhou\",\n\t\t\tDomain:          \"ssl.zhiqiang.wang\",\n\t\t}},\n\t}, ssl)\n\t//---------------------deployer end-------------------------------\n\n\t//---------------------Certificate Information start-------------------------------\n\t//Obtain certificate information through domain access\n\tdomainCertificates, err := certificate.SSLCertificateInfoByTCP(\"ssl.zhiqiang.wang\")\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tdomainCertificate := domainCertificates[0]\n\tfmt.Printf(\"certificate NotBefore：%s\\n\", domainCertificate.NotBefore)\n\tfmt.Printf(\"certificate NotAfter：%s\\n\", domainCertificate.NotAfter)\n\n\t//Obtain certificate information through the content of the certificate file\n\tdomainCertificate2, err := certificate.SSLCertificateInfoByCer([]byte(ssl.Certificate))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Printf(\"certificate NotBefore：%s\\n\", domainCertificate2.NotBefore)\n\tfmt.Printf(\"certificate NotAfter：%s\\n\", domainCertificate2.NotAfter)\n\t//---------------------Certificate Information start-------------------------------\n}\n~~~\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkg6%2Fssl-certificate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpkg6%2Fssl-certificate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpkg6%2Fssl-certificate/lists"}