Beispiel #1
0
def create_parser():
    """Create parser."""
    parser = confargparse.ConfArgParser(description="letsencrypt client %s" %
                                        letsencrypt.__version__)

    add = parser.add_argument
    config_help = lambda name: interfaces.IConfig[name].__doc__

    add("-d", "--domains", metavar="DOMAIN", nargs="+")
    add("-s",
        "--server",
        default="letsencrypt-demo.org:443",
        help=config_help("server"))

    # TODO: we should generate the list of choices from the set of
    # available authenticators, but that is tricky due to the
    # dependency between init_auths and config. Hardcoding it for now.
    add("-a",
        "--authenticator",
        dest="authenticator",
        help=config_help("authenticator"))

    add("-k",
        "--authkey",
        type=read_file,
        help="Path to the authorized key file")
    add("-B",
        "--rsa-key-size",
        type=int,
        default=2048,
        metavar="N",
        help=config_help("rsa_key_size"))

    add("-R",
        "--revoke",
        action="store_true",
        help="Revoke a certificate from a menu.")
    add("--revoke-certificate",
        dest="rev_cert",
        type=read_file,
        help="Revoke a specific certificate.")
    add("--revoke-key",
        dest="rev_key",
        type=read_file,
        help="Revoke all certs generated by the provided authorized key.")

    add("-b",
        "--rollback",
        type=int,
        default=0,
        metavar="N",
        help="Revert configuration N number of checkpoints.")
    add("-v",
        "--view-config-changes",
        action="store_true",
        help="View checkpoints and associated configuration changes.")

    # TODO: resolve - assumes binary logic while client.py assumes ternary.
    add("-r",
        "--redirect",
        action="store_true",
        help="Automatically redirect all HTTP traffic to HTTPS for the newly "
        "authenticated vhost.")

    add("--no-confirm",
        dest="no_confirm",
        action="store_true",
        help="Turn off confirmation screens, currently used for --revoke")

    add("-e",
        "--agree-tos",
        dest="eula",
        action="store_true",
        help="Skip the end user license agreement screen.")
    add("-t",
        "--text",
        dest="use_curses",
        action="store_false",
        help="Use the text output instead of the curses UI.")

    add("--config-dir",
        default="/etc/letsencrypt",
        help=config_help("config_dir"))
    add("--work-dir",
        default="/var/lib/letsencrypt",
        help=config_help("work_dir"))
    add("--backup-dir",
        default="/var/lib/letsencrypt/backups",
        help=config_help("backup_dir"))
    add("--key-dir",
        default="/etc/letsencrypt/keys",
        help=config_help("key_dir"))
    add("--cert-dir",
        default="/etc/letsencrypt/certs",
        help=config_help("cert_dir"))

    add("--le-vhost-ext",
        default="-le-ssl.conf",
        help=config_help("le_vhost_ext"))
    add("--cert-path",
        default="/etc/letsencrypt/certs/cert-letsencrypt.pem",
        help=config_help("cert_path"))
    add("--chain-path",
        default="/etc/letsencrypt/certs/chain-letsencrypt.pem",
        help=config_help("chain_path"))

    add("--apache-server-root",
        default="/etc/apache2",
        help=config_help("apache_server_root"))
    add("--apache-mod-ssl-conf",
        default="/etc/letsencrypt/options-ssl.conf",
        help=config_help("apache_mod_ssl_conf"))
    add("--apache-ctl", default="apache2ctl", help=config_help("apache_ctl"))
    add("--apache-enmod", default="a2enmod", help=config_help("apache_enmod"))
    add("--apache-init-script",
        default="/etc/init.d/apache2",
        help=config_help("apache_init_script"))

    return parser
Beispiel #2
0
def create_parser():
    """Create parser."""
    parser = confargparse.ConfArgParser(description="letsencrypt client %s" %
                                        letsencrypt.__version__)

    add = parser.add_argument
    config_help = lambda name: interfaces.IConfig[name].__doc__

    add("-d", "--domains", metavar="DOMAIN", nargs="+")
    add("-s",
        "--server",
        default="letsencrypt-demo.org:443",
        help=config_help("server"))

    add("-p",
        "--privkey",
        type=read_file,
        help="Path to the private key file for certificate generation.")
    add("-B",
        "--rsa-key-size",
        type=int,
        default=2048,
        metavar="N",
        help=config_help("rsa_key_size"))

    add("-k", "--revoke", action="store_true", help="Revoke a certificate.")
    add("-b",
        "--rollback",
        type=int,
        default=0,
        metavar="N",
        help="Revert configuration N number of checkpoints.")
    add("-v",
        "--view-config-changes",
        action="store_true",
        help="View checkpoints and associated configuration changes.")

    # TODO: resolve - assumes binary logic while client.py assumes ternary.
    add("-r",
        "--redirect",
        action="store_true",
        help="Automatically redirect all HTTP traffic to HTTPS for the newly "
        "authenticated vhost.")

    add("-e",
        "--agree-tos",
        dest="eula",
        action="store_true",
        help="Skip the end user license agreement screen.")
    add("-t",
        "--text",
        dest="use_curses",
        action="store_false",
        help="Use the text output instead of the curses UI.")

    add("--config-dir",
        default="/etc/letsencrypt",
        help=config_help("config_dir"))
    add("--work-dir",
        default="/var/lib/letsencrypt",
        help=config_help("work_dir"))
    add("--backup-dir",
        default="/var/lib/letsencrypt/backups",
        help=config_help("backup_dir"))
    add("--key-dir",
        default="/etc/letsencrypt/keys",
        help=config_help("key_dir"))
    add("--cert-dir",
        default="/etc/letsencrypt/certs",
        help=config_help("cert_dir"))

    add("--le-vhost-ext",
        default="-le-ssl.conf",
        help=config_help("le_vhost_ext"))
    add("--cert-path",
        default="/etc/letsencrypt/certs/cert-letsencrypt.pem",
        help=config_help("cert_path"))
    add("--chain-path",
        default="/etc/letsencrypt/certs/chain-letsencrypt.pem",
        help=config_help("chain_path"))

    add("--apache-server-root",
        default="/etc/apache2",
        help=config_help("apache_server_root"))
    add("--apache-mod-ssl-conf",
        default="/etc/letsencrypt/options-ssl.conf",
        help=config_help("apache_mod_ssl_conf"))
    add("--apache-ctl", default="apache2ctl", help=config_help("apache_ctl"))
    add("--apache-enmod", default="a2enmod", help=config_help("apache_enmod"))
    add("--apache-init-script",
        default="/etc/init.d/apache2",
        help=config_help("apache_init_script"))

    return parser