UFW

ubuntu防火墙规则之ufw

爷,独闯天下 提交于 2020-04-27 21:05:23
前言 因公司项目的需求,需要对客户端机器简便使用防火墙的功能,所以可在页面进行简便设置防护墙规则,当然,这个功能需求放到我手上我才有机会学到。因为客户端机器都是ubuntu的,所以当然用了ubuntu特有且简便的防火墙设置规则,那就是ufw,文章以ubuntu16.04为准,其它版本的用法应该也差不太多。本文着重介绍其常用的用法,至于其他的用法那就要等各位小伙伴再自行研究了。 wiki UFW 全称为Uncomplicated Firewall,是Ubuntu 系统上默认的防火墙组件, 为了轻量化配置iptables 而开发的一款工具。 UFW 提供一个非常友好的界面用于创建基于IPV4,IPV6的防火墙规则。 <br> # ufw使用教程 使用ufw的命令必须有管理员权限才可运行,没有的话就要sudo一下了,不过要注意安全,不能瞎搞哈。。。 开启和禁用 # ufw enable //开启防火墙 # ufw disable //禁用防火墙 # ufw reset //重置防火墙,会把你所有已添加的规则全部删除,并且禁用防火墙 可以使用以下命令查看ufw防火墙的状态 # ufw status // 没开启是这个样子的 Status: inactive //开启后是这样子的 Status: active ... // 如果你添加了防火墙规则下面这里就会显示 设置默认的防火墙规则

Java生成固定长度的随机字符串(以大小写字母和数字)

