AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-342155

James's questions

Martin Hope
James
Asked: 2017-02-06 14:56:03 +0800 CST

将空间从一个分区转移到另一个分区

  • 0

我有一台运行 Ubuntu 16.04 的 Linux 服务器。

今天早上我遇到了一个问题,我的一个分区空间不足,我设法释放一些空间作为临时解决方案,但需要将一些空间从一个分区转移/重新分配到另一个。

运行df -h我得到:

Filesystem      Size  Used Avail Use% Mounted on
udev             16G     0   16G   0% /dev
tmpfs           3.2G  318M  2.9G  10% /run
/dev/md1         20G   19G   25M 100% /
tmpfs            16G  4.0K   16G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            16G     0   16G   0% /sys/fs/cgroup
/dev/md2        201G  943M  190G   1% /home
tmpfs           3.2G     0  3.2G   0% /run/user/1004
tmpfs           3.2G     0  3.2G   0% /run/user/1000

正如您所看到/dev/md1的,空间几乎不足,我想将一些可用空间转移/dev/md2到这个分区上,因为我永远不会在我的/home目录上使用 201G。

我该怎么做或/穿上/dev/md2?

disk-space-utilization partition mount ubuntu-16.04 dedicated-server
  • 1 个回答
  • 473 Views
Martin Hope
James
Asked: 2017-01-13 22:45:45 +0800 CST

从 OVH 内核切换到默认内核而不重新安装 Ubuntu

  • 0

我有一个由 OVH 托管的专用服务器。

在安装服务器时,我必须保留默认的内核选择,即使用稳定/测试过的 OVH 内核而不是发行版的本机内核。

我最近切换到使用 APF 防火墙而不是 UFW,在使用我的所有规则设置 APF 并启动它之后,apf -s我得到如下所示的输出:

apf(11291): {glob} flushing & zeroing chain policies apf(11291):
{glob} firewall offline apf(11328): {glob} activating firewall
libkmod: ERROR ../libkmod/libkmod-module.c:1655
kmod_module_new_from_loaded: could not open /proc/modules: No such
file or directory Error: could not get list of modules: No such file
or directory apf(11368): {glob} kernel version not equal to 2.4.x or
2.6.x, aborting. apf(11328): {glob} firewall initalized

