Basic Usage of Free Serv00 Vritual Host Service on FreeBSD - NETSEC

Latest

Learning, Sharing, Creating

Cybersecurity Memo

Tuesday, November 19, 2024

Basic Usage of Free Serv00 Vritual Host Service on FreeBSD

ADMIN.NET.PL presents its brand new free hosting service: Serv00.com - Revolutionary Free Hosting. It is based on cPanel or DirectAdmin PHP+MySQL hosting on FreeBSD OS.



Website:
  •  https://www.serv00.com/
Features:
  • Support for PHP scripts: from 5.6 to 8.1.
  • Django, Pyramid, Catalyst, RoR, Node.js, Redmine, Trac
  • Python, Ruby, Perl, Java, TCL/TK, Lua, Erlang, Rust, Pascal, C, C++, D, R
  • GIT, SVN, and HG (Mercurial) repositories
  • Databases: MySQL 8.0, PostgreSQL 11, MongoDB 4.0
  • Access to SSH and the ability to manage the account using the devil command
  • SSL certificate support (SNI)
  • Free Let's encrypt certificates
  • Custom error pages
  • Unlimited number of email aliases
  • Anti-spam and anti-virus protection
  • E-Mail via IMAP and POP3 protocols with SSL/TLS encryption and Webmail
  • Crontab jobs
  • Ability to run your own software
  • Daily backups (7 days)
  • No artificial limit for a single file size
  • DNS servers for your domains
  • .Htaccess and mod_rewrite support
  • Servers are located in the European Union

Background Info for Serv00




Following info is from: https://saika.us.kg/2024/08/15/serv00-keep-alive/
  1. Serv00 不是 VPS,是一台独立服务器,新建了很多用户,按照用户进行隔离,并没有虚拟化一个完整的 FreeBSD Server 给用户,所以没有 Root 权限,但是内置了很多独立服务器自带的软件包、服务等等,可以说是有利有弊;
  2. Serv00 不是 Linux 系统,是 FreeBSD 系统,虽说 Unix like 使用起来总是相似的,但是总归还是不一样的;
  3. Serv00 自带了一个 Web 服务器——Apache。Apache 与 Nginx 功能相似但是使用方法是不一样的,而且在没有 Root 权限的情况下,很多东西你无法进行设置;
  4. 每个用户能够最多预留三个端口的使用权,而且端口范围在 1024-64000;
  5. 因为是独立服务器按照用户进行隔离,所以你不能对其进行重启、重装等操作,机器的重启与重装会影响这台 Server 上的一万名用户
  6. And so on…

Serv00 的 Apache 服务器附带了一个插件——Phusion Passenger,利用其特性,我们能够在 Serv00 上实现访问网页即对进行实现保活。已知 WWW websites 在被访问时会按照其类型被唤醒,而且通过 Phusion Passenger 托管的 Django / NodeJS / Ruby on Rails 等类型的应用是可以端口复用,在 80 /443 端口提供 Web 服务的,所以只需要在这样一个脚本或者应用内写入进程的检测与唤醒即可通过网页对进程保活。




Register an Account

As to today, Nov 19, 2024, the latest server panel13.serv00.com is also full. If you tried to register an account, you will get a notification The account limit on the server has been reached - please try again later!. 

https://panel.serv00.com/

You will have to wait until server has some free space which means some accounts have been cleaned up and totoal numbers is less than 140000 on the server, then you will be able to register an account.

Currently, 140000 accounts and no space left for new registration on the server.

 




1 Create your own account

2 Log into your assigned panel through https://panel.serv00.com/

For me, I am using https://panel13.serv00.com/

3 Panel Dashboard - DevilWEB2.0


4 Check your Account Info and Server Info

Plan:FREE
Expiration date:Nov. 18, 2034, 4:51 a.m.


Mail servers

SMTP server:mail13.serv00.com
IMAP server:mail13.serv00.com
POP3 server:mail13.serv00.com

Database servers

MySQL server:mysql13.serv00.com
PostgreSQL server:pgsql13.serv00.com
MongoDB server:mongo13.serv00.com

DNS servers

DNS server #1:dns1.serv00.com
DNS server #2:dns2.serv00.com


Login with SSH

 SSH

host: Depending on the allocated server when you registered. For me, there are 12 servers full already, so I got server 13, which is :
  • panel13.serv00.com
user name and account is the one you regestered at serv00.



To keep you account alive, you had better to log in once every 90 days

https://www.serv00.com/tos


Install WordPress


https://docs.serv00.com/WordPress/

 Create a MySQL DB

