Этот КБ в comodo веб-сайте описывает, как сделать это:
В основном Вы будете воссоздавать свой сайт в IIS и генерировать запрос от того. Затем Вы удаляете его и заменяете сертификат на Вашем текущем сайте.
Просто просмотрев мои примечания по dscl, которого я написал сценарий справедливо экстенсивно. Я абсолютно уверен, что ответ не, нет никакого способа постараться не предоставлять пароль. Единственное исключение могло бы быть то, если бы Вы были корнем на локальном поле (который, в Вашем примере, действительно кажется, имеет место). [Я почти исключительно сделал, переключает сеть.]
Если Вы будете использовать, то ожидают или pexpect, Вы можете, закодировал пароль в сценарии (обратимым способом), и затем звоните в программу, в которой Вы нуждаетесь. [Я придумал метод для кодирования/декодирования чего-то, что похоже на напыщенность речи, но это - безопасность через мрак, я боюсь.]
Для использования pexpect, что-то вдоль этих строк работало бы [отмечают, что этот пример использует dscl, и не dsimport! (Я предполагаю, что это могло быть упрощено немного для Вашего ставившего целью; включение регистрирующейся команды для dscl ребенка помогает при установке вещей)]:
#!/usr/bin/env python
import pexpect
# If you don't have pexpect, you should be able to run
# 'sudo easy_install pexpect' to get it
### Fill in these variables
diradmin = "diradmin"
host = "host"
directory = '/Local/Default' # '/LDAPv3/127.0.0.1'
# Note: it is possible to encode the data here so it is not in plain text!
password = "password"
DSCL_PROMPT = " > " # Don't change this (unless the dscl tool changes)
def ReplyOnGoodResult(child, desired, reply):
"""Helps analyze the results as we try to set passwords.
child = a pexpect child process
desired = The value we hope to see
reply = text to send if we get the desired result (or None for no reply)
If we do get the desired result, we send the reply and return true.
If not, we return false."""
expectations = [ pexpect.EOF, pexpect.TIMEOUT, '(?i)error', desired ]
desired_index = len(expectations) - 1
index = child.expect(expectations)
if index == desired_index:
if reply:
child.sendline(reply)
return True
else:
return False
def RunDSCLCommand(dscl_child, command):
"""Issues one dscl command; returns if it succeeded or failed.
command = the command to be sent to dscl, such as 'passwd Users/foo newpword'
"""
assert dscl_child is not None, "No connection successfully established"
# We should be logged in with a prompt awaiting us
expected_list = [ pexpect.EOF, pexpect.TIMEOUT,
'(?i)error', 'Invalid Path', DSCL_PROMPT ]
desired_index = len(expected_list) - 1
invalid_path_index = desired_index - 1
dscl_child.sendline(command)
reply_index = dscl_child.expect(expected_list)
if reply_index == desired_index:
return True
# Find the next prompt so that on the next call to a command like this
# one, we will know we are at a consistent starting place
# Looking at the self.dscl_child.before will likely contain
# the error that occured, but for now:
dscl_child.expect(DSCL_PROMPT)
if invalid_path_is_success and reply_index == invalid_path_index:
# The item doesn't exist, but we will still count it
# as a success. (Most likely we were told to delete the item).
return True
# one of the error conditions was triggered
return False
# Here is the part of the program where we start doing things
prompt = DSCL_PROMPT
dscl_child = pexpect.spawn("dscl -u %s -p %s" % (diradmin, host))
#dscl_child.logfile = file("dscl_child.log", "w") # log what is going on
success = False
if (ReplyOnGoodResult(self.dscl_child, "Password:", password) and
ReplyOnGoodResult(self.dscl_child, prompt, "cd %s" % directory) and
ReplyOnGoodResult(self.dscl_child, prompt, "auth %s %s" % (diradmin, password)) and
ReplyOnGoodResult(self.dscl_child, prompt, None)):
success = True
if success:
# Now issue a command
success = RunDSCLCommand(dscl_child, 'passwd Users/foo newpword')
dscl_child.close()
Я отправил часть кода, который я использую здесь; я боюсь, что это горестно не поддерживается (и отправляется на pymacadmin группу об этом здесь. К сожалению, не похоже, что я описал что-либо о том, как использовать его :(