假如想象 提交于 2020-04-24 03:30:12
package org.jimmy.autosearch2019.test; import java.util.ArrayList; import java.util.Random; /** * @author ラピスラズリ(Dawn) * @date 2019年5月30日 下午3:18:48 * @detail 随机生成固定长度的字符串 */ public class TestRandom2019053001 { public static ArrayList<String> strList = new ArrayList<String> (); public static Random random = new Random(); public static final int RANDOM_LENGTH1 = 256 ; public static final int RANDOM_LENGTH2 = 512 ; public static final int RANDOM_LENGTH3 = 1024 ; static { init(); } public static void main(String[] args) { String randomStr = generateRandomStr(RANDOM_LENGTH1); System.out.println

ubuntu下使用ufw保护docker容器

核能气质少年 提交于 2020-03-23 12:26:23
3 月,跳不动了?>>> docker会默认开启iptables NAT规则,如果使用-p port:port这种形式暴露端口是得不到ufw的防护的。 因为ufw操作的实际上是filter规则链,并没有提供简单的操作nat链的方案。 经过一番google之后,终于解决这个问题,现总结如下。 两步走 第一步,禁用docker操作iptables的功能 编辑 /etc/default/docker 文件,修改 DOCKER_OPTS="--iptables=false" ,等同于给docker启动参数添加 --iptables=false 选项,此选项会禁用docker添加iptables规则。 相关参考文档: http://blog.viktorpetersson.com/post/101707677489/the-dangers-of-ufw-docker 第二步,编辑ufw默认规则链 编辑 /etc/ufw/before.rules 这个文件,在文件末尾追加以下内容: *nat :POSTROUTING ACCEPT [0:0] -A POSTROUTING ! -o docker0 -s 172.17.0.0/16 -j MASQUERADE COMMIT 之后重启一下ufw规则即可: sudo ufw disable sudo ufw enable 相关参考文档: https

MySQL与phpMyAdmin5

只愿长相守 提交于 2020-03-14 15:14:41
sudo apt install mysql-server apache2 php php7.2-mbstring php-mysqli sudo apt install mariadb-server apache2 php php7.2-mbstring php-mysqli sudo systemctl enable mysql sudo systemctl enable apache2 sudo ufw allow mysql sudo ufw allow apache sudo mysql update mysql.user set authentication_string=PASSWORD('demo123'),plugin='mysql_native_password' where user='root'; flush privileges; 修改mysqld.conf [client] default-character-set = utf8mb4 [mysql] character-set-server = utf8mb4 sudo systemctl restart mysql 修改conf.default.php password 数据库用户'root'的密码 blowfish_secret db2545515c456c8ff5d2ba3c474838e3

Linux服务器之Ubuntu的安装与配置

邮差的信 提交于 2020-02-26 16:33:18
Ubuntu是基于Debian的、免费的Linux发行版,Ubuntu官方承诺: Ubuntu将永远免费,包括企业版和安全升级。 Ubuntu将全球数百个公司提供商业支持。 Ubuntu包含由自由软件团体提供的最佳翻译和本地化。 Ubuntu光盘仅仅包含自由软件,鼓励用户使用自由和开源软件,并改善和传播它。 相对于RedHat系列的发行版,Ubuntu显得更为激进。如果你想体验最新的Linux内核、最新的软件仓库,Ubuntu绝对是最佳选择!今天朱哥和大家唠唠:如何在虚拟机中安装Ubuntu Server操作系统。 一. 系统安装 1.1 准备 安装之前,我们要从官网下载所需的系统镜像文件,如: 由于本次是安装服务器版的Ubuntu,所以请点击【Ubuntu Server】下的 【18.04 LTS】按钮开始下载(带有 LTS 标识的为长期支持版本)。下载完成后,我们得到的镜像文件如: ubuntu-18.04.3-live-server-amd64.iso 。 接下来,我们还要做以下准备: 在自己电脑上安装 VMware Workstation 或 VirtualBox 等虚拟化软件; 创建虚拟机、添加磁盘、设置虚拟机网络(可以先设置为桥接模式); 将下载好的镜像文件添加到CD驱动器中; 启动虚拟机,开始安装。 1.2 安装系统 选择安装语言: 保持默认,按回车键进入下一步

UFW not allowing Kurento Media Server 6.7 to get connected through ws_uri

人走茶凉 提交于 2019-12-25 00:33:20
问题 Problem I had very strange experiences while configuring UFW for kurento-media-server(version 6.7.0) in Ubuntu 16.04 for a local network . My node app and KMS are both installed on the same server, running on different ports. With UFW disabled, the app works fine, and the node app is working quite well with KMS. Now, I activate ufw and configure it to allow in and out kurento-media-server listening port( 8888 ) allow in and out connections through all UDP ports, allow in through node app's

Ubuntu关闭防火墙的方法(ufw/iptables)

偶尔善良 提交于 2019-12-06 20:39:19
How do I disable the firewall in Ubuntu Linux server edition? How do I turn off the firewall in Ubuntu Linux version 12.04 or 14.04 LTS server? The latest version of Ubuntu comes with a program called ufw. It is used for managing a Linux firewall and aims to provide an easy to use interface for the user. A Note About ufw As I said earlier, the latest version of Ubuntu comes with ufw (now it is the default firewall configuration tool for Ubuntu). It is developed to ease iptables firewall configuration, ufw provides a user friendly way to create an IPv4 or IPv6 host-based firewall. List ufw

UFW firewall is not working on Ubuntu in DigitalOcean

蹲街弑〆低调 提交于 2019-12-05 05:27:00
问题 In my DigitalOcean (DO) droplet I installed this image: Ubuntu Docker 17.12.0~ce on 16.04 (which is available on ** DO website > droplet> destroy> rebuild droplet**) , in ssh (after user configuration), I run sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw enable sudo ufw status verbose and get: Status: active Logging: on (low) Default: deny (incoming), allow (outgoing), allow (routed) New profiles: skip To Action From -- ------ ---- 22 LIMIT IN Anywhere 2375/tcp ALLOW

UFW firewall is not working on Ubuntu in DigitalOcean

醉酒当歌 提交于 2019-12-03 21:10:42
In my DigitalOcean (DO) droplet I installed this image: Ubuntu Docker 17.12.0~ce on 16.04 (which is available on ** DO website > droplet> destroy> rebuild droplet**) , in ssh (after user configuration), I run sudo ufw default deny incoming sudo ufw default allow outgoing sudo ufw enable sudo ufw status verbose and get: Status: active Logging: on (low) Default: deny (incoming), allow (outgoing), allow (routed) New profiles: skip To Action From -- ------ ---- 22 LIMIT IN Anywhere 2375/tcp ALLOW IN Anywhere 2376/tcp ALLOW IN Anywhere 22 (v6) LIMIT IN Anywhere (v6) 2375/tcp (v6) ALLOW IN Anywhere

springboot项目部署到ubuntu18.04的过程,http跳转https,使用acme.sh安装证书

时光毁灭记忆、已成空白 提交于 2019-12-01 08:36:22
最近开发的友链联盟项目即将"竣工”,准备拿到公有云Ubuntu是测试下,想要达到的理想状态有如下几点: 端口保持9090,发布spring boot的jar包,后台运行 nginx部署,强制https访问应用 使用 acme.sh 来生成、安装ssl证书 开启防火墙,打开80、443端口,关闭9090端口(避免直接访问9090打开应用) 目前已经完成上面的要求,可以尝试访问 http://sitefriendlinks.com 、 http://sitefriendlinks.com:9090 ,前者会强制跳转到 https://sitefriendlinks.com ,后者无法打开。 环境安装 nginx apt install nginx 安装后自动就启动了,你可以用如下命令进行开启和关闭: service nginx stop service nginx start service nginx restart # 重启 mysql apt install mysql-server 详情请看: https://www.jianshu.com/p/3821c2603b92 需要注意修改root密码: show databases; use mysql; update user set authentication_string=PASSWORD("yourpassword")