雷池 SafeLine

waf

2025-04-10 · 1 min · word · Me

Alpine qemu-guest-agent no such package

> apk add qemu-guest-agent ERROR: unable to select packages: qemu-guest-agent (no such package): required by: world[qemu-guest-agent] Only way: Change Alpine repositores. # https://wiki.alpinelinux.org/wiki/Repositories > setup-apkrepos -cf or http://alpine.ccns.ncku.edu.tw/alpine/v3.20/main #http://dl-cdn.alpinelinux.org/alpine/v3.20/community http://alpine.cs.nycu.edu.tw/v3.20/main http://alpine.cs.nycu.edu.tw/v3.20/community

2024-09-21 · 1 min · 31 words · Me

Alpine Linux image with Cloud-Init ready for Proxmox

[轉]How to prepare Alpine Linux image with Cloud-Init ready for Proxmox https://5wire.co.uk/how-to-prepare-alpine-linux-image-with-cloud-init-ready-for-proxmox/ [轉]Enable cloud-init for a Alpine VM on proxmox https://gist.github.com/longtian/499261f4c68f0fb40b481bb1e74aa8ca

2024-09-20 · 1 min · 21 words · Me

[轉]Debian: fail2ban + nftables

https://blog.cyberfront.org/index.php/2021/10/27/debian-fail2ban/

2024-09-19 · 1 min · word · Me

nftables template

