add frappy port to firewall
+ add AcceptEnv to sshd_config (seems not yet to work)
This commit is contained in:
13
install.py
13
install.py
@@ -217,6 +217,7 @@ def frappy(cfg=None, port=None, requirements='', **kwds):
|
||||
if not cfg:
|
||||
return False, None
|
||||
req = pip_requirements['l_samenv']
|
||||
main_ports.add(int(port or 10767))
|
||||
if requirements:
|
||||
req[cfg] = '\n'.join(requirements.split(','))
|
||||
with open('/home/l_samenv/frappy/requirements.txt') as f:
|
||||
@@ -274,13 +275,14 @@ def pip():
|
||||
filename = tmpname.replace('.tmp', '.txt')
|
||||
content = ''.join('# --- for %s ---\n%s\n' % kv for kv in requirements.items())
|
||||
if content:
|
||||
print(user, filename)
|
||||
if write_when_new(filename, content, user=='root'):
|
||||
if doit:
|
||||
os.rename(filename, tmpname)
|
||||
unix_cmd('mv', filename, tmpname, sudo=True)
|
||||
if os.system(' '.join(pipcmd)) == 0:
|
||||
os.rename(tmpname, filename)
|
||||
unix_cmd('mv', tmpname, filename, sudo=True)
|
||||
else:
|
||||
os.remove(tmpname)
|
||||
unix_cmd('rm', tmpname, sudo=True)
|
||||
else:
|
||||
print(' '.join(pipcmd))
|
||||
show.dirty = True
|
||||
@@ -317,6 +319,8 @@ def write_when_new(filename, content, as_root=False, ignore_reduction=False):
|
||||
content += '\n'
|
||||
lines = content.split('\n')
|
||||
try:
|
||||
for parent in reversed(Path(filename).absolute().parents):
|
||||
unix_cmd('chmod', 'o+rx', parent, sudo=True)
|
||||
with open(filename) as fil:
|
||||
old = fil.read()
|
||||
except FileNotFoundError:
|
||||
@@ -716,7 +720,8 @@ def handle_config():
|
||||
if servicecfg and to_start.get('service') is None:
|
||||
to_start[service] = 'restart', as_root
|
||||
|
||||
change_firewall(router_ports, main_ports, doit)
|
||||
if change_firewall(router_ports, main_ports, doit):
|
||||
show.dirty = True
|
||||
if 'dialout' not in unix_cmd('id l_samenv'):
|
||||
do_cmd('usermod -a -G dialout l_samenv')
|
||||
pip()
|
||||
|
||||
@@ -109,7 +109,8 @@ PrintMotd no
|
||||
#Banner none
|
||||
|
||||
# Allow client to pass locale environment variables
|
||||
AcceptEnv GIT* EDITOR
|
||||
AcceptEnv GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_COMMITTER_NAME GIT_COMMITTER_EMAIL GITEA_TOKEN
|
||||
AcceptEnv EDITOR
|
||||
|
||||
# override default of no subsystems
|
||||
Subsystem sftp /usr/lib/openssh/sftp-server
|
||||
|
||||
Reference in New Issue
Block a user