|
50 | 50 | import sys
|
51 | 51 |
|
52 | 52 | from mig.shared.base import force_native_str, force_utf8
|
| 53 | +from mig.shared.compat import ensure_native_string, inspect_args, \ |
| 54 | + SimpleNamespace |
53 | 55 | from mig.shared.defaults import default_http_port, default_https_port, \
|
54 | 56 | auth_openid_mig_db, auth_openid_ext_db, MIG_BASE, STRONG_TLS_CIPHERS, \
|
55 | 57 | STRONG_TLS_CURVES, STRONG_SSH_HOSTKEYALGOS, STRONG_SSH_KEXALGOS, \
|
56 | 58 | STRONG_SSH_CIPHERS, STRONG_SSH_MACS, LEGACY_SSH_HOSTKEYALGOS, \
|
57 | 59 | LEGACY_SSH_KEXALGOS, LEGACY_SSH_CIPHERS, LEGACY_SSH_MACS, \
|
58 | 60 | FALLBACK_SSH_HOSTKEYALGOS, FALLBACK_SSH_KEXALGOS, FALLBACK_SSH_CIPHERS, \
|
59 |
| - FALLBACK_SSH_MACS, CRACK_USERNAME_REGEX, CRACK_WEB_REGEX, keyword_any, \ |
60 |
| - keyword_auto |
61 |
| -from mig.shared.compat import ensure_native_string |
| 61 | + FALLBACK_SSH_MACS, CRACK_USERNAME_REGEX, CRACK_WEB_REGEX, \ |
| 62 | + keyword_any, keyword_auto |
62 | 63 | from mig.shared.fileio import read_file, read_file_lines, write_file, \
|
63 | 64 | write_file_lines
|
64 | 65 | from mig.shared.htmlgen import menu_items
|
@@ -299,16 +300,7 @@ def template_remove(template_file, remove_pattern):
|
299 | 300 | ]
|
300 | 301 |
|
301 | 302 |
|
302 |
| -def generate_confs( |
303 |
| - generateconfs_output_path, |
304 |
| - # NOTE: make sure command line args with white-space are properly wrapped |
305 |
| - generateconfs_command=subprocess.list2cmdline(sys.argv), |
306 |
| - source=keyword_auto, |
307 |
| - destination=keyword_auto, |
308 |
| - user=keyword_auto, |
309 |
| - group=keyword_auto, |
310 |
| - timezone=keyword_auto, |
311 |
| - destination_suffix="", |
| 303 | +_DEFAULTS = SimpleNamespace( |
312 | 304 | base_fqdn='',
|
313 | 305 | public_fqdn='',
|
314 | 306 | public_alias_fqdn='',
|
@@ -538,6 +530,248 @@ def generate_confs(
|
538 | 530 | datasafety_link='',
|
539 | 531 | datasafety_text='',
|
540 | 532 | wwwserve_max_bytes=-1,
|
| 533 | +) |
| 534 | + |
| 535 | + |
| 536 | +def generate_confs( |
| 537 | + generateconfs_output_path, |
| 538 | + # NOTE: make sure command line args with white-space are properly wrapped |
| 539 | + generateconfs_command=subprocess.list2cmdline(sys.argv), |
| 540 | + source=keyword_auto, |
| 541 | + destination=keyword_auto, |
| 542 | + user=keyword_auto, |
| 543 | + group=keyword_auto, |
| 544 | + timezone=keyword_auto, |
| 545 | + destination_suffix="", |
| 546 | + base_fqdn=_DEFAULTS.base_fqdn, |
| 547 | + public_fqdn=_DEFAULTS.public_fqdn, |
| 548 | + public_alias_fqdn=_DEFAULTS.public_alias_fqdn, |
| 549 | + public_sec_fqdn=_DEFAULTS.public_sec_fqdn, |
| 550 | + status_alias_fqdn=_DEFAULTS.status_alias_fqdn, |
| 551 | + mig_cert_fqdn=_DEFAULTS.mig_cert_fqdn, |
| 552 | + ext_cert_fqdn=_DEFAULTS.ext_cert_fqdn, |
| 553 | + mig_oid_fqdn=_DEFAULTS.mig_oid_fqdn, |
| 554 | + ext_oid_fqdn=_DEFAULTS.ext_oid_fqdn, |
| 555 | + mig_oidc_fqdn=_DEFAULTS.mig_oidc_fqdn, |
| 556 | + ext_oidc_fqdn=_DEFAULTS.ext_oidc_fqdn, |
| 557 | + sid_fqdn=_DEFAULTS.sid_fqdn, |
| 558 | + io_fqdn=_DEFAULTS.io_fqdn, |
| 559 | + cert_fqdn_extras=_DEFAULTS.cert_fqdn_extras, |
| 560 | + cloud_fqdn=_DEFAULTS.cloud_fqdn, |
| 561 | + seafile_fqdn=_DEFAULTS.seafile_fqdn, |
| 562 | + seafile_base=_DEFAULTS.seafile_base, |
| 563 | + seafmedia_base=_DEFAULTS.seafmedia_base, |
| 564 | + seafhttp_base=_DEFAULTS.seafhttp_base, |
| 565 | + openid_address=_DEFAULTS.openid_address, |
| 566 | + sftp_address=_DEFAULTS.sftp_address, |
| 567 | + sftp_subsys_address=_DEFAULTS.sftp_subsys_address, |
| 568 | + ftps_address=_DEFAULTS.ftps_address, |
| 569 | + davs_address=_DEFAULTS.davs_address, |
| 570 | + jupyter_services=_DEFAULTS.jupyter_services, |
| 571 | + jupyter_services_desc=_DEFAULTS.jupyter_services_desc, |
| 572 | + jupyter_services_enable_proxy_https=_DEFAULTS.jupyter_services_enable_proxy_https, |
| 573 | + jupyter_services_proxy_config=_DEFAULTS.jupyter_services_proxy_config, |
| 574 | + cloud_services=_DEFAULTS.cloud_services, |
| 575 | + cloud_services_desc=_DEFAULTS.cloud_services_desc, |
| 576 | + apache_version=_DEFAULTS.apache_version, |
| 577 | + apache_etc=_DEFAULTS.apache_etc, |
| 578 | + apache_run=_DEFAULTS.apache_run, |
| 579 | + apache_lock=_DEFAULTS.apache_lock, |
| 580 | + apache_log=_DEFAULTS.apache_log, |
| 581 | + apache_worker_procs=_DEFAULTS.apache_worker_procs, |
| 582 | + openssh_version=_DEFAULTS.openssh_version, |
| 583 | + mig_code=_DEFAULTS.mig_code, |
| 584 | + mig_state=_DEFAULTS.mig_state, |
| 585 | + mig_certs=_DEFAULTS.mig_certs, |
| 586 | + auto_add_cert_user=_DEFAULTS.auto_add_cert_user, |
| 587 | + auto_add_oid_user=_DEFAULTS.auto_add_oid_user, |
| 588 | + auto_add_oidc_user=_DEFAULTS.auto_add_oidc_user, |
| 589 | + auto_add_filter_fields=_DEFAULTS.auto_add_filter_fields, |
| 590 | + auto_add_filter_method=_DEFAULTS.auto_add_filter_method, |
| 591 | + auto_add_user_permit=_DEFAULTS.auto_add_user_permit, |
| 592 | + auto_add_user_with_peer=_DEFAULTS.auto_add_user_with_peer, |
| 593 | + cert_valid_days=_DEFAULTS.cert_valid_days, |
| 594 | + oid_valid_days=_DEFAULTS.oid_valid_days, |
| 595 | + oidc_valid_days=_DEFAULTS.oidc_valid_days, |
| 596 | + generic_valid_days=_DEFAULTS.generic_valid_days, |
| 597 | + enable_migadmin=_DEFAULTS.enable_migadmin, |
| 598 | + enable_sftp=_DEFAULTS.enable_sftp, |
| 599 | + enable_sftp_subsys=_DEFAULTS.enable_sftp_subsys, |
| 600 | + sftp_subsys_auth_procs=_DEFAULTS.sftp_subsys_auth_procs, |
| 601 | + enable_davs=_DEFAULTS.enable_davs, |
| 602 | + enable_ftps=_DEFAULTS.enable_ftps, |
| 603 | + enable_wsgi=_DEFAULTS.enable_wsgi, |
| 604 | + wsgi_procs=_DEFAULTS.wsgi_procs, |
| 605 | + enable_gdp=_DEFAULTS.enable_gdp, |
| 606 | + enable_jobs=_DEFAULTS.enable_jobs, |
| 607 | + enable_resources=_DEFAULTS.enable_resources, |
| 608 | + enable_workflows=_DEFAULTS.enable_workflows, |
| 609 | + enable_events=_DEFAULTS.enable_events, |
| 610 | + enable_sharelinks=_DEFAULTS.enable_sharelinks, |
| 611 | + enable_transfers=_DEFAULTS.enable_transfers, |
| 612 | + enable_freeze=_DEFAULTS.enable_freeze, |
| 613 | + enable_sandboxes=_DEFAULTS.enable_sandboxes, |
| 614 | + enable_vmachines=_DEFAULTS.enable_vmachines, |
| 615 | + enable_preview=_DEFAULTS.enable_preview, |
| 616 | + enable_jupyter=_DEFAULTS.enable_jupyter, |
| 617 | + enable_cloud=_DEFAULTS.enable_cloud, |
| 618 | + enable_hsts=_DEFAULTS.enable_hsts, |
| 619 | + enable_vhost_certs=_DEFAULTS.enable_vhost_certs, |
| 620 | + enable_verify_certs=_DEFAULTS.enable_verify_certs, |
| 621 | + enable_seafile=_DEFAULTS.enable_seafile, |
| 622 | + enable_duplicati=_DEFAULTS.enable_duplicati, |
| 623 | + enable_crontab=_DEFAULTS.enable_crontab, |
| 624 | + enable_notify=_DEFAULTS.enable_notify, |
| 625 | + enable_imnotify=_DEFAULTS.enable_imnotify, |
| 626 | + enable_dev_accounts=_DEFAULTS.enable_dev_accounts, |
| 627 | + enable_twofactor=_DEFAULTS.enable_twofactor, |
| 628 | + twofactor_mandatory_protos=_DEFAULTS.twofactor_mandatory_protos, |
| 629 | + enable_twofactor_strict_address=_DEFAULTS.enable_twofactor_strict_address, |
| 630 | + twofactor_auth_apps=_DEFAULTS.twofactor_auth_apps, |
| 631 | + enable_peers=_DEFAULTS.enable_peers, |
| 632 | + peers_mandatory=_DEFAULTS.peers_mandatory, |
| 633 | + peers_explicit_fields=_DEFAULTS.peers_explicit_fields, |
| 634 | + peers_contact_hint=_DEFAULTS.peers_contact_hint, |
| 635 | + enable_cracklib=_DEFAULTS.enable_cracklib, |
| 636 | + enable_openid=_DEFAULTS.enable_openid, |
| 637 | + enable_gravatars=_DEFAULTS.enable_gravatars, |
| 638 | + enable_sitestatus=_DEFAULTS.enable_sitestatus, |
| 639 | + enable_quota=_DEFAULTS.enable_quota, |
| 640 | + prefer_python3=_DEFAULTS.prefer_python3, |
| 641 | + io_account_expire=_DEFAULTS.io_account_expire, |
| 642 | + gdp_email_notify=_DEFAULTS.gdp_email_notify, |
| 643 | + user_interface=_DEFAULTS.user_interface, |
| 644 | + mig_oid_title=_DEFAULTS.mig_oid_title, |
| 645 | + mig_oid_provider=_DEFAULTS.mig_oid_provider, |
| 646 | + ext_oid_title=_DEFAULTS.ext_oid_title, |
| 647 | + ext_oid_provider=_DEFAULTS.ext_oid_provider, |
| 648 | + mig_oidc_title=_DEFAULTS.mig_oidc_title, |
| 649 | + mig_oidc_provider_meta_url=_DEFAULTS.mig_oidc_provider_meta_url, |
| 650 | + ext_oidc_title=_DEFAULTS.ext_oidc_title, |
| 651 | + ext_oidc_provider_meta_url=_DEFAULTS.ext_oidc_provider_meta_url, |
| 652 | + ext_oidc_provider_issuer=_DEFAULTS.ext_oidc_provider_issuer, |
| 653 | + ext_oidc_provider_authorization_endpoint=_DEFAULTS.ext_oidc_provider_authorization_endpoint, |
| 654 | + ext_oidc_provider_verify_cert_files=_DEFAULTS.ext_oidc_provider_verify_cert_files, |
| 655 | + ext_oidc_provider_token_endpoint=_DEFAULTS.ext_oidc_provider_token_endpoint, |
| 656 | + ext_oidc_provider_token_endpoint_auth=_DEFAULTS.ext_oidc_provider_token_endpoint_auth, |
| 657 | + ext_oidc_provider_user_info_endpoint=_DEFAULTS.ext_oidc_provider_user_info_endpoint, |
| 658 | + ext_oidc_scope=_DEFAULTS.ext_oidc_scope, |
| 659 | + ext_oidc_user_info_token_method=_DEFAULTS.ext_oidc_user_info_token_method, |
| 660 | + ext_oidc_public_key_files=_DEFAULTS.ext_oidc_public_key_files, |
| 661 | + ext_oidc_private_key_files=_DEFAULTS.ext_oidc_private_key_files, |
| 662 | + ext_oidc_response_type=_DEFAULTS.ext_oidc_response_type, |
| 663 | + ext_oidc_response_mode=_DEFAULTS.ext_oidc_response_mode, |
| 664 | + ext_oidc_client_id=_DEFAULTS.ext_oidc_client_id, |
| 665 | + ext_oidc_client_name=_DEFAULTS.ext_oidc_client_name, |
| 666 | + ext_oidc_pkce_method=_DEFAULTS.ext_oidc_pkce_method, |
| 667 | + ext_oidc_id_token_encrypted_response_alg=_DEFAULTS.ext_oidc_id_token_encrypted_response_alg, |
| 668 | + ext_oidc_id_token_encrypted_response_enc=_DEFAULTS.ext_oidc_id_token_encrypted_response_enc, |
| 669 | + ext_oidc_user_info_signed_response_alg=_DEFAULTS.ext_oidc_user_info_signed_response_alg, |
| 670 | + ext_oidc_cookie_same_site=_DEFAULTS.ext_oidc_cookie_same_site, |
| 671 | + ext_oidc_pass_cookies=_DEFAULTS.ext_oidc_pass_cookies, |
| 672 | + ext_oidc_remote_user_claim=_DEFAULTS.ext_oidc_remote_user_claim, |
| 673 | + ext_oidc_pass_claim_as=_DEFAULTS.ext_oidc_pass_claim_as, |
| 674 | + ext_oidc_rewrite_cookie=_DEFAULTS.ext_oidc_rewrite_cookie, |
| 675 | + dhparams_path=_DEFAULTS.dhparams_path, |
| 676 | + daemon_keycert=_DEFAULTS.daemon_keycert, |
| 677 | + daemon_keycert_sha256=_DEFAULTS.daemon_keycert_sha256, |
| 678 | + daemon_pubkey=_DEFAULTS.daemon_pubkey, |
| 679 | + daemon_pubkey_from_dns=_DEFAULTS.daemon_pubkey_from_dns, |
| 680 | + daemon_pubkey_md5=_DEFAULTS.daemon_pubkey_md5, |
| 681 | + daemon_pubkey_sha256=_DEFAULTS.daemon_pubkey_sha256, |
| 682 | + daemon_show_address=_DEFAULTS.daemon_show_address, |
| 683 | + alias_field=_DEFAULTS.alias_field, |
| 684 | + peers_permit=_DEFAULTS.peers_permit, |
| 685 | + vgrid_creators=_DEFAULTS.vgrid_creators, |
| 686 | + vgrid_managers=_DEFAULTS.vgrid_managers, |
| 687 | + signup_methods=_DEFAULTS.signup_methods, |
| 688 | + login_methods=_DEFAULTS.login_methods, |
| 689 | + digest_salt=_DEFAULTS.digest_salt, |
| 690 | + crypto_salt=_DEFAULTS.crypto_salt, |
| 691 | + csrf_protection=_DEFAULTS.csrf_protection, |
| 692 | + password_policy=_DEFAULTS.password_policy, |
| 693 | + password_legacy_policy=_DEFAULTS.password_legacy_policy, |
| 694 | + hg_path=_DEFAULTS.hg_path, |
| 695 | + hgweb_scripts=_DEFAULTS.hgweb_scripts, |
| 696 | + trac_admin_path=_DEFAULTS.trac_admin_path, |
| 697 | + trac_ini_path=_DEFAULTS.trac_ini_path, |
| 698 | + public_port=_DEFAULTS.public_port, |
| 699 | + public_http_port=_DEFAULTS.public_http_port, |
| 700 | + public_https_port=_DEFAULTS.public_https_port, |
| 701 | + mig_cert_port=_DEFAULTS.mig_cert_port, |
| 702 | + ext_cert_port=_DEFAULTS.ext_cert_port, |
| 703 | + mig_oid_port=_DEFAULTS.mig_oid_port, |
| 704 | + ext_oid_port=_DEFAULTS.ext_oid_port, |
| 705 | + mig_oidc_port=_DEFAULTS.mig_oidc_port, |
| 706 | + ext_oidc_port=_DEFAULTS.ext_oidc_port, |
| 707 | + sid_port=_DEFAULTS.sid_port, |
| 708 | + sftp_port=_DEFAULTS.sftp_port, |
| 709 | + sftp_subsys_port=_DEFAULTS.sftp_subsys_port, |
| 710 | + sftp_show_port=_DEFAULTS.sftp_show_port, |
| 711 | + sftp_max_sessions=_DEFAULTS.sftp_max_sessions, |
| 712 | + davs_port=_DEFAULTS.davs_port, |
| 713 | + davs_show_port=_DEFAULTS.davs_show_port, |
| 714 | + ftps_ctrl_port=_DEFAULTS.ftps_ctrl_port, |
| 715 | + ftps_ctrl_show_port=_DEFAULTS.ftps_ctrl_show_port, |
| 716 | + ftps_pasv_ports=_DEFAULTS.ftps_pasv_ports, |
| 717 | + openid_port=_DEFAULTS.openid_port, |
| 718 | + openid_show_port=_DEFAULTS.openid_show_port, |
| 719 | + openid_session_lifetime=_DEFAULTS.openid_session_lifetime, |
| 720 | + seafile_secret=_DEFAULTS.seafile_secret, |
| 721 | + seafile_ccnetid=_DEFAULTS.seafile_ccnetid, |
| 722 | + seafile_seahub_port=_DEFAULTS.seafile_seahub_port, |
| 723 | + seafile_seafhttp_port=_DEFAULTS.seafile_seafhttp_port, |
| 724 | + seafile_client_port=_DEFAULTS.seafile_client_port, |
| 725 | + seafile_quota=_DEFAULTS.seafile_quota, |
| 726 | + seafile_ro_access=_DEFAULTS.seafile_ro_access, |
| 727 | + public_use_https=_DEFAULTS.public_use_https, |
| 728 | + user_clause=_DEFAULTS.user_clause, |
| 729 | + group_clause=_DEFAULTS.group_clause, |
| 730 | + listen_clause=_DEFAULTS.listen_clause, |
| 731 | + serveralias_clause=_DEFAULTS.serveralias_clause, |
| 732 | + distro=_DEFAULTS.distro, |
| 733 | + autolaunch_page=_DEFAULTS.autolaunch_page, |
| 734 | + landing_page=_DEFAULTS.landing_page, |
| 735 | + skin=_DEFAULTS.skin, |
| 736 | + title=_DEFAULTS.title, |
| 737 | + short_title=_DEFAULTS.short_title, |
| 738 | + extra_userpage_scripts=_DEFAULTS.extra_userpage_scripts, |
| 739 | + extra_userpage_styles=_DEFAULTS.extra_userpage_styles, |
| 740 | + external_doc=_DEFAULTS.external_doc, |
| 741 | + vgrid_label=_DEFAULTS.vgrid_label, |
| 742 | + secscan_addr=_DEFAULTS.secscan_addr, |
| 743 | + default_menu=_DEFAULTS.default_menu, |
| 744 | + user_menu=_DEFAULTS.user_menu, |
| 745 | + collaboration_links=_DEFAULTS.collaboration_links, |
| 746 | + default_vgrid_links=_DEFAULTS.default_vgrid_links, |
| 747 | + advanced_vgrid_links=_DEFAULTS.advanced_vgrid_links, |
| 748 | + support_email=_DEFAULTS.support_email, |
| 749 | + admin_email=_DEFAULTS.admin_email, |
| 750 | + admin_list=_DEFAULTS.admin_list, |
| 751 | + smtp_server=_DEFAULTS.smtp_server, |
| 752 | + smtp_sender=_DEFAULTS.smtp_sender, |
| 753 | + permanent_freeze=_DEFAULTS.permanent_freeze, |
| 754 | + log_level=_DEFAULTS.log_level, |
| 755 | + freeze_to_tape=_DEFAULTS.freeze_to_tape, |
| 756 | + status_system_match=_DEFAULTS.status_system_match, |
| 757 | + storage_protocols=_DEFAULTS.storage_protocols, |
| 758 | + duplicati_protocols=_DEFAULTS.duplicati_protocols, |
| 759 | + imnotify_address=_DEFAULTS.imnotify_address, |
| 760 | + imnotify_channel=_DEFAULTS.imnotify_channel, |
| 761 | + imnotify_username=_DEFAULTS.imnotify_username, |
| 762 | + imnotify_password=_DEFAULTS.imnotify_password, |
| 763 | + gdp_data_categories=_DEFAULTS.gdp_data_categories, |
| 764 | + gdp_id_scramble=_DEFAULTS.gdp_id_scramble, |
| 765 | + gdp_path_scramble=_DEFAULTS.gdp_path_scramble, |
| 766 | + quota_backend=_DEFAULTS.quota_backend, |
| 767 | + quota_user_limit=_DEFAULTS.quota_user_limit, |
| 768 | + quota_vgrid_limit=_DEFAULTS.quota_vgrid_limit, |
| 769 | + ca_fqdn=_DEFAULTS.ca_fqdn, |
| 770 | + ca_user=_DEFAULTS.ca_user, |
| 771 | + ca_smtp=_DEFAULTS.ca_smtp, |
| 772 | + datasafety_link=_DEFAULTS.datasafety_link, |
| 773 | + datasafety_text=_DEFAULTS.datasafety_text, |
| 774 | + wwwserve_max_bytes=_DEFAULTS.wwwserve_max_bytes, |
541 | 775 | _getpwnam=pwd.getpwnam,
|
542 | 776 | _prepare=None,
|
543 | 777 | _writefiles=None,
|
@@ -630,6 +864,9 @@ def generate_confs(
|
630 | 864 | return (options, user_dict)
|
631 | 865 |
|
632 | 866 |
|
| 867 | +_GENERATE_CONFS_PARAMETERS = set(inspect_args(generate_confs)) - set(_GENERATE_CONFS_NOFORWARD_KEYS) |
| 868 | + |
| 869 | + |
633 | 870 | def _generate_confs_prepare(
|
634 | 871 | options,
|
635 | 872 | # forwarded arguments
|
|
0 commit comments