https://wiki.gbe0.com/en/linux/firewalling-and-filtering/nftables/template-inbound-outbound #!/usr/sbin/nft -f ## Clear/flush all existing rules flush ruleset # Main inet family filtering table table inet filter { # Rules for forwarded traffic chain forward { type filter hook forward priority 0; policy drop ## Log any unmatched traffic but rate limit logging to a maximum of 60 messages/minute ## The default policy will be applied to unmatched traffic limit rate 60/minute burst 100 packets \ log prefix "Forward - Drop: " \ comment "Log any unmatched traffic" ## Count the unmatched traffic counter \ comment "Count any unmatched traffic" } # Rules for input traffic chain input { type filter hook input priority 0; policy drop ## Permit inbound traffic to loopback interface iif lo \ accept \ comment "Permit all traffic in from loopback interface" ## Permit established and related connections ct state established,related \ counter \ accept \ comment "Permit established/related connections" ## Log and drop new TCP non-SYN packets tcp flags != syn ct state new \ limit rate 100/minute burst 150 packets \ log prefix "IN - New !SYN: " \ comment "Rate limit logging for new connections that do not have the SYN TCP flag set" tcp flags != syn ct state new \ counter \ drop \ comment "Drop new connections that do not have the SYN TCP flag set" ## Log and drop TCP packets with invalid fin/syn flag set tcp flags & (fin|syn) == (fin|syn) \ limit rate 100/minute burst 150 packets \ log prefix "IN - TCP FIN|SIN: " \ comment "Rate limit logging for TCP packets with invalid fin/syn flag set" tcp flags & (fin|syn) == (fin|syn) \ counter \ drop \ comment "Drop TCP packets with invalid fin/syn flag set" ## Log and drop TCP packets with invalid syn/rst flag set tcp flags & (syn|rst) == (syn|rst) \ limit rate 100/minute burst 150 packets \ log prefix "IN - TCP SYN|RST: " \ comment "Rate limit logging for TCP packets with invalid syn/rst flag set" tcp flags & (syn|rst) == (syn|rst) \ counter \ drop \ comment "Drop TCP packets with invalid syn/rst flag set" ## Log and drop invalid TCP flags tcp flags & (fin|syn|rst|psh|ack|urg) < (fin) \ limit rate 100/minute burst 150 packets \ log prefix "IN - FIN:" \ comment "Rate limit logging for invalid TCP flags (fin|syn|rst|psh|ack|urg) < (fin)" tcp flags & (fin|syn|rst|psh|ack|urg) < (fin) \ counter \ drop \ comment "Drop TCP packets with flags (fin|syn|rst|psh|ack|urg) < (fin)" ## Log and drop invalid TCP flags tcp flags & (fin|syn|rst|psh|ack|urg) == (fin|psh|urg) \ limit rate 100/minute burst 150 packets \ log prefix "IN - FIN|PSH|URG:" \ comment "Rate limit logging for invalid TCP flags (fin|syn|rst|psh|ack|urg) == (fin|psh|urg)" tcp flags & (fin|syn|rst|psh|ack|urg) == (fin|psh|urg) \ counter \ drop \ comment "Drop TCP packets with flags (fin|syn|rst|psh|ack|urg) == (fin|psh|urg)" ## Drop traffic with invalid connection state ct state invalid \ limit rate 100/minute burst 150 packets \ log flags all prefix "IN - Invalid: " \ comment "Rate limit logging for traffic with invalid connection state" ct state invalid \ counter \ drop \ comment "Drop traffic with invalid connection state" ## Permit IPv4 ping/ping responses but rate limit to 2000 PPS ip protocol icmp icmp type { echo-reply, echo-request } \ limit rate 2000/second \ counter \ accept \ comment "Permit inbound IPv4 echo (ping) limited to 2000 PPS" ## Permit all other inbound IPv4 ICMP ip protocol icmp \ counter \ accept \ comment "Permit all other IPv4 ICMP" ## Permit IPv6 ping/ping responses but rate limit to 2000 PPS icmpv6 type { echo-reply, echo-request } \ limit rate 2000/second \ counter \ accept \ comment "Permit inbound IPv6 echo (ping) limited to 2000 PPS" ## Permit all other inbound IPv6 ICMP meta l4proto { icmpv6 } \ counter \ accept \ comment "Permit all other IPv6 ICMP" ## Permit inbound traceroute UDP ports but limit to 500 PPS udp dport 33434-33524 \ limit rate 500/second \ counter \ accept \ comment "Permit inbound UDP traceroute limited to 500 PPS" ## Permit inbound SSH tcp dport ssh ct state new \ counter \ accept \ comment "Permit inbound SSH connections" ## Permit inbound HTTP and HTTPS tcp dport { http, https } ct state new \ counter \ accept \ comment "Permit inbound HTTP and HTTPS connections" ## Log any unmatched traffic but rate limit logging to a maximum of 60 messages/minute ## The default policy will be applied to unmatched traffic limit rate 60/minute burst 100 packets \ log prefix "IN - Drop: " \ comment "Log any unmatched traffic" ## Count the unmatched traffic counter \ comment "Count any unmatched traffic" } # Rules for output traffic chain output { type filter hook output priority 0; policy drop ## Permit outbound traffic to loopback interface oif lo \ accept \ comment "Permit all traffic out to loopback interface" ## Permit established and related connections ct state established,related \ counter \ accept \ comment "Permit established/related connections" ## Drop traffic with invalid connection state ct state invalid \ limit rate 100/minute burst 150 packets \ log flags all prefix "OUT - Invalid: " \ comment "Rate limit logging for traffic with invalid connection state" ct state invalid \ counter \ drop \ comment "Drop traffic with invalid connection state" ## Permit IPv4 ping/ping responses but rate limit to 2000 PPS ip protocol icmp icmp type { echo-reply, echo-request } \ limit rate 2000/second \ counter \ accept \ comment "Permit outbound IPv4 echo (ping) limited to 2000 PPS" ## Permit all other outbound IPv4 ICMP ip protocol icmp \ counter \ accept \ comment "Permit all other IPv4 ICMP" ## Permit IPv6 ping/ping responses but rate limit to 2000 PPS icmpv6 type { echo-reply, echo-request } \ limit rate 2000/second \ counter \ accept \ comment "Permit outbound IPv6 echo (ping) limited to 2000 PPS" ## Permit all other outbound IPv6 ICMP meta l4proto { icmpv6 } \ counter \ accept \ comment "Permit all other IPv6 ICMP" ## Permit outbound traceroute UDP ports but limit to 500 PPS udp dport 33434-33524 \ limit rate 500/second \ counter \ accept \ comment "Permit outbound UDP traceroute limited to 500 PPS" ## Allow outbound HTTP and HTTPS connections tcp dport { http, https } ct state new \ counter \ accept \ comment "Permit outbound HTTP and HTTPS connections" ## Permit outbound DNS requests meta l4proto { tcp, udp } th dport 53 \ counter \ accept \ comment "Permit outbound TCP and UDP DNS requests" ## Allow outbound NTP requests udp dport 123 \ counter \ accept \ comment "Permit outbound NTP requests" ## Log any unmatched traffic but rate limit logging to a maximum of 60 messages/minute ## The default policy will be applied to unmatched traffic limit rate 60/minute burst 100 packets \ log prefix "OUT - Drop: " \ comment "Log any unmatched traffic" ## Count the unmatched traffic counter \ comment "Count any unmatched traffic" } }

2024-09-17 · 6 min · 1160 words · Me

aws FortiGate VM public / private vm Can't OutGoing. SG need setting correct.

