Fixes in change_password for users, disabled password change

This commit is contained in:
absurdo 2023-12-03 20:24:23 +01:00
parent 8e693ae7b6
commit e4410d0421
3 changed files with 25 additions and 2 deletions

View file

@ -3,7 +3,7 @@
import sys
import argparse
import os
from pastafariutils.unix import add_user, del_user, change_password
#from pastafariutils.unix import add_user, del_user, change_password
from pathlib import Path
from subprocess import call, DEVNULL
import json
@ -23,6 +23,7 @@ parser.add_argument('--ssh_pub_key_file', help='The ssh pub key of the unix user
args=parser.parse_args()
"""
if args.password:
password_user=args.password
@ -35,7 +36,7 @@ if args.password:
else:
print('Changed password succesfully...\n')
"""
if args.ssh_pub_key_file:

View file

@ -172,6 +172,27 @@ if linux_distro=='arch':
print('Error, cannot add utilities for archlinux')
exit(1)
# Add selinux permisions
if call("sudo getenforce", shell=True)==0:
# If selinux enabled, set permissions to /home/hosting/sites for sites.
if call("setenforce 0", shell=True) > 0:
print('Error, cannot disable selinux...')
exit(1)
#with open('/etc/sysconfig/selinux') as f:
if linux_distro=='rocky' or linux_distro=='fedora' or linux_distro=='almalinux':
if call("sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/selinux/config", shell=True) > 0:
print('Error, cannot disable selinux in file /etc/selinux/config...')
exit(1)
if call("sed -i 's/SELINUX=enforcing/SELINUX=permissive/g' /etc/sysconfig/selinux", shell=True) > 0:
print('Error, cannot disable selinux in file /etc/sysconfig/selinux...')
exit(1)
"""
else:

View file

@ -14,6 +14,7 @@
<p><label>${lang('pastafari2', 'ssh_port', 'SSH port')}* <span class="pastafari2_error error" id="ssh_port_error"></span></label> <input type="number" name="ssh_port" value="22"></p>
<p><input type="submit" value="${lang('pastafari2', 'send', 'Send')}"/></p>
</form>
<p><strong class="error">${lang('pastafari2', 'if_fedora_derivatives', 'Warning: if you use Fedora based distros, WE PUT selinux in permissive mode.')}</strong></p>
</div>
<p><a href="${url_for('.pastafari2_dashboard')}">Servers</a> &gt;&gt; ${lang('pastafari2', 'add_server', 'Add server')}</p>
<script type="text/javascript" src="${make_media_url('js/jsutils/posting2.js', 'pastafari2')}"></script>