make sure you got your db name, username (start with something m7948_) & password, server host name. 

  1. Go to ~/domains/DOMAIN/ where DOMAIN (such as jo.serv00.net) is the name of the domain where WordPress will be installed, command: cd ~/domains/DOMAIN/
  2. Download the installation archive of the latest CMS version:
    fetch https://wordpress.org/latest.zip
  3. Delete the public_html directory, unpack the archive, rename the unpacked directory and remove the unnecessary archive after unpacking: rm -r public_html && unzip latest.zip && mv wordpress public_html && rm latest.zip
  4. Go to the website and continue the classic Wordpress installation in your browser. https://jo.serv00.net



Deploy Your Own Apps in Serv00


Enable - Run Your Own Applications 

DevilWEB2.0 - Additional services - Run your own applications - Enabled

Unblock IP

If for some reasons, your ip got blocked by serv00.com, you can use following page to unblock your ip. 
https://www.serv00.com/ip_unban/


Install PM2



bash <(curl -s https://raw.githubusercontent.com/Shadownc/serv00-sh/main/install-pm2.sh)
# or
bash <(curl -s https://raw.githubusercontent.com/k0baya/alist_repl/main/serv00/install-pm2.sh)

PM2 commands list:
  • pm2 start ./auto-renew.sh
  • pm2 list
  • pm2 delete auto-renew


Install Cloudflared

Cloudflared 官方仓库并没有构建 FreeBSD 系统上能够使用的二进制文件,但是同样的,我找到了第三方的构筑。使用第三方构筑的二进制文件,就能愉快的使用隧道了。

关于 Cloudflared 是什么,有什么用,ARGO_TOKEN 如何获取等部分,这里不再赘述,详细可以查看我的关于 CodeSandbox 的文章。

1 创建并进入Cloudflared 的工作目录:
  • mkdir -p ~/domains/cloudflared && cd ~/domains/cloudflared

2 下载 Cloudflared:
  • wget https://cloudflared.bowring.uk/binaries/cloudflared-freebsd-latest.7z && 7z x cloudflared-freebsd-latest.7z && rm cloudflared-freebsd-latest.7z && mv -f ./temp/* ./cloudflared && rm -rf temp

3 测试运行:
  • ./cloudflared tunnel --edge-ip-version auto --protocol http2 --heartbeat-interval 10s run --token ARGO_TOKEN

其中 ARGO_TOKEN 要替换成自己的。确定运行没有问题后,按 Ctrl+c即可停止运行。

4 使用 pm2 启动 Cloudflared:
  • pm2 start ./cloudflared -- tunnel --edge-ip-version auto --protocol http2 --heartbeat-interval 10s run --token ARGO_TOKEN

其中 ARGO_TOKEN 要替换成自己的。

[j@s13]:<~/domains/cloudflared>$ pm2 start ./cloudflared -- tunnel --edge-ip-version auto --protocol http2 --heartbeat-interval 10s run --token eyJhIjoiN2YzNjkyNmRlOTI3ZWQ3NmEwYThhOGYyNWFhZjMxOGMiLCJ0IjoiODQ3YzM3NTctODRhZC00YjExLTliNzAtMmNiZmUwZjgzYmNhIiwicyI6Ik1qTTJZekV5T1RndFkyVXdPQzAwWkRCaExUaGpZbVF0WkRVMk1ETTRNREl3TldSbSJ91

[PM2] Spawning PM2 daemon with pm2_home=/home/jo/.pm2
[PM2] PM2 Successfully daemonized
[PM2] Starting /usr/home/jo/domains/cloudflared/cloudflared in fork_mode (1 instance)
[PM2] Done.
┌────┬────────────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name           │ namespace   │ version │ mode    │ pid      │ uptime │ ↺    │ status    │ cpu      │ mem      │ user     │ watching │
├────┼────────────────┼─────────────┼─────────┼─────────┼──────────┼────────┼──────┼───────────┼──────────┼──────────┼──────────┼──────────┤
│ 0  │ cloudflared    │ default     │ N/A     │ fork    │ 86038    │ 3s     │ 0    │ online    │ 600%     │ 26.3mb   │ jo  │ disabled │
└────┴────────────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
[jo@s13]:<~/domains/cloudflared>$
You might need to wait a bit to see all outputs. 

5 接着去 CLoudflare 的面板中设置域名对应端口,即可使用域名访问自己搭建的服务了。


Note: https://saika.us.kg/2024/01/27/serv00_logs/


Your Own Domain Mailbox with Serv00 Hosting


使用自己的域名

  1. 登录serv00面板 这里用的S13的 面板地址就是:https://panel13.serv00.com/
  1. 点击DNS zones 新增一个(Add new zone)
    1. notion image
  1. 要到你的域名托管处添加A记录解析 推荐托管在Cloudflare
  1. 返回Zone list 点击你添加的域名右侧操作按钮的Edit 红框内的需要在Cloudflare DNS解析添加
    1. notion image
  1. Cloudflare添加
    1. notion image
  1. 面板点击E-mail 添加一个邮箱
    1. notion image
  1. 返回Domain list 就可以看到域名出现在列表了 点击Details 设置一下存储大小 注意不要给太大 因为serv00只有3G储存
    1. notion image

使用脚本批量创建

  1. 前置工作 添加邮箱的时候 控制台会有一个/add 的请求 找到它并且记录token
    1. notion image
  1. 修改脚本中对应值 直接在控制台运行脚本
    1. csrfToken
      上一步保存的token
      domain
      你的域名
      number
      你是S几就填几
      password
      生成的邮箱的密码
      maxEmails
      本次执行生成邮箱的数量


const csrfToken = ''; // 填入实际的 CSRF token
const domain = ''; // 你的域名
const number = 13; // serv00赛季号
const password = 'your1@PASSWORD'; // 替换成实际的密码
const maxEmails = 10; // 想要生成的邮箱数量

// 随机字符池,用于生成邮箱前缀
const characters = 'abcdefghijklmnopqrstuvwxyz0123456789'; 

// 生成指定长度的随机前缀
function generateRandomPrefix(length = 5) {
  let prefix = '';
  for (let i = 0; i < length; i++) {
    const randomIndex = Math.floor(Math.random() * characters.length);
    prefix += characters[randomIndex];
  }
  return prefix;
}

// 添加单个邮箱的函数
async function addMailbox(prefix, password) {
  const email = `${prefix}@${domain}`;
  const body = `csrfmiddlewaretoken=${csrfToken}&email=${email}&id_email-placeholder-1=${prefix}&password1=${password}&password2=${password}`;

  const response = await fetch(`https://panel${number}.serv00.com/mail/details/add_mailbox/${domain}`, {
    method: "POST",
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
    body: body,
    credentials: "include"
  });

  if (response.ok) {
    console.log(`邮箱 ${email} 添加成功`);
  } else {
    console.error(`邮箱 ${email} 添加失败: ${response.status} ${await response.text()}`);
  }
}

// 批量添加邮箱的函数
async function batchAdd(password, maxEmails) {
  const usedPrefixes = new Set(); // 用于避免重复的前缀

  for (let i = 0; i < maxEmails; i++) {
    let prefix;
    do {
      prefix = generateRandomPrefix(); // 生成随机前缀
    } while (usedPrefixes.has(prefix)); // 确保前缀不重复

    usedPrefixes.add(prefix); // 记录已使用的前缀
    await addMailbox(prefix, password);
    await new Promise(resolve => setTimeout(resolve, 1000)); // 延迟 1 秒
  }
}

// 在浏览器控制台中运行
batchAdd(password, maxEmails);


Note: https://blog.lmyself.top/article/122ee568-45a2-802a-a9ea-c2bf6e5d1c23


IP Quality Check in FreeBSD

https://github.com/spiritLHLS/ecs

IP质量检测,含15家数据库查询,含DNS黑名单查询
含 IPV4 和 IPV6 检测,含ASN和地址查询
含邮件端口检测
  • bash <(wget -qO- bash.spiritlhl.net/ecs-ipcheck)


Auto Login to Renew Serv00 Every Month



可以使用自身 SSH 自身的方式进行自动续期,操作如下:
1 进入一个自己喜欢的路径,使用 cat 命令新建 auto-renew.sh 脚本:

cat > auto-renew.sh << EOF
#!/bin/bash

sshpass -p '密码' ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -tt 用户名@地址 "exit" &

EOF


记得把其中的密码、用户名、ssh的地址修改为你自己的。

2 给 auto-renew.sh添加可执行权限:
  • chmod +x auto-renew.sh

3 再去 Panel 中找到 Cron jobs 选项卡,使用 Add cron job 功能添加任务,Specify time 选择 Monthly,Form type 选择 Advanced。Command 写 auto_renew.sh 脚本文件的绝对路径,如 /home/username/auto_renew.sh >/dev/null 2>&1 即可。
这样就会每隔一个月自动执行一次SSH连接,自己SSH自己进行续期。





No comments:

Post a Comment