MONOKERN在找到一个论坛帖子解释说由于某些主机使用内核而需要这样做后,我更改了 APF 中的一个设置,该设置被描述为“支持单片内核构建 [no LKM's]”。

使用 then 重新启动 APFapf -r会产生以下输出:

apf(22524): {glob} flushing & zeroing chain policies apf(22524):
{glob} firewall offline apf(22599): {glob} activating firewall
libkmod: ERROR ../libkmod/libkmod-module.c:1655
kmod_module_new_from_loaded: could not open /proc/modules: No such
file or directory Error: could not get list of modules: No such file
or directory apf(22703): {glob} determined (IFACE_UNTRUSTED) eth0 has
address 158.69.123.46 apf(22703): {glob} loading preroute.rules
//carries on printing out the firewall rules it is setting up...
apf(22599): {glob} firewall initalized

OVH 说我可以在重新安装期间随时更改内核,但我真的不想这样做。

我在我的服务器上托管了一个有点流行的游戏,在任何给定时间都有大约 100 个在线用户。让服务器离线几个小时以重新安装发行版并重新设置所有内容确实不切实际。

是否可以切换回Ubuntu 16.04的本机分发内核,而无需重新安装并丢失我的所有配置/数据和已安装的软件包,如果可以,如何操作?

kernel ubuntu-16.04
  • 1 个回答
  • 756 Views
Martin Hope
James
Asked: 2016-04-07 00:45:36 +0800 CST

为我的域和所有子域设置 Let's Encrypt

  • 1

我设置了一个服务器(Debian 7 Wheezy 和 Apache 2.2)来托管我的域,以及由此产生的一些子域。

目前,我将这些都设置在defaultconf 文件中作为单独的虚拟主机。

例如,我正在托管example.net并拥有forum.example.net并且game.example.net:

<VirtualHost *:80>
        ServerName example.net
        DocumentRoot /var/www
        <Directory /var/www>
            Options -Indexes
        </Directory>
</VirtualHost>

<VirtualHost *:80>
        ServerName forum.example.net
        DocumentRoot /var/www/forum
        <Directory /var/www/forum>
            Options -Indexes
        </Directory>
</VirtualHost>

<VirtualHost *:80>
        ServerName game.example.net
        DocumentRoot /var/www/game
        <Directory /var/www/game>
            Options -Indexes
        </Directory>
</VirtualHost>

我想将这些全部设置为使用 HTTPS,因此安装了 Let's Encrypt 来执行此操作。

当我完成安装部分时,我只想先尝试为一个域设置它,以确保我没有弄乱任何东西,因此game.example.net最初使用。

我让它工作得很好,现在想在其他域中推广它,forum.example.net并且example.net.

我尝试按照这里的一些步骤进行操作,然后运行letsencrypt-auto --apache -d example.net -d www.example.net并加载了界面,但它只是让我重新安装我当前的证书(我刚刚设置的game.example.net那个)或更新它。

如何设置 Let's Encrypt 以便我的所有子域都在 HTTPS 下?

以下是default-ssl涵盖的当前文件game.example.net:

IfModule mod_ssl.c>
<VirtualHost _default_:443>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www/game
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/game>
                Options -Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

        CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined

        #   SSL Engine Switch:
        #   Enable/Disable SSL for this virtual host.
        SSLEngine on

        #   A self-signed (snakeoil) certificate can be created by installing
        #   the ssl-cert package. See
        #   /usr/share/doc/apache2.2-common/README.Debian.gz for more info.
        #   If both key and certificate are stored in the same file, only the
        #   SSLCertificateFile directive is needed.
        SSLCertificateFile    /etc/letsencrypt/live/game.example.net/cert.pem
        SSLCertificateKeyFile /etc/letsencrypt/live/game.example.net/privkey.pem

        #   Server Certificate Chain:
        #   Point SSLCertificateChainFile at a file containing the
        #   concatenation of PEM encoded CA certificates which form the
        #   certificate chain for the server certificate. Alternatively
        #   the referenced file can be the same as SSLCertificateFile
        #   when the CA certificates are directly appended to the server
        #   certificate for convinience.
        #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt

        #   Certificate Authority (CA):
        #   Set the CA certificate verification path where to find CA
        #   certificates for client authentication or alternatively one
        #   huge file containing all of them (file must be PEM encoded)
        #   Note: Inside SSLCACertificatePath you need hash symlinks
        #         to point to the certificate files. Use the provided
        #         Makefile to update the hash symlinks after changes.
        #SSLCACertificatePath /etc/ssl/certs/
        #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt

        #   Certificate Revocation Lists (CRL):
        #   Set the CA revocation path where to find CA CRLs for client
        #   authentication or alternatively one huge file containing all
        #   of them (file must be PEM encoded)
        #   Note: Inside SSLCARevocationPath you need hash symlinks
        #         to point to the certificate files. Use the provided
        #         Makefile to update the hash symlinks after changes.
        #SSLCARevocationPath /etc/apache2/ssl.crl/
        #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl

        #   Client Authentication (Type):
        #   Client certificate verification type and depth.  Types are
        #   none, optional, require and optional_no_ca.  Depth is a
        #   number which specifies how deeply to verify the certificate
        #   issuer chain before deciding the certificate is not valid.
        #SSLVerifyClient require
        #SSLVerifyDepth  10
 #   Access Control:
        #   With SSLRequire you can do per-directory access control based
        #   on arbitrary complex boolean expressions containing server
        #   variable checks and other lookup directives.  The syntax is a
        #   mixture between C and Perl.  See the mod_ssl documentation
        #   for more details.
        #<Location />
        #SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
        #            and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
        #            and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
        #            and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
        #            and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20       ) \
        #           or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
        #</Location>

        #   SSL Engine Options:
        #   Set various options for the SSL engine.
        #   o FakeBasicAuth:
        #     Translate the client X.509 into a Basic Authorisation.  This means that
        #     the standard Auth/DBMAuth methods can be used for access control.  The
        #     user name is the `one line' version of the client's X.509 certificate.
        #     Note that no password is obtained from the user. Every entry in the user
        #     file needs this password: `xxj31ZMTZzkVA'.
        #   o ExportCertData:
        #     This exports two additional environment variables: SSL_CLIENT_CERT and
        #     SSL_SERVER_CERT. These contain the PEM-encoded certificates of the
        #     server (always existing) and the client (only existing when client
        #     authentication is used). This can be used to import the certificates
        #     into CGI scripts.
        #   o StdEnvVars:
        #     This exports the standard SSL/TLS related `SSL_*' environment variables.
        #     Per default this exportation is switched off for performance reasons,
        #     because the extraction step is an expensive operation and is usually
        #     useless for serving static content. So one usually enables the
        #     exportation for CGI and SSI requests only.
        #   o StrictRequire:
        #     This denies access when "SSLRequireSSL" or "SSLRequire" applied even
        #     under a "Satisfy any" situation, i.e. when it applies access is denied
        #     and no other module can change it.
        #   o OptRenegotiate:
        #     This enables optimized SSL connection renegotiation handling when SSL
        #     directives are used in per-directory context.
        #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
<FilesMatch "\.(cgi|shtml|phtml|php)$">
                SSLOptions +StdEnvVars
        </FilesMatch>
        <Directory /usr/lib/cgi-bin>
                SSLOptions +StdEnvVars
        </Directory>

        #   SSL Protocol Adjustments:
        #   The safe and default but still SSL/TLS standard compliant shutdown
        #   approach is that mod_ssl sends the close notify alert but doesn't wait for
        #   the close notify alert from client. When you need a different shutdown
        #   approach you can use one of the following variables:
        #   o ssl-unclean-shutdown:
        #     This forces an unclean shutdown when the connection is closed, i.e. no
        #     SSL close notify alert is send or allowed to received.  This violates
        #     the SSL/TLS standard but is needed for some brain-dead browsers. Use
        #     this when you receive I/O errors because of the standard approach where
        #     mod_ssl sends the close notify alert.
        #   o ssl-accurate-shutdown:
        #     This forces an accurate shutdown when the connection is closed, i.e. a
        #     SSL close notify alert is send and mod_ssl waits for the close notify
        #     alert of the client. This is 100% SSL/TLS standard compliant, but in
        #     practice often causes hanging connections with brain-dead browsers. Use
        #     this only for browsers where you know that their SSL implementation
        #     works correctly.
        #   Notice: Most problems of broken clients are also related to the HTTP
        #   keep-alive facility, so you usually additionally want to disable
        #   keep-alive for those clients, too. Use variable "nokeepalive" for this.
        #   Similarly, one has to force some clients to use HTTP/1.0 to workaround
        #   their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and
        #   "force-response-1.0" for this.
        BrowserMatch "MSIE [2-6]" \
                nokeepalive ssl-unclean-shutdown \
                downgrade-1.0 force-response-1.0
        # MSIE 7 and newer should be able to use keepalive
        BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown

ServerName game.example.net
SSLCertificateChainFile /etc/letsencrypt/live/game.example.net/chain.pem
</VirtualHost>
</IfModule>
apache-2.2
  • 1 个回答
  • 635 Views
Martin Hope
James
Asked: 2016-03-06 17:59:05 +0800 CST

阻止直接访问端口,但允许通过子域访问

  • 1

我最近开始使用 Elastic 搜索、Logstash 和 Kibana 来帮助可视化我服务器上的日志。

这效果很好,但唯一的问题是,这一切都可以通过我服务器上的端口访问它们来公开访问。例如example.com:9200或example.com:5601。

我找到了一种将弹性搜索仅限于本地流量的方法,但我需要一种方法来限制对 Kibana 的公共访问。

我想将其公开,以便我可以访问它,但使用htaccess. 我已经成功实现了这一点,所以如果我导航到kibana.example.com它,在通过之前会要求我输入用户名和密码。但是,我仍然可以直接使用它来访问它,example.com:5601而不会被要求进行身份验证。

环顾四周,似乎 iptables 是解决这个问题的方法。我尝试使用sudo iptables -A INPUT -p tcp --dport 5601 -j DROP,这确实阻止了对端口的所有访问,但它也阻止了我在引导时允许的流量kibana.example.com。

kibana.example.com当您尝试直接访问端口时,如何修改上述规则以允许访问但阻止访问?

我的服务器运行 Debain Jessie,我使用 Apache 2.2 作为我的 Web 服务器。

apache-2.2
  • 1 个回答
  • 802 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve