remove npm letsencrypt

This commit is contained in:
Philipp Kunz 2017-01-01 14:25:46 +01:00
parent fd89e54295
commit 34299fa651
2 changed files with 0 additions and 114 deletions

View File

@ -31,8 +31,6 @@
"beautylog": "^6.0.0",
"cflare": "0.0.10",
"fs-extra": "^1.0.0",
"le-store-certbot": "^2.0.3",
"letsencrypt": "^2.1.8",
"lik": "^1.0.27",
"q": "^1.4.1",
"smartcli": "^2.0.1",

View File

@ -15,27 +15,10 @@ export interface ILetsencryptConstructorOptions {
sslDir: string
}
let leStoreConfig = {
configDir: paths.leConfigDir,
privkeyPath: ':configDir/:hostname/privkey.pem',
fullchainPath: ':configDir/:hostname/fullchain.pem',
certPath: ':configDir/:hostname/cert.pem',
chainPath: ':configDir/:hostname/chain.pem',
workDir: ':configDir/letsencrypt/var/lib',
logsDir: ':configDir/letsencrypt/var/log',
debug: true
}
let leStoreInstance = leStore.create(leStoreConfig)
export class Letsencrypt {
leEnv: TLeEnv
challengeHandler: ChallengeHandler // this is the format we use
sslDir: string
private _leInstance: any
private _leServerUrl: string
constructor(optionsArg: ILetsencryptConstructorOptions) {
@ -51,23 +34,6 @@ export class Letsencrypt {
this._leServerUrl = letsencrypt.stagingServerUrl
}
// create leInstance
this._leInstance = letsencrypt.create({
server: this._leServerUrl,
challenges: {
'dns-01': this._leChallengeHandler()
},
challengeType: 'dns-01',
store: leStoreInstance,
agreeToTerms: (opts, agreeCb) => {
agreeCb(null, opts.tosUrl)
},
debug: true,
log: function (debug) {
console.info(arguments)
}
})
console.log()
}
/**
@ -77,84 +43,6 @@ export class Letsencrypt {
plugins.beautylog.log(`trying to register domain ${domainNameArg}`)
let done = q.defer()
plugins.smartfile.fs.ensureDirSync(plugins.path.join(paths.leConfigDir, 'live', domainNameArg))
this._leInstance.check({ domains: [domainNameArg] }).then((cert) => {
console.log(cert)
let opts = {
domains: [domainNameArg],
email: 'domains@lossless.org',
agreeTos: true,
rsaKeySize: 2048, // 2048 or higher
challengeType: 'dns-01',
duplicate: true
}
if (cert) {
if (true) {
return this._leInstance.renew(opts, cert).catch((err) => {
console.log(err)
})
} else {
return cert
}
} else {
// Register Certificate manually
return this._leInstance.register(opts).catch((err) => {
console.log(err)
})
}
})
return done.promise
}
// --------------------------------------------
// Translate for official letsencrypt stuff
// --------------------------------------------
private _leCopyToDestination(domainNameArg) {
let done = q.defer()
done.resolve()
return done.promise
}
/**
* translates to the format expected by letsencrypt node implementation
*/
private _leChallengeHandler() {
return {
getOptions: () => {
return {
debug: false
}
},
set: (args, domain, challenge, keyAuthorization, cb) => {
let keyAuthDigest = require('crypto')
.createHash('sha256').update(keyAuthorization || '')
.digest('base64')
.replace(/\+/g, '-')
.replace(/\//g, '_')
.replace(/=+$/g, '')
this.challengeHandler.setChallenge(domain, keyAuthDigest)
.then(() => {
cb()
})
},
get: (defaults, domain, challenge, cb) => {
console.log(domain)
console.log(challenge)
cb()
},
remove: (args, domain, challenge, cb) => {
this.challengeHandler.cleanChallenge(domain)
.then(() => {
cb()
})
},
loopback: (defaults, domain, token, keyAuthorization, done) => {
done()
},
test: (defaults, domain, challenge, cb) => {
cb()
}
}
}
}