| 45 | self.opts["config_dir"] = os.path.dirname(c_path) |
| 46 | |
| 47 | def sanitize_kwargs(self, kwargs): |
| 48 | roster_vals = [ |
| 49 | ("host", str), |
| 50 | ("ssh_user", str), |
| 51 | ("ssh_passwd", str), |
| 52 | ("ssh_port", int), |
| 53 | ("ssh_sudo", bool), |
| 54 | ("ssh_sudo_user", str), |
| 55 | ("ssh_priv", str), |
| 56 | ("ssh_priv_passwd", str), |
| 57 | ("ssh_identities_only", bool), |
| 58 | ("ssh_remote_port_forwards", str), |
| 59 | ("ssh_keepalive", bool), |
| 60 | ("ssh_keepalive_interval", int), |
| 61 | ("ssh_keepalive_count_max", int), |
| 62 | ("ssh_options", list), |
| 63 | ("ssh_max_procs", int), |
| 64 | ("ssh_askpass", bool), |
| 65 | ("ssh_key_deploy", bool), |
| 66 | ("ssh_update_roster", bool), |
| 67 | ("ssh_scan_ports", str), |
| 68 | ("ssh_scan_timeout", int), |
| 69 | ("ssh_timeout", int), |
| 70 | ("ssh_log_file", str), |
| 71 | ("ssh_pre_hook", str), |
| 72 | ("raw_shell", bool), |
| 73 | ("refresh_cache", bool), |
| 74 | ("roster", str), |
| 75 | ("roster_file", str), |
| 76 | ("rosters", list), |
| 77 | ("ignore_host_keys", bool), |
| 78 | ("raw_shell", bool), |
| 79 | ("extra_filerefs", str), |
| 80 | ("min_extra_mods", str), |
| 81 | ("thin_extra_mods", str), |
| 82 | ("verbose", bool), |
| 83 | ("static", bool), |
| 84 | ("ssh_wipe", bool), |
| 85 | ("rand_thin_dir", bool), |
| 86 | ("regen_thin", bool), |
| 87 | ("ssh_run_pre_flight", bool), |
| 88 | ("no_host_keys", bool), |
| 89 | ("saltfile", str), |
| 90 | ] |
| 91 | sane_kwargs = {} |
| 92 | for name, kind in roster_vals: |
| 93 | if name not in kwargs: |
| 94 | continue |
| 95 | try: |
| 96 | val = kind(kwargs[name]) |
| 97 | except ValueError: |
| 98 | log.warning("Unable to cast kwarg %s", name) |
| 99 | continue |
| 100 | if kind is bool or kind is int: |
| 101 | sane_kwargs[name] = val |
| 102 | elif kind is str: |
| 103 | if val.find("ProxyCommand") != -1: |
| 104 | log.warning("Filter unsafe value for kwarg %s", name) |