difftreelog
feat initial work on russh+remowt prototype
in: trunk
30 files changed
.rustfmt.tomldiffbeforeafterboth--- /dev/null
+++ b/.rustfmt.toml
@@ -0,0 +1 @@
+hard_tabs = true
Cargo.lockdiffbeforeafterboth17source = "registry+https://github.com/rust-lang/crates.io-index"17source = "registry+https://github.com/rust-lang/crates.io-index"18checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"18checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"1920[[package]]21name = "adler2"22version = "2.0.0"23source = "registry+https://github.com/rust-lang/crates.io-index"24checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"2526[[package]]27name = "aead"28version = "0.5.2"29source = "registry+https://github.com/rust-lang/crates.io-index"30checksum = "d122413f284cf2d62fb1b7db97e02edb8cda96d769b16e443a4f6195e35662b0"31dependencies = [32 "crypto-common",33 "generic-array",34]3536[[package]]37name = "aes"38version = "0.8.4"39source = "registry+https://github.com/rust-lang/crates.io-index"40checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0"41dependencies = [42 "cfg-if",43 "cipher",44 "cpufeatures",45]4647[[package]]48name = "aes-gcm"49version = "0.10.3"50source = "registry+https://github.com/rust-lang/crates.io-index"51checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1"52dependencies = [53 "aead",54 "aes",55 "cipher",56 "ctr",57 "ghash",58 "subtle",59]196020[[package]]61[[package]]21name = "aho-corasick"62name = "aho-corasick"247 "cc",288 "cc",248 "cfg-if",289 "cfg-if",249 "libc",290 "libc",250 "miniz_oxide",291 "miniz_oxide 0.7.4",251 "object",292 "object",252 "rustc-demangle",293 "rustc-demangle",253]294]295296[[package]]297name = "base16ct"298version = "0.2.0"299source = "registry+https://github.com/rust-lang/crates.io-index"300checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf"301302[[package]]303name = "base64ct"304version = "1.6.0"305source = "registry+https://github.com/rust-lang/crates.io-index"306checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b"307308[[package]]309name = "bcrypt-pbkdf"310version = "0.10.0"311source = "registry+https://github.com/rust-lang/crates.io-index"312checksum = "6aeac2e1fe888769f34f05ac343bbef98b14d1ffb292ab69d4608b3abc86f2a2"313dependencies = [314 "blowfish",315 "pbkdf2 0.12.2",316 "sha2",317]318319[[package]]320name = "bifrostlink"321version = "0.1.0"322dependencies = [323 "async-trait",324 "bytes",325 "derivative",326 "futures",327 "serde",328 "serde_json",329 "tokio",330 "tracing",331 "uuid",332]333334[[package]]335name = "bifrostlink-ports"336version = "0.1.0"337dependencies = [338 "bifrostlink",339 "bytes",340 "tokio",341 "tracing",342]254343255[[package]]344[[package]]256name = "bindgen"345name = "bindgen"293 "generic-array",382 "generic-array",294]383]384385[[package]]386name = "block-padding"387version = "0.3.3"388source = "registry+https://github.com/rust-lang/crates.io-index"389checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93"390dependencies = [391 "generic-array",392]295393296[[package]]394[[package]]297name = "blocking"395name = "blocking"306 "piper",404 "piper",307]405]406407[[package]]408name = "blowfish"409version = "0.9.1"410source = "registry+https://github.com/rust-lang/crates.io-index"411checksum = "e412e2cd0f2b2d93e02543ceae7917b3c70331573df19ee046bcbc35e45e87d7"412dependencies = [413 "byteorder",414 "cipher",415]416417[[package]]418name = "bstr"419version = "1.10.0"420source = "registry+https://github.com/rust-lang/crates.io-index"421checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c"422dependencies = [423 "memchr",424 "serde",425]426427[[package]]428name = "bumpalo"429version = "3.16.0"430source = "registry+https://github.com/rust-lang/crates.io-index"431checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"308432309[[package]]433[[package]]310name = "byteorder"434name = "byteorder"318source = "registry+https://github.com/rust-lang/crates.io-index"442source = "registry+https://github.com/rust-lang/crates.io-index"319checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50"443checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50"444445[[package]]446name = "cbc"447version = "0.1.2"448source = "registry+https://github.com/rust-lang/crates.io-index"449checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6"450dependencies = [451 "cipher",452]320453321[[package]]454[[package]]322name = "cc"455name = "cc"345source = "registry+https://github.com/rust-lang/crates.io-index"478source = "registry+https://github.com/rust-lang/crates.io-index"346checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"479checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"480481[[package]]482name = "chacha20"483version = "0.9.1"484source = "registry+https://github.com/rust-lang/crates.io-index"485checksum = "c3613f74bd2eac03dad61bd53dbe620703d4371614fe0bc3b9f04dd36fe4e818"486dependencies = [487 "cfg-if",488 "cipher",489 "cpufeatures",490]491492[[package]]493name = "cipher"494version = "0.4.4"495source = "registry+https://github.com/rust-lang/crates.io-index"496checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad"497dependencies = [498 "crypto-common",499 "inout",500]347501348[[package]]502[[package]]349name = "clang-sys"503name = "clang-sys"357511358[[package]]512[[package]]359name = "clap"513name = "clap"360version = "4.5.13"514version = "4.5.16"361source = "registry+https://github.com/rust-lang/crates.io-index"515source = "registry+https://github.com/rust-lang/crates.io-index"362checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc"516checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019"363dependencies = [517dependencies = [364 "clap_builder",518 "clap_builder",365 "clap_derive",519 "clap_derive",366]520]367521368[[package]]522[[package]]369name = "clap_builder"523name = "clap_builder"370version = "4.5.13"524version = "4.5.15"371source = "registry+https://github.com/rust-lang/crates.io-index"525source = "registry+https://github.com/rust-lang/crates.io-index"372checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99"526checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6"373dependencies = [527dependencies = [374 "anstream",528 "anstream",375 "anstyle",529 "anstyle",410 "crossbeam-utils",564 "crossbeam-utils",411]565]566567[[package]]568name = "const-oid"569version = "0.9.6"570source = "registry+https://github.com/rust-lang/crates.io-index"571checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8"412572413[[package]]573[[package]]414name = "cpufeatures"574name = "cpufeatures"419 "libc",579 "libc",420]580]581582[[package]]583name = "crc32fast"584version = "1.4.2"585source = "registry+https://github.com/rust-lang/crates.io-index"586checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3"587dependencies = [588 "cfg-if",589]421590422[[package]]591[[package]]423name = "crossbeam-utils"592name = "crossbeam-utils"424version = "0.8.20"593version = "0.8.20"425source = "registry+https://github.com/rust-lang/crates.io-index"594source = "registry+https://github.com/rust-lang/crates.io-index"426checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"595checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80"596597[[package]]598name = "crypto-bigint"599version = "0.5.5"600source = "registry+https://github.com/rust-lang/crates.io-index"601checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76"602dependencies = [603 "generic-array",604 "rand_core 0.6.4",605 "subtle",606 "zeroize",607]427608428[[package]]609[[package]]429name = "crypto-common"610name = "crypto-common"432checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"613checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3"433dependencies = [614dependencies = [434 "generic-array",615 "generic-array",616 "rand_core 0.6.4",435 "typenum",617 "typenum",436]618]619620[[package]]621name = "ctr"622version = "0.9.2"623source = "registry+https://github.com/rust-lang/crates.io-index"624checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835"625dependencies = [626 "cipher",627]628629[[package]]630name = "curve25519-dalek"631version = "4.1.3"632source = "registry+https://github.com/rust-lang/crates.io-index"633checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be"634dependencies = [635 "cfg-if",636 "cpufeatures",637 "curve25519-dalek-derive",638 "digest",639 "fiat-crypto",640 "rustc_version",641 "subtle",642 "zeroize",643]644645[[package]]646name = "curve25519-dalek-derive"647version = "0.1.1"648source = "registry+https://github.com/rust-lang/crates.io-index"649checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3"650dependencies = [651 "proc-macro2",652 "quote",653 "syn 2.0.72",654]655656[[package]]657name = "data-encoding"658version = "2.6.0"659source = "registry+https://github.com/rust-lang/crates.io-index"660checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2"661662[[package]]663name = "delegate"664version = "0.12.0"665source = "registry+https://github.com/rust-lang/crates.io-index"666checksum = "4e018fccbeeb50ff26562ece792ed06659b9c2dae79ece77c4456bb10d9bf79b"667dependencies = [668 "proc-macro2",669 "quote",670 "syn 2.0.72",671]672673[[package]]674name = "der"675version = "0.7.9"676source = "registry+https://github.com/rust-lang/crates.io-index"677checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0"678dependencies = [679 "const-oid",680 "pem-rfc7468",681 "zeroize",682]683684[[package]]685name = "derivative"686version = "2.2.0"687source = "registry+https://github.com/rust-lang/crates.io-index"688checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"689dependencies = [690 "proc-macro2",691 "quote",692 "syn 1.0.109",693]694695[[package]]696name = "des"697version = "0.8.1"698source = "registry+https://github.com/rust-lang/crates.io-index"699checksum = "ffdd80ce8ce993de27e9f063a444a4d53ce8e8db4c1f00cc03af5ad5a9867a1e"700dependencies = [701 "cipher",702]437703438[[package]]704[[package]]439name = "digest"705name = "digest"442checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"708checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"443dependencies = [709dependencies = [444 "block-buffer",710 "block-buffer",711 "const-oid",445 "crypto-common",712 "crypto-common",713 "subtle",446]714]715716[[package]]717name = "ecdsa"718version = "0.16.9"719source = "registry+https://github.com/rust-lang/crates.io-index"720checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca"721dependencies = [722 "der",723 "digest",724 "elliptic-curve",725 "rfc6979",726 "signature",727 "spki",728]729730[[package]]731name = "ed25519"732version = "2.2.3"733source = "registry+https://github.com/rust-lang/crates.io-index"734checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53"735dependencies = [736 "pkcs8",737 "signature",738]739740[[package]]741name = "ed25519-dalek"742version = "2.1.1"743source = "registry+https://github.com/rust-lang/crates.io-index"744checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871"745dependencies = [746 "curve25519-dalek",747 "ed25519",748 "rand_core 0.6.4",749 "serde",750 "sha2",751 "subtle",752 "zeroize",753]447754448[[package]]755[[package]]449name = "either"756name = "either"450version = "1.13.0"757version = "1.13.0"451source = "registry+https://github.com/rust-lang/crates.io-index"758source = "registry+https://github.com/rust-lang/crates.io-index"452checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"759checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0"760761[[package]]762name = "elliptic-curve"763version = "0.13.8"764source = "registry+https://github.com/rust-lang/crates.io-index"765checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47"766dependencies = [767 "base16ct",768 "crypto-bigint",769 "digest",770 "ff",771 "generic-array",772 "group",773 "hkdf",774 "pem-rfc7468",775 "pkcs8",776 "rand_core 0.6.4",777 "sec1",778 "subtle",779 "zeroize",780]453781454[[package]]782[[package]]455name = "endi"783name = "endi"532source = "registry+https://github.com/rust-lang/crates.io-index"860source = "registry+https://github.com/rust-lang/crates.io-index"533checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"861checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"862863[[package]]864name = "ff"865version = "0.13.0"866source = "registry+https://github.com/rust-lang/crates.io-index"867checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449"868dependencies = [869 "rand_core 0.6.4",870 "subtle",871]872873[[package]]874name = "fiat-crypto"875version = "0.2.9"876source = "registry+https://github.com/rust-lang/crates.io-index"877checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d"878879[[package]]880name = "flate2"881version = "1.0.32"882source = "registry+https://github.com/rust-lang/crates.io-index"883checksum = "9c0596c1eac1f9e04ed902702e9878208b336edc9d6fddc8a48387349bab3666"884dependencies = [885 "crc32fast",886 "miniz_oxide 0.8.0",887]888889[[package]]890name = "fuchsia-cprng"891version = "0.1.1"892source = "registry+https://github.com/rust-lang/crates.io-index"893checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba"894895[[package]]896name = "futures"897version = "0.3.30"898source = "registry+https://github.com/rust-lang/crates.io-index"899checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0"900dependencies = [901 "futures-channel",902 "futures-core",903 "futures-executor",904 "futures-io",905 "futures-sink",906 "futures-task",907 "futures-util",908]909910[[package]]911name = "futures-channel"912version = "0.3.30"913source = "registry+https://github.com/rust-lang/crates.io-index"914checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78"915dependencies = [916 "futures-core",917 "futures-sink",918]534919535[[package]]920[[package]]536name = "futures-core"921name = "futures-core"537version = "0.3.30"922version = "0.3.30"538source = "registry+https://github.com/rust-lang/crates.io-index"923source = "registry+https://github.com/rust-lang/crates.io-index"539checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"924checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d"925926[[package]]927name = "futures-executor"928version = "0.3.30"929source = "registry+https://github.com/rust-lang/crates.io-index"930checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d"931dependencies = [932 "futures-core",933 "futures-task",934 "futures-util",935]540936541[[package]]937[[package]]542name = "futures-io"938name = "futures-io"557 "pin-project-lite",953 "pin-project-lite",558]954]955956[[package]]957name = "futures-macro"958version = "0.3.30"959source = "registry+https://github.com/rust-lang/crates.io-index"960checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac"961dependencies = [962 "proc-macro2",963 "quote",964 "syn 2.0.72",965]559966560[[package]]967[[package]]561name = "futures-sink"968name = "futures-sink"575source = "registry+https://github.com/rust-lang/crates.io-index"982source = "registry+https://github.com/rust-lang/crates.io-index"576checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"983checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48"577dependencies = [984dependencies = [985 "futures-channel",578 "futures-core",986 "futures-core",579 "futures-io",987 "futures-io",988 "futures-macro",580 "futures-sink",989 "futures-sink",581 "futures-task",990 "futures-task",582 "memchr",991 "memchr",593dependencies = [1002dependencies = [594 "typenum",1003 "typenum",595 "version_check",1004 "version_check",1005 "zeroize",596]1006]5971007598[[package]]1008[[package]]606 "wasi",1016 "wasi",607]1017]10181019[[package]]1020name = "ghash"1021version = "0.5.1"1022source = "registry+https://github.com/rust-lang/crates.io-index"1023checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1"1024dependencies = [1025 "opaque-debug",1026 "polyval",1027]6081028609[[package]]1029[[package]]610name = "gimli"1030name = "gimli"618source = "registry+https://github.com/rust-lang/crates.io-index"1038source = "registry+https://github.com/rust-lang/crates.io-index"619checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"1039checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"10401041[[package]]1042name = "globset"1043version = "0.4.14"1044source = "registry+https://github.com/rust-lang/crates.io-index"1045checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1"1046dependencies = [1047 "aho-corasick",1048 "bstr",1049 "log",1050 "regex-automata",1051 "regex-syntax",1052]10531054[[package]]1055name = "group"1056version = "0.13.0"1057source = "registry+https://github.com/rust-lang/crates.io-index"1058checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63"1059dependencies = [1060 "ff",1061 "rand_core 0.6.4",1062 "subtle",1063]6201064621[[package]]1065[[package]]622name = "hashbrown"1066name = "hashbrown"648source = "registry+https://github.com/rust-lang/crates.io-index"1092source = "registry+https://github.com/rust-lang/crates.io-index"649checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"1093checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"10941095[[package]]1096name = "hex-literal"1097version = "0.4.1"1098source = "registry+https://github.com/rust-lang/crates.io-index"1099checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46"11001101[[package]]1102name = "hkdf"1103version = "0.12.4"1104source = "registry+https://github.com/rust-lang/crates.io-index"1105checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7"1106dependencies = [1107 "hmac",1108]11091110[[package]]1111name = "hmac"1112version = "0.12.1"1113source = "registry+https://github.com/rust-lang/crates.io-index"1114checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e"1115dependencies = [1116 "digest",1117]11181119[[package]]1120name = "home"1121version = "0.5.9"1122source = "registry+https://github.com/rust-lang/crates.io-index"1123checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"1124dependencies = [1125 "windows-sys",1126]6501127651[[package]]1128[[package]]652name = "indexmap"1129name = "indexmap"658 "hashbrown",1135 "hashbrown",659]1136]11371138[[package]]1139name = "inout"1140version = "0.1.3"1141source = "registry+https://github.com/rust-lang/crates.io-index"1142checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5"1143dependencies = [1144 "block-padding",1145 "generic-array",1146]6601147661[[package]]1148[[package]]662name = "is_terminal_polyfill"1149name = "is_terminal_polyfill"679source = "registry+https://github.com/rust-lang/crates.io-index"1166source = "registry+https://github.com/rust-lang/crates.io-index"680checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"1167checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b"11681169[[package]]1170name = "js-sys"1171version = "0.3.70"1172source = "registry+https://github.com/rust-lang/crates.io-index"1173checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a"1174dependencies = [1175 "wasm-bindgen",1176]6811177682[[package]]1178[[package]]683name = "lazy_static"1179name = "lazy_static"684version = "1.5.0"1180version = "1.5.0"685source = "registry+https://github.com/rust-lang/crates.io-index"1181source = "registry+https://github.com/rust-lang/crates.io-index"686checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"1182checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"1183dependencies = [1184 "spin",1185]6871186688[[package]]1187[[package]]689name = "lazycell"1188name = "lazycell"697source = "registry+https://github.com/rust-lang/crates.io-index"1196source = "registry+https://github.com/rust-lang/crates.io-index"698checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"1197checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"11981199[[package]]1200name = "libm"1201version = "0.2.8"1202source = "registry+https://github.com/rust-lang/crates.io-index"1203checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058"6991204700[[package]]1205[[package]]701name = "linux-raw-sys"1206name = "linux-raw-sys"709source = "registry+https://github.com/rust-lang/crates.io-index"1214source = "registry+https://github.com/rust-lang/crates.io-index"710checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"1215checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24"12161217[[package]]1218name = "md5"1219version = "0.7.0"1220source = "registry+https://github.com/rust-lang/crates.io-index"1221checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771"7111222712[[package]]1223[[package]]713name = "memchr"1224name = "memchr"739 "adler",1250 "adler",740]1251]12521253[[package]]1254name = "miniz_oxide"1255version = "0.8.0"1256source = "registry+https://github.com/rust-lang/crates.io-index"1257checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1"1258dependencies = [1259 "adler2",1260]7411261742[[package]]1262[[package]]743name = "mio"1263name = "mio"774 "minimal-lexical",1294 "minimal-lexical",775]1295]12961297[[package]]1298name = "non-zero-byte-slice"1299version = "0.1.0"1300source = "registry+https://github.com/rust-lang/crates.io-index"1301checksum = "89daa1daa11c9df05d1181bcd0936d8066f8543144d77b09808eb78d65e38024"1302dependencies = [1303 "serde",1304]7761305777[[package]]1306[[package]]778name = "nu-ansi-term"1307name = "nu-ansi-term"784 "winapi",1313 "winapi",785]1314]13151316[[package]]1317name = "num-bigint"1318version = "0.4.6"1319source = "registry+https://github.com/rust-lang/crates.io-index"1320checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9"1321dependencies = [1322 "num-integer",1323 "num-traits",1324 "rand 0.8.5",1325]13261327[[package]]1328name = "num-bigint-dig"1329version = "0.8.4"1330source = "registry+https://github.com/rust-lang/crates.io-index"1331checksum = "dc84195820f291c7697304f3cbdadd1cb7199c0efc917ff5eafd71225c136151"1332dependencies = [1333 "byteorder",1334 "lazy_static",1335 "libm",1336 "num-integer",1337 "num-iter",1338 "num-traits",1339 "rand 0.8.5",1340 "smallvec",1341 "zeroize",1342]13431344[[package]]1345name = "num-integer"1346version = "0.1.46"1347source = "registry+https://github.com/rust-lang/crates.io-index"1348checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f"1349dependencies = [1350 "num-traits",1351]13521353[[package]]1354name = "num-iter"1355version = "0.1.45"1356source = "registry+https://github.com/rust-lang/crates.io-index"1357checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf"1358dependencies = [1359 "autocfg",1360 "num-integer",1361 "num-traits",1362]13631364[[package]]1365name = "num-traits"1366version = "0.2.19"1367source = "registry+https://github.com/rust-lang/crates.io-index"1368checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"1369dependencies = [1370 "autocfg",1371 "libm",1372]7861373787[[package]]1374[[package]]788name = "object"1375name = "object"799source = "registry+https://github.com/rust-lang/crates.io-index"1386source = "registry+https://github.com/rust-lang/crates.io-index"800checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"1387checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"13881389[[package]]1390name = "opaque-debug"1391version = "0.3.1"1392source = "registry+https://github.com/rust-lang/crates.io-index"1393checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"13941395[[package]]1396name = "openssh"1397version = "0.11.0"1398source = "registry+https://github.com/rust-lang/crates.io-index"1399checksum = "0f27389e5da64700a3efb7f925e442f824f6e3d4b1c27f75e115a92ad3aecbb1"1400dependencies = [1401 "libc",1402 "once_cell",1403 "openssh-mux-client",1404 "shell-escape",1405 "tempfile",1406 "thiserror",1407 "tokio",1408]14091410[[package]]1411name = "openssh-mux-client"1412version = "0.17.5"1413source = "registry+https://github.com/rust-lang/crates.io-index"1414checksum = "b87a1b6780afc5f9f38f81f7928c91c3c24532c48914477ab6caf2ba076ae866"1415dependencies = [1416 "cfg-if",1417 "non-zero-byte-slice",1418 "once_cell",1419 "openssh-mux-client-error",1420 "sendfd",1421 "serde",1422 "ssh_format",1423 "tokio",1424 "tokio-io-utility",1425 "typed-builder",1426]14271428[[package]]1429name = "openssh-mux-client-error"1430version = "0.1.0"1431source = "registry+https://github.com/rust-lang/crates.io-index"1432checksum = "015d49e592f4d2a456033e6ec48036588e8e58c8908424b1bc40994de58ae648"1433dependencies = [1434 "ssh_format_error",1435 "thiserror",1436]8011437802[[package]]1438[[package]]803name = "ordered-stream"1439name = "ordered-stream"815source = "registry+https://github.com/rust-lang/crates.io-index"1451source = "registry+https://github.com/rust-lang/crates.io-index"816checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"1452checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39"14531454[[package]]1455name = "p256"1456version = "0.13.2"1457source = "registry+https://github.com/rust-lang/crates.io-index"1458checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b"1459dependencies = [1460 "ecdsa",1461 "elliptic-curve",1462 "primeorder",1463 "sha2",1464]14651466[[package]]1467name = "p384"1468version = "0.13.0"1469source = "registry+https://github.com/rust-lang/crates.io-index"1470checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209"1471dependencies = [1472 "ecdsa",1473 "elliptic-curve",1474 "primeorder",1475 "sha2",1476]14771478[[package]]1479name = "p521"1480version = "0.13.3"1481source = "registry+https://github.com/rust-lang/crates.io-index"1482checksum = "0fc9e2161f1f215afdfce23677034ae137bbd45016a880c2eb3ba8eb95f085b2"1483dependencies = [1484 "base16ct",1485 "ecdsa",1486 "elliptic-curve",1487 "primeorder",1488 "rand_core 0.6.4",1489 "sha2",1490]14911492[[package]]1493name = "pageant"1494version = "0.0.1-beta.3"1495source = "git+https://github.com/Eugeny/russh/#4115b8fd3a94c17c0178761ea769a40ca410903d"1496dependencies = [1497 "bytes",1498 "delegate",1499 "futures",1500 "rand 0.8.5",1501 "thiserror",1502 "tokio",1503 "windows",1504]8171505818[[package]]1506[[package]]819name = "pam-client"1507name = "pam-client"845source = "registry+https://github.com/rust-lang/crates.io-index"1533source = "registry+https://github.com/rust-lang/crates.io-index"846checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae"1534checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae"15351536[[package]]1537name = "password-hash"1538version = "0.4.2"1539source = "registry+https://github.com/rust-lang/crates.io-index"1540checksum = "7676374caaee8a325c9e7a2ae557f216c5563a171d6997b0ef8a65af35147700"1541dependencies = [1542 "base64ct",1543 "rand_core 0.6.4",1544 "subtle",1545]15461547[[package]]1548name = "pbkdf2"1549version = "0.11.0"1550source = "registry+https://github.com/rust-lang/crates.io-index"1551checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917"1552dependencies = [1553 "digest",1554 "hmac",1555 "password-hash",1556 "sha2",1557]15581559[[package]]1560name = "pbkdf2"1561version = "0.12.2"1562source = "registry+https://github.com/rust-lang/crates.io-index"1563checksum = "f8ed6a7761f76e3b9f92dfb0a60a6a6477c61024b775147ff0973a02653abaf2"1564dependencies = [1565 "digest",1566 "hmac",1567]15681569[[package]]1570name = "pem-rfc7468"1571version = "0.7.0"1572source = "registry+https://github.com/rust-lang/crates.io-index"1573checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412"1574dependencies = [1575 "base64ct",1576]8471577848[[package]]1578[[package]]849name = "pin-project-lite"1579name = "pin-project-lite"868 "futures-io",1598 "futures-io",869]1599]16001601[[package]]1602name = "pkcs1"1603version = "0.7.5"1604source = "registry+https://github.com/rust-lang/crates.io-index"1605checksum = "c8ffb9f10fa047879315e6625af03c164b16962a5368d724ed16323b68ace47f"1606dependencies = [1607 "der",1608 "pkcs8",1609 "spki",1610]16111612[[package]]1613name = "pkcs5"1614version = "0.7.1"1615source = "registry+https://github.com/rust-lang/crates.io-index"1616checksum = "e847e2c91a18bfa887dd028ec33f2fe6f25db77db3619024764914affe8b69a6"1617dependencies = [1618 "aes",1619 "cbc",1620 "der",1621 "pbkdf2 0.12.2",1622 "scrypt",1623 "sha2",1624 "spki",1625]16261627[[package]]1628name = "pkcs8"1629version = "0.10.2"1630source = "registry+https://github.com/rust-lang/crates.io-index"1631checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7"1632dependencies = [1633 "der",1634 "pkcs5",1635 "rand_core 0.6.4",1636 "spki",1637]8701638871[[package]]1639[[package]]872name = "polkit-backend"1640name = "polkit-backend"909 "windows-sys",1677 "windows-sys",910]1678]16791680[[package]]1681name = "poly1305"1682version = "0.8.0"1683source = "registry+https://github.com/rust-lang/crates.io-index"1684checksum = "8159bd90725d2df49889a078b54f4f79e87f1f8a8444194cdca81d38f5393abf"1685dependencies = [1686 "cpufeatures",1687 "opaque-debug",1688 "universal-hash",1689]16901691[[package]]1692name = "polyval"1693version = "0.6.2"1694source = "registry+https://github.com/rust-lang/crates.io-index"1695checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25"1696dependencies = [1697 "cfg-if",1698 "cpufeatures",1699 "opaque-debug",1700 "universal-hash",1701]9111702912[[package]]1703[[package]]913name = "ppv-lite86"1704name = "ppv-lite86"918 "zerocopy",1709 "zerocopy",919]1710]17111712[[package]]1713name = "primeorder"1714version = "0.13.6"1715source = "registry+https://github.com/rust-lang/crates.io-index"1716checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6"1717dependencies = [1718 "elliptic-curve",1719]9201720921[[package]]1721[[package]]922name = "proc-macro-crate"1722name = "proc-macro-crate"945 "proc-macro2",1745 "proc-macro2",946]1746]17471748[[package]]1749name = "rand"1750version = "0.4.6"1751source = "registry+https://github.com/rust-lang/crates.io-index"1752checksum = "552840b97013b1a26992c11eac34bdd778e464601a4c2054b5f0bff7c6761293"1753dependencies = [1754 "fuchsia-cprng",1755 "libc",1756 "rand_core 0.3.1",1757 "rdrand",1758 "winapi",1759]9471760948[[package]]1761[[package]]949name = "rand"1762name = "rand"953dependencies = [1766dependencies = [954 "libc",1767 "libc",955 "rand_chacha",1768 "rand_chacha",956 "rand_core",1769 "rand_core 0.6.4",957]1770]9581771959[[package]]1772[[package]]963checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"1776checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"964dependencies = [1777dependencies = [965 "ppv-lite86",1778 "ppv-lite86",966 "rand_core",1779 "rand_core 0.6.4",967]1780]17811782[[package]]1783name = "rand_core"1784version = "0.3.1"1785source = "registry+https://github.com/rust-lang/crates.io-index"1786checksum = "7a6fdeb83b075e8266dcc8762c22776f6877a63111121f5f8c7411e5be7eed4b"1787dependencies = [1788 "rand_core 0.4.2",1789]17901791[[package]]1792name = "rand_core"1793version = "0.4.2"1794source = "registry+https://github.com/rust-lang/crates.io-index"1795checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc"9681796969[[package]]1797[[package]]970name = "rand_core"1798name = "rand_core"975 "getrandom",1803 "getrandom",976]1804]18051806[[package]]1807name = "rdrand"1808version = "0.4.0"1809source = "registry+https://github.com/rust-lang/crates.io-index"1810checksum = "678054eb77286b51581ba43620cc911abf02758c91f93f479767aed0f90458b2"1811dependencies = [1812 "rand_core 0.3.1",1813]18141815[[package]]1816name = "redox_syscall"1817version = "0.4.1"1818source = "registry+https://github.com/rust-lang/crates.io-index"1819checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa"1820dependencies = [1821 "bitflags 1.3.2",1822]9771823978[[package]]1824[[package]]979name = "regex"1825name = "regex"1004source = "registry+https://github.com/rust-lang/crates.io-index"1850source = "registry+https://github.com/rust-lang/crates.io-index"1005checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"1851checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b"18521853[[package]]1854name = "remove_dir_all"1855version = "0.5.3"1856source = "registry+https://github.com/rust-lang/crates.io-index"1857checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7"1858dependencies = [1859 "winapi",1860]100618611007[[package]]1862[[package]]1008name = "remowt-agent"1863name = "remowt-agent"1009version = "0.1.0"1864version = "0.1.0"1010dependencies = [1865dependencies = [1011 "anyhow",1866 "anyhow",1867 "bifrostlink",1868 "bifrostlink-ports",1012 "clap",1869 "clap",1013 "pam-client",1870 "futures",1871 "futures-util",1872 "nix",1014 "polkit-shared",1873 "polkit-shared",1015 "rand",1874 "rand 0.8.5",1875 "remowt-link-shared",1016 "serde",1876 "serde",1017 "tokio",1877 "tokio",1878 "tokio-util",1018 "tracing",1879 "tracing",1019 "tracing-subscriber",1880 "tracing-subscriber",1020 "ui-prompt",1881 "ui-prompt",1023 "zbus_polkit",1884 "zbus_polkit",1024]1885]18861887[[package]]1888name = "remowt-link-shared"1889version = "0.1.0"1890dependencies = [1891 "bifrostlink",1892 "serde",1893 "serde_json",1894 "thiserror",1895 "tokio",1896]102518971026[[package]]1898[[package]]1027name = "remowt-ssh"1899name = "remowt-ssh"1028version = "0.1.0"1900version = "0.1.0"1901dependencies = [1902 "anyhow",1903 "async-trait",1904 "bifrostlink",1905 "bifrostlink-ports",1906 "clap",1907 "openssh",1908 "remowt-link-shared",1909 "russh",1910 "russh-config",1911 "russh-keys",1912 "tempdir",1913 "tokio",1914 "tracing-subscriber",1915 "uuid",1916]19171918[[package]]1919name = "rfc6979"1920version = "0.4.0"1921source = "registry+https://github.com/rust-lang/crates.io-index"1922checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2"1923dependencies = [1924 "hmac",1925 "subtle",1926]102919271030[[package]]1928[[package]]1031name = "rpassword"1929name = "rpassword"1039 "winapi",1937 "winapi",1040]1938]19391940[[package]]1941name = "rsa"1942version = "0.9.6"1943source = "registry+https://github.com/rust-lang/crates.io-index"1944checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc"1945dependencies = [1946 "const-oid",1947 "digest",1948 "num-bigint-dig",1949 "num-integer",1950 "num-traits",1951 "pkcs1",1952 "pkcs8",1953 "rand_core 0.6.4",1954 "sha2",1955 "signature",1956 "spki",1957 "subtle",1958 "zeroize",1959]19601961[[package]]1962name = "russh"1963version = "0.46.0-beta.4"1964source = "git+https://github.com/Eugeny/russh/#4115b8fd3a94c17c0178761ea769a40ca410903d"1965dependencies = [1966 "aes",1967 "aes-gcm",1968 "async-trait",1969 "bitflags 2.6.0",1970 "byteorder",1971 "cbc",1972 "chacha20",1973 "ctr",1974 "curve25519-dalek",1975 "des",1976 "digest",1977 "elliptic-curve",1978 "flate2",1979 "futures",1980 "generic-array",1981 "hex-literal",1982 "hmac",1983 "log",1984 "num-bigint",1985 "once_cell",1986 "p256",1987 "p384",1988 "p521",1989 "poly1305",1990 "rand 0.8.5",1991 "rand_core 0.6.4",1992 "russh-cryptovec",1993 "russh-keys",1994 "sha1",1995 "sha2",1996 "ssh-encoding",1997 "ssh-key",1998 "subtle",1999 "thiserror",2000 "tokio",2001]20022003[[package]]2004name = "russh-config"2005version = "0.7.1"2006source = "git+https://github.com/Eugeny/russh/#4115b8fd3a94c17c0178761ea769a40ca410903d"2007dependencies = [2008 "futures",2009 "globset",2010 "home",2011 "log",2012 "thiserror",2013 "tokio",2014 "whoami",2015]20162017[[package]]2018name = "russh-cryptovec"2019version = "0.7.3"2020source = "git+https://github.com/Eugeny/russh/#4115b8fd3a94c17c0178761ea769a40ca410903d"2021dependencies = [2022 "libc",2023 "winapi",2024]20252026[[package]]2027name = "russh-keys"2028version = "0.46.0-beta.3"2029source = "git+https://github.com/Eugeny/russh/#4115b8fd3a94c17c0178761ea769a40ca410903d"2030dependencies = [2031 "aes",2032 "async-trait",2033 "bcrypt-pbkdf",2034 "block-padding",2035 "byteorder",2036 "cbc",2037 "ctr",2038 "data-encoding",2039 "der",2040 "digest",2041 "ecdsa",2042 "ed25519-dalek",2043 "elliptic-curve",2044 "futures",2045 "hmac",2046 "home",2047 "inout",2048 "log",2049 "md5",2050 "num-integer",2051 "p256",2052 "p384",2053 "p521",2054 "pageant",2055 "pbkdf2 0.11.0",2056 "pkcs1",2057 "pkcs5",2058 "pkcs8",2059 "rand 0.8.5",2060 "rand_core 0.6.4",2061 "rsa",2062 "russh-cryptovec",2063 "sec1",2064 "serde",2065 "sha1",2066 "sha2",2067 "spki",2068 "ssh-encoding",2069 "ssh-key",2070 "thiserror",2071 "tokio",2072 "tokio-stream",2073 "typenum",2074 "zeroize",2075]104120761042[[package]]2077[[package]]1043name = "rustc-demangle"2078name = "rustc-demangle"1051source = "registry+https://github.com/rust-lang/crates.io-index"2086source = "registry+https://github.com/rust-lang/crates.io-index"1052checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"2087checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"20882089[[package]]2090name = "rustc_version"2091version = "0.4.0"2092source = "registry+https://github.com/rust-lang/crates.io-index"2093checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"2094dependencies = [2095 "semver",2096]105320971054[[package]]2098[[package]]1055name = "rustix"2099name = "rustix"1076source = "registry+https://github.com/rust-lang/crates.io-index"2120source = "registry+https://github.com/rust-lang/crates.io-index"1077checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"2121checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"21222123[[package]]2124name = "salsa20"2125version = "0.10.2"2126source = "registry+https://github.com/rust-lang/crates.io-index"2127checksum = "97a22f5af31f73a954c10289c93e8a50cc23d971e80ee446f1f6f7137a088213"2128dependencies = [2129 "cipher",2130]21312132[[package]]2133name = "scrypt"2134version = "0.11.0"2135source = "registry+https://github.com/rust-lang/crates.io-index"2136checksum = "0516a385866c09368f0b5bcd1caff3366aace790fcd46e2bb032697bb172fd1f"2137dependencies = [2138 "pbkdf2 0.12.2",2139 "salsa20",2140 "sha2",2141]21422143[[package]]2144name = "sec1"2145version = "0.7.3"2146source = "registry+https://github.com/rust-lang/crates.io-index"2147checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc"2148dependencies = [2149 "base16ct",2150 "der",2151 "generic-array",2152 "pkcs8",2153 "subtle",2154 "zeroize",2155]21562157[[package]]2158name = "semver"2159version = "1.0.23"2160source = "registry+https://github.com/rust-lang/crates.io-index"2161checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"21622163[[package]]2164name = "sendfd"2165version = "0.4.3"2166source = "registry+https://github.com/rust-lang/crates.io-index"2167checksum = "604b71b8fc267e13bb3023a2c901126c8f349393666a6d98ac1ae5729b701798"2168dependencies = [2169 "libc",2170 "tokio",2171]107821721079[[package]]2173[[package]]1080name = "serde"2174name = "serde"1081version = "1.0.204"2175version = "1.0.208"1082source = "registry+https://github.com/rust-lang/crates.io-index"2176source = "registry+https://github.com/rust-lang/crates.io-index"1083checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12"2177checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2"1084dependencies = [2178dependencies = [1085 "serde_derive",2179 "serde_derive",1086]2180]108721811088[[package]]2182[[package]]1089name = "serde_derive"2183name = "serde_derive"1090version = "1.0.204"2184version = "1.0.208"1091source = "registry+https://github.com/rust-lang/crates.io-index"2185source = "registry+https://github.com/rust-lang/crates.io-index"1092checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222"2186checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf"1093dependencies = [2187dependencies = [1094 "proc-macro2",2188 "proc-macro2",1095 "quote",2189 "quote",109821921099[[package]]2193[[package]]1100name = "serde_json"2194name = "serde_json"1101version = "1.0.122"2195version = "1.0.125"1102source = "registry+https://github.com/rust-lang/crates.io-index"2196source = "registry+https://github.com/rust-lang/crates.io-index"1103checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da"2197checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed"1104dependencies = [2198dependencies = [1105 "itoa",2199 "itoa",1106 "memchr",2200 "memchr",1130 "digest",2224 "digest",1131]2225]22262227[[package]]2228name = "sha2"2229version = "0.10.8"2230source = "registry+https://github.com/rust-lang/crates.io-index"2231checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8"2232dependencies = [2233 "cfg-if",2234 "cpufeatures",2235 "digest",2236]113222371133[[package]]2238[[package]]1134name = "sharded-slab"2239name = "sharded-slab"1139 "lazy_static",2244 "lazy_static",1140]2245]22462247[[package]]2248name = "shell-escape"2249version = "0.1.5"2250source = "registry+https://github.com/rust-lang/crates.io-index"2251checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f"114122521142[[package]]2253[[package]]1143name = "shlex"2254name = "shlex"1154 "libc",2265 "libc",1155]2266]22672268[[package]]2269name = "signature"2270version = "2.2.0"2271source = "registry+https://github.com/rust-lang/crates.io-index"2272checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de"2273dependencies = [2274 "digest",2275 "rand_core 0.6.4",2276]115622771157[[package]]2278[[package]]1158name = "slab"2279name = "slab"1179 "windows-sys",2300 "windows-sys",1180]2301]23022303[[package]]2304name = "spin"2305version = "0.9.8"2306source = "registry+https://github.com/rust-lang/crates.io-index"2307checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67"23082309[[package]]2310name = "spki"2311version = "0.7.3"2312source = "registry+https://github.com/rust-lang/crates.io-index"2313checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d"2314dependencies = [2315 "base64ct",2316 "der",2317]23182319[[package]]2320name = "ssh-cipher"2321version = "0.2.0"2322source = "registry+https://github.com/rust-lang/crates.io-index"2323checksum = "caac132742f0d33c3af65bfcde7f6aa8f62f0e991d80db99149eb9d44708784f"2324dependencies = [2325 "aes",2326 "aes-gcm",2327 "cbc",2328 "chacha20",2329 "cipher",2330 "ctr",2331 "poly1305",2332 "ssh-encoding",2333 "subtle",2334]23352336[[package]]2337name = "ssh-encoding"2338version = "0.2.0"2339source = "registry+https://github.com/rust-lang/crates.io-index"2340checksum = "eb9242b9ef4108a78e8cd1a2c98e193ef372437f8c22be363075233321dd4a15"2341dependencies = [2342 "base64ct",2343 "pem-rfc7468",2344 "sha2",2345]23462347[[package]]2348name = "ssh-key"2349version = "0.6.6"2350source = "registry+https://github.com/rust-lang/crates.io-index"2351checksum = "ca9b366a80cf18bb6406f4cf4d10aebfb46140a8c0c33f666a144c5c76ecbafc"2352dependencies = [2353 "bcrypt-pbkdf",2354 "ed25519-dalek",2355 "num-bigint-dig",2356 "p256",2357 "p384",2358 "p521",2359 "rand_core 0.6.4",2360 "rsa",2361 "sec1",2362 "sha2",2363 "signature",2364 "ssh-cipher",2365 "ssh-encoding",2366 "subtle",2367 "zeroize",2368]23692370[[package]]2371name = "ssh_format"2372version = "0.14.1"2373source = "registry+https://github.com/rust-lang/crates.io-index"2374checksum = "24ab31081d1c9097c327ec23550858cb5ffb4af6b866c1ef4d728455f01f3304"2375dependencies = [2376 "serde",2377 "ssh_format_error",2378]23792380[[package]]2381name = "ssh_format_error"2382version = "0.1.0"2383source = "registry+https://github.com/rust-lang/crates.io-index"2384checksum = "be3c6519de7ca611f71ef7e8a56eb57aa1c818fecb5242d0a0f39c83776c210c"2385dependencies = [2386 "serde",2387]118123881182[[package]]2389[[package]]1183name = "static_assertions"2390name = "static_assertions"1191source = "registry+https://github.com/rust-lang/crates.io-index"2398source = "registry+https://github.com/rust-lang/crates.io-index"1192checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"2399checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"24002401[[package]]2402name = "subtle"2403version = "2.6.1"2404source = "registry+https://github.com/rust-lang/crates.io-index"2405checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292"119324061194[[package]]2407[[package]]1195name = "syn"2408name = "syn"1213 "unicode-ident",2426 "unicode-ident",1214]2427]24282429[[package]]2430name = "tempdir"2431version = "0.3.7"2432source = "registry+https://github.com/rust-lang/crates.io-index"2433checksum = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"2434dependencies = [2435 "rand 0.4.6",2436 "remove_dir_all",2437]121524381216[[package]]2439[[package]]1217name = "tempfile"2440name = "tempfile"125824811259[[package]]2482[[package]]1260name = "tokio"2483name = "tokio"1261version = "1.39.2"2484version = "1.39.3"1262source = "registry+https://github.com/rust-lang/crates.io-index"2485source = "registry+https://github.com/rust-lang/crates.io-index"1263checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1"2486checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5"1264dependencies = [2487dependencies = [1265 "backtrace",2488 "backtrace",1266 "bytes",2489 "bytes",1274 "windows-sys",2497 "windows-sys",1275]2498]24992500[[package]]2501name = "tokio-io-utility"2502version = "0.7.6"2503source = "registry+https://github.com/rust-lang/crates.io-index"2504checksum = "8d672654d175710e52c7c41f6aec77c62b3c0954e2a7ebce9049d1e94ed7c263"2505dependencies = [2506 "tokio",2507]127625081277[[package]]2509[[package]]1278name = "tokio-macros"2510name = "tokio-macros"1285 "syn 2.0.72",2517 "syn 2.0.72",1286]2518]25192520[[package]]2521name = "tokio-stream"2522version = "0.1.15"2523source = "registry+https://github.com/rust-lang/crates.io-index"2524checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af"2525dependencies = [2526 "futures-core",2527 "pin-project-lite",2528 "tokio",2529 "tokio-util",2530]25312532[[package]]2533name = "tokio-util"2534version = "0.7.11"2535source = "registry+https://github.com/rust-lang/crates.io-index"2536checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1"2537dependencies = [2538 "bytes",2539 "futures-core",2540 "futures-sink",2541 "pin-project-lite",2542 "tokio",2543]128725441288[[package]]2545[[package]]1289name = "toml_datetime"2546name = "toml_datetime"1359 "tracing-log",2616 "tracing-log",1360]2617]26182619[[package]]2620name = "typed-builder"2621version = "0.20.0"2622source = "registry+https://github.com/rust-lang/crates.io-index"2623checksum = "7e14ed59dc8b7b26cacb2a92bad2e8b1f098806063898ab42a3bd121d7d45e75"2624dependencies = [2625 "typed-builder-macro",2626]26272628[[package]]2629name = "typed-builder-macro"2630version = "0.20.0"2631source = "registry+https://github.com/rust-lang/crates.io-index"2632checksum = "560b82d656506509d43abe30e0ba64c56b1953ab3d4fe7ba5902747a7a3cedd5"2633dependencies = [2634 "proc-macro2",2635 "quote",2636 "syn 2.0.72",2637]136126381362[[package]]2639[[package]]1363name = "typenum"2640name = "typenum"1380name = "ui-prompt"2657name = "ui-prompt"1381version = "0.1.0"2658version = "0.1.0"1382dependencies = [2659dependencies = [2660 "bifrostlink",1383 "serde",2661 "serde",1384 "thiserror",2662 "thiserror",1385 "tokio",2663 "tokio",1393source = "registry+https://github.com/rust-lang/crates.io-index"2671source = "registry+https://github.com/rust-lang/crates.io-index"1394checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"2672checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"26732674[[package]]2675name = "universal-hash"2676version = "0.5.1"2677source = "registry+https://github.com/rust-lang/crates.io-index"2678checksum = "fc1de2c688dc15305988b563c3854064043356019f97a4b46276fe734c4f07ea"2679dependencies = [2680 "crypto-common",2681 "subtle",2682]139526831396[[package]]2684[[package]]1397name = "utf8parse"2685name = "utf8parse"1426source = "registry+https://github.com/rust-lang/crates.io-index"2714source = "registry+https://github.com/rust-lang/crates.io-index"1427checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"2715checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"27162717[[package]]2718name = "wasite"2719version = "0.1.0"2720source = "registry+https://github.com/rust-lang/crates.io-index"2721checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b"27222723[[package]]2724name = "wasm-bindgen"2725version = "0.2.93"2726source = "registry+https://github.com/rust-lang/crates.io-index"2727checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5"2728dependencies = [2729 "cfg-if",2730 "once_cell",2731 "wasm-bindgen-macro",2732]27332734[[package]]2735name = "wasm-bindgen-backend"2736version = "0.2.93"2737source = "registry+https://github.com/rust-lang/crates.io-index"2738checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b"2739dependencies = [2740 "bumpalo",2741 "log",2742 "once_cell",2743 "proc-macro2",2744 "quote",2745 "syn 2.0.72",2746 "wasm-bindgen-shared",2747]27482749[[package]]2750name = "wasm-bindgen-macro"2751version = "0.2.93"2752source = "registry+https://github.com/rust-lang/crates.io-index"2753checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf"2754dependencies = [2755 "quote",2756 "wasm-bindgen-macro-support",2757]27582759[[package]]2760name = "wasm-bindgen-macro-support"2761version = "0.2.93"2762source = "registry+https://github.com/rust-lang/crates.io-index"2763checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836"2764dependencies = [2765 "proc-macro2",2766 "quote",2767 "syn 2.0.72",2768 "wasm-bindgen-backend",2769 "wasm-bindgen-shared",2770]27712772[[package]]2773name = "wasm-bindgen-shared"2774version = "0.2.93"2775source = "registry+https://github.com/rust-lang/crates.io-index"2776checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484"27772778[[package]]2779name = "web-sys"2780version = "0.3.70"2781source = "registry+https://github.com/rust-lang/crates.io-index"2782checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0"2783dependencies = [2784 "js-sys",2785 "wasm-bindgen",2786]27872788[[package]]2789name = "whoami"2790version = "1.5.1"2791source = "registry+https://github.com/rust-lang/crates.io-index"2792checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9"2793dependencies = [2794 "redox_syscall",2795 "wasite",2796 "web-sys",2797]142827981429[[package]]2799[[package]]1430name = "winapi"2800name = "winapi"1448source = "registry+https://github.com/rust-lang/crates.io-index"2818source = "registry+https://github.com/rust-lang/crates.io-index"1449checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"2819checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"28202821[[package]]2822name = "windows"2823version = "0.58.0"2824source = "registry+https://github.com/rust-lang/crates.io-index"2825checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6"2826dependencies = [2827 "windows-core",2828 "windows-targets",2829]28302831[[package]]2832name = "windows-core"2833version = "0.58.0"2834source = "registry+https://github.com/rust-lang/crates.io-index"2835checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99"2836dependencies = [2837 "windows-implement",2838 "windows-interface",2839 "windows-result",2840 "windows-strings",2841 "windows-targets",2842]28432844[[package]]2845name = "windows-implement"2846version = "0.58.0"2847source = "registry+https://github.com/rust-lang/crates.io-index"2848checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b"2849dependencies = [2850 "proc-macro2",2851 "quote",2852 "syn 2.0.72",2853]28542855[[package]]2856name = "windows-interface"2857version = "0.58.0"2858source = "registry+https://github.com/rust-lang/crates.io-index"2859checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515"2860dependencies = [2861 "proc-macro2",2862 "quote",2863 "syn 2.0.72",2864]28652866[[package]]2867name = "windows-result"2868version = "0.2.0"2869source = "registry+https://github.com/rust-lang/crates.io-index"2870checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e"2871dependencies = [2872 "windows-targets",2873]28742875[[package]]2876name = "windows-strings"2877version = "0.1.0"2878source = "registry+https://github.com/rust-lang/crates.io-index"2879checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10"2880dependencies = [2881 "windows-result",2882 "windows-targets",2883]145028841451[[package]]2885[[package]]1452name = "windows-sys"2886name = "windows-sys"1564 "hex",2998 "hex",1565 "nix",2999 "nix",1566 "ordered-stream",3000 "ordered-stream",1567 "rand",3001 "rand 0.8.5",1568 "serde",3002 "serde",1569 "serde_repr",3003 "serde_repr",1570 "sha1",3004 "sha1",1637 "syn 2.0.72",3071 "syn 2.0.72",1638]3072]30733074[[package]]3075name = "zeroize"3076version = "1.8.1"3077source = "registry+https://github.com/rust-lang/crates.io-index"3078checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde"163930791640[[package]]3080[[package]]1641name = "zvariant"3081name = "zvariant"Cargo.tomldiffbeforeafterboth--- a/Cargo.toml
+++ b/Cargo.toml
@@ -2,6 +2,6 @@
members = ["cmds/*", "crates/*"]
resolver = "2"
-[workspace.packages]
+[workspace.dependencies]
bifrostlink = { path = "../bifrostlink/crates/bifrostlink" }
bifrostlink-ports = { path = "../bifrostlink/crates/bifrostlink-ports" }
Justfilediffbeforeafterboth--- /dev/null
+++ b/Justfile
@@ -0,0 +1,12 @@
+dev: dev-build dev-install
+
+dev-install:
+ mkdir -p ./target/libexec
+ ln -sf ./target/x86_64-unknown-linux-musl/release/remowt-agent ./target/libexec/remowt-x86_64-linux
+
+dev-build:
+ cargo build --release --target=x86_64-unknown-linux-musl -p remowt-agent
+
+dev-deploy: dev-build dev-install
+ ssh edgeworth2 mkdir -p /home/lach/.remowt
+ rsync -arv ./target/x86_64-unknown-linux-musl/release/remowt-agent edgeworth2:/home/lach/.remowt/remowt-agent
cmds/polkit-backend/Cargo.tomldiffbeforeafterboth--- a/cmds/polkit-backend/Cargo.toml
+++ /dev/null
@@ -1,17 +0,0 @@
-[package]
-name = "polkit-backend"
-version = "0.1.0"
-edition = "2021"
-
-[dependencies]
-anyhow = "1.0.86"
-clap = { version = "4.5.11", features = ["derive"] }
-nix = "0.29.0"
-pam-client = "0.5.0"
-polkit-shared = { version = "0.1.0", path = "../../crates/polkit-shared" }
-tokio = { version = "1.39.2", features = ["macros", "rt", "rt-multi-thread"] }
-tracing = "0.1.40"
-tracing-subscriber = "0.3.18"
-ui-prompt = { version = "0.1.0", path = "../../crates/ui-prompt" }
-zbus = { version = "4.4.0", features = ["tokio"] }
-zbus_polkit = { version = "4.0.0", features = ["tokio"] }
cmds/polkit-backend/etc/systemd/system/remowt-polkit-helper.servicediffbeforeafterboth--- a/cmds/polkit-backend/etc/systemd/system/remowt-polkit-helper.service
+++ /dev/null
@@ -1,12 +0,0 @@
-[Unit]
-Description=Remowt polkit helper service
-
-[Service]
-Type=dbus
-BusName=lach.polkit.helper1
-ExecStart=@libexecdir@/polkit-backend
-# TODO: Hardening
-
-[Install]
-WantedBy=multi-user.target
-Alias=dbus-lach.polkit.helper1.service
cmds/polkit-backend/share/dbus-1/system-services/lach.polkit.helper1.confdiffbeforeafterboth--- a/cmds/polkit-backend/share/dbus-1/system-services/lach.polkit.helper1.conf
+++ /dev/null
@@ -1,5 +0,0 @@
-[D-BUS Service]
-Name=lach.polkit.helper1
-Exec=/bin/false
-User=root
-SystemdService=dbus-lach.polkit.helper1.service
cmds/polkit-backend/share/dbus-1/system.d/lach.polkit.helper1.confdiffbeforeafterboth--- a/cmds/polkit-backend/share/dbus-1/system.d/lach.polkit.helper1.conf
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "https://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
-<busconfig>
- <policy user="root">
- <allow own = "lach.polkit.helper1"/>
- <allow send_interface="lach.PolkitInputHandler"/>
- </policy>
- <policy context="default">
- <allow send_destination="lach.polkit.helper1"/>
- <deny send_interface="lach.PolkitInputHandler"/>
- </policy>
-</busconfig>
cmds/polkit-backend/src/main.rsdiffbeforeafterboth--- a/cmds/polkit-backend/src/main.rs
+++ /dev/null
@@ -1,238 +0,0 @@
-use std::collections::{HashMap, HashSet};
-use std::ffi::{CStr, CString};
-use std::future::pending;
-use std::sync::LazyLock;
-
-use anyhow::Context as _;
-use clap::Parser;
-use nix::unistd::{setuid, Uid, User};
-use pam_client::{Context, ConversationHandler, ErrorCode, Flag};
-use polkit_shared::BackendRequest;
-use tokio::runtime::Handle;
-use tokio::task::{block_in_place, spawn_blocking};
-use tracing::trace;
-use ui_prompt::dbus::DbusPrompterProxyBlocking;
-use ui_prompt::{BlockingPrompter, Prompter};
-use zbus::fdo;
-use zbus::message::Header;
-use zbus::zvariant::OwnedValue;
-use zbus::{blocking, interface, proxy, Connection};
-
-struct Helper {
- connection: Connection,
- blocking_connection: blocking::Connection,
-}
-
-static ALLOWED_ENVIRONMENT: LazyLock<HashSet<&str>> = LazyLock::new(|| {
- [
- // pam ssh agent auth
- "SSH_AUTH_SOCK",
- // ssh itself provides this when running PAM
- "SSH_AUTH_INFO_0",
- // contains user which ran sudo
- "SUDO_USER",
- ]
- .into_iter()
- .collect()
-});
-
-struct Conversation<P>(P);
-impl<P: BlockingPrompter> Conversation<P> {
- fn prompt_inner(&self, echo: bool, prompt: &CStr) -> Result<CString, ErrorCode> {
- trace!("do prompt");
- let out = self
- .0
- .prompt_text(
- echo,
- &prompt.to_string_lossy(),
- "PAM prompt request",
- &[],
- )
- .map_err(|e| {
- trace!("prompt error: {e}");
- ErrorCode::CONV_ERR
- })?;
- CString::new(out).map_err(|_| ErrorCode::CONV_AGAIN)
- }
- fn text_inner(&self, error: bool, msg: &CStr) {
- trace!("do text");
- let msg = msg.to_string_lossy();
- let _ = self.0.display_text(error, &msg, &[]);
- }
-}
-impl<P: BlockingPrompter> ConversationHandler for Conversation<P> {
- fn prompt_echo_on(&mut self, prompt: &CStr) -> Result<CString, ErrorCode> {
- self.prompt_inner(true, prompt)
- }
-
- fn prompt_echo_off(&mut self, prompt: &CStr) -> Result<CString, ErrorCode> {
- self.prompt_inner(false, prompt)
- }
-
- fn text_info(&mut self, msg: &CStr) {
- self.text_inner(false, msg)
- }
-
- fn error_msg(&mut self, msg: &CStr) {
- self.text_inner(true, msg)
- }
-
- fn radio_prompt(&mut self, prompt: &CStr) -> Result<bool, ErrorCode> {
- let prompt = prompt.to_string_lossy();
- let result = self
- .0
- .prompt_radio(&prompt, "PAM prompt request", &[])
- .map_err(|_| ErrorCode::CONV_ERR)?;
- Ok(result)
- }
-}
-
-#[proxy(
- default_service = "org.freedesktop.DBus",
- default_path = "/org/freedesktop/DBus"
-)]
-trait DBus {
- fn get_connection_credentials(&self, body: &str) -> zbus::Result<HashMap<String, OwnedValue>>;
-}
-
-#[interface(name = "lach.PolkitHelper")]
-impl Helper {
- async fn init_conversation(
- &self,
- request: BackendRequest,
- #[zbus(header)] hdr: Header<'_>,
- ) -> fdo::Result<()> {
- let Some(sender) = hdr.sender().map(|v| v.to_owned()) else {
- trace!("missing sender");
- return Err(fdo::Error::AuthFailed("missing sender".to_owned()));
- };
-
- let dbus = DBusProxy::new(&self.connection).await?;
-
- // TOCTOU: sender might be already disconnected, and there might be another
- // user with different user id here, but does it matters?
- let reply = dbus.get_connection_credentials(&sender).await?;
- let uid: u32 = (&reply["UnixUserID"]).try_into().unwrap();
-
- let blocking_connection = self.blocking_connection.clone();
- let thread_result: fdo::Result<()> = block_in_place(move || {
- trace!("find user");
- let user = User::from_uid(Uid::from_raw(uid))
- .map_err(|_| fdo::Error::AuthFailed("error querying user".to_owned()))?
- .ok_or_else(|| fdo::Error::AuthFailed("uid not found".to_owned()))?;
-
- let responder = DbusPrompterProxyBlocking::new(
- &blocking_connection,
- sender,
- request.prompter_path,
- )?;
- let conversation = Conversation(responder);
- trace!("run context for {}", &user.name);
- let mut ctx = Context::new(
- // TODO: Should another scope be used?
- "login",
- Some(&user.name),
- conversation,
- )
- .map_err(|_| fdo::Error::Failed("pam context init failed".to_owned()))?;
-
- trace!("fill env");
- for (k, v) in request.environment {
- if k.contains('=') || !ALLOWED_ENVIRONMENT.contains(k.as_str()) {
- continue;
- }
- let _ = ctx.putenv(format!("{k}={v}"));
- }
-
- trace!("authenticate");
- ctx.authenticate(Flag::NONE)
- .map_err(|_| fdo::Error::AuthFailed("pam authentication failed".to_owned()))?;
-
- trace!("acct mgmt");
- ctx.acct_mgmt(Flag::NONE)
- .map_err(|_| fdo::Error::AuthFailed("pam acct mgmt failed".to_owned()))?;
-
- Ok(())
- });
-
- thread_result?;
-
- trace!("respond");
- let proxy = zbus_polkit::policykit1::AuthorityProxy::new(&self.connection).await?;
-
- let identity_details = request
- .identity
- .details
- .iter()
- .map(|(k, v)| (k.as_str(), (**v).try_clone().expect("success")))
- .collect::<HashMap<_, _>>();
- proxy
- .authentication_agent_response2(
- uid,
- &request.cookie,
- &zbus_polkit::policykit1::Identity {
- identity_kind: &request.identity.kind,
- identity_details: &identity_details,
- },
- )
- .await?;
- Ok(())
- }
-}
-
-const OBJ_PATH: &str = "/lach/PolkitHelper";
-
-#[derive(Parser)]
-struct Opts {
- /// Not recommended: start as a session connection, then use escalation
- /// to respond to polkit requests.
- #[arg(long)]
- session: bool,
-}
-
-#[tokio::main]
-async fn main() -> anyhow::Result<()> {
- tracing_subscriber::fmt::init();
- let opts = Opts::parse();
- let connection = if opts.session {
- Connection::session().await
- } else {
- Connection::system().await
- }
- .context("failed to open connection")?;
-
- let session = opts.session;
- let blocking_connection: anyhow::Result<blocking::Connection> = spawn_blocking(move || {
- Ok(if session {
- blocking::Connection::session()?
- } else {
- blocking::Connection::system()?
- })
- })
- .await?;
- let blocking_connection = blocking_connection.context("failed to open blocking connection")?;
-
- if opts.session {
- setuid(Uid::from_raw(0))
- .context("polkit-backend needs to be suid if run in session mode")?;
- }
-
- connection
- .object_server()
- .at(
- OBJ_PATH,
- Helper {
- connection: connection.clone(),
- blocking_connection,
- },
- )
- .await
- .context("failed listen path")?;
-
- connection
- .request_name("lach.polkit.helper1")
- .await
- .context("failed to request name")?;
-
- pending().await
-}
cmds/polkit-dbus-helper/Cargo.tomldiffbeforeafterboth--- /dev/null
+++ b/cmds/polkit-dbus-helper/Cargo.toml
@@ -0,0 +1,17 @@
+[package]
+name = "polkit-backend"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+anyhow = "1.0.86"
+clap = { version = "4.5.11", features = ["derive"] }
+nix = "0.29.0"
+pam-client = "0.5.0"
+polkit-shared = { version = "0.1.0", path = "../../crates/polkit-shared" }
+tokio = { version = "1.39.2", features = ["macros", "rt", "rt-multi-thread"] }
+tracing = "0.1.40"
+tracing-subscriber = "0.3.18"
+ui-prompt = { version = "0.1.0", path = "../../crates/ui-prompt" }
+zbus = { version = "4.4.0", features = ["tokio"] }
+zbus_polkit = { version = "4.0.0", features = ["tokio"] }
cmds/polkit-dbus-helper/README.adocdiffbeforeafterboth--- /dev/null
+++ b/cmds/polkit-dbus-helper/README.adoc
@@ -0,0 +1,8 @@
+== What is it?
+
+Usually, there is a `polkit-agent-helper-1` suid binary installed on the system with polkit package.
+
+This, however, an alternative to that approach, a system daemon listening for dbus requests, which works
+without using suid binaries.
+
+In future it will provide some additional features.
cmds/polkit-dbus-helper/etc/systemd/system/remowt-polkit-helper.servicediffbeforeafterboth--- /dev/null
+++ b/cmds/polkit-dbus-helper/etc/systemd/system/remowt-polkit-helper.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Remowt polkit helper service
+
+[Service]
+Type=dbus
+BusName=lach.polkit.helper1
+ExecStart=@libexecdir@/polkit-backend
+# TODO: Hardening
+
+[Install]
+WantedBy=multi-user.target
+Alias=dbus-lach.polkit.helper1.service
cmds/polkit-dbus-helper/share/dbus-1/system-services/lach.polkit.helper1.confdiffbeforeafterboth--- /dev/null
+++ b/cmds/polkit-dbus-helper/share/dbus-1/system-services/lach.polkit.helper1.conf
@@ -0,0 +1,5 @@
+[D-BUS Service]
+Name=lach.polkit.helper1
+Exec=/bin/false
+User=root
+SystemdService=dbus-lach.polkit.helper1.service
cmds/polkit-dbus-helper/share/dbus-1/system.d/lach.polkit.helper1.confdiffbeforeafterboth--- /dev/null
+++ b/cmds/polkit-dbus-helper/share/dbus-1/system.d/lach.polkit.helper1.conf
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN" "https://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
+<busconfig>
+ <policy user="root">
+ <allow own = "lach.polkit.helper1"/>
+ <allow send_interface="lach.PolkitInputHandler"/>
+ </policy>
+ <policy context="default">
+ <allow send_destination="lach.polkit.helper1"/>
+ <deny send_interface="lach.PolkitInputHandler"/>
+ </policy>
+</busconfig>
cmds/polkit-dbus-helper/src/main.rsdiffbeforeafterboth--- /dev/null
+++ b/cmds/polkit-dbus-helper/src/main.rs
@@ -0,0 +1,236 @@
+use std::collections::{HashMap, HashSet};
+use std::ffi::{CStr, CString};
+use std::future::pending;
+use std::sync::LazyLock;
+
+use anyhow::Context as _;
+use clap::Parser;
+use nix::unistd::{setuid, Uid, User};
+use pam_client::{Context, ConversationHandler, ErrorCode, Flag};
+use polkit_shared::BackendRequest;
+use tokio::task::{block_in_place, spawn_blocking};
+use tracing::trace;
+use ui_prompt::dbus::DbusPrompterProxyBlocking;
+use ui_prompt::BlockingPrompter;
+use zbus::fdo;
+use zbus::message::Header;
+use zbus::zvariant::OwnedValue;
+use zbus::{blocking, interface, proxy, Connection};
+
+struct Helper {
+ connection: Connection,
+ blocking_connection: blocking::Connection,
+}
+
+static ALLOWED_ENVIRONMENT: LazyLock<HashSet<&str>> = LazyLock::new(|| {
+ [
+ // pam ssh agent auth
+ "SSH_AUTH_SOCK",
+ // ssh itself provides this when running PAM
+ "SSH_AUTH_INFO_0",
+ // contains user which ran sudo
+ "SUDO_USER",
+ ]
+ .into_iter()
+ .collect()
+});
+
+struct Conversation<P>(P);
+impl<P: BlockingPrompter> Conversation<P> {
+ fn prompt_inner(&self, echo: bool, prompt: &CStr) -> Result<CString, ErrorCode> {
+ trace!("do prompt");
+ let out = self
+ .0
+ .prompt_text(echo, &prompt.to_string_lossy(), "PAM prompt request", &[])
+ .map_err(|e| {
+ trace!("prompt error: {e}");
+ ErrorCode::CONV_ERR
+ })?;
+ CString::new(out).map_err(|_| ErrorCode::CONV_AGAIN)
+ }
+ fn text_inner(&self, error: bool, msg: &CStr) {
+ trace!("do text");
+ let msg = msg.to_string_lossy();
+ let _ = self.0.display_text(error, &msg, &[]);
+ }
+}
+impl<P: BlockingPrompter> ConversationHandler for Conversation<P> {
+ fn prompt_echo_on(&mut self, prompt: &CStr) -> Result<CString, ErrorCode> {
+ self.prompt_inner(true, prompt)
+ }
+
+ fn prompt_echo_off(&mut self, prompt: &CStr) -> Result<CString, ErrorCode> {
+ self.prompt_inner(false, prompt)
+ }
+
+ fn text_info(&mut self, msg: &CStr) {
+ self.text_inner(false, msg)
+ }
+
+ fn error_msg(&mut self, msg: &CStr) {
+ self.text_inner(true, msg)
+ }
+
+ fn radio_prompt(&mut self, prompt: &CStr) -> Result<bool, ErrorCode> {
+ let prompt = prompt.to_string_lossy();
+ let result = self
+ .0
+ .prompt_radio(&prompt, "PAM prompt request", &[])
+ .map_err(|_| ErrorCode::CONV_ERR)?;
+ Ok(result)
+ }
+}
+
+#[proxy(
+ default_service = "org.freedesktop.DBus",
+ default_path = "/org/freedesktop/DBus"
+)]
+trait DBus {
+ fn get_connection_credentials(&self, body: &str) -> zbus::Result<HashMap<String, OwnedValue>>;
+}
+
+#[interface(name = "lach.PolkitHelper")]
+impl Helper {
+ async fn init_conversation(
+ &self,
+ request: BackendRequest,
+ #[zbus(header)] hdr: Header<'_>,
+ ) -> fdo::Result<()> {
+ let Some(sender) = hdr.sender().map(|v| v.to_owned()) else {
+ trace!("missing sender");
+ return Err(fdo::Error::AuthFailed("missing sender".to_owned()));
+ };
+
+ let dbus = DBusProxy::new(&self.connection).await?;
+
+ // TOCTOU: sender might be already disconnected, and there might be another
+ // user with different user id here, but does it matters?
+ let reply = dbus.get_connection_credentials(&sender).await?;
+ let connection_uid: u32 = (&reply["UnixUserID"]).try_into().unwrap();
+
+ let identity = request.identity.clone();
+ let blocking_connection = self.blocking_connection.clone();
+ let thread_result: fdo::Result<()> = block_in_place(move || {
+ trace!("find user");
+ let Some(identity_uid) = identity.uid() else {
+ return Err(fdo::Error::AuthFailed("can't process identity".to_owned()));
+ };
+ let user = User::from_uid(identity_uid)
+ .map_err(|_| fdo::Error::AuthFailed("error querying user".to_owned()))?
+ .ok_or_else(|| fdo::Error::AuthFailed("uid not found".to_owned()))?;
+
+ let responder = DbusPrompterProxyBlocking::new(
+ &blocking_connection,
+ sender,
+ request.prompter_path,
+ )?;
+ let conversation = Conversation(responder);
+ trace!("run context for {}", &user.name);
+ let mut ctx = Context::new(
+ // TODO: Should another scope be used?
+ "login",
+ Some(&user.name),
+ conversation,
+ )
+ .map_err(|_| fdo::Error::Failed("pam context init failed".to_owned()))?;
+
+ trace!("fill env");
+ for (k, v) in request.environment {
+ if k.contains('=') || !ALLOWED_ENVIRONMENT.contains(k.as_str()) {
+ continue;
+ }
+ let _ = ctx.putenv(format!("{k}={v}"));
+ }
+
+ trace!("authenticate");
+ ctx.authenticate(Flag::NONE)
+ .map_err(|_| fdo::Error::AuthFailed("pam authentication failed".to_owned()))?;
+
+ trace!("acct mgmt");
+ ctx.acct_mgmt(Flag::NONE)
+ .map_err(|_| fdo::Error::AuthFailed("pam acct mgmt failed".to_owned()))?;
+
+ Ok(())
+ });
+
+ thread_result?;
+
+ trace!("respond");
+ let proxy = zbus_polkit::policykit1::AuthorityProxy::new(&self.connection).await?;
+
+ let identity_details = request
+ .identity
+ .details
+ .iter()
+ .map(|(k, v)| (k.as_str(), (**v).try_clone().expect("success")))
+ .collect::<HashMap<_, _>>();
+ proxy
+ .authentication_agent_response2(
+ connection_uid,
+ &request.cookie,
+ &zbus_polkit::policykit1::Identity {
+ identity_kind: &request.identity.kind,
+ identity_details: &identity_details,
+ },
+ )
+ .await?;
+ Ok(())
+ }
+}
+
+const OBJ_PATH: &str = "/lach/PolkitHelper";
+
+#[derive(Parser)]
+struct Opts {
+ /// Not recommended: start as a session connection, then use escalation
+ /// to respond to polkit requests.
+ #[arg(long)]
+ session: bool,
+}
+
+#[tokio::main]
+async fn main() -> anyhow::Result<()> {
+ tracing_subscriber::fmt::init();
+ let opts = Opts::parse();
+ let connection = if opts.session {
+ Connection::session().await
+ } else {
+ Connection::system().await
+ }
+ .context("failed to open connection")?;
+
+ let session = opts.session;
+ let blocking_connection: anyhow::Result<blocking::Connection> = spawn_blocking(move || {
+ Ok(if session {
+ blocking::Connection::session()?
+ } else {
+ blocking::Connection::system()?
+ })
+ })
+ .await?;
+ let blocking_connection = blocking_connection.context("failed to open blocking connection")?;
+
+ if opts.session {
+ setuid(Uid::from_raw(0))
+ .context("polkit-backend needs to be suid if run in session mode")?;
+ }
+
+ connection
+ .object_server()
+ .at(
+ OBJ_PATH,
+ Helper {
+ connection: connection.clone(),
+ blocking_connection,
+ },
+ )
+ .await
+ .context("failed listen path")?;
+
+ connection
+ .request_name("lach.polkit.helper1")
+ .await
+ .context("failed to request name")?;
+
+ pending().await
+}
cmds/remowt-agent/Cargo.tomldiffbeforeafterboth--- a/cmds/remowt-agent/Cargo.toml
+++ b/cmds/remowt-agent/Cargo.toml
@@ -5,12 +5,18 @@
[dependencies]
anyhow = "1.0.86"
+bifrostlink.workspace = true
+bifrostlink-ports.workspace = true
clap = { version = "4.5.13", features = ["derive"] }
-pam-client = "0.5.0"
+futures = "0.3.30"
+futures-util = "0.3.30"
+nix = "0.29.0"
polkit-shared = { version = "0.1.0", path = "../../crates/polkit-shared" }
rand = "0.8.5"
+remowt-link-shared = { version = "0.1.0", path = "../../crates/remowt-link-shared" }
serde = { version = "1.0.204", features = ["derive"] }
tokio = { version = "1.39.2", features = ["rt-multi-thread", "fs", "macros"] }
+tokio-util = { version = "0.7.11", features = ["codec"] }
tracing = "0.1.40"
tracing-subscriber = "0.3.18"
ui-prompt = { version = "0.1.0", path = "../../crates/ui-prompt" }
cmds/remowt-agent/src/helper/dbus.rsdiffbeforeafterboth--- /dev/null
+++ b/cmds/remowt-agent/src/helper/dbus.rs
@@ -0,0 +1,79 @@
+use std::collections::HashMap;
+use std::marker::PhantomData;
+
+use polkit_shared::{BackendRequest, Identity};
+use tokio::runtime::Handle;
+use ui_prompt::dbus::DbusPrompterInterface;
+use ui_prompt::Prompter;
+use zbus::Connection;
+
+use crate::PolkitHelperProxy;
+
+use super::Helper;
+
+
+struct TemporaryPrompterInterface<P: Prompter + 'static> {
+ connection: Connection,
+ path: String,
+ _marker: PhantomData<P>,
+}
+impl<P: Prompter + 'static> TemporaryPrompterInterface<P> {
+ async fn new(connection: Connection, prompter: P) -> Self {
+ let path = format!(
+ "/remowt/prompters/{}",
+ uuid::Uuid::new_v4().to_string().replace("-", "_")
+ );
+ let _ = connection
+ .object_server()
+ .at(path.clone(), DbusPrompterInterface(prompter))
+ .await;
+ Self {
+ connection,
+ path,
+ _marker: PhantomData,
+ }
+ }
+}
+impl<P: Prompter + Send + Sync + 'static> Drop for TemporaryPrompterInterface<P> {
+ fn drop(&mut self) {
+ // FIXME: block_in_place prevents to moving to current_thread runtime
+ // There should be a blocking way to remove ObjectServer listener.
+ // As far as I can see, it is only async because of async RwLock, shouldn't it be
+ // just a sync lock?
+ tokio::task::block_in_place(move || {
+ Handle::current().block_on(async {
+ let _ = self
+ .connection
+ .object_server()
+ .remove::<DbusPrompterInterface<P>, String>(self.path.clone())
+ .await;
+ });
+ });
+ }
+}
+
+pub struct DbusHelper {
+ connection: Connection,
+ helper: PolkitHelperProxy<'static>,
+}
+impl Helper for DbusHelper {
+ async fn help_me<P: Prompter + Send + Sync + 'static>(
+ &self,
+ cookie: &str,
+ prompter: P,
+ identity: Identity,
+ ) -> anyhow::Result<()> {
+ let prompter = TemporaryPrompterInterface::new(self.connection.clone(), prompter).await;
+ self.helper
+ .init_conversation(
+ BackendRequest {
+ cookie: cookie.to_owned(),
+ environment: HashMap::new(),
+ prompter_path: prompter.path.clone(),
+ identity,
+ }, // cookie.to_owned(), HashMap::new(), prompter.path.clone()
+ )
+ .await?;
+ Ok(())
+ }
+}
cmds/remowt-agent/src/helper/mod.rsdiffbeforeafterboth--- /dev/null
+++ b/cmds/remowt-agent/src/helper/mod.rs
@@ -0,0 +1,18 @@
+use futures::Future;
+use polkit_shared::Identity;
+use ui_prompt::Prompter;
+
+mod suid;
+mod dbus;
+
+pub use suid::SuidHelper;
+pub use dbus::DbusHelper;
+
+pub trait Helper {
+ fn help_me<P: Prompter + Send + Sync + 'static>(
+ &self,
+ cookie: &str,
+ prompt: P,
+ identity: Identity,
+ ) -> impl Future<Output = anyhow::Result<()>> + Send;
+}
cmds/remowt-agent/src/helper/suid.rsdiffbeforeafterboth--- /dev/null
+++ b/cmds/remowt-agent/src/helper/suid.rs
@@ -0,0 +1,83 @@
+use std::pin::pin;
+use std::process::Stdio;
+
+use anyhow::{bail, anyhow};
+use futures::stream::Peekable;
+use futures::StreamExt as _;
+use nix::unistd::User;
+use polkit_shared::Identity;
+use tokio::io::AsyncWriteExt as _;
+use tokio::process::Command;
+use tokio::select;
+use tokio_util::codec::{FramedRead, LinesCodec};
+use ui_prompt::Prompter;
+
+use super::Helper;
+
+#[derive(Clone)]
+pub struct SuidHelper;
+impl Helper for SuidHelper {
+ async fn help_me<P: Prompter + 'static>(
+ &self,
+ cookie: &str,
+ prompt: P,
+ identity: Identity,
+ ) -> anyhow::Result<()> {
+ let Some(uid) = dbg!(identity.uid()) else {
+ bail!("can't process identity");
+ };
+ let user = User::from_uid(dbg!(uid))
+ .map_err(|e| anyhow!("error querying user: {e}"))?
+ .ok_or_else(|| anyhow!("user not found"))?;
+
+ let mut cmd = Command::new("polkit-agent-helper-1");
+ cmd.arg(user.name);
+ cmd.stdin(Stdio::piped());
+ cmd.stdout(Stdio::piped());
+ cmd.kill_on_drop(true);
+ let mut child = cmd.spawn()?;
+ let mut stdin = child.stdin.take().expect("piped");
+ let mut stdout =
+ pin!(
+ FramedRead::new(child.stdout.take().expect("piped"), LinesCodec::new()).peekable()
+ );
+
+ assert!(!cookie.contains("\n"));
+ stdin.write_all(cookie.as_bytes()).await?;
+ stdin.write_all(b"\n").await?;
+
+ while let Some(line) = stdout.next().await {
+ let line = dbg!(line?);
+ // TODO: Dedicated codec?
+ let res = if let Some(prompt_text) = line.strip_prefix("PAM_PROMPT_ECHO_OFF ") {
+ prompt.prompt_text(false, prompt_text, "", &[]).await?
+ } else if let Some(prompt_text) = line.strip_prefix("PAM_PROMPT_ECHO_ON ") {
+ prompt.prompt_text(true, prompt_text, "", &[]).await?
+ } else if let Some(msg_text) = line.strip_prefix("PAM_ERROR_MSG ") {
+ prompt.display_text(true, msg_text, &[]).await?;
+ String::new()
+ } else if let Some(msg_text) = line.strip_prefix("PAM_TEXT_INFO ") {
+ select! {
+ _ = Peekable::peek(stdout.as_mut()) => {},
+ r = prompt.display_text(false, msg_text, &[]) => {r?}
+ }
+ String::new()
+ } else if line == "SUCCESS" {
+ return Ok(());
+ } else if line == "FAILURE" {
+ bail!("helper binary reported failure")
+ } else {
+ // TODO: Success/failure handling
+ bail!("unknown agent request");
+ };
+
+ if res.contains("\n") {
+ bail!("response should not include newline")
+ }
+
+ stdin.write_all(res.as_bytes()).await?;
+ stdin.write_all(b"\n").await?;
+ }
+ bail!("agent finished unexpectedly")
+ }
+}
cmds/remowt-agent/src/main.rsdiffbeforeafterboth--- a/cmds/remowt-agent/src/main.rs
+++ b/cmds/remowt-agent/src/main.rs
@@ -1,281 +1,269 @@
use std::borrow::Cow;
use std::collections::{BTreeMap, HashMap};
+use std::future;
use std::io::{stdout, Write};
-use std::marker::PhantomData;
+use std::path::PathBuf;
use std::sync::{Arc, Mutex, OnceLock};
-use std::{future, process};
+use bifrostlink::{AddressT, Rpc};
+use bifrostlink_ports::unix_socket::from_socket;
use clap::Parser;
use polkit_shared::{emphasize, BackendRequest, Identity, PidDisplay};
-use tokio::runtime::Handle;
-use tokio::task::{AbortHandle, JoinHandle, LocalSet};
+use remowt_link_shared::Address;
+use tokio::io::{AsyncReadExt, AsyncWriteExt};
+use tokio::net::UnixStream;
+use tokio::runtime::Runtime;
+use tokio::task::AbortHandle;
use tracing::{info, trace};
-use ui_prompt::dbus::DbusPrompterInterface;
use ui_prompt::rofi::RofiPrompter;
use ui_prompt::{PrependSourcePrompter, Prompter, Source};
+use zbus::fdo;
use zbus::zvariant::{OwnedValue, Str};
-use zbus::{fdo, ObjectServer};
use zbus::{interface, proxy, Connection};
use zbus_polkit::policykit1::Subject;
-struct TemporaryPrompterInterface<P: Prompter + Send + Sync + 'static> {
- connection: Connection,
- path: String,
- _marker: PhantomData<P>,
-}
-impl<P: Prompter + Send + Sync + 'static> TemporaryPrompterInterface<P> {
- async fn new(connection: Connection, prompter: P) -> Self {
- let path = format!(
- "/remowt/prompters/{}",
- uuid::Uuid::new_v4().to_string().replace("-", "_")
- );
- let _ = connection
- .object_server()
- .at(path.clone(), DbusPrompterInterface(prompter))
- .await;
- Self {
- connection,
- path,
- _marker: PhantomData,
- }
- }
-}
-impl<P: Prompter + Send + Sync + 'static> Drop for TemporaryPrompterInterface<P> {
- fn drop(&mut self) {
- // FIXME: block_in_place prevents to moving to current_thread runtime
- // There should be a blocking way to remove ObjectServer listener.
- // As far as I can see, it is only async because of async RwLock, shouldn't it be
- // just a sync lock?
- tokio::task::block_in_place(move || {
- Handle::current().block_on(async {
- let _ = self
- .connection
- .object_server()
- .remove::<DbusPrompterInterface<P>, String>(self.path.clone())
- .await;
- });
- });
- }
-}
+use self::helper::{Helper, SuidHelper};
+pub mod helper;
+
struct CancelTaskOnDrop {
- tasks: Arc<Mutex<HashMap<String, AbortHandle>>>,
- handle: String,
+ tasks: Arc<Mutex<HashMap<String, AbortHandle>>>,
+ handle: String,
}
impl Drop for CancelTaskOnDrop {
- fn drop(&mut self) {
- info!("cancel on drop");
- if let Some(task) = self
- .tasks
- .lock()
- .expect("not poisoned")
- .remove(&self.handle)
- {
- task.abort();
- }
- }
+ fn drop(&mut self) {
+ info!("cancel on drop");
+ if let Some(task) = self
+ .tasks
+ .lock()
+ .expect("not poisoned")
+ .remove(&self.handle)
+ {
+ task.abort();
+ }
+ }
}
-struct Agent {
- helper: PolkitHelperProxy<'static>,
- tasks: Arc<Mutex<HashMap<String, AbortHandle>>>,
- connection: Connection,
+struct Agent<H> {
+ tasks: Arc<Mutex<HashMap<String, AbortHandle>>>,
+ helper: H,
}
-impl Agent {
- async fn new(connection: Connection) -> anyhow::Result<Self> {
- Ok(Self {
- helper: PolkitHelperProxy::new(&connection).await?,
- tasks: Arc::new(Mutex::new(HashMap::new())),
- connection,
- })
- }
+impl<H> Agent<H> {
+ fn new(helper: H) -> Self {
+ Agent {
+ tasks: Arc::new(Mutex::new(HashMap::new())),
+ helper,
+ }
+ }
}
#[interface(name = "org.freedesktop.PolicyKit1.AuthenticationAgent")]
-impl Agent {
- /// BeginAuthentication method
- #[allow(clippy::too_many_arguments)]
- async fn begin_authentication(
- &self,
- action_id: String,
- message: String,
- icon_name: String,
- mut details: BTreeMap<String, String>,
- cookie: String,
- identities: Vec<Identity>,
- ) -> zbus::fdo::Result<()> {
- use std::fmt::Write;
- info!("begin auth");
- let _cancel_guard = Arc::new(OnceLock::new());
- let task = {
- let connection = self.connection.clone();
- let helper = self.helper.clone();
- let cookie = cookie.clone();
- let _cancel_guard = _cancel_guard.clone();
- tokio::task::spawn(async move {
- let _cancel_guard = _cancel_guard.clone();
- trace!("conversation task");
- let mut description = format!("{message}\n\n<b>Action id:</b> {action_id}",);
- if let Some(subject) = details.remove("polkit.caller-pid") {
- let _ = write!(description, "\n<b>Caller:</b> ");
- if let Ok(pid) = subject.parse::<u32>() {
- let _ = write!(description, "{}", PidDisplay(pid));
- } else {
- let _ = write!(description, "{}", emphasize("invalid pid"));
- }
- }
- if let Some(subject) = details.remove("polkit.subject-pid") {
- let _ = write!(description, "\n<b>Subject:</b> ");
- if let Ok(pid) = subject.parse::<u32>() {
- let _ = write!(description, "{}", PidDisplay(pid));
- } else {
- let _ = write!(description, "{}", emphasize("invalid pid"));
- }
- }
- let mut prompter = PrependSourcePrompter {
- source: vec![Source(Cow::Borrowed("polkit agent"))],
- description: description.clone(),
- prompter: RofiPrompter,
- };
+impl<H> Agent<H>
+where
+ H: Helper + Clone + Send + Sync + 'static,
+{
+ /// BeginAuthentication method
+ #[allow(clippy::too_many_arguments)]
+ async fn begin_authentication(
+ &self,
+ action_id: String,
+ message: String,
+ icon_name: String,
+ mut details: BTreeMap<String, String>,
+ cookie: String,
+ identities: Vec<Identity>,
+ ) -> zbus::fdo::Result<()> {
+ use std::fmt::Write;
+ info!("begin auth");
+ let _cancel_guard = Arc::new(OnceLock::new());
+ let task = {
+ let helper = self.helper.clone();
+ let cookie = cookie.clone();
+ let _cancel_guard = _cancel_guard.clone();
+ tokio::task::spawn(async move {
+ let _cancel_guard = _cancel_guard.clone();
+ trace!("conversation task");
+ let mut description = format!("{message}\n\n<b>Action id:</b> {action_id}",);
+ if let Some(subject) = details.remove("polkit.caller-pid") {
+ let _ = write!(description, "\n<b>Caller:</b> ");
+ if let Ok(pid) = subject.parse::<u32>() {
+ let _ = write!(description, "{}", PidDisplay(pid));
+ } else {
+ let _ = write!(description, "{}", emphasize("invalid pid"));
+ }
+ }
+ if let Some(subject) = details.remove("polkit.subject-pid") {
+ let _ = write!(description, "\n<b>Subject:</b> ");
+ if let Ok(pid) = subject.parse::<u32>() {
+ let _ = write!(description, "{}", PidDisplay(pid));
+ } else {
+ let _ = write!(description, "{}", emphasize("invalid pid"));
+ }
+ }
+ let mut prompter = PrependSourcePrompter {
+ source: vec![Source(Cow::Borrowed("polkit agent"))],
+ description: description.clone(),
+ prompter: RofiPrompter,
+ };
- let identity_displays: Vec<String> =
- identities.iter().map(|v| v.to_string()).collect();
- let identity_displays: Vec<&str> =
- identity_displays.iter().map(|v| v.as_str()).collect();
- info!("choose identity");
- let choosen_identity = match identity_displays.len() {
- 0 => {
- return Err(fdo::Error::AuthFailed(
- "no identity to authenticate as".to_owned(),
- ))
- }
- 1 => 0,
- _ => {
- prompter
- .prompt_enum(
- "Identity",
- "Select identity to use for polkit authorization",
- &identity_displays,
- &[],
- )
- .await?
- }
- };
- info!("identity chosen");
+ let identity_displays: Vec<String> =
+ identities.iter().map(|v| v.to_string()).collect();
+ let identity_displays: Vec<&str> =
+ identity_displays.iter().map(|v| v.as_str()).collect();
+ info!("choose identity");
+ let choosen_identity = match identity_displays.len() {
+ 0 => {
+ return Err(fdo::Error::AuthFailed(
+ "no identity to authenticate as".to_owned(),
+ ))
+ }
+ 1 => 0,
+ _ => {
+ prompter
+ .prompt_enum(
+ "Identity",
+ "Select identity to use for polkit authorization",
+ &identity_displays,
+ &[],
+ )
+ .await?
+ }
+ };
+ info!("identity chosen");
+
+ let _ = write!(
+ description,
+ "\n<b>Identity:</b> {}",
+ identities[choosen_identity as usize]
+ );
+ prompter.description = description;
- let _ = write!(
- description,
- "\n<b>Identity:</b> {}",
- identities[choosen_identity as usize]
- );
- prompter.description = description;
+ prompter.source.push(Source(Cow::Borrowed("polkit daemon")));
- prompter.source.push(Source(Cow::Borrowed("polkit daemon")));
- // let connection = Connection::system().await?;
- // let helper = PolkitHelperProxy::new(&connection).await?;
- let prompter = TemporaryPrompterInterface::new(connection, prompter).await;
- info!("init conv");
- helper
- .init_conversation(
- BackendRequest {
- cookie: cookie.to_owned(),
- environment: HashMap::new(),
- prompter_path: prompter.path.clone(),
- // TODO: Let user choose
- identity: identities[choosen_identity as usize].clone(),
- }, // cookie.to_owned(), HashMap::new(), prompter.path.clone()
- )
- .await?;
- println!("ASKED");
- dbg!(action_id, message, icon_name, details, cookie, identities);
+ helper
+ .help_me(
+ &cookie,
+ prompter,
+ identities[choosen_identity as usize].clone(),
+ )
+ .await
+ .map_err(|e| fdo::Error::Failed(e.to_string()))?;
+ // let connection = Connection::system().await?;
+ // let helper = PolkitHelperProxy::new(&connection).await?;
- Ok(())
- })
- };
- self.tasks
- .lock()
- .unwrap()
- .insert(cookie.clone(), task.abort_handle());
- info!("abort handle stored");
- let _ = _cancel_guard.set(CancelTaskOnDrop {
- tasks: self.tasks.clone(),
- handle: cookie.clone(),
- });
+ Ok(())
+ })
+ };
+ self.tasks
+ .lock()
+ .unwrap()
+ .insert(cookie.clone(), task.abort_handle());
+ info!("abort handle stored");
+ let _ = _cancel_guard.set(CancelTaskOnDrop {
+ tasks: self.tasks.clone(),
+ handle: cookie.clone(),
+ });
- let _ = task.await;
+ let _ = task.await;
- Ok(())
- }
+ Ok(())
+ }
- /// CancelAuthentication method
- async fn cancel_authentication(&self, cookie: &str) -> zbus::fdo::Result<()> {
- info!("auth cancelled");
- if let Some(abort) = self.tasks.lock().unwrap().remove(cookie) {
- info!("abort handle found");
- abort.abort();
- }
- // debug!("Authentication cancled ! {cookie}");
- Ok(())
- }
+ /// CancelAuthentication method
+ async fn cancel_authentication(&self, cookie: &str) -> zbus::fdo::Result<()> {
+ info!("auth cancelled");
+ if let Some(abort) = self.tasks.lock().unwrap().remove(cookie) {
+ info!("abort handle found");
+ abort.abort();
+ }
+ // debug!("Authentication cancled ! {cookie}");
+ Ok(())
+ }
}
const OBJ_PATH: &str = "/org/freedesktop/PolicyKit1/AuthenticationAgent";
#[proxy(
- interface = "lach.PolkitHelper",
- default_service = "lach.polkit.helper1",
- default_path = "/lach/PolkitHelper"
+ interface = "lach.PolkitHelper",
+ default_service = "lach.polkit.helper1",
+ default_path = "/lach/PolkitHelper"
)]
trait PolkitHelper {
- fn init_conversation(&self, request: BackendRequest) -> zbus::Result<()>;
+ fn init_conversation(&self, request: BackendRequest) -> zbus::Result<()>;
}
#[derive(Parser)]
enum Opts {
- Agent,
- AskPass { description: String },
+ Agent,
+ AskPass {
+ description: String,
+ },
+ RealAgent {
+ #[arg(long)]
+ path: PathBuf,
+ },
}
-#[tokio::main]
-async fn main() -> anyhow::Result<()> {
- tracing_subscriber::fmt::init();
- let opts = Opts::parse();
+fn main() -> anyhow::Result<()> {
+ tracing_subscriber::fmt::init();
+ let opts = Opts::parse();
- match opts {
- Opts::Agent => {
- trace!("started");
- let conn = Connection::system().await?;
+ let runtime = Runtime::new()?;
- let proxy = zbus_polkit::policykit1::AuthorityProxy::new(&conn).await?;
- conn.object_server()
- .at(OBJ_PATH, Agent::new(conn.clone()).await?)
- .await?;
+ match opts {
+ Opts::Agent => {
+ // TODO: Setup env, directories with various things...
+ runtime.block_on(main_agent())
+ }
+ Opts::AskPass { description } => runtime.block_on(main_askpass(description)),
+ Opts::RealAgent { path } => runtime.block_on(main_real_agent(path)),
+ }
+}
+async fn main_real_agent(path: PathBuf) -> anyhow::Result<()> {
+ let mut stream = UnixStream::connect(path).await?;
+ stream.write_all(b"REMOWT_HELLO\0").await?;
+ let mut buf = [0u8; 12];
+ stream.read_exact(&mut buf).await?;
+ assert_eq!(&buf, b"REMOWT_EHLO\0");
+ let port = from_socket(stream);
+ let rpc = Rpc::<Address, remowt_link_shared::Error>::new(Address::Agent);
+ rpc.add_direct(Address::User, port, bifrostlink::Rtt(0));
+ Ok(())
+}
- let session_id = std::env::var("XDG_SESSION_ID")?;
- let mut details = HashMap::new();
- let val: OwnedValue = {
- let wrapped: Str<'_> = session_id.into();
- wrapped.into()
- };
- details.insert("session-id".to_string(), val);
- proxy
- .register_authentication_agent(
- &Subject {
- subject_kind: "unix-session".to_string(),
- subject_details: details,
- },
- "C",
- OBJ_PATH,
- )
- .await?;
- }
- Opts::AskPass { description } => {
- let password = RofiPrompter
- .prompt_text(false, &description, "SSH password request", &[])
- .await?;
- stdout().lock().write_all(password.as_bytes())?;
- }
- }
+async fn main_agent() -> anyhow::Result<()> {
+ trace!("started");
+ let conn = Connection::system().await?;
+
+ let proxy = zbus_polkit::policykit1::AuthorityProxy::new(&conn).await?;
+ conn.object_server()
+ .at(OBJ_PATH, Agent::new(SuidHelper))
+ .await?;
+
+ let session_id = std::env::var("XDG_SESSION_ID")?;
+ let mut details = HashMap::new();
+ let val: OwnedValue = {
+ let wrapped: Str<'_> = session_id.into();
+ wrapped.into()
+ };
+ details.insert("session-id".to_string(), val);
+ proxy
+ .register_authentication_agent(
+ &Subject {
+ subject_kind: "unix-session".to_string(),
+ subject_details: details,
+ },
+ "C",
+ OBJ_PATH,
+ )
+ .await?;
+ future::pending().await
+}
- future::pending().await
+async fn main_askpass(description: String) -> anyhow::Result<()> {
+ let password = RofiPrompter
+ .prompt_text(false, &description, "SSH password request", &[])
+ .await?;
+ stdout().lock().write_all(password.as_bytes())?;
+ future::pending().await
}
cmds/remowt-ssh/Cargo.tomldiffbeforeafterboth--- a/cmds/remowt-ssh/Cargo.toml
+++ b/cmds/remowt-ssh/Cargo.toml
@@ -4,3 +4,17 @@
edition = "2021"
[dependencies]
+clap = { version = "4.5.16", features = ["derive"] }
+openssh = { version = "0.11.0", features = ["native-mux"] }
+tracing-subscriber = "0.3.18"
+bifrostlink.workspace = true
+remowt-link-shared = { version = "0.1.0", path = "../../crates/remowt-link-shared" }
+tokio = { version = "1.39.3", features = ["macros"] }
+anyhow = "1.0.86"
+bifrostlink-ports.workspace = true
+uuid = { version = "1.10.0", features = ["v4"] }
+tempdir = "0.3.7"
+russh = { git = "https://github.com/Eugeny/russh/" }
+russh-config = { git = "https://github.com/Eugeny/russh/" }
+russh-keys = { git = "https://github.com/Eugeny/russh/" }
+async-trait = "0.1.81"
cmds/remowt-ssh/src/main.rsdiffbeforeafterboth--- a/cmds/remowt-ssh/src/main.rs
+++ b/cmds/remowt-ssh/src/main.rs
@@ -1,3 +1,140 @@
-fn main() {
- println!("Hello, world!");
+use std::borrow::Cow;
+use std::ffi::OsString;
+use std::os::unix::ffi::OsStringExt;
+use std::path::PathBuf;
+use std::sync::Arc;
+
+use anyhow::{bail, ensure};
+use async_trait::async_trait;
+use bifrostlink::Rpc;
+use clap::Parser;
+use remowt_link_shared::Address;
+use russh::client::{connect, Config, Handler, Session};
+use tempdir::TempDir;
+use tokio::io::{AsyncReadExt, AsyncWriteExt};
+use tokio::net::UnixSocket;
+
+#[derive(Parser)]
+struct Opts {
+ host: String,
+}
+
+struct MyHandler {
+ host: String,
+ port: u16,
+}
+#[async_trait]
+impl Handler for MyHandler {
+ type Error = russh::Error;
+ async fn check_server_key(
+ &mut self,
+ server_public_key: &russh_keys::key::PublicKey,
+ ) -> Result<bool, Self::Error> {
+ Ok(russh_keys::check_known_hosts(
+ &self.host,
+ self.port,
+ &server_public_key,
+ )?)
+ }
+}
+
+#[tokio::main(flavor = "current_thread")]
+async fn main() -> anyhow::Result<()> {
+ let rpc = Rpc::<Address, remowt_link_shared::Error>::new(Address::User);
+ tracing_subscriber::fmt::init();
+ let opts = Opts::parse();
+
+ let conf = dbg!(russh_config::parse_home(&opts.host)?);
+ println!("connect");
+ let mut sess = connect(
+ Arc::new(Config {
+ ..Default::default()
+ }),
+ dbg!((conf.host_name.clone(), conf.port)),
+ MyHandler {
+ host: conf.host_name,
+ port: conf.port,
+ },
+ )
+ .await?;
+ println!("agent");
+ let mut agent = russh_keys::agent::client::AgentClient::connect_env().await?;
+ for ele in agent.request_identities().await? {
+ let (_agent, res) = sess.authenticate_future(conf.user.clone(), ele, agent).await;
+ agent = _agent;
+ if res? {
+ break;
+ }
+ }
+ // let sess = Session::connect(opts.host, openssh::KnownHosts::Strict).await?;
+
+ let socket = UnixSocket::new_stream()?;
+
+ println!("mktemp");
+ let mut cmd_chan = sess.channel_open_session().await?;
+ cmd_chan
+ .exec(true, "mktemp -d remowt.XXXXXXXXXXXX --tmpdir")
+ .await?;
+ let mut stdout = vec![];
+ loop {
+ let Some(msg) = cmd_chan.wait().await else {
+ bail!("unexpected channel end");
+ };
+ match msg {
+ russh::ChannelMsg::Data { data } => stdout.extend(data.as_ref()),
+ russh::ChannelMsg::ExitStatus { exit_status } => {
+ if exit_status != 0 {
+ bail!("mktemp failed");
+ }
+ break;
+ }
+ _ => {}
+ }
+ }
+
+ ensure!(stdout.ends_with(b"\n"));
+ stdout.pop();
+
+ // Remote host is not neccessary linux, openssh crate makes incorrect assumptions here.
+ // TODO: Remove on local close.
+ let remote_dir = PathBuf::from(OsString::from_vec(stdout));
+ let remote_socket = remote_dir.join("primary.sock");
+
+ let local_dir = TempDir::new("remowt")?;
+ let local_socket = local_dir.path().join("primary.sock");
+
+ println!("listen");
+ socket.bind(&local_socket)?;
+ let listener = socket.listen(1)?;
+
+ eprintln!("forward socket");
+
+ let mut sock = sess
+ .channel_open_direct_streamlocal(dbg!(remote_socket.to_str().expect("path is utf-8")))
+ .await?;
+
+ eprintln!("wait");
+ while let Some(v) = sock.wait().await {
+ dbg!(v);
+ }
+
+ eprintln!("spawn agent");
+
+ // let _agent = sess
+ // .command("/home/lach/.remowt/remowt-agent")
+ // .arg("agent-real")
+ // .arg("--path")
+ // .arg(remote_socket.to_str().expect("path is utf-8"))
+ // .spawn()
+ // .await?;
+ //
+ // let (mut conn, _) = listener.accept().await?;
+ // let mut buf = [0u8; 13];
+ // conn.read_exact(&mut buf).await?;
+ // assert_eq!(&buf, b"REMOWT_HELLO\0");
+ // conn.write_all(b"REMOWT_EHLO\0").await?;
+ //
+ // println!("handshake complete!");
+
+ Ok(())
}
crates/polkit-shared/src/lib.rsdiffbeforeafterboth--- a/crates/polkit-shared/src/lib.rs
+++ b/crates/polkit-shared/src/lib.rs
@@ -47,6 +47,19 @@
pub details: HashMap<String, OwnedValue>,
}
+impl Identity {
+ pub fn uid(&self) -> Option<Uid> {
+ if self.kind != "unix-user" {
+ return None;
+ }
+ let uid = self.details.get("uid")?;
+ let Value::U32(uid) = &**uid else {
+ return None;
+ };
+ Some(Uid::from_raw(*uid))
+ }
+}
+
impl fmt::Display for Identity {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self.kind.as_str() {
crates/remowt-link-shared/Cargo.tomldiffbeforeafterboth--- /dev/null
+++ b/crates/remowt-link-shared/Cargo.toml
@@ -0,0 +1,11 @@
+[package]
+name = "remowt-link-shared"
+version = "0.1.0"
+edition = "2021"
+
+[dependencies]
+bifrostlink.workspace = true
+serde = { version = "1.0.208", features = ["derive"] }
+serde_json = "1.0.125"
+thiserror = "1.0.63"
+tokio = "1.39.3"
crates/remowt-link-shared/src/lib.rsdiffbeforeafterboth--- /dev/null
+++ b/crates/remowt-link-shared/src/lib.rs
@@ -0,0 +1,39 @@
+use bifrostlink::error::{ErrorT, ListenerForYourRequestHasBeenDeadError, ResponseError};
+use bifrostlink::AddressT;
+use serde::{Deserialize, Serialize};
+
+#[derive(Clone, Serialize, Hash, Eq, Debug, PartialEq, Deserialize)]
+pub enum Address {
+ User,
+ Agent,
+}
+impl AddressT for Address {}
+
+#[derive(thiserror::Error, Debug)]
+pub enum Error {
+ #[error("listener is dead")]
+ ListenerDead,
+ #[error("response: {0}")]
+ Response(String),
+}
+impl From<ListenerForYourRequestHasBeenDeadError> for Error {
+ fn from(_value: ListenerForYourRequestHasBeenDeadError) -> Self {
+ Self::ListenerDead
+ }
+}
+impl From<serde_json::Error> for Error {
+ fn from(_value: serde_json::Error) -> Self {
+ Self::ListenerDead
+ }
+}
+impl From<Error> for ResponseError {
+ fn from(val: Error) -> Self {
+ ResponseError(val.to_string())
+ }
+}
+impl From<ResponseError> for Error {
+ fn from(value: ResponseError) -> Self {
+ Self::Response(value.0)
+ }
+}
+impl ErrorT for Error {}
crates/ui-prompt/Cargo.tomldiffbeforeafterboth--- a/crates/ui-prompt/Cargo.toml
+++ b/crates/ui-prompt/Cargo.toml
@@ -4,6 +4,7 @@
edition = "2021"
[dependencies]
+bifrostlink.workspace = true
serde = "1.0.204"
thiserror = "1.0.63"
tokio = { version = "1.39.2", features = ["io-util", "macros", "process", "rt"] }
crates/ui-prompt/src/bifrost.rsdiffbeforeafterboth--- /dev/null
+++ b/crates/ui-prompt/src/bifrost.rs
@@ -0,0 +1,166 @@
+use bifrostlink::error::ErrorT;
+use bifrostlink::{request, AddressT, Rpc};
+use serde::{Deserialize, Serialize};
+
+use crate::{Error, Prompter, Source};
+
+pub struct BifrostPrompter<A: AddressT, E: ErrorT> {
+ pub address: A,
+ pub rpc: Rpc<A, E>,
+}
+
+#[derive(Serialize, Deserialize)]
+struct EnumRequest {
+ prompt: String,
+ description: String,
+ variants: Vec<String>,
+ source: Vec<Source>,
+}
+#[derive(Serialize, Deserialize)]
+struct EnumResponse {
+ value: u32,
+}
+request!(EnumRequest => EnumResponse);
+
+#[derive(Serialize, Deserialize)]
+struct TextRequest {
+ echo: bool,
+ prompt: String,
+ description: String,
+ source: Vec<Source>,
+}
+#[derive(Serialize, Deserialize)]
+struct TextResponse {
+ value: String,
+}
+request!(TextRequest => TextResponse);
+
+#[derive(Serialize, Deserialize)]
+struct DisplayRequest {
+ error: bool,
+ description: String,
+ source: Vec<Source>,
+}
+request!(DisplayRequest => ());
+
+impl<A: AddressT, E: ErrorT> Prompter for BifrostPrompter<A, E>
+where
+ crate::Error: From<E>,
+{
+ async fn prompt_enum(
+ &self,
+ prompt: &str,
+ description: &str,
+ variants: &[&str],
+ source: &[crate::Source],
+ ) -> crate::Result<u32> {
+ let res = self
+ .rpc
+ .request(
+ self.address.clone(),
+ &EnumRequest {
+ prompt: prompt.to_owned(),
+ description: description.to_owned(),
+ variants: variants.into_iter().map(|v| (*v).to_owned()).collect(),
+ source: source.to_vec(),
+ },
+ )
+ .await?;
+ Ok(res.value)
+ }
+
+ async fn prompt_text(
+ &self,
+ echo: bool,
+ prompt: &str,
+ description: &str,
+ source: &[crate::Source],
+ ) -> crate::Result<String> {
+ let res = self
+ .rpc
+ .request(
+ self.address.clone(),
+ &TextRequest {
+ echo,
+ prompt: prompt.to_owned(),
+ description: description.to_owned(),
+ source: source.to_vec(),
+ },
+ )
+ .await?;
+ Ok(res.value)
+ }
+
+ async fn display_text(
+ &self,
+ error: bool,
+ description: &str,
+ source: &[crate::Source],
+ ) -> crate::Result<()> {
+ self.rpc
+ .request(
+ self.address.clone(),
+ &DisplayRequest {
+ error,
+ description: description.to_owned(),
+ source: source.to_vec(),
+ },
+ )
+ .await?;
+ Ok(())
+ }
+}
+
+pub fn handle_bifrost_prompts<
+ P: Prompter + Clone + 'static,
+ A: AddressT,
+ E: ErrorT + From<Error>,
+>(
+ rpc: &Rpc<A, E>,
+ prompt: P,
+) {
+ rpc.register_request_handler(true, {
+ let prompt = prompt.clone();
+ move |_addr, req: EnumRequest| {
+ let prompt = prompt.clone();
+ async move {
+ let i = prompt
+ .prompt_enum(
+ &req.prompt,
+ &req.description,
+ &req.variants.iter().map(|v| v.as_str()).collect::<Vec<_>>(),
+ &req.source,
+ )
+ .await?;
+
+ Ok(EnumResponse { value: i })
+ }
+ }
+ });
+ rpc.register_request_handler(true, {
+ let prompt = prompt.clone();
+ move |_addr, req: TextRequest| {
+ let prompt = prompt.clone();
+ async move {
+ let i = prompt
+ .prompt_text(req.echo, &req.prompt, &req.description, &req.source)
+ .await?;
+
+ Ok(TextResponse { value: i })
+ }
+ }
+ });
+ rpc.register_request_handler(true, {
+ let prompt = prompt.clone();
+ move |_addr, req: DisplayRequest| {
+ let prompt = prompt.clone();
+ async move {
+ prompt
+ .display_text(req.error, &req.description, &req.source)
+ .await?;
+
+ Ok(())
+ }
+ }
+ });
+}
crates/ui-prompt/src/lib.rsdiffbeforeafterboth--- a/crates/ui-prompt/src/lib.rs
+++ b/crates/ui-prompt/src/lib.rs
@@ -5,6 +5,7 @@
pub mod dbus;
pub mod rofi;
+pub mod bifrost;
#[derive(thiserror::Error, Debug)]
pub enum Error {
@@ -25,7 +26,7 @@
}
}
-pub trait Prompter {
+pub trait Prompter: Send + Sync {
fn prompt_radio(
&self,
prompt: &str,
@@ -77,6 +78,48 @@
) -> Result<String>;
fn display_text(&self, error: bool, description: &str, source: &[Source]) -> Result<()>;
}
+impl<P> Prompter for &P
+where
+ P: Prompter,
+{
+ fn prompt_radio(
+ &self,
+ prompt: &str,
+ description: &str,
+ source: &[Source],
+ ) -> impl Future<Output = Result<bool>> + Send {
+ (*self).prompt_radio(prompt, description, source)
+ }
+
+ fn prompt_enum(
+ &self,
+ prompt: &str,
+ description: &str,
+ variants: &[&str],
+ source: &[Source],
+ ) -> impl Future<Output = Result<u32>> + Send {
+ (*self).prompt_enum(prompt, description, variants, source)
+ }
+
+ fn prompt_text(
+ &self,
+ echo: bool,
+ prompt: &str,
+ description: &str,
+ source: &[Source],
+ ) -> impl Future<Output = Result<String>> + Send {
+ (*self).prompt_text(echo, prompt, description, source)
+ }
+
+ fn display_text(
+ &self,
+ error: bool,
+ description: &str,
+ source: &[Source],
+ ) -> impl Future<Output = Result<()>> + Send {
+ (*self).display_text(error, description, source)
+ }
+}
pub struct PrependSourcePrompter<P> {
pub prompter: P,
flake.nixdiffbeforeafterboth--- a/flake.nix
+++ b/flake.nix
@@ -62,6 +62,7 @@
cargo-release
rustPlatform.bindgenHook
pam
+ just
];
};
formatter = pkgs.alejandra;
rust-toolchain.tomldiffbeforeafterboth--- a/rust-toolchain.toml
+++ b/rust-toolchain.toml
@@ -1,3 +1,4 @@
[toolchain]
channel = "nightly-2024-07-20"
components = ["rustfmt", "clippy", "rust-analyzer", "rust-src"]
+targets = ["x86_64-unknown-linux-musl"]