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-172216

Delirium's questions

Martin Hope
Delirium
Asked: 2022-02-05 10:30:40 +0800 CST

仅删除 big acme.json 中的证书

  • 0

我试图弄清楚如何格式化大 json 文件并只删除格式如下的证书:

{
  "http-01": {
    "Account": {
      "Email": "[email protected]",
      "Registration": {
        "body": {
          "status": "valid",
          "contact": [
            "mailto:[email protected]"
          ]
        },
        "uri": "https://acme-v02.api.letsencrypt.org/acme/acct/110801506"
      },
      "PrivateKey": "long_key_string",
      "KeyType": "4096"
    },
    "Certificates": [
      {
        "domain": {
          "main": "domain.tld"
        },
        "certificate": "long_cert_string",
        "key": "long_key_String",
        "Store": "default"
      },
      {
        "domain": {
          "main": "domain2.tld"
        },
      .....

我cat acme.json |grep certificate | awk ' { print $1 $2 } '试过了,但我正在努力如何在昏迷之间只选择文本"certificate":和编辑证书。

有没有优雅的方式用 bash/python 格式化它?我找不到办法。

bash python
  • 1 个回答
  • 68 Views
Martin Hope
Delirium
Asked: 2021-10-11 23:57:53 +0800 CST

当它是 md0 sw raid 1 时如何调整 /dev/sda2 的大小

  • 0

4TB我刚刚从2TBssd添加了更大的md0RAID,但大小仍然相同。我试图调整 .partition 的大小,但它说它很忙。Parted 仍在按旧尺寸调整它的大小。

大批:

Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] 
md0 : active raid1 sdb2[3] sda2[2]
      1875210240 blocks super 1.2 [2/2] [UU]
      bitmap: 3/14 pages [12KB], 65536KB chunk

知道我做错了什么吗?谢谢

resize2fs /dev/sda2 
resize2fs 1.44.5 (15-Dec-2018)
resize2fs: Device or resource busy while trying to open /dev/sda2
Couldn't find valid filesystem superblock.

GNU Parted 3.2
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p                                                                
Warning: Not all of the space available to /dev/sda appears to be used, you can fix the GPT to use all of the space (an extra 3750727680 blocks) or continue with the current setting? 
Fix/Ignore? Fix                                                           
Model: ATA KINGSTON SEDC450 (scsi)
Disk /dev/sda: 3841GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  32.5MB  31.5MB                     bios_grub
 2      32.5MB  1920GB  1920GB                     raid

resize      resizepart  
(parted) resizepart 2
End?  [1920GB]? 35000GB                                                   
Error: The location 35000GB is outside of the device /dev/sda.

fdisk 输出:

Disk /dev/sda: 3.5 TiB, 3840755982336 bytes, 7501476528 sectors
Disk model: KINGSTON SEDC450
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 36C330A7-33FB-423A-981B-2DC29CCE3822

Device     Start        End    Sectors  Size Type
/dev/sda1   2048      63487      61440   30M BIOS boot
/dev/sda2  63488 3750748159 3750684672  1.8T Linux RAID

Disk /dev/sdb: 3.5 TiB, 3840755982336 bytes, 7501476528 sectors
Disk model: KINGSTON SEDC450
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 36C330A7-33FB-423A-981B-2DC29CCE3822

Device     Start        End    Sectors  Size Type
/dev/sdb1   2048      63487      61440   30M BIOS boot
/dev/sdb2  63488 3750748159 3750684672  1.8T Linux RAID
filesystems raid
  • 1 个回答
  • 226 Views
Martin Hope
Delirium
Asked: 2020-02-19 00:21:20 +0800 CST

Apache 反向代理 SSL 问题

  • 0

我在我的主机名上https://servername/phpmyadmin/安装了phpmyadmin。我想更改 url 并“采用”域证书并在其上使用它db.domain.tld,但我无法让它工作。

这是我的 ProxyPass 在ISPConfig主机名中的配置,其中11.22.33.44是服务器 IP 的占位符。

ProxyRequests off
SSLProxyEngine on
ProxyPassReverseCookiePath /phpmyadmin/ /
ProxyPassReverseCookieDomain 11.22.33.44 db.domain.tld

ProxyPass "/" https://11.22.33.44/phpmyadmin/ connectiontimeout=10000 timeout=10000
ProxyPassReverse "/" https://11.22.33.44/phpmyadmin/

这是我在错误日志中得到的错误

[Tue Feb 18 09:18:57.640945 2020] [proxy:error] [pid 7804:tid 139734462269184] [client IPv6-placeholder:44762] AH00898: Error during SSL Handshake with remote server returned by /
[Tue Feb 18 09:18:57.640950 2020] [proxy_http:error] [pid 7804:tid 139734462269184] [client IPv6-placeholder:44762] AH01097: pass request body failed to 11.22.33.44:443 (11.22.33.44)

我的浏览器中的响应是

Proxy Error
The proxy server could not handle the request

Reason: Error during SSL Handshake with remote server
debian apache-httpd
  • 1 个回答
  • 868 Views
Martin Hope
Delirium
Asked: 2020-01-31 06:09:55 +0800 CST

从列表中检测 cms

  • 0

如果他们使用 Wordpress,我的营销部门希望我检测我们的域。我有我们庞大的域列表,但我找不到合适的 cms 检测器,它只会将具有 wordpress 的域保存到输出文件中。

我将非常感谢您的建议。

scripting programming
  • 1 个回答
  • 253 Views
Martin Hope
Delirium
Asked: 2020-01-16 00:54:00 +0800 CST

NFTable 说明

  • 1

我需要澄清一下。如果我添加此规则

nft add rule ip filter INPUT ip daddr 127.0.0.1 drop

nftables 会忽略它并且永远不会承认,因为它在规则的末尾?

debian nftables
  • 1 个回答
  • 62 Views
Martin Hope
Delirium
Asked: 2019-12-17 07:49:17 +0800 CST

创建具有精确大小的 /dev/sda1 和 /dev/sda2

  • 1

怎么可能创建/dev/sda1和/dev/sda2大小为20GB?我潜伏在谷歌上并尝试过:

Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-286677119, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-286677119, default 286677119): +size 20G
Last sector, +sectors or +size{K,M,G,T,P} (2048-286677119, default 286677119): 

Created a new partition 1 of type 'Linux' and of size 136.7 GiB.

但它再次以全尺寸创建136.7 GiB。

debian fdisk
  • 2 个回答
  • 195 Views
Martin Hope
Delirium
Asked: 2019-12-05 02:34:47 +0800 CST

从“自身”从网络服务器下载文件时出现 404 错误

  • 0

我需要以某种方式允许我的服务器从自身下载文件。我必须使用wgetfrom example.comon file example.com/script.json,但是当我尝试这样做时,我收到 404 错误

Resolving https://example.com (example.com )... 1.2.3.4
Connecting to example.com (example.com)|1.2.3.4|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2019-12-04 11:10:50 ERROR 404: Not Found.

文件在目录中/home/site.com/apps/frontend/public

我是否以某种方式为此域设置了 localhost?我觉得我喜欢,但不知道怎么做。

apache-httpd
  • 1 个回答
  • 823 Views
Martin Hope
Delirium
Asked: 2019-11-27 01:01:04 +0800 CST

Postfix 延迟几天发送电子邮件

  • 0

Postfix 正在发送延迟几天的电子邮件。不知道为什么,因为我没有延迟发送设置/etc/postfix/main.cf。它实际上只发生在一个域中。我在服务器上有多个域,只有一个有这个问题。

debian postfix
  • 1 个回答
  • 132 Views
Martin Hope
Delirium
Asked: 2019-10-30 23:39:19 +0800 CST

将数据从 KVM 虚拟机内部复制到主机文件系统

  • 0

是否可以将数据从运行的虚拟机内部复制KVM/QEMU到物理主机?

debian
  • 1 个回答
  • 1466 Views
Martin Hope
Delirium
Asked: 2019-09-14 02:13:40 +0800 CST

使用子存储库创建 debian 本地存储库 main,非免费

  • 2

如何创建具有子存储库main, non-free并为其生成key.gpg的本地存储库?

我准备好了文件夹/srv/dists/buster

debian
  • 1 个回答
  • 1718 Views
Martin Hope
Delirium
Asked: 2019-07-06 07:53:45 +0800 CST

qcow2 上的输入/输出在重启后神秘修复

  • 0

Input/Output error当我尝试使用qcow2磁盘在我的 KVM 虚拟机上执行某些操作时出现错误。我读到它可能损坏的虚拟磁盘,但我只是在我的管理程序上运行virsh destroy,virsh start现在它工作正常。

我想问是否有可能追踪这个问题的原因,或者是因为系统重启而丢失了证据?

debian virtual-machine
  • 1 个回答
  • 119 Views
Martin Hope
Delirium
Asked: 2019-04-12 06:22:32 +0800 CST

安装php7.1-gd的问题

  • -2

我在 debian9 上运行并使用ppa:ondrej/php存储库,但无法安装 php7.1。也不安装缺少的依赖项。当我尝试安装它时,apt install php7.1-gd我遇到了这个错误。

apt-get install php7.1-gd
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 php7.1-gd : Depends: libgd3 (>= 2.1.1) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

这是我尝试安装时发生的错误libgd3

apt install libgd3
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libgd3 : Depends: libc6 (>= 2.29) but 2.24-11+deb9u4 is to be installed
          Depends: libfontconfig1 (>= 2.12.6) but 2.11.0-6.7+b1 is to be installed
          Depends: libjpeg8 (>= 8c) but it is not installable
E: Unable to correct problems, you have held broken packages.
debian apache-httpd
  • 2 个回答
  • 2399 Views
Martin Hope
Delirium
Asked: 2019-03-28 06:48:57 +0800 CST

Varnish - 一个站点的多个后端

  • 2

Varnish 可以为一个站点配置多个后端吗?例如,我有具有多个后端的高可用性站点。

例如,我有www.goodies.com一个在 php 5.6 上运行的站点。所以我有 3 个www-nodes作为后端www-node5.6a www-node5.6b www-node5.6c

我在 Varnish 中配置了这样的后端:

backend www-node5.6a {
    .host = "10.0.0.11";
    .port = "80";
    .connect_timeout = 6000s;
    .first_byte_timeout = 6000s;
    .between_bytes_timeout = 6000s;
}

backend www-node5.6b {
    .host = "10.0.0.12";
    .port = "80";
    .connect_timeout = 6000s;
    .first_byte_timeout = 6000s;
    .between_bytes_timeout = 6000s;
}

backend www-node5.6c {
    .host = "10.0.0.13";
    .port = "80";
    .connect_timeout = 6000s;
    .first_byte_timeout = 6000s;
    .between_bytes_timeout = 6000s;
}

我的问题是,如何配置 Varnish 以便用户将被随机使用到此特定站点的任何后端?

debian apache-httpd
  • 1 个回答
  • 354 Views
Martin Hope
Delirium
Asked: 2019-01-26 02:18:49 +0800 CST

PhpMyadmin 因小 SQL 文件而超时

  • 1

我正在尝试将碰撞上传到 phpmyadmin,它只有 2MB,但它有 12000 行。

我总是收到这个错误:

Service Unavailable
The server is temporarily unable to service your request due to
maintenance downtime or capacity problems. Please try again later.

我有 max_input_time = 1000 max_execution_time = 1000

php mysql
  • 1 个回答
  • 414 Views
Martin Hope
Delirium
Asked: 2019-01-10 06:23:33 +0800 CST

更改 KVM 上的存储

  • 0

我在 KVM“machine01”中有虚拟机我有存储/data/sas1/virt/virt.qcow2但未使用/data/sas1/virt/virt2.qcow2

我想通过我的主管上的命令行从/data/sas1/virt/virt.qcow2我/data/sas1/virt/virt2.qcow2的 VirtIO 磁盘源路径更改。那可能吗?

kvm virtual-machine
  • 1 个回答
  • 102 Views
Martin Hope
Delirium
Asked: 2019-01-05 05:59:30 +0800 CST

ssh-copy-id 询问密码

  • 2

我用这个命令创建了用户并生成了密钥

root# mkdir /usr/share/foreman/.ssh
root# chmod 700 /usr/share/foreman/.ssh
root# chown user:user/usr/share/foreman/.ssh

root# su user -s /bin/bash
user$ ssh-keygen

然后尝试在用户和root之间复制密钥(在同一台服务器上)

user$ ssh-copy-id [email protected]
user$ ssh [email protected]

但是当 tryint to ssh-copy-idroot 要求输入密码时。不知道为什么。

在互联网评论上发现 UsePAM 可以解决这个问题,但对我没有用。

#UsePAM yes

我的 sshd_config 中也有这个选项允许

PasswordAuthentication yes
ssh users
  • 1 个回答
  • 2669 Views
Martin Hope
Delirium
Asked: 2018-08-02 23:03:53 +0800 CST

sshpass 并在 bash 备份脚本中查找错误

  • 0

我正在使用此脚本通过 rsync 备份远程文件。当我尝试启动时出现问题,我得到这个输出错误,我不知道如何处理。感谢您的建议,如果有的话。

#!/bin/bash
#VARIABLES DEFINE TO STORE COMMANDS AND VALUES.
TODAY_DATE=$(date +%Y%m%d) #Store current date
MKDIR=$(which mkdir)    #store mkdir command
RSYNC=$(which rsync)    #store rsync command
DEL=$(which rm)             #store rm command
TAR=$(which tar)             #store tar command
MAIL=$(which mail)         #store mail command
LOGFILE='/tmp/backup.log' #store path of log file & touch this file in /tmp directory

#ADD EMAIL ID IN MAILTO FOR GETTING NOTIFICATIONS IN MAIL
MAILTO='[email protected]'
BODY="nnFor more information please check $LOGFILE.nnnThanks,n$0"

#CREATE DIRECTORY TO STORE BACKUP FILES
PRODBACKDIR=$TODAY_DATE/var/production-backup/

#IF CONDITION CHECK DIRECTORY IS PRESENT OR NOT AND IF NOT PRESENT CREATE DIRECTORY WITH PROVIDED DIR STRUCTURE.
if [ ! -d "{$PRODBACKDIR}" ] && [ `$MKDIR -p "$PRODBACKDIR"` ];
then
echo -e "Directory Created for site";
fi

#if [ ! -d “{$BLOGBACKDIR}” ] && [ `$MKDIR -p “$BLOGBACKDIR”` ];
#then
#echo -e “Directory Created for Production Blog Codebase”;
#fi

#REMOVE BACKUP FILES 7 DAYS OLDER
find /var/production-backup/ -mtime +7 -exec rm -rf {} ;

#RSYNC COMMAND  TO SYNC CODE OR DATA FROM REMOTE SERVER TO LOCAL USING SSHPASS TO PASS PASSWORD OF REMOTE SERVER
sshpass -p 'password' rsync –progress -rPz -e ssh backups@remotehost:/var/www/website $PRODBACKDIR

#FOR LOOP TO CHECK BACKUP FILES AND COMPRESSED IT WITH .TAR.GZ FILE WHICH SAVES DISK SPACE ON LOCAL SYSTEM AND ALSO REMOVE NON COMPRESSED FILES.
for DOC in $PRODBACKDIR; do
echo "`date '+%Y-%m-%d'` : ${DOC} backup started";
if [ -d ${DOC} ]; then
          FILENAME=$(echo $DOC | awk -F '/' '{print $NF}');
          TARFILE="$FILENAME-$TODAY_DATE.tar.gz";
          echo "`date '+%Y-%m-%d'` : ${DOC} archiving started.";
          $TAR -cvzf $PRODBACKDIR/$TARFILE $PRODBACKDIR/$FILENAME;

#IF CONDITION CHECK ERRORS WHILE CREATING TAR.GZ AND REPORT IF TAR COMMAND FAILS.
if [ $? -eq 0 ]; then
                       echo "`date '+%Y-%m-%d'` : ${DOC} archiving done."
                       $DEL -rf $PRODBACKDIR/$FILENAME
                       echo "`date '+%Y-%m-%d'` : ${DOC} deleting of non-archive directory done."
               else
                       echo "Error while creating tar."
                       echo -e "Error while creating tar file.$BODY" | $MAIL -s 'Error : Creating tar file' $MAILTO
                       exit 1
               fi
       fi
       echo "`date '+%Y-%m-%d %H:%M:%S'` : ${DOC} backup completed"
done


#SEND THE NOTIFICATION EMAIL AFTER SUCCESSFUL COMPLETION OF BACKUP.
echo -e "Backups successfully done for Production codebase" | $MAIL -s "Completed : Backup finished." $MAILTO

错误:

find: missing argument to `-exec'
Try 'find --help' for more information.
Unexpected remote arg: backups@remotehost:/var/www/website
rsync error: syntax or usage error (code 1) at main.c(1361) [sender=3.1.2]
2018-08-02 : 20180802/var/production-backup/ backup started
2018-08-02 : 20180802/var/production-backup/ archiving started.
20180802/var/production-backup/
2018-08-02 : 20180802/var/production-backup/ archiving done.
2018-08-02 : 20180802/var/production-backup/ deleting of non-archive directory d                                                                                                                               one.
2018-08-02 06:58:59 : 20180802/var/production-backup/ backup completed
bash scripting
  • 1 个回答
  • 875 Views
Martin Hope
Delirium
Asked: 2018-06-21 03:32:22 +0800 CST

RedHat 全局 vimrc 不起作用

  • 0

我想设置全局 vimrc。但它不起作用。我已经/usr/share/vim/vimrc在我有这个配置的地方设置了它。

colo torte
syntax on

如果配色方案不适用于用户,我做错了什么?

rhel vim
  • 1 个回答
  • 456 Views

Sidebar

Stats

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

    模块 i915 可能缺少固件 /lib/firmware/i915/*

    • 3 个回答
  • Marko Smith

    无法获取 jessie backports 存储库

    • 4 个回答
  • Marko Smith

    如何将 GPG 私钥和公钥导出到文件

    • 4 个回答
  • Marko Smith

    我们如何运行存储在变量中的命令?

    • 5 个回答
  • Marko Smith

    如何配置 systemd-resolved 和 systemd-networkd 以使用本地 DNS 服务器来解析本地域和远程 DNS 服务器来解析远程域?

    • 3 个回答
  • Marko Smith

    dist-upgrade 后 Kali Linux 中的 apt-get update 错误 [重复]

    • 2 个回答
  • Marko Smith

    如何从 systemctl 服务日志中查看最新的 x 行

    • 5 个回答
  • Marko Smith

    Nano - 跳转到文件末尾

    • 8 个回答
  • Marko Smith

    grub 错误:你需要先加载内核

    • 4 个回答
  • Marko Smith

    如何下载软件包而不是使用 apt-get 命令安装它?

    • 7 个回答
  • Martin Hope
    user12345 无法获取 jessie backports 存储库 2019-03-27 04:39:28 +0800 CST
  • Martin Hope
    Carl 为什么大多数 systemd 示例都包含 WantedBy=multi-user.target? 2019-03-15 11:49:25 +0800 CST
  • Martin Hope
    rocky 如何将 GPG 私钥和公钥导出到文件 2018-11-16 05:36:15 +0800 CST
  • Martin Hope
    Evan Carroll systemctl 状态显示:“状态:降级” 2018-06-03 18:48:17 +0800 CST
  • Martin Hope
    Tim 我们如何运行存储在变量中的命令? 2018-05-21 04:46:29 +0800 CST
  • Martin Hope
    Ankur S 为什么 /dev/null 是一个文件?为什么它的功能不作为一个简单的程序来实现? 2018-04-17 07:28:04 +0800 CST
  • Martin Hope
    user3191334 如何从 systemctl 服务日志中查看最新的 x 行 2018-02-07 00:14:16 +0800 CST
  • Martin Hope
    Marko Pacak Nano - 跳转到文件末尾 2018-02-01 01:53:03 +0800 CST
  • Martin Hope
    Kidburla 为什么真假这么大? 2018-01-26 12:14:47 +0800 CST
  • Martin Hope
    Christos Baziotis 在一个巨大的(70GB)、一行、文本文件中替换字符串 2017-12-30 06:58:33 +0800 CST

热门标签

linux bash debian shell-script text-processing ubuntu centos shell awk ssh

Explore

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

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve