- wildcard cert functionality
- Kazoo interaction over AMQP
- works with Kazoo to create/delete DNS records required for DNS challenge
- moved some things around (utility functions mostly)
- updated README with build/install instructions
@ -21,6 +21,9 @@ LEAPI operates in a multi-master configuration. When you add or delete a server
```[GET] https://leapiserver.tld/api/domains``` --- List Domains
```[PUT] https://leapiserver.tld/api/domains/mycoolsite.com``` --- Add New Domain
```[PUT] https://leapiserver.tld/api/domains/%2A.example.com {"domain":"mycoolsite} ``` --- Add New Domain (wildcard--urlencoded)
```[PUT] https://leapiserver.tld/api/domains {"domain":"*.example.com"} ``` --- Add New Domain (wildcard domain in request body)
```[PUT] https://leapiserver.tld/api/domains {"domain":"*.example.com", "check_domain":"web1.example.com"} ``` --- Add New Domain (wildcard domain in request body, with domain to use for checking if cert was installed [otherwise api.example.com will be used for check])
@ -32,9 +35,12 @@ LEAPI operates in a multi-master configuration. When you add or delete a server
- Download the LEAPI binary, or build from source.
- Copy it to ```/opt/leapi```
- You may use the included SystemD service file if you use a SystemD based distribution.
- Edit the ```leapi_config.json``` file for your needs, leaving ```production``` set to ```false``` until setup is complete. Set the ```sync_type``` to either ```ssh``` or ```https```. If you choose ```ssh``` you must create and copy keys and verify you can login to all servers that need to share files between each other. Note: if you enable ```https_server_port``` in the config file, LEAPI needs a certificate to be able to start (it requires the ```tls_chain_path``` and ```tls_key_path```). You can generate a temporary self signed certificate and key with openssl:
- Edit the ```leapi_config.json``` file for your needs, leaving ```production``` set to ```false``` until setup is complete. Set the ```sync_type``` to either ```ssh``` or ```https```. If you choose ```ssh``` you must create and copy keys and verify you can login to all servers that need to share files between each other. Note: if you enable ```https_server_port``` in the config file, LEAPI needs a certificate to be able to start (it requires the ```tls_chain_path_prefix``` and ```tls_key_path_prefix```). You can generate a temporary self signed certificate and key with OpenSSL:
log.Fatal("Unable to initialize RabbitMQ consumer: "+err.Error())
}
deferconsumer.Close()
gofunc(){
err=consumer.Run(handleAmqpMsg)//this is the function that we want to call to consume presence messages
iferr!=nil{
log.Fatal("Unable to start/run RabbitMQ consumer: "+err.Error())
}
}()
log.Println("Consuming on topic exchange: '"+amqpExchange+"' with routing key: '"+routingKeyConsume+"' using queue: 'consumer_"+appname+"_"+appconf.Hostname+"'.")
certgroups[n]=cg//replace certgroup with modified/appended version
certgroup_slot=n//set slot we need to run renewal for
break
}elseiflen(certgroups)==(n+1){//all certgroup slots are full (or incompatible), and we are on the last one, so make another
varnewcgCertGroup
ifwildcard{
newcg.Wildcard=true
//use api.domain.com instead of *.domain.com for primary domain:
//newcg.PrimaryDomain = "api" + domain[1:] //FIXME ??? getssl does support wildcards as primary domain, but there seems to be issues calling it with exec.Command when a wildcard is involved
//newcg.Domains = append(cg.Domains, domain)
newcg.PrimaryDomain=domain
newcg.Domains=make([]string,0)//make empty slice so if there are no results JSON will contain [] instead of null
}else{
newcg.PrimaryDomain=domain
newcg.Domains=make([]string,0)
}
certgroups=append(certgroups,newcg)
certgroup_slot=n+1//set slot we need to run renewal for
break
}
}
iflen(certgroups)==0{//certgroups is empty, so start fresh
//configDir set by environment variable LEAPI_CONFDIR, otherwise assumed to be /opt/leapi or ./
{
"hostname":"web1.mydomain.net", //hostname or IP of this particular server; must match the server you add to LEAPI. You can use "-" to use the system hostname (must be resolvable by other LEAPI systems).
"primary_domain":"mydomain.net", //the main base domain that is always present
"sync_type":"https", //method of transferring files between LEAPI hosts. "ssh" or "https"
"username":"leapi", //the username to use for file transfer (applies to either http or ssh)
"hostname":"web1.mydomain.net", //hostname or IP of this particular server; MUST match the server you add to LEAPI. You can use "-" to use the system hostname (must be resolvable by other LEAPI systems).
"primary_domain":"mydomain.net", //the main base domain that is always present; can NOT be a wildcard domain
"check_port":"443", //the port/service to check to verify cert installation (https/imap/imaps/xmpp/ftp/smtp)
"production":false, //if false, the staging LE server will be used. Set true to use the rate limited real server.
"secret_key":"SecReT_KeY-4API-AuThenTiCaTiON"
"frontend_url":"admin.mydomain.net", //the frontend URL, if any (for CORS). Use "-" if none.
"http_server_port":"-", //set to 80 if you are not using a separate web server or proxy. "-" will assume port 80.
"https_server_enable":true, //set to false to disable HTTPS listener (for initial setup, or for using a separate web server/proxy)
"https_server_port":"-", //the port your HTTPS server is running on, whether LEAPI or an external web server/proxy. Set to "-" for default (port 443)
"tls_cert_path_prefix":"/etc/ssl/leapi/cert", //file paths DO NOT INCLUDE EXTENSION. "/etc/ssl/cert" will write files "/etc/ssl/cert01.crt", "/etc/ssl/cert02.crt", etc.