1. aws https://www.fortinet.com/content/dam/fortinet/assets/solutions/aws/FortiGate-AWS-Engineering-Reference-Document-Q4-2015.pdf 2. https://geekdudes.wordpress.com/2018/07/18/install-fortigate-amazon-ec2-instance/ 3. https://geekdudes.wordpress.com/2018/08/19/creating-static-route-in-aws-ec2-fortigate-instance/ Many documents forget SG(security group) 1. FortiGate VM SG need Inbound rules: All traffic All All 10.0.0.0/16 2. Private VM SG need Inbound rules: All traffic All All 10.0.0.0/16 Setting finish. First fortigate cmd: execute ping Private VM private ip. Need success. Second in private vm cmd: ping FortiGate Lan ip. Need success. Don’t forgate Check “Ping” option. ping 10.0.1.1. Need success. Now ping 8.8.8.8 Must success. ...

2020-07-07 · 1 min · 126 words · Me

ethereum docker geth shell for geth attach and tail log

Help use docker geth for geth attach and watch log. Geth Command line path need to change for yourself env. #!/bin/sh IFS=$'\n' echo $1 echo $2 case $2 in attach) docker exec -it $(docker ps -a --no-trunc | grep $1 | awk '{print $1}') geth attach --datadir=/root/.ethereum/devchain ;; log) docker exec -it $(docker ps -a --no-trunc | grep $1 | awk '{print $1}') tail -n 30 -f /root/geth.log ;; sh) docker exec -it $(docker ps -a --no-trunc | grep $1 | awk '{print $1}') sh ;; bash) docker exec -it $(docker ps -a --no-trunc | grep $1 | awk '{print $1}') bash ;; *) echo "command parms1: docker container name" echo "command parms2: attach (geth attach) or log (tail -n 30 -f) or sh or bash" esac

2020-01-10 · 1 min · 127 words · Me

[轉]如何為LINUX, WINDOWS容器加入憑證?

https://blog.kkbruce.net/2020/01/linux-windows-container-add-cert.html?fbclid=IwAR0d_LhzAYwatOZ-Ibl4mK7Ne-iAViwKT_UWcj0Wg52YlHTKzSFNDWcp-Hk#more ubuntu /usr/local/share/ca-certificates update-ca-certificates windows Import-Certificate -FilePath ooxx -CertStoreLocation ooxx

2020-01-06 · 1 min · 10 words · Me

[轉]Windows、WSL 与 Linux 的性能对比

https://www.cnbeta.com/articles/tech/922349.htm 尽管执行了各种各样的测试,但是如果对在七个不同操作系统上成功运行的所有测试取几何平均值,可以得出这样的结论: Windows 10 Build 19008 的总体性能要比 Build 18362 版本好,而 WSL 的性能并没有太大变化 WSL2 比 WSL 的性能确实稍好一些,这是因为在 I/O 或网络活动繁重的工作负载的情况下前者性能要好得多 在这种特殊的 Core i9 7960X 场景下,运行 Ubuntu Linux 的速度总体上比最快的 Windows 配置快 27% 有兴趣的朋友可查看这份更详细的 OpenBenchmarking.org 结果文件,以深入研究这些 Windows / WSL / Linux 基准测试内容。

2019-12-17 · 1 min · 38 words · Me

linux .bashrc

# General Aliases alias apk='apk --progress' alias ll="ls -ltan" alias hosts='cat /etc/hosts' alias ..="cd .." alias ...="cd ../.." alias ....="cd ../../.." alias untar="tar xzvkf" alias mv="mv -nv" alias cp="cp -i" alias ip4="ip -4 addr" alias ip6="ip -6 addr" COL_YEL="\[\e[1;33m\]" COL_GRA="\[\e[0;37m\]" COL_WHI="\[\e[1;37m\]" COL_GRE="\[\e[1;32m\]" COL_RED="\[\e[1;31m\]" # Bash Prompt if test "$UID" -eq 0 ; then _COL_USER=$COL_RED _p=" #" else _COL_USER=$COL_GRE _p=">" fi COLORIZED_PROMPT="${_COL_USER}\u${COL_WHI}@${COL_YEL}\h${COL_WHI}:\w${_p} \[\e[m\]" case $TERM in *term | rxvt | screen ) PS1="${COLORIZED_PROMPT}\[\e]0;\u@\h:\w\007\]" ;; linux ) PS1="${COLORIZED_PROMPT}" ;; * ) PS1="\u@\h:\w${_p} " ;; esac

2019-11-28 · 1 min · 83 words · Me

linux aws s3 exploer crossftp

https://www.tecmint.com/nginx-web-server-security-hardening-and-performance-tips/?fbclid=IwAR3WRK-N-buun8QIMDUbzes72-w6p8SKCxnzr0sGU_PFAyudPRbHiumtFu0

2019-04-23 · 1 min · word · Me

Pinta windows linux mac

