Revision 2ed6a7d6
b/daemons/ganeti-rapi | ||
---|---|---|
169 | 169 |
help="Port to run API (%s default)." % |
170 | 170 |
constants.RAPI_PORT, |
171 | 171 |
default=constants.RAPI_PORT, type="int") |
172 |
parser.add_option("-S", "--https", dest="ssl",
|
|
173 |
help="Secure HTTP protocol with SSL",
|
|
174 |
default=False, action="store_true")
|
|
172 |
parser.add_option("--no-ssl", dest="ssl",
|
|
173 |
help="Do not secure HTTP protocol with SSL",
|
|
174 |
default=True, action="store_false")
|
|
175 | 175 |
parser.add_option("-K", "--ssl-key", dest="ssl_key", |
176 | 176 |
help="SSL key", |
177 |
default=None, type="string")
|
|
177 |
default=constants.RAPI_CERT_FILE, type="string")
|
|
178 | 178 |
parser.add_option("-C", "--ssl-cert", dest="ssl_cert", |
179 | 179 |
help="SSL certificate", |
180 |
default=None, type="string")
|
|
180 |
default=constants.RAPI_CERT_FILE, type="string")
|
|
181 | 181 |
parser.add_option("-f", "--foreground", dest="fork", |
182 | 182 |
help="Don't detach from the current terminal", |
183 | 183 |
default=True, action="store_false") |
... | ... | |
205 | 205 |
if options.fork: |
206 | 206 |
utils.CloseFDs() |
207 | 207 |
|
208 |
if options.ssl: |
|
209 |
# Read SSL certificate |
|
210 |
ssl_params = http.HttpSslParams(ssl_key_path=options.ssl_key, |
|
211 |
ssl_cert_path=options.ssl_cert) |
|
212 |
else: |
|
213 |
ssl_params = None |
|
214 |
|
|
208 | 215 |
ssconf.CheckMaster(options.debug) |
209 | 216 |
|
210 | 217 |
if options.fork: |
... | ... | |
216 | 223 |
utils.WritePidFile(constants.RAPI_PID) |
217 | 224 |
try: |
218 | 225 |
mainloop = daemon.Mainloop() |
219 |
server = RemoteApiHttpServer(mainloop, "", options.port) |
|
226 |
server = RemoteApiHttpServer(mainloop, "", options.port, |
|
227 |
ssl_params=ssl_params, ssl_verify_peer=False) |
|
220 | 228 |
server.Start() |
221 | 229 |
try: |
222 | 230 |
mainloop.Run() |
Also available in: Unified diff