标签 ubuntu 下的文章

  1. 物理机直接安装 ubuntu, 所有应用都部署在 docker
  2. ssh 只允许密钥登录, 禁止 root 用户登录
  3. 所有访问( http, tcp)都通过 nginx 代理, ufw 只暴露固定的几个端口, nginx 开启 https 证书
  4. nginx 配置 geolite2, 禁止任何 国外 ip 访问, 异常访问基本都是国外 ip
  5. fail2ban 自动封禁所有 nginx 日志里面国外 ip
  6. 不安装 1panel,宝塔等任何 web 管理工具, 直接 ssh 到机器上命令行管理

分享下我的 nginx 配置

load_module "modules/ngx_http_geoip2_module.so";
load_module "modules/ngx_stream_geoip2_module.so";

worker_processes 4;

error_log /var/log/nginx/nginx_error.log;
error_log /var/log/nginx/nginx_error.log notice;
error_log /var/log/nginx/nginx_error.log info;

pid /var/log/nginx/nginx.pid;

events {
    worker_connections 1024;
}


http {
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    geoip2 /etc/nginx/geoip/GeoLite2-Country.mmdb {
      auto_reload 24h;
      $geoip_country_code  default=Unknown source=$remote_addr country iso_code;
      $geoip_country_name  country  names  en;
    }
    geoip2 /etc/nginx/geoip/GeoLite2-City.mmdb {
      auto_reload 24h;
      $geoip_city   default=Unknown city names en;
    }

    map $geoip_country_code $allowed_country {
        default no;
        CN yes;
    }

    map $remote_addr $allowed {
        default $allowed_country;
        127.0.0.1 yes;
        ~^192\.168\.\\d+\.\\d+$ yes;
        ~^172\.16\.0\.\\d+$ yes;
        ~^172\.17\.\\d+\.\\d+$ yes;
    }

    map $http_upgrade $connection_upgrade {
        default upgrade;
        '' "";
    }

    log_format json_analytics escape=json '{'
    '"timestamp": "$msec", ' # request unixtime in seconds with a milliseconds resolution
    '"request_id": "$request_id", ' # the unique request id
    '"request_length": "$request_length", ' # request length (including headers and body)
    '"body_bytes_sent": "$body_bytes_sent", '
    '"remote_addr": "$remote_addr", ' # client IP
    '"time_iso8601": "$time_iso8601", '
    '"request_uri": "$request_uri", ' # full path and arguments if the request
    '"code": "$status", ' # response status code
    '"http_host": "$http_host", ' # the request Host: header
    '"server_name": "$server_name", ' # the name of the vhost serving the request
    '"request_time": "$request_time", ' # request processing time in seconds with msec resolution
    '"upstream": "$upstream_addr", ' # upstream backend server for proxied requests
    '"request_method": "$request_method", ' # request method
    '"allowed": "$allowed", '
    '"geoip_country_code": "$geoip_country_code", '
    '"geoip_country_name": "$geoip_country_name", '
    '"geoip_city": "$geoip_city"'
    '}';

    access_log /var/log/nginx/access.log json_analytics;
    error_log /var/log/nginx/error.log warn;

    set_real_ip_from 0.0.0.0/0;
    real_ip_header X-Real-IP;
    real_ip_recursive on;

    sendfile on;
    server_tokens off;
    keepalive_timeout 65;

    gzip on;
    gzip_vary on;
    gzip_comp_level 4;
    gzip_min_length 256;
    gzip_proxied expired no-cache no-store private no_last_modified no_etag auth;
    gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy;

    proxy_buffering off;
    proxy_buffers 4 128k;
    proxy_buffer_size 256k;
    proxy_busy_buffers_size 256k;



    ssl_session_timeout 5m;
    ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers ALL:!DH:!EXPORT:!RC4:+HIGH:+MEDIUM:-LOW:!aNULL:!eNULL;

    ssl_certificate /etc/nginx/ssl/fullchain.cer;
    ssl_certificate_key /etc/nginx/ssl/xxx.cc.key;


    include /etc/nginx/conf.d/*.conf;

}


stream {

    geoip2 /etc/nginx/geoip/GeoLite2-Country.mmdb {
      auto_reload 24h;
      $geoip_country_code  default=Unknown source=$remote_addr country iso_code;
      $geoip_country_name  country  names  en;
    }
    geoip2 /etc/nginx/geoip/GeoLite2-City.mmdb {
      auto_reload 24h;
      $geoip_city   default=Unknown city names en;
    }



    map $geoip_country_code $allowed_country {
        default no;
        CN yes;
    }

    map $remote_addr $allowed {
        default $allowed_country;
        127.0.0.1 yes;
        ~^192\.168\.\\d+\.\\d+$ yes;
        ~^172\.16\.0\.\\d+$ yes;
        ~^172\.17\.\\d+\.\\d+$ yes;
    }

    log_format json_analytics escape=json '{'
    '"timestamp": "$msec", ' # request unixtime in seconds with a milliseconds resolution
    '"connection": "$connection", ' # connection serial number
    '"pid": "$pid", ' # process pid
    '"remote_addr": "$remote_addr", ' # client IP
    '"remote_port": "$remote_port", ' # client port
    '"time_iso8601": "$time_iso8601", ' # local time in the ISO 8601 standard format
    '"upstream": "$upstream_addr", '
    '"protocol": "$protocol", '
    '"allowed": "$allowed", '
    '"request_method": "STREAM", '
    '"geoip_country_code": "$geoip_country_code", '
    '"geoip_country_name": "$geoip_country_name", '
    '"geoip_city": "$geoip_city"'
    '}';

    access_log /var/log/nginx/access.log json_analytics;
    error_log /var/log/nginx/error.log warn;

    include /etc/nginx/stream.d/*.conf;
}

ssh 代理

map $allowed $ssh_server {
    yes ssh;
}

upstream ssh {
    server  192.168.5.1:1234;
}

server {
    listen    5678;
    listen [::]:5678;
    proxy_pass $ssh_server;
    proxy_connect_timeout 30s;
    proxy_timeout 60s;

    ssl_preread on;
}

http 代理

server {
    server_name x.x.com;
    listen 1233 ssl;
    listen [::]:1233 ssl;

    http2 on;
    charset "utf-8";

    if ($allowed != yes) {
        return 404;
    }

    error_page 497 =307 https://$host:$server_port$request_uri;

    client_max_body_size 512M;
    proxy_buffering off;


    set $backend "http://192.168.5.1:1234";
    include /etc/nginx/conf.d/basic/no_log.conf;

    location / {
        proxy_redirect off;
        proxy_set_header Host $host:$server_port;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

        proxy_pass $backend;
    }

}

Running a Cronjob Under Docker Container

当您想要安排计划任务,可以使用内置在 macOS 和 Linux 中的常见工具,比如 cron,或者像 AWS Lambda 这样的特殊工具。Cron 不如 AWS Lambda 强大,但它在 Unix 系统的后台任务中工作得很好,特别是在使用容器的情况下。然而,对于 Docker 来说这有点复杂,因为不能简单地从终端开始新的 cron 作业,并期望它工作。

How to Dockerize a Cron Job

要在 Docker 容器中运行 cron 作业,您需要使用 cron 并在 Docker 容器的前台运行它。

下面是一个如何设置的例子:

Create Cron File

创建一个文件,其中包含要在 Docker 容器下运行的所有 cron 作业。

cat cron

我们的示例文件如下:

* * * * * echo "Current date is `date`" > /var/log/cron

Create Dockerfile

接下来,创建一个安装 cron 服务的 Dockerfile,并将脚本复制到容器。

在这里,我们提供了 3 个 Dockerfile 示例,它们使用不同的操作系统。

Dockerfile with Alpine Linux

FROM alpine:3

# Copy cron file to the container
COPY cron /etc/cron.d/cron

# Give the permission
RUN chmod 0644 /etc/cron.d/cron

# Add the cron job
RUN crontab /etc/cron.d/cron

# Link cron log file to stdout
RUN ln -s /dev/stdout /var/log/cron

# Run the cron service in the foreground
CMD [ "crond", "-l", "2", "-f" ]

Dockerfile with Apache and PHP

FROM php:8.0-apache

# Install cron
RUN apt update && \
    apt -y install cron

# Copy cron file to the container
COPY cron /etc/cron.d/cron

# Give the permission
RUN chmod 0644 /etc/cron.d/cron

# Add the cron job
RUN crontab /etc/cron.d/cron

# Link cron log file to stdout
RUN ln -s /dev/stdout /var/log/cron

# Start cron service
RUN sed -i 's/^exec /service cron start\n\nexec /' /usr/local/bin/apache2-foreground

Dockerfile with Ubuntu Linux

FROM ubuntu:latest

# Install cron deamon
RUN apt update && apt install -y cron

# Copy cron file to the container
COPY cron /etc/cron.d/cron

# Give the permission 
RUN chmod 0644 /etc/cron.d/cron

# Add the cron job
RUN crontab /etc/cron.d/cron

# Link cron log file to stdout
RUN ln -s /dev/stdout /var/log/cron

# Run the cron service in the foreground
CMD ["cron", "-f"]

Build and Run Container

当前目录中有两个文件,一个是 cron, 它包含了 cronjob。 一个是 Dockerfile, 它有 Docker 的构建指令。运行以下命令使用 Dockerfile 构建 Docker 镜像。

docker build -t my_cron .

镜像构建成功后,启动容器:

docker run -d my_cron

这将启动容器下的 cron 守护进程,它将执行 cron 文件中定义的所有计划作业。

Test Setup

我们已经链接了 cron 日志文件 /var/log/cron/dev/stdout ,Cron 服务生成的所有日志
可以使用 docker logs 命令查看。

首先,使用 docker ps 命令查找容器 id 或名称。

docker ps

然后检查 Docker 容器的日志文件。

docker logs container_id

在 cronjobs 中,我打印了当前日期并把它们写入日志中。

Running Cronjobs in Docker

输出如上所示,这意味着 cron 作业在 Docker 容器下正常运行。

multibootusb-9.2.0-setup是个多系统启动U盘制作工具,能把多个系统镜像(像 Ubuntu、Kali、Windows PE 等)装到一个 U 盘里,开机时选想进的系统就行。

一、准备工作

  1. 下载安装包

    安装包下载:https://pan.quark.cn/s/f3b15864c764

  2. 准备 U 盘

    • 至少 8GB 容量(越大越好,装的系统越多)。
    • 先把 U 盘里的东西备份一下,制作时会格式化!
  3. 关闭杀毒软件(可选)

    • 个别杀毒软件可能会误报,安装时可以暂时关掉,装完再开。

二、安装步骤

  1. 双击 multibootusb-9.2.0-setup.exe运行。
  2. 如果是 Windows 10/11,会弹出“用户账户控制”提示 → 点  “是” (需要管理员权限)。
  3. 进入安装向导,选语言(默认 English,有的版本有中文可选)。
  4. 点  “Next” ​ 继续。
  5. 选安装位置:

    • 默认是 C:\Program Files\multibootusb,想改就点“Browse”选 D 盘或其他盘。
  6. 选附加任务:

    • 建议勾“Create a desktop shortcut”(创建桌面快捷方式),点“Next”。
  7. 点  “Install” ​ 开始安装,等进度条走完(大概十几秒)。
  8. 最后点  “Finish” ​ 完成安装,桌面上会有 multibootusb 图标。

三、首次运行设置

  1. 双击桌面图标打开软件。
  2. 插入准备好的 U 盘(会被自动识别)。
  3. 在“Select USB Drive”下拉菜单里选你的 U 盘(注意别选错!)。
  4. 点“Detect Drives”刷新一下,确保 U 盘被正确识别。

四、基本使用(简单说两句)

  • 添加系统镜像:点“Browse”选择 ISO 镜像文件(比如 Ubuntu.iso、kali-linux.iso)。
  • 写入 U 盘:选好镜像后点“Install”,等待进度条走完(时间取决于镜像大小和 U 盘速度)。
  • 多系统共存:重复添加不同镜像,它们会按顺序排在启动菜单里。
  • 启动测试:制作完成后,重启电脑,进 BIOS 设置 U 盘启动,就能看到多系统菜单了。

在 Ubuntu 的默认配置中,当系统检测到仅存在一个操作系统时,GRUB 启动菜单会被隐藏,系统会直接进入内核启动流程。这种“无感启动”在桌面用户场景下较为友好,但在 服务器、运维、开发和多内核管理场景 中,会带来一系列明显的痛点。

可通过配置grub控制默认是否显示grub界面以及倒计时相关的配置

配置文件路径

  1. ubuntu grub配置文件路径

/etc/default/grub

  1. centos grub配置文件路径

/etc/sysconfig/grub

默认配置文件内容

# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"

# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"

# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"

主要关注以下三个参数

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0

GRUB_DEFAULT

默认引导项,可以有以下几种值

  1. saved 代表上次启动时选择的引导项
  2. 从0开始的数字,第一个引导项是0,第二个引导项是1,以此类推

如上图Previous Linux Versions存在的子菜单可以用2>0或者2>1表示

  1. grub选项名

GRUB_TIMEOUT_STYLE

grub显示风格,默认值是menu

可选值有menu,hidden,countdown

如果该选项未设置或者值设为menu,启动时将显示grub,并开启GRUB_TIMEOUT倒计时。倒计时结束前可以按任意键中断倒计时,否则倒计时结束后会引导GRUB_DEFAULT启动项。

如果选项设置为hiddencountdown,在显示grub界面之前会开启GRUB_TIMEOUT倒计时。倒计时结束前按ESC键中断倒计会进入grub界面,如果没有按ESC键进行中断操作,倒计时结束后会引导GRUB_DEFAULT启动项。

hiddencountdown的区别在于,hidden不显示倒计时读秒,countdown显示倒计时读秒

GRUB_TIMEOUT

这个参数代表grub的超时时间,单位是秒,默认值为5,设置为0代表不显示grub界面,-1代表一直等待

例子

GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=5

修改后执行update-grub应用配置,重启后必定进入grub界面

GRUB_DEFAULT=1
GRUB_TIMEOUT_STYLE=countdown
GRUB_TIMEOUT=5

修改后执行update-grub应用配置,重启后在5秒倒计时结束前按ESC必定进入grub界面

GRUB_DEFAULT="2>1"
GRUB_TIMEOUT_STYLE=menu
GRUB_TIMEOUT=5

修改后执行update-grub应用配置,重启后在5秒倒计时结束后会引导指定启动项,这个方法对于客户要求进入旧版本内核比较好用

linux 系统下的这个学习版的 PDF 编辑工具,有需要的可以一块学习

适用环境:Debian 系
已测试环境:Ubuntu24.04/Xubuntu24.04

下载及安装

wget https://code-industry.net/public/master-pdf-editor-5.9.35-qt5.x86_64.deb

sudo apt install -y ./master-pdf-editor-5.9.35-qt5.x86_64.deb

石皮解方法

# 在001b7b70处,将88替换成FE sudo perl -pi -e 's/(\xE8...\xFF)\x88(..\xBF\x30)/$1\xFE$2/g' /opt/master-pdf-editor-5/masterpdfeditor5

就可以见证奇迹了


📌 转载信息
原作者:
Randy
转载时间:
2026/1/1 15:52:02

  工欲善其事必先利其器,这是一个关于十大黑客最佳操作平台的综合文章。

  在本文中,包括公德黑客运用的10个绝佳操作平台。每一个都是免费的,基于于Linux位,并且与许多黑客工具一起打包。

  10.

  |IMG

  是一个渗透检测的发行版的Linux从全球受到了最流行的免费的操作平台无法为黑客,的2017黑客入侵工具包,和周遭的工作GNOME经典图形桌面状态。

  该为大概3GB的镜象DVDISO画质,是基于的发行及自起动运行光碟,其传统在于一套用于网路渗透检测的实用软件虽然它与非常相像,但并不完全相似。采用了GNOME桌面。

  致力于必须执行渗透检测操作的安全学者视频培训脚本,的工作框架大部份包括了五分类软件,这些工具早已在菜单包括五个类别归纳整理。

  下载

  9.

  2017黑客入侵工具包

  |IMG

  是一个基于的开放源码渗透检测Linux发行版,它借助存档进行升级。它包含300多个渗透检测软件,另外还包含进行广泛操作所需的基本管理硬件。

  下载

  8.HAWKLINUX

  截图|IMG:

  HawkLinux被视为常识解决方案有限公司(PvtLtd.)生产的最非凡黑客技术,最有效和全面的基于的渗入测试Linux分散技术。专用于700多种适于渗透检测仪的软件,以及300多种适于多功用安全的器材和蓄意软件调查。

  HawkLinux是为白围巾黑客和渗入测试者设计的基于(Linux)的Linux发行版操作平台。Hawk可以适于网络安全和会计或者数字取证。它还包括多种软件,适合于联通安全和无线网路安全检测。

  下载HAWKLINUX

  7.ARCHLINUX

  ArchLinuxIMG:

  ArchLinux绝对是免费和开放源代码软件,并支持社区参加。

  ArchLinux是通用x86/64GNU/Linux发行版。Arch采用滚动更新机制,尽大力提供最新的稳固版硬件。初始安装的Arch只是一个基本平台,随后客户可以按照自己的偏好安装必须的硬件并配置成合乎自己梦想的平台.

  下载ArchLinux

  6.(NST)

  NST|iMG

  网络安全软件包(NST)是一个可鼓励的即用(live)CD,基于Core。这个软件包设计用来方便访问最棒的开源网路安全应用,主要运行在x86系统上。开发这个网路安全软件包的主要目的是为网路安全管控人员提供一套完备的开源网路安全软件。

  NST最奇特的地方是可以将大多数x86机器(奔腾2及以上)转化成一台可以适于网络流量预测、入侵测试、网络数据包生成、无线网路监视的虚拟服务器,当然它也可以当作一套复杂的网路/主机扫描器来使用。

  下载

  5.WEB

  武士网络测试|IMG:博客

  Web测试框架从根本上集中在检测Web应用程序的安全性,并牵涉Web评估和误用设备的负载。建立“武士网络测试框架”的功绩来自于Kevin,和Frank。“武士框架”为公德黑客和面试者提供了一个即时Linux条件,该条件预先配置为再次运行成为虚拟机执行Web渗透检测。

  武士Web测试框架结合了众所周知的检测器材,如和ance,和适于映射,w3af和Burp的启迪,以及BeEF和的研发。结构依赖于9.04,是完全开源的,并斩获关于工程的正常升级。

  下载WEB

  4.

  IMG

  是一个基于Unix的工作框架,根据由RedHat公司支持的由支持的组创立的Linux和GNU程序(Linux发行版)。

  包括的程序分散在不同的免费和开放源代码许可证下,并计划变成这种科技的主要优势。是RedHatLinux发行版的附属产品。

  下载

  3.

  IMG

  OS是面向安全的操作平台,它被设计为适于渗透检测、计算机取证、反向工程、攻击、云计算渗透检测、隐私/匿名、密码等场合。该发行基于,其传统在于MATE桌面环境,并由研发。

  操作平台运用Kali存档进行各类捆绑更新并协调新的软件。为PC框架审查员提供一个简略易用的GUI和重量级条件,发挥广泛的法律科学,弱点评估和加密。这个操作平台是十分适于定制化。

  下载操作平台

  2.

  LinuxIMG

  是一个基于的Linux发行版,用于在安全检测中帮助道德黑客和渗入测试员工。操作平台的目标是更迅速,更有效地运行并具备可忽视桌面的状况。的主要优势在于,它自己的特定软件内存在正常的时间间隔内进行升级2017黑客入侵工具包,以维持颜色的稳固和流行。

  分散包括从Web测试和平台调查到拉伸测试,嗅探,安全检测,犯罪现场调查和研发的70多种软件。

  下载

  1.KALILINUX

  KaliLinux|

  最先进的渗入测试平台。KaliLinux也是一个旨在于小软件(称为KaliLinux)应用。

  由Ltd维护和支助。最先由的Mati和Devon通过重写来完成,是她们之前写的适于取证的Linux发行版。

  最流行的kaliLinux软件

  Nmap,-ng,,,框架,Burp套件,John培训脚本,社会项目软件包,,,OWASPZAP

  下载KALILINUX