{"id":18361236,"url":"https://github.com/hujun-open/rclip","last_synced_at":"2025-04-06T14:31:39.277Z","repository":{"id":151415817,"uuid":"105465334","full_name":"hujun-open/rclip","owner":"hujun-open","description":"a tool to copy selected text in tmux copy mode on remote host to local system clipboard","archived":false,"fork":false,"pushed_at":"2024-06-14T18:37:33.000Z","size":13,"stargazers_count":21,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T01:51:12.633Z","etag":null,"topics":["clipboard","copy-paste","tmux"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hujun-open.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-01T18:47:23.000Z","updated_at":"2025-01-24T10:30:12.000Z","dependencies_parsed_at":"2024-11-05T22:34:36.573Z","dependency_job_id":"947cb7aa-1840-4085-8f7f-01fdc1e37e9d","html_url":"https://github.com/hujun-open/rclip","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hujun-open%2Frclip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hujun-open%2Frclip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hujun-open%2Frclip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hujun-open%2Frclip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hujun-open","download_url":"https://codeload.github.com/hujun-open/rclip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247495925,"owners_count":20948127,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["clipboard","copy-paste","tmux"],"created_at":"2024-11-05T22:32:52.662Z","updated_at":"2025-04-06T14:31:34.264Z","avatar_url":"https://github.com/hujun-open.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# rclip\nrclip is a tool copy text from remote host to local system cliboard; \n\nit is specifically designed for copy seletected text in tmux copy-mode on a remote host to local system cliboard over network; which is a big pain point of using tmux;\n\n**Note: You don't need rclip if your terminal supports [OSC 52](https://github.com/tmux/tmux/wiki/Clipboard#how-it-works)**\n\n## how does it work?\nfirst run rclip as reflector role on remote host, which is processing listening on two ports over TLS:\n* rcv_port: default 8891\n* send_port: default 8890\n\nthe ports could be changed by commandline parameters\n\nany text received on rcv_port will be forwarded to send_port   \n\nrun rclip as sender role on local system, it connects to the send_port of reflector, and copy the received text to local system clipboard\n\nconfigure tmux so that the tmux copy-pipe command invoke rclip as receiver role, which connects to rcv_port of reflector, and send selected text to reflector;\n\n## why this 3 party design?\nthis is to get around firewall between remote host and local system; remote host is typicall a server, while local system is typically a client device like a laptop;\n\nif you use VPN to remote access the server, there typically will be a firewall between server and local system, and that firewall will likely to block any connection initiated by server to the local system; so a simple client and server design won't work\n\nrclip also send keepalive message every 40 seconds between reflector and sender to avoid firewall idle timeout the TCP connection;\n\n\n\n## security\n\nrclip use TLS to secure communication between reflector, sender and receiver; it also uses client authentication with its own root CA to prevent spoof;\n\nby default, rclip sender and receiver will check SAN(Subject Alternative Name) of reflector's certificate, to see the reflector's IP or FQDN match its certificate SAN; however this check could be skipped by using a hard coded \"1.1.1.1\" in SAN of reflector certificate when parameter \"-loose\" is specified; this is to avoid hassle to create a different certificate for each remote host; this of course decrease the overall security, but personally think it is acceptable trade-off given user typically specify the reflector address on local system directly;\n\n## build\nrclip is coded with golang ver1.9, just use \"go build\" in the source directory to build the binary;\ngolang pkg required:\n* github.com/atotto/clipboard\n\n## install\nsince rclip use TLS and its own CA, so following key and certificates are needed to generated before installation:\n* root CA cert/key\n* reflector key/cert\n* sender key/cert\n* receiver key/cert\n\nnotes:\n  * there are many opensource tools could generate key and certs like [openssl](https://www.openssl.org/) or [XCA](http://xca.sourceforge.net/)\n  * If you want to skip SAN check, make sure there is SubjectAltName extension with \"1.1.1.1\" as ip addresss in the certificate of reflector\n\n\nrclip expect above key/certs located in following directory:\n* Windows: [windows_user_dir]\\appdata\\AppData\\Roaming\\rclip\n* Linux/OSX: $HOME/.rclip/\n\n\non remote host where tmux is running, following cert/keys with expected file name are needed:\n* root CA cert: ca_cert\n* reflector cert/key: refl_cert/refl_key\n* receiver cert/key: rcv_cert/rcv_key\n\non local system, following cert/keys are needed:\n* root CA cert: ca_cert\n* sender key/cert: sender_cert/sender_key\n\nall cert/key files's permission should be set that only owner could read\n\nadd following line in your .tmux.conf on remote host:\n```\nbind-key -T copy-mode-vi _your_key_of_choice_ send-keys -X copy-pipe \"_rclip_install_path_/rclip\"\n```\nthis is an example:\n```\nbind-key -T copy-mode-vi y send-keys -X copy-pipe \"/usr/local/bin/rclip\"\n```\nnote: if you want to skip SAN check, add \"-loose\"; e.g. \n```\nbind-key -T copy-mode-vi _your_key_of_choice_ send-keys -X copy-pipe \"_rclip_install_path_/rclip -loose\"\n```\nnote: invoke rclip without any parameter, it will run as receiver, and connects to reflector on the same host, using default recv_port\n\n## usage\non remote host:\n* start reflector process: \n```\nrclip -role refl\n``` \n\non local system:\n* start sender process: \n```\nrclip -role sender -refl_ip \u003cremote_host_ip\u003e\n```\nnote: if you want to skip SAN check, add \"-loose\"; e.g.\n```\nrclip -role sender -refl_ip \u003cremote_host_ip\u003e -loose\n```\n\nTo make a remote copy: go into tmux copy mode on remote host, select some text, press the specified key, voila, the text are copied into local clipboard, secury \u0026 easy;\n\n## CLI Parameter\n```\nremote clipboard, version 1.1\nflag provided but not defined: -?\nUsage of rclip:\n  -loose\n        use hard coded address for reflector certificate SAN check\n  -rcv_port uint\n        specify the port for receiver on reflector (default 8891)\n  -refl_ip string\n        reflector listening ip address\n  -role string\n        specify the role, rcv/refl/sender (default \"rcv\")\n  -send_port uint\n        specify the port for sender on reflector (default 8890)\n```\n\n\n## license\nMIT; https://opensource.org/licenses/MIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhujun-open%2Frclip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhujun-open%2Frclip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhujun-open%2Frclip/lists"}