Is it possible to script hestia? - server

i'd like to know if it's possible, and how to script Hestia in order to add users, databases, dns and all.
I know this tool to script the installation of hestia.
https://gabizz.github.io/hestiacp-scriptline-generator/
But nothing about config.
Any ideas?
Best regards.
N.

You can find all of the commands under this page :
https://docs.hestiacp.com/cli_commands/commands.html
e.g -
For adding users:
v-add-user admin2 P4$$w#rD bgates#aol.com
For adding database:
v-add-database admin wordpress_db matt qwerty123
For adding domain:
v-add-dns-domain admin example.com ns1.example.com ns2.example.com '' '' '' '' '' '' yes

Related

Buildroot/busybox usertable.txt and take away access rights for a group/user

Question 1:
Thru buildroot usertable.txt I created a user called deviceuser which belongs to group operator and nogroup:
$cat usertable.txt
deviceuser -1 deviceuser -1 =SERIAL_NO /mnt /bin/sh operator Device user for non-trivial maintanence work
After image is loaded into target what I get in /etc/group is :
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
kmem:x:9:
wheel:x:10:root
cdrom:x:11:
dialout:x:18:
floppy:x:19:
video:x:28:
audio:x:29:
tape:x:32:
www-data:x:33:
utmp:x:43:
plugdev:x:46:
staff:x:50:
lock:x:54:
netdev:x:82:
users:x:100:
admin:x:1002:deviceuser <====== not sure where its coming from
nogroup:x:65534:deviceuser
deviceuser:x:1000:
sshd:x:1001:
operator:x:37:deviceuser
$ cat /etc/shadow
root:$1$blahblahblah.:10933:0:99999:7:::
daemon:*:10933:0:99999:7:::
bin:*:10933:0:99999:7:::
sys:*:10933:0:99999:7:::
sync:*:10933:0:99999:7:::
mail:*:10933:0:99999:7:::
www-data:*:10933:0:99999:7:::
operator:*:10933:0:99999:7:::
nobody:*:10933:0:99999:7:::
deviceuser:$1$blahblahblah:::::::
sshd:*:::::::
As noted above, deviceuser gets admin priviledge and I need to eliminate that and make deviceuser part of operator and nogroup only.
Question 2:
I want to take the access rights (read/right/execute) away from this deviceuser or operator group for /etc/ folder, while keeping everybody else's permissions intact, there are a number of users and groups in the system including www-data. What's the simplest way to do this without affecting any kind of permission issue for www-data and others?
If I do "chmod -R o-wrx /etc " then I believe www-data will have issues running some init scripts.
Thanks
Ratin

why wildfly server is asking me to add users even after adding user?

mngmt-users.properties file. The users are added in the file but when I try to run the localhost it says it's running then if I try to view the admin console it is redirecting to http://localhost:9990/error/index_win.html. That tells the server is running but I could not open admin console.
#
# Properties declaration of users for the realm 'ManagementRealm' which is the default realm
# for new installations. Further authentication mechanism can be configured
# as part of the <management /> in standalone.xml.
#
# Users can be added to this properties file at any time, updates after the server has started
# will be automatically detected.
#
# By default the properties realm expects the entries to be in the format: -
# username=HEX( MD5( username ':' realm ':' password))
#
# A utility script is provided which can be executed from the bin folder to add the users: -
# - Linux
# bin/add-user.sh
#
# - Windows
# bin\add-user.bat
#
#$REALM_NAME=ManagementRealm$ This line is used by the add-user utility to identify the realm name already used in this file.
#
# On start-up the server will also automatically add a user $local - this user is specifically
# for local tools running against this AS installation.
#
# The following illustrates how an admin user could be defined, this
# is for illustration only and does not correspond to a usable password.
#
#admin=2a0923285184943425d1f53ddd58ec7a
tejaswini=25ab658c2861b2e64783aaa9ba95c2e5
aswini#19=388ced81791ddb1760b83dc4ec8b7a61
saisana=ff39d778414ab12d84fc4fa7fdacb634
alekya=d72e9c90345ce4d9290c3a2728b3cd60
prasad=c6c7c67cf343f6862d3b77bae9f61d17
teju=28b9e55b314fd60855a7843b4455dbed
Screen shot of added user
May be u have tried to create specifically application user or management user when u ran the addUser utility,
please refer the below link for steps to register user
https://bgasparotto.com/add-user-wildfly

Change configuration parameters from command-line or programatically

