Inheritance: System.Diagnostics.Process
        bool CreateKeyPair()
        {
            string key_file_name = DateTime.Now.ToString ("yyyy-MM-dd_HH\\hmm") + ".key";
            string computer_name = Dns.GetHostName ();

            if (computer_name.EndsWith (".local",  StringComparison.InvariantCultureIgnoreCase) ||
                computer_name.EndsWith (".config", StringComparison.InvariantCultureIgnoreCase))

                computer_name = computer_name.Substring (0,
                    computer_name.LastIndexOf (".", StringComparison.InvariantCulture));

            string arguments =
                "-t rsa "  + // Crypto type
                "-b 4096 " + // Key size
                "-P \"\" " + // No password
                "-C \"" + computer_name + " (SparkleShare)\" " + // Key comment
                "-f \"" + key_file_name + "\"";

            var ssh_keygen = new Command ("ssh-keygen", arguments);
            ssh_keygen.StartInfo.WorkingDirectory = Path;
            ssh_keygen.StartAndWaitForExit ();

            if (ssh_keygen.ExitCode == 0) {
                Logger.LogInfo ("Auth", "Created key pair: " + key_file_name);
                ImportKeys ();

                return true;
            }

            Logger.LogInfo ("Auth", "Could not create key pair");
            return false;
        }
Beispiel #2
0
        public override void CreateStartupItem()
        {
            // There aren't any bindings in MonoMac to support this yet, so
            // we call out to an applescript to do the job

            string args = "-e 'tell application \"System Events\" to " +
                "make login item at end with properties " +
                "{path:\"" + NSBundle.MainBundle.BundlePath + "\", hidden:false}'";

            var process = new Command ("osascript", args);
            process.StartAndWaitForExit ();

            Logger.LogInfo ("Controller", "Added " + NSBundle.MainBundle.BundlePath + " to login items");
        }
Beispiel #3
0
        string FetchHostKey()
        {
            Logger.LogInfo ("Auth", string.Format ("Fetching host key for {0}", RemoteUrl.Host));
            var ssh_keyscan = new Command ("ssh-keyscan", string.Format ("-t rsa -p 22 {0}", RemoteUrl.Host));

            if (RemoteUrl.Port > 0)
                ssh_keyscan.StartInfo.Arguments = string.Format ("-t rsa -p {0} {1}", RemoteUrl.Port, RemoteUrl.Host);

            string host_key = ssh_keyscan.StartAndReadStandardOutput ();

            if (ssh_keyscan.ExitCode == 0 && !string.IsNullOrWhiteSpace (host_key))
                return host_key;

            return null;
        }
Beispiel #4
0
        public override void SetFolderIcon()
        {
            var gvfs_set_attribute = new Command ("gvfs-set-attribute", "\"" + Configuration.DefaultConfiguration.FoldersPath + "\" " +
                "metadata::custom-icon-name org.sparkleshare.SparkleShare");

            gvfs_set_attribute.StartInfo.EnvironmentVariables ["XDG_DATA_HOME"] =
                Path.Combine (Config.HomePath, ".local", "share");

            gvfs_set_attribute.StartAndWaitForExit ();
        }