File tree 1 file changed +20
-3
lines changed
manager/src/backend/internal
1 file changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -39,11 +39,14 @@ const internalSsl = {
39
39
// This host is due to expire in 1 day, time to renew
40
40
logger . info ( 'Host ' + host . hostname + ' is due for SSL renewal' ) ;
41
41
42
- internalSsl . configureSsl ( host )
42
+ internalSsl . renewSsl ( host )
43
43
. then ( ( ) => {
44
- return internalNginx . generateConfig ( host ) ;
44
+ // Certificate was requested ok, update the timestamp on the host
45
+ db . hosts . update ( { _id : host . _id } , { ssl_expires : timestamp . now ( '+90d' ) } , {
46
+ multi : false ,
47
+ upsert : false
48
+ } ) ;
45
49
} )
46
- . then ( internalNginx . reload )
47
50
. then ( next )
48
51
. catch ( err => {
49
52
logger . error ( err ) ;
@@ -88,6 +91,20 @@ const internalSsl = {
88
91
} ) ;
89
92
} ,
90
93
94
+ /**
95
+ * @param {Object } host
96
+ * @returns {Promise }
97
+ */
98
+ renewSsl : host => {
99
+ logger . info ( 'Renewing SSL certificates for ' + host . hostname ) ;
100
+
101
+ return utils . exec ( '/usr/bin/letsencrypt renew --force-renewal --disable-hook-validation --cert-name "' + host . hostname + '"' )
102
+ . then ( result => {
103
+ logger . info ( result ) ;
104
+ return result ;
105
+ } ) ;
106
+ } ,
107
+
91
108
/**
92
109
* @param {Object } host
93
110
* @returns {Promise }
You can’t perform that action at this time.
0 commit comments