我正在服务器上设置我的第一个 Django 项目
当我这样做时python manage.py runserver .0.0.0.0:80,它告诉我
You don't have permission to access that port.
当我这样做时,python manage.py runserver .0.0.0.0:8000它告诉我该端口已被使用。
我正在尝试运行 LAMP 堆栈。
我如何“获得许可”?如何查看哪些进程打开了端口?
我正在尝试使用 pip 在 virtualenv 中安装 python pandas 包。
在我的开发机器上它安装正确,但现在我正在服务器上尝试,它到目前为止似乎卡住了:
warnings.warn(LapackSrcNotFoundError.__doc__)
/apps/PYTHON/2.7.3/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'define_macros'
warnings.warn(msg)
non-existing path in 'numpy/distutils': 'site.cfg'
non-existing path in 'numpy/lib': 'benchmarks'
Could not locate executable gfortran
Could not locate executable f95
Found executable /apps/modules/wrappers/fortran/ifort
Run Code Online (Sandbox Code Playgroud)
顶部显示 ifort 以 46% 的 CPU 运行。
有什么方法可以判断这是否正常工作(例如,我可以检查它正在更新的文件),还是卡在循环中?
到目前为止,它已经运行了 40 分钟。
我在 redhat 上的同一个 apache 实例下配置了几个虚拟主机:
对于每个虚拟主机WSGIScriptAlias设置都指向激活虚拟环境的 python 文件:
activate_this = '/path_to_the_virtualenv/bin/activate_this.py'
execfile(activate_this, dict(__file__=activate_this))
Run Code Online (Sandbox Code Playgroud)
现在,我计划将其中一个项目升级到 python-2.7,另一个升级到 python-3.x。我知道我可以有不同的虚拟环境,单独的 python 沙箱。因此,python 方面的一切都很好。
问题是:在同一个apache+mod_wsgi实例下,不同的apache虚拟主机可以使用不同的python版本吗?
如果没有,继续进行的最佳选择是什么?
有一个相关的WsgiPythonHome设置,但它是在“服务器配置”上下文中全局定义的,而不是每个虚拟主机。另外,mod_wsgi 是为特定的 python 版本编译的,所以我不确定它是否可以处理这种情况。
我可能遗漏了一些东西,或者这可能只是布局支柱数据的错误方式。
我想遍历第二级支柱数据。
支柱示例:
repo:
Option1:
version1:
display_name: "abcde"
version2:
display_name: "fghij"
Option2:
version1:
display_name: "klmn"`
Run Code Online (Sandbox Code Playgroud)
SL:
{% for version, versioninfo in salt['pillar.get']('repo', {}).iteritems() %}
{{ versioninfo[] }}{{ versioninfo[]['display_name'] }}
{% endfor %}`
Run Code Online (Sandbox Code Playgroud)
我想返回每个版本和显示名称,有效地忽略第一级支柱数据。显然上面的jinja不起作用,但是有没有办法做到这一点?
所以我目前正在尝试让脚本工作,但是当我手动运行它时它的行为与我从 crontab 运行它时的行为不同。基本上,我有一个从一台服务器到另一台服务器的反向 ssh 隧道,为了验证我的隧道是否已启动,我:
我知道有更优雅的方法来验证 ssh 隧道(如 autossh 和 ServerKeepAlive),但对于策略和冗余问题,我必须以这种方式做事。无论如何,这是脚本:
from __future__ import print_function
from __future__ import absolute_import
import os, sys, subprocess, logging, pexpect
COMMAND_PROMPT = '[#$] '
TERMINAL_PROMPT = '(?1)terminal type\?'
TERMINAL_TYPE = 'vt100'
SSH_NEWKEY = '(?i)are you sure you want to continue connecting'
SERVERS = [{address':'192.168.100.10', 'connString':'ssh user@192.168.100.10', 'testGet':'wget http://192.168.100.11/test.html -t 1 -T 10', 'tunnel':'start_tunnel'}, {address':'192.168.100.12', 'connString':'ssh user@192.168.100.12', 'testGet':'wget …Run Code Online (Sandbox Code Playgroud) 有没有人在 ansible 模板中为循环组合组。我们想要做的是获取两个组的公共成员并循环它们以创建我们的配置。我们正在尝试在主机限制中工作但接收的相同格式'dict object' has no attribute 'tag_function_psql:&tag_release_dev'
{% for host in groups['tag_function_psql:&tag_release_dev'] %}
Run Code Online (Sandbox Code Playgroud) 我有三台 Linux 服务器,我创建了 ansible 清单文件:
[web]
192.168.0.155
192.168.0.165
192.168.0.175
Run Code Online (Sandbox Code Playgroud)
我有 playbook.yml:
---
- hosts: web
tasks:
- name: Check drinks versions
shell: "python3.4 {{ item.sw_path }} -v"
sudo: yes
with_items:
- { sw_path: '/home/beer.py' }
- { sw_path: '/home/vodka.py' }
- { sw_path: '/home/whisky.py' }
Run Code Online (Sandbox Code Playgroud)
脚本(beer.py、vodka.py 和whisky.py)以如下格式打印它们的版本:“/home/beer.py 1.0.0”。我需要获取这个版本,将它与我存储在数据库中的版本(这是实际版本)进行比较,如果版本不相等,则将实际版本从 svn(svn 路径也存储在数据库中)复制到服务器。我如何使用 ansible 功能做到这一点?
我正在尝试通过命令在我的 Amazon ec2 RHEL nginx 服务器上设置让我们加密,$ sudo yum install certbot-nginx但它一直失败:
$ sudo yum install certbot-nginx
Last metadata expiration check: 2:58:11 ago on Sat 17 Aug 2019 11:29:45 PM UTC.
Error:
Problem: conflicting requests
- nothing provides pyparsing needed by python2-certbot-nginx-0.36.0-1.el7.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
Run Code Online (Sandbox Code Playgroud)
在网上做了一些绊脚石之后,我安装了各种 python 和 pip 包(完整列表如下)。知道我可能会错过什么吗?
这是我的操作系统详细信息,然后是安装的 python 和 pip 包...
$ cat /etc/os-release
NAME="Red Hat Enterprise Linux"
VERSION="8.0 (Ootpa)"
ID="rhel"
ID_LIKE="fedora" …Run Code Online (Sandbox Code Playgroud) 我是一个长期的 linux 系统管理员,但对 CentOS 不熟悉。我只需要确定这个 CentOS 服务器是否容易受到CVE-2019-18348 的攻击。为此,我必须验证安装的软件包是否已打补丁,或者有办法测试机器上的漏洞。
我还没有找到任何可靠的方法来测试漏洞,所以我只能查看软件包版本、更改日志等。
首先,关于漏洞的一些细节:
CVE-2019-18348:在 Python 2.x 到 2.7.17 中的 urllib2 和 Python 3.x 到 3.8.0 中的 urllib 中发现了一个问题。如果攻击者控制了一个 url 参数,则 CRLF 注入是可能的,如 urllib.request.urlopen 的第一个参数所示,\r\n(特别是在 URL 的主机组件中)后跟一个 HTTP 标头。这类似于 CVE-2019-9740 查询字符串问题和 CVE-2019-9947 路径字符串问题。
当 glibc 修复了 CVE-2016-10739 时,这是不可利用的
以下是我的系统的版本详细信息:
系统已完全更新,但我没有看到启用任何安全性或反向移植存储库。我无法找到有关是否有针对 centos 的安全更新存储库以及如何启用它的任何信息。
[root@host]# yum repolist
Last metadata expiration check: 1:37:46 ago on Fri 06 Dec 2019 07:51:08 PM UTC.
repo id repo name status
AppStream …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 CentOS 7 上安装 Ansible,并将 Ansible 配置为使用 Python 3。我已经安装了 Python2 和 Python3。
[root@ansible1 ~]# python --version
Python 2.7.5
[root@ansible1 ~]# python3 --version
Python 3.6.8
Run Code Online (Sandbox Code Playgroud)
如果我使用 安装 Ansible yum install ansible,该ansible --version命令会显示 Ansible 配置为使用 Python 2.7.5。我卸载ansible( yum remove ansible);
[root@ansible1 ~]# ansible --version
ansible 2.9.10
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /bin/ansible
python version = 2.7.5 (default, Aug 7 2019, 00:51:29) [GCC 4.8.5 …Run Code Online (Sandbox Code Playgroud) python ×10
ansible ×3
pip ×3
redhat ×2
amazon-ec2 ×1
apache-2.2 ×1
centos ×1
centos8 ×1
certbot ×1
cron ×1
cve ×1
django ×1
installation ×1
lets-encrypt ×1
linux ×1
mod-wsgi ×1
saltstack ×1
scm ×1
security ×1
virtualhost ×1