幸好Paint.NET是開放原始碼的軟體,於是有位任職於Novell公司,叫做Jonathan Pobst的開發者,利用了Paint.NET的原始碼,改用Gtk#函式庫開發了一款美工軟體,取名叫「Pinta」。 https://pinta-project.com/pintaproject/pinta/

2019-04-22 · 1 min · 3 words · Me

bash linux

# General Aliases alias apk='apk --progress' alias ll="ls -ltan" alias hosts='cat /etc/hosts' alias ..="cd .." alias ...="cd ../.." alias ....="cd ../../.." alias untar="tar xzvkf" alias mv="mv -nv" alias cp="cp -i" alias ip4="ip -4 addr" alias ip6="ip -6 addr" COL_YEL="\[\e[1;33m\]" COL_GRA="\[\e[0;37m\]" COL_WHI="\[\e[1;37m\]" COL_GRE="\[\e[1;32m\]" COL_RED="\[\e[1;31m\]" # Bash Prompt if test "$UID" -eq 0 ; then _COL_USER=$COL_RED _p=" #" else _COL_USER=$COL_GRE _p=">" fi COLORIZED_PROMPT="${_COL_USER}\u${COL_WHI}@${COL_YEL}\h${COL_WHI}:\w${_p} \[\e[m\]" case $TERM in *term | rxvt | screen ) PS1="${COLORIZED_PROMPT}\[\e]0;\u@\h:\w\007\]" ;; linux ) PS1="${COLORIZED_PROMPT}" ;; * ) PS1="\u@\h:\w${_p} " ;; esac

2019-03-11 · 1 min · 83 words · Me

[轉]Windows Server 2019 vs. Linux vs. FreeBSD Performance On A 2P EPYC Server

https://www.phoronix.com/scan.php?page=article&item=windows2019-linux-bsd&num=1&fbclid=IwAR0VBMPUsmOw_qJQtJ1AzEq4el8KhZMPK9sRmlMN8rLhwZJfFqO32RuefGI

2018-12-28 · 1 min · word · Me

docker問題

https://blog.csdn.net/u011166225/article/details/84940228 对于个人开发者来说,在一定情况下很好用。但是对于构建管理项目或者提供构建流程管理的Devops项目而言却是个灾难–本地存储结构不能对用户开放,它们也不能干扰用户本身的构建流程。所幸的是,Moby umbrella的开发团队注意到了这一点,他们希望通过重构存储管理和容器快照来解决一部分问题,于是BuildKit诞生了。 -——————– 作者:狗蛋丶 来源:CSDN 原文:https://blog.csdn.net/u011166225/article/details/84940228 版权声明:本文为博主原创文章,转载请附上博文链接!

2018-12-26 · 1 min · 8 words · Me

[轉]Centos7 容器中删除文件的问题

http://dockone.io/question/1516 巨坑! Centos7默认xfs文件系统与docker默认overlay2存储驱动不匹配,会导致容器内文件无法删除等问题 https://blog.csdn.net/weixin_41826563/article/details/80549323 wx65251206 再次遇到这个问题,终于还是发扬刨根问题的精神,经过一上午的百度,google,bing 终于找到根本原因。 这里记录一下,为了帮助后面的人,同时也提醒自己。 问题原因与docker无关,在于linux内核版本。 测试有问题的内核版本是Red Hat 4.8.3-9—对应的发行版是CentOS7.2

2018-12-26 · 1 min · 12 words · Me

[轉]Install Python version 3 side by side with version 2 in Centos 7

https://stackoverflow.com/questions/45997541/install-python-version-3-side-by-side-with-version-2-in-centos-7 yum -y install https://centos7.iuscommunity.org/ius-release.rpm yum -y install python36u yum -y install python36u-pip pip3.6 install numpy

2018-12-14 · 1 min · 16 words · Me

$@ linux shell

http://jyhshin.pixnet.net/blog/post/39349999-shell-script-%E8%87%AA%E5%8B%95%E5%AE%9A%E7%BE%A9%E7%9A%84%E8%AE%8A%E6%95%B8 $@ 包含所有輸入的參數,$@ 即代表 $1, $2,….直到所有參數結束。$@ 用將所有參數以空白為間隔,存在 $@ 中。也就是說 $@ 代表了 “$1” “$2” “$3”….。

2018-11-07 · 1 min · 14 words · Me

[轉]linux exec与重定向

http://xstarcd.github.io/wiki/shell/exec_redirect.html

2018-11-06 · 1 min · word · Me

[轉]linux改時區

https://blog.keniver.com/2017/06/linux-%E8%A8%AD%E5%AE%9A%E4%BF%AE%E6%94%B9%E6%99%82%E5%8D%80/ sudo dpkg-reconfigure tzdata

2018-10-27 · 1 min · 4 words · Me