How can I change settings in pg_hba.conf and postgresql.conf either from the command-line or programatically (especially from fabric or fabtools)?
I already found set_config, but that does not seem to work for parameters which require a server restart. The parameters to change are listen_addresses in postgresql.conf and a new line in pg_hba.conf, so connections from our sub-network will be accepted.
This is needed to write deployment scripts using fabric. It is not an option to copy template-files which then override the existing *.conf files, because the database server might be shared with other applications which bring their own configuration parameters. Thus, the existing configuration must be altered, not replaced.
Here is the currently working solution, incorporating the hint from a_horse_with_no_name. I paste a snippet from our fabfile.py (it uses require from fabtools, and it runs against Ubuntu):
db_name = env.variables['DB_NAME']
db_user = env.variables['DB_USER']
db_pass = env.variables['DB_PASSWORD']
# Require a PostgreSQL server.
require.postgres.server(version="9.4")
require.postgres.user(db_user, db_pass)
require.postgres.database(db_name, db_user)
# Listen on all addresses - use firewall to block inadequate access.
sudo(''' psql -c "ALTER SYSTEM SET listen_addresses='*';" ''', user='postgres')
# Download the remote pg_hba.conf to a temp file
tmp = tempfile.NamedTemporaryFile()
with open(tmp.name, "w") as f:
get("/etc/postgresql/9.4/main/pg_hba.conf", f, use_sudo=True)
# Define the necessary line in pg_hba.conf.
hba_line = "host all all {DB_ACCEPT_IP}/0 md5".format(**env.variables)
# Search the hba_line in the existing pg_hba.conf
with open(tmp.name, "ra") as f:
for line in f:
if hba_line in line:
found = True
break
else:
found = False
# If it does not exist, append it and upload the modified pg_hba.conf to the remote machine.
if not found:
with open(tmp.name, "a") as f:
f.write(hba_line)
put(f.name, "/etc/postgresql/9.4/main/pg_hba.conf", use_sudo=True)
# Restart the postgresql service, so the changes take effect.
sudo("service postgresql restart")
The aspect I don't like with this solution is that if I change DB_ACCEPT_IP, this will just append a new line and not remove the old one. I am sure a cleaner solution is possible.

Symfony 1.4 I get the wrong values in app.yml

Obviously it is not that simple. Let's start from the beginning: I'm working on a shared project and yesterday I've been asked to add the plugin mgI18n. I followed the readme file step by step, but when it came down to run the command line to create the table used by the plugin, I got this:
database "" does not exists
I searched it, and I found out that sfConfig::get('app_mgI18nPlugin_connection'); returned an empty value. It was weird, because I've done every step right, setting the value in my app.yml and clearing symfony cache, so I logged sfConfig::getAll(); and found out that the only values for 'app_' stored here were the ones from the file app.yml in the plugin folder of kdDoctrineGuardFacebookConnectPlugin. I've already tried removing that file and clearing the cache, obtaining only to lose these values.
Here is the file contents:
project/apps/frontend/config/app.yml
all:
#other values
facebook:
appId: yyy
secret: yyy
cookie: true
script_lang: fr_FR
perms: email
mgI18nPlugin:
connection: doctrine
cultures_available:
fr: Français
en: English
it: Italiano
de: Deutsch
project/plugins/kdDoctrineGuardFacebookConnectPlugin/config/app.yml
all:
facebook:
appId: xxx
secret: xxx
cookie: true
script_lang: fr_FR
perms: email
and this is what I get when I log sfConfig::getAll(); :
array('app_facebook_appId' => 'xxx',
'app_facebook_secret' => 'xxx',
'app_facebook_cookie' => true,
'app_facebook_script_lang' => 'fr_FR',
'app_facebook_perms' => 'email',
)
Why the values for the main app.yml are not loaded? How do I correct this behaviour?
Thank you all in advance for your help, if you need more specifics I'll glady add them
If I understood you well you are in a command line task context (some sfTask). Symfony tasks by default do not run in application context. In most cases just call your task as
./symfony namespace:name --application=frontend
and you will have your configs.
If it is your own task just add it an option with default value in your configure method:
$this->addOptions(array(
new sfCommandOption('application', null, sfCommandOption::PARAMETER_REQUIRED, 'The application name', 'frontend'),
...
)
Plugin settings are loaded correctly, because plugins are configured per project not application (you enable them in ProjectConfiguration, not generated frontendConfiguration class)

Pinax TemplateSyntaxError

i ran into this errors while trying to modify pinax database model
i am using eclipse pydev
i have this error on the pydev
Exception Type: TemplateSyntaxError at /
Exception Value: Caught an exception while rendering: (1146, "Table 'test1.announcements_announcement' doesn't exist")
please how do i correct this
UPDATE: i asked this question and left unresolved some months back and you what ran into the bug again this week and typed the error message in google hit the page with the question and unanswered so i think i have to answer it and hope it help someone in the future have the same problem.
some the problem is that the sqlite path is out of place so django or this case pinax can not find it so to resolve that change the absolute path to sqlite like it
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = os.path.join(PROJECT_ROOT,'dev.db' ) # Or path to database file if using sqlite3.
DATABASE_USER = '' # Not used with sqlite3.
DATABASE_PASSWORD = '' # Not used with sqlite3.
DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
i hope that help
chnge the sqlite3 path like this
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'. DATABASE_NAME = os.path.join(PROJECT_ROOT,'dev.db' ) # Or path to database file if using sqlite3. DATABASE_USER = '' # Not used with sqlite3. DATABASE_PASSWORD = '' # Not used with sqlite3. DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3.
If your database model is missing a column, run
python manage.py syncdb
from the command line. This ensures that your models match the underlying database representation.