tinc异地组网使用实例

tinc异地组网使用实例 tinc是一个组建虚拟专用网络(VPN)的工具,通过隧道及加密技术在互联网上点与点之间创建专有网络。tinc 在网络层工作,因此无需对现有软件进行修改和配置。其数据通讯经过加密和压缩,能避免敏感数据和隐私的泄露。 vps主机安装设置tinc debian系统 公网ip 12.23.34.45 vpn名称 bbq vpn主机名 tcb vpn ip 10.0.0.11 安装tinc 使用apt install tinc -y安装tinc ➜ ~ apt install tinc -y Reading package lists... Done Building dependency tree... Done Reading state information... Done The following additional packages will be installed: liblzo2-2 The following NEW packages will be installed: liblzo2-2 tinc 0 upgraded, 2 newly installed, 0 to remove and 6 not upgraded. Need to get 261 kB of archives. After this operation, 831 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian bookworm/main amd64 liblzo2-2 amd64 2.10-2 [56.9 kB] Get:2 http://deb.debian.org/debian bookworm/main amd64 tinc amd64 1.0.36-2+b2 [204 kB] Fetched 261 kB in 0s (2,189 kB/s) Selecting previously unselected package liblzo2-2:amd64. (Reading database ... 56790 files and directories currently installed.) Preparing to unpack .../liblzo2-2_2.10-2_amd64.deb ... Unpacking liblzo2-2:amd64 (2.10-2) ... Selecting previously unselected package tinc. Preparing to unpack .../tinc_1.0.36-2+b2_amd64.deb ... Unpacking tinc (1.0.36-2+b2) ... Setting up liblzo2-2:amd64 (2.10-2) ... Setting up tinc (1.0.36-2+b2) ... Created symlink /etc/systemd/system/multi-user.target.wants/tinc.service → /lib/systemd/system/tinc.service. Processing triggers for man-db (2.11.2-2) ... Processing triggers for libc-bin (2.36-9+deb12u9) ... 新建vpn配置目录 以vpn名称新建配置目录 ...

三月 31, 2025 · jqx

使用Cloudflare Zero Trust实现网页登录SSH

使用Cloudflare Zero Trust实现网页登录SSH 首先登录https://one.dash.cloudflare.com/ 网络->Tunnels,创建隧道,隧道类型选择Cloudflared,隧道名自定义hhssh。 按照提示安装cloudflared并连接隧道,vps在这里选择debian,然后按照提示安装cloudflared并运行。 curl -L --output cloudflared.deb https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64.deb && sudo dpkg -i cloudflared.deb && sudo cloudflared service install eyJhIjoiOWRmMjczNGM3NjI3ZTNiMmZh 连接成功后,页面下方 Connectors 会显示当前已连接的设备。 下一步,开始设置公共主机名。 子域中自定义hhssh,域选择自有域名,路径(path)留空,服务类型选择SSH,URL里填写localhost:22,其中22为服务器ssh端口,按照实际情况设置,保存隧道。 Access->应用程序,添加应用程序。 应用程序类型选择 自托管,基本信息中应用程序名设置为hhssh,会话持续时长默认24小时,可自定义。 点击添加公共主机名,同上述Tunnels域名设置即可,点击下一步,在最后高级设置中,浏览器呈现设置中选择SSH保存设置。 下来设置邮箱验证策略,Access->策略,添加策略。 策略名自定义emailauth,操作为允许(allow),添加规则中,选择器设置为Emails,值中填写自己用来接收验证码的邮箱地址,保存。 Access->应用程序,选择刚建立的hhss,右侧三点菜单,编辑配置,在策略tab中,点击选择现有策略,勾选刚才新建的emailauth即可。 通过域名hhssh.0x8.net来登录页面,会提示输入邮箱接收验证码,输入验证码后即可按提示输入服务器账号密码来登录ssh。 享受你的webssh之旅吧!

一月 23, 2025 · jqx

设置screen实现每次登录vps使用同一会话

设置screen实现每次登录vps使用同一会话 首先安装screen apt install screen # or dnf install screnn # or pacman -S screen 新建.keepsession.sh脚本, vi ~/.keepsession.sh,内容如下 #!/bin/sh if screen -ls | grep -q "There is a screen on"; then screen -xRR else screen -S mysession fi chmod +x ~/.keepsession.sh添加执行权限,编辑~/.bashrc,添加以下内容: if [ -f ~/.keepsession.sh ]; then source ~/.keepsession.sh fi 这样以后每次登录都打开之前创建的会话。

一月 22, 2025 · jqx

使用证书安全快捷的连接SSH服务

经常使用ssh连接服务器的朋友,有时为了安全可能ssh还使用了非默认端口(22),这样每次使用密码登录时,都得按照如下的命令来连接服务器。这样显得有点不方便,因此推荐将密码设置复杂难以回溯,然后使用证书的形式来登录ssh服务器,免去了每次使用密码的麻烦。只要你把证书妥善保管,就会安全如初。 ssh user@hostname -p223 本地生成证书 首先使用ssh-keygen命令在本地生成证书,为了方便使用未设置证书密码。 $ ssh-keygen Generating public/private ed25519 key pair. Enter file in which to save the key (~/.ssh/id_ed25519): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in ~/.ssh/id_ed25519 Your public key has been saved in ~/.ssh/id_ed25519.pub The key fingerprint is: SHA256:Kcd0LM......Vams1XJA user@op36 The key's randomart image is: +--[ED25519 256]--+ | cef+.=.. | | ..oEo+.X | | aaaa+o O | | obbbb= B | |cccccc= S . | |dddd + . | |O w | | o | | | +----[SHA256]-----+ 设置SSH服务 使用ssh-copy-id将公钥拷贝至远端服务器 ...

一月 9, 2025 · JQ

GitHub端口22连接超时改用443端口连接

GitHub端口22连接超时改用443端口连接 clone github仓库时老是提示22端口超时,如下: $ git clone [email protected]:xtod/yuwang.git Cloning into 'yuwang'... ssh: connect to host github.com port 22: Connection timed out fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. 还提示是否对该仓库具有访问权或者仓库是否存在,这不废话么,我肯定确认。 于是试着ssh -T了一下,看能不能访问,但提示的还是22端口超时 $ ssh -T [email protected] ssh: connect to host github.com port 22: Connection timed out 现在来看应该是访问问题,在此把访问端口改为443吧,不用22了,编辑~/.ssh/config写入如下内容: Host github.com HostName ssh.github.com User git Port 443 PreferredAuthentications publickey IdentityFile ~/.ssh/id_ed25519 然后再ssh -T试一下 ...

一月 1, 2025 · JQ