7. WAPT Server Advanced Configuration¶
The WAPT Server configuration file on GNU/ Linux and macOS systems is found in /opt/wapt/conf/waptserver.ini
or in /opt/wapt/waptserver/waptserver.ini
.
The WAPT Server configuration file on Windows is found in C:\wapt\conf\waptserver.ini
.
Attention
Modification of these files is reserved for advanced users!!
7.1. Default configurations of waptserver file and nginx¶
7.1.1. Modify the [options] section of waptserver.ini¶
Several options can be defined in the [options] section.
[options]
Options (Default Value) |
Description |
Example |
---|---|---|
|
Defines where the WAPT Agents are stored on the WAPT Server. |
agents_folder = /var/www/wapt/waptagent |
|
Defines whether websocket connections should be authenticated.
If |
allow_unauthenticated_connect = True |
|
Allows the initial registration of the WAPT Agent using a login and password. |
allow_unauthenticated_registration = True |
|
Debug only - Allows unsigned status data from Agent. |
allow_unsigned_status_data = True |
|
Defines a custom WAPT Server application root path. |
application_root = wapt |
|
Enables authentication logs. |
authentication_logs = False |
|
Enables automatic configuration when waptsetup is installed. |
auto_create_waptagent_from_config = True |
|
Defines the host certificate lifetime (in days). |
client_certificate_lifetime = 500 |
|
Defines whether unused :ref:` Windows KB should be automatically deleted <auto_kb_clean>` from the WAPT Server. |
cleanup_kbs = False |
|
Defines the websocket client timeout (in seconds). |
clients_read_timeout = 10 |
|
Defines the host certificate signing certificate. |
clients_signing_certificate = C:\private\org-coder.crt |
|
Defines the host certificate signing CRL periodicity (in days). |
clients_signing_crl_days = 15 |
|
Defines the host certificate signing CRL path. |
clients_signing_crl = C:\private\org-coder.crt |
|
Defines the host certificate signing CRL URL. |
clients_signing_crl_url = https://srvwapt.mydomain.lan/crl |
|
Defines the host certificate signing key path. |
clients_signing_key = C:\private\org-coder.crt |
|
Defines the maximum allowed delay before WAPT Agent requests time out (in seconds). |
client_tasks_timeout = 5 |
|
If x64, allows you to copy all WinPE from |
copy_winpe_x64_in_tftp_folder = True |
|
Defines the maximum allowed delay before PostgreSQL queries time out (in seconds). |
db_connect_timeout = 10 |
|
Defines the url of the PostgreSQL server (by default WAPT use a local Unix Socket). |
db_host = https://wapt.mydomain.lan |
|
Defines the maximum simultaneous connections to the PostgreSQL database. |
db_max_connections = 100 |
|
Defines the PostgreSQL database that the WAPT Server connects to. |
db_name = wapt |
|
Defines the password for authenticating the user on the PostgreSQL database (by default WAPT uses a local UNIX socket). |
db_password = WAPT_DB_PASSWORD |
|
Defines the port of the PostgreSQL server. |
db_port = 5432 |
|
Defines the database stale timeout (in seconds). |
db_stale_timeout = 500 |
|
Defines the PostgreSQL user connecting to the database. |
db_user = wapt |
|
Defines the default acl for a new user opening the WAPT Console. |
default_ldap_users_acls = admin |
|
Automatically downloads the |
download_wsusscn2 = False |
|
Enables WAPT Store Webui (Deprecated). |
enable_store = False |
|
Encrypts host package with client certificate. |
encrypt_host_packages = True |
|
Adds basic authentication to WAPT Server. |
htpasswd_path = True |
|
Defines the proxy server to allow the WAPT Server to recover its CRL. |
http_proxy = http://srvproxy.mydomain.lan:3128 |
|
Adds additional known CA to verify certificates. |
known_certificates_folder = /opt/wapt/ssl/ |
|
Defines the UPN Active directory user for SSO and/or waptserver-ldap mode for self-service. |
ldap_account_service_login = wapt-ldap@ad.tranquil.it |
|
Defines the user password for SSO and/or waptserver-ldap mode for self-service. |
ldap_account_service_password = PASSWORD |
|
Defines the LDAP authentication base DN. |
ldap_auth_base_dn = dc=mydomain,dc=lan |
|
Defines the LDAP authentication server. |
ldap_auth_server = srvads.mydomain.lan |
|
Enables the search of nested group in Active Directory. |
ldap_nesting_group_support = False |
|
Enables the search on Active Directory primary group users. |
ldap_primary_group_ad_support = False |
|
Lists subnets without authentication requirement. |
list_subnet_skip_login_wads = 192.168.0.0/24,192.168.1.0/24 |
|
Enables authentication to use WADS (format is |
login_on_wads = True |
|
Defines the log level. Possible values are: |
loglevel = debug |
|
Sets the maximum simultaneous WAPT client connections. |
max_clients = 2048 |
|
Sets the minimum SuperAdmin password length. |
min_password_length = 15 |
|
Defines the Nginx web server HTTP port (Windows only). |
nginx_http = 8080 |
|
Defines the Nginx web server HTTPS port (Windows only). |
nginx_https = 44380 |
|
If one of the option is set, it will not log it: |
optimized_authentication_logs = False |
|
Défines the periodicity at which the WAPT Server verifies the synchronization status of remote repositories (in minutes). |
remote_repo_update_delay = 5 |
|
Enables websocket communication with WAPT Agents configured as remote repositories. |
remote_repo_websockets = False |
|
Defines the random string for initializing the Python Flask application server. The string is generated when first installing the WAPT Server and is unique for every WAPT Server. |
secret_key = FKjfzjfkF687fjrkeznfkj7678jknk78687 |
|
Defines the WAPT Server UUID (this anonymous id is used for WAPT statistics). |
server_uuid = 76efezfa6-b309-1fez5-92cd-8ea48fc122dc |
|
Defines the maximum allowed time the session is opened (in seconds). |
session_lifetime = 352120 |
|
Defines the maximum allowed time difference for the websockets (in seconds). |
signature_clockskew = 72000 |
|
Defines the authentication token lifetime (in seconds). |
token_lifetime = 43200 |
|
Defines the path to the trusted signers certificate directory. |
trusted_signers_certificates_folder = C:\private\org-coder.crt |
|
Defines the path to trusted users CA certificate directory. |
trusted_users_certificates_folder = C:\private\org-coder.crt |
|
Enables a WAPT Agent to register using its kerberos account.
If |
use_kerberos = True |
|
Enables client certificate authentication. |
use_ssl_client_auth = True |
|
Enables the WADS feature and enables wapttftpserver. |
wads_enable = True |
|
Defines the folder on the WAPT Server that stores files related to WADS. |
wads_folder = /var/www/waptwads |
|
Defines the LDAP DN of Active Directory User Group allowed to connect to the WAPT Console. |
wapt_admin_group_dn = CN=waptadmins,OU=groups,DC=ad,DC=mydomain,DC=lan |
|
Defines the sAMAccountName Active Directory User Group(s) allowed to connect to the WAPT Console. The value can be several groups, separated by commas. |
wapt_admin_group = waptadmins, wapttechs |
|
Defines the directory path of the WAPT repository. |
wapt_folder = /var/www/wapt |
|
Defines the path to database that stores the status of running tasks. |
wapt_huey_db = C:\Program Files(x86)\wapt\db\waptservertasks.sqlite |
|
Defines the SuperAdmin password for connecting to the WAPT Console. |
wapt_password = 46642dd2b1dfezfezgfezgadf0ezgeezgezf53d |
|
Defines the WAPT Server python service port. |
waptserver_port = 1313 |
|
Defines the SuperAdmin username in the WAPT Console. |
wapt_user = wapt_admin |
|
Defines the location of WAPT WUA folder. |
waptwua_folder = /var/www/waptwua |
|
Defines the list of WakeOnLAN UDP ports to send magic packets to. |
wol_port = 9, 123, 4000 |
|
Defines how to listen to the WAPT Server service. |
wapt_bind_interface = 127.0.0.1 |
|
Defines the location of jinja template used for WADS ipxe script. |
ipxe_script_jinja_path = /opt/wapt/waptserver/templates/ipxe-autoregister.j2 |
7.1.2. Configuring Nginx¶
The default Nginx configuration is as follows:
# uwsgi upstream server
upstream waptserver {
server unix:///run/waptserver/uwsgi.sock;
}
log_format combined_ssl '$remote_addr $ssl_client_s_dn $ssl_client_verify $remote_user [$time_local] '
'"$request" $status $body_bytes_sent '
'"$http_referer" "$http_user_agent"';
server {
listen 80;
listen [::]:80;
listen 443 ssl;
listen [::]:443 ssl;
server_name srvwapt.mydomain.lan;
server_name 192.168.100.12;
access_log "/var/log/nginx/access.log" combined_ssl;
ssl_certificate "/opt/wapt/waptserver/ssl/cert.pem";
ssl_certificate_key "/opt/wapt/waptserver/ssl/key.pem";
ssl_protocols TLSv1.2;
ssl_dhparam "/etc/ssl/certs/dhparam.pem";
ssl_prefer_server_ciphers on;
ssl_ciphers 'EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH';
ssl_stapling on;
ssl_stapling_verify on;
ssl_session_cache none;
ssl_session_tickets off;
# HSTS (ngx_http_headers_module is required) (63072000 seconds)
add_header Strict-Transport-Security "max-age=63072000" always;
ssl_client_certificate "/opt/wapt/conf/ca-srvwapt.mydomain.lan.crt";
ssl_crl "/opt/wapt/conf/ca-check-clients.crl";
ssl_verify_client optional;
gzip_min_length 1000;
gzip_buffers 4 8k;
gzip_http_version 1.0;
gzip_disable "msie6";
gzip_types text/plain text/css application/json;
gzip_vary on;
index index.html;
server_tokens off;
client_max_body_size 12288m;
client_body_timeout 1800;
large_client_header_buffers 4 16k;
proxy_headers_hash_max_size 1024;
proxy_headers_hash_bucket_size 128;
proxy_request_buffering off;
location ^~ /.well-known/acme-challenge/ {
default_type "text/plain";
root /var/www/html;
}
# sub instances
include "/opt/wapt/conf/wapt.d/*.conf";
location /static {
alias "/opt/wapt/waptserver/static";
}
location /ssl {
alias "/var/www/ssl";
}
# not protected URL
location ~ ^/(wapt/waptsetup.*\.exe|wapt/ping|wapt/waptagent/.*|wapt/waptagent\.exe|wapt/waptdeploy\.exe|wapt/conf\.d/.*\.json)$ {
add_header Cache-Control "store, no-cache, must-revalidate, post-check=0, pre-check=0";
add_header Pragma "no-cache";
root "/var/www";
}
location ~ ^/api/v3/(wads_register_host|set_host_wads_status|baseipxe|get_host_ipxe|get_wads_exe.*|get_wads_config)$ {
proxy_http_version 1.1;
proxy_request_buffering off;
include "/opt/wapt/conf/forward_ssl_auth.conf";
rewrite /(.*) /$1 break;
proxy_pass http://127.0.0.1:8080;
}
# not protected URL
location /wads {
alias "/var/www/wads";
}
location = / {
include "/opt/wapt/conf/forward_ssl_auth.conf";
proxy_pass http://127.0.0.1:8080;
}
# SSL protected URL
location /waptwua {
add_header Cache-Control "store, no-cache, must-revalidate, post-check=0, pre-check=0";
add_header Pragma "no-cache";
include "/opt/wapt/conf/forward_ssl_auth.conf";
include "/opt/wapt/conf/require_ssl_auth.conf";
alias "/var/www/waptwua";
}
# SSL protected URL
location ~ ^/(wapt/.*|wapt-diff-repos/.*|licences\.json|sync\.json)$ {
add_header Cache-Control "store, no-cache, must-revalidate, post-check=0, pre-check=0";
add_header Pragma "no-cache";
include "/opt/wapt/conf/forward_ssl_auth.conf";
include "/opt/wapt/conf/require_ssl_auth.conf";
root "/var/www";
}
location /rules.json {
add_header Cache-Control "store, no-cache, must-revalidate, post-check=0, pre-check=0";
add_header Pragma "no-cache";
include "/opt/wapt/conf/forward_ssl_auth.conf";
root "/var/www";
}
# we don't want to expose our list of computers in case someone scan this folder.
location /wapt-host/Packages {
return 403;
}
location ~ ^/(wapt-host/.*)$ {
log_not_found off;
add_header Cache-Control "store, no-cache, must-revalidate, post-check=0, pre-check=0";
add_header Pragma "no-cache";
include "/opt/wapt/conf/forward_ssl_auth.conf";
include "/opt/wapt/conf/require_ssl_auth.conf";
root "/var/www";
}
location ~ ^/.*_kerberos$ {
proxy_http_version 1.1;
proxy_request_buffering off;
include "/opt/wapt/conf/forward_ssl_auth.conf";
auth_gss on;
auth_gss_format_full on;
auth_gss_keytab /etc/nginx/http-krb5.keytab;
proxy_pass http://127.0.0.1:8080;
}
# we need socketio for these actions.
# they are enabled only locally on the loopback
location ~ ^/api/v3/(update_hosts_sid_table|hosts_sid)$ {
proxy_http_version 1.1;
proxy_request_buffering off;
include "/opt/wapt/conf/forward_ssl_auth.conf";
rewrite /(.*) /$1 break;
proxy_pass http://127.0.0.1:8080;
allow 127.0.0.1;
deny all;
}
# we need socketio for these actions
location ~ ^/api/v3/(update_hosts_sid_table|trigger_host_action|reset_hosts_sid|host_tasks_status|trigger_cancel_task|hosts_delete|launch_sync_on_remotes_repos|broadcast_sync_on_remotes_repo)$ {
proxy_http_version 1.1;
proxy_request_buffering off;
include "/opt/wapt/conf/forward_ssl_auth.conf";
include "/opt/wapt/conf/require_ssl_auth.conf";
rewrite /(.*) /$1 break;
proxy_pass http://127.0.0.1:8080;
}
location /get_websocket_auth_token {
return 404;
}
# these actions are not protected by SSL client side certificate, as we perhaps don't have one at this stage.
# in case uwsgi is enabled, we wat this to still be handled by eventlet waptserver as these endpoints are not cpu intensive but often called
location ~ ^/(ping)$ {
proxy_http_version 1.1;
proxy_request_buffering off;
include "/opt/wapt/conf/forward_ssl_auth.conf";
rewrite /(.*) /$1 break;
proxy_pass http://127.0.0.1:8080;
}
# these actions are not protected by SSL client side certificate, as we perhaps don't have one at this stage.
location ~ ^/(login|api/v3/login|api/v3/logout|api/v3/get_hash_json_content|api/v3/waptagent_version|add_host|api/v3/add_host|api/v3/get_waptagent_exe/.*/waptagent.exe)$ {
proxy_http_version 1.1;
proxy_request_buffering off;
include "/opt/wapt/conf/forward_ssl_auth.conf";
rewrite /(.*) /$1 break;
include /opt/wapt/conf/uwsgi_params;
uwsgi_pass waptserver;
}
location / {
proxy_http_version 1.1;
proxy_request_buffering off;
include "/opt/wapt/conf/forward_ssl_auth.conf";
include "/opt/wapt/conf/require_ssl_auth.conf";
include /opt/wapt/conf/uwsgi_params;
uwsgi_pass waptserver;
}
location /socket.io {
proxy_http_version 1.1;
proxy_request_buffering off;
include "/opt/wapt/conf/forward_ssl_auth.conf";
include "/opt/wapt/conf/require_ssl_auth.conf";
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_pass http://127.0.0.1:8080/socket.io;
}
}
7.2. Configuring WAPT Server for large infrastructures¶
The default operating system, Nginx and PostgreSQL settings are adapted for around 400 WAPT Agents. If you have more than 400 clients it is necessary to modify a few system level parameters along with PostgreSQL database, Nginx web and WAPT Server python server.
In the future, the postconf.sh script might take charge of this configuration depending on the expected number of client computers.
With the following parameters, one WAPT Server should scale up to around 5000 concurrent active clients. You may have more clients in the database if they are not all running at the same time. If you have more than 5000 clients it is recommended to have more than one WAPT Server.
The limit in the number of end point clients is due to the bottleneck in the python code and the PostgreSQL backend. WAPT performance gets better with time and in the future WAPT Server might support a large base on a single host. However the Nginx part scales very well and it can takes full advantage of a 10Gbps connection for high load package deployments.
Note
The parameters to be modified below are linked together and should be modified globally and not individually.
7.2.1. Multithreading support with uWSGI¶
To enable multithreading with uWSGI, you can add the following parameter in section [options] of /opt/wapt/conf/waptserver.ini
:
use_uwsgi = True
You must run /opt/wapt/waptserver/scripts/postconf.sh
after this modification.
7.2.2. Configuring Nginx¶
OS Type |
File location |
---|---|
Debian and derivatives |
|
RedHat and derivatives |
|
Windows |
|
In the nginx.conf
file, modify the worker_connections
parameter.
The value should be around 2.5 times the number of WAPT clients (n connections for websockets and n connections for package downloads and inventory upload + some margin).
events {
worker_connections 4096;
}
Then upgrade the number of filedescriptors in the nginx.conf
file:
worker_rlimit_nofile 32768;
Depending on the partitioning of your WAPT Server you might have to be careful with the Nginx temporary file upload directory. Nginx acts as a reverse proxy for the WAPT Server Python engine and its does a caching of packages uploaded when uploading a new package from the Console.
The packages are stored in the /var/lib/nginx/proxy
directory.
You have to make sure that the partition hosting this directory is large enough.
You may change this directory location using the following Nginx configuration parameter.
$client_body_temp_path
7.2.3. Configuring the Linux System¶
Increase the number of filedescriptors. The system unit file asks for an increase in the allowed number of filedescriptors (LimitNOFILE=32768). We should have the same thing for Nginx. There are a few limits to modify.
First we modify system wide the number of filedescriptors allowed for Nginx and WAPT.
Create the
/etc/security/limits.d/wapt.conf
.
cat > /etc/security/limits.d/wapt.conf <<EOF
wapt hard nofile 32768
wapt soft nofile 32768
www-data hard nofile 32768
www-data soft nofile 32768
EOF
Nginx serves as a reverse proxy and makes quite a lot of connections. Each WAPT client keeps a websocket connection up all the time in order to respond to actions from the WAPT Server.
The Linux kernel has a protection against having too many TCP connections opened at the same time and one may get the SYN flooding on port message in the Nginx log. In order to avoid these messages, it is necessary to modify the two following parameters. It should be around 1.5 times the number of WAPT clients.
cat > /etc/sysctl.d/wapt.conf <<EOF
net.ipv4.tcp_max_syn_backlog=4096
net.core.somaxconn=4096
EOF
sysctl --system
7.2.4. Configuring the PostgreSQL database¶
OS Type |
File location |
---|---|
Debian and derivatives |
|
RedHat and derivatives |
|
Windows |
|
A higher number of clients need a higher number of connections to the PostgreSQL database.
In the postgresql.conf
file, you need to increase the following parameter to approximately 1/4 the number of active WAPT Agents.
max_connections = 1000
In /opt/wapt/conf/waptserver.ini
file (for Windows C:\wapt\conf\waptserver.ini
), db_max_connections
should be equal to PostgreSQL max_connections
minus 10 (PostgreSQL needs to keep some connections for its housekeeping stuff).
The max_clients
parameter should be set around 1.2 times the number of WAPT Agents:
[options]
...
max_clients = 4096
db_max_connections = 990
7.3. Using the command-lines for repository management¶
7.3.1. wapt-get upload-package¶
The wapt-get upload-package <path to the package> command uploads a package onto the main WAPT repository.
The command wapt-get upload-package C:\waptdev\tis-tightvnc.wapt returns:
Using config file: C:\Users\documentation\AppData\Local\waptconsole\waptconsole.ini
Uploading packages to https://srvwapt.mydomain.lan
Please get login for https://srvwapt.mydomain.lan/api/v3/upload_xxx:admin
Password:
c:\waptdev\tis-tightvnc.wapt[================================] 54316019/54316019 - 00:00:17
OK : 1 Packages uploaded, 0 errors
7.3.2. wapt-get scan-packages¶
Hint
This command applies to Windows repositories ONLY.
The wapt-get scan-packages <directory> command rebuilds a Packages
file for a WAPT package repository.
The command wapt-get scan-packages C:waptwaptserverrepositorywapt returns:
Using config file: C:\Program Files (x86)\wapt\wapt-get.ini
Packages filename: C:\wapt\waptserver\repository\wapt
Processed packages:
C:\wapt\waptserver\repository\wapt\tis-firefox.wapt
C:\wapt\waptserver\repository\wapt\tis-tightvnc.wapt
C:\wapt\waptserver\repository\wapt\tis-7zip.wapt
Skipped packages:
7.3.3. wapt-scanpackages¶
Hint
This command applies to Linux repositories ONLY.
The wapt-scanpackages <directory> command rebuilds a Packages
file for a WAPT package repository.
The command wapt-scanpackages /var/www/wapt/ returns nothing.
7.3.4. Re-signing packages on the WAPT Server using a command line¶
Use this method if re-signing from the WAPT console method does not complete successfully. These commands are ONLY available for WAPT Servers running Linux.
Warning
Before using this method, ensure that your WAPT Server is safe and not under the control of an unauthorized third party entity.
Copy your
.crt
and.pem
to/tmp/
on the WAPT Server using Winscp or an equivalent tool.It is then possible to re-sign all the packages at once on the WAPT Server with the following commands.
wapt-signpackages -d /var/www/wapt-host -c /tmp/wapt_pub_key.crt -k /tmp/wapt_priv_key.pem -s
wapt-signpackages -d /var/www/wapt -c /tmp/wapt_pub_key.crt -k /tmp/wapt_priv_key.pem -s
wapt-scanpackages /var/www/wapt/
If the error Access violation appears, the reason is that the WAPT package is too voluminous.
Edit the package and check this procedure to transfert a voluminous package.
Danger
Remove the .crt and .pem from /tmp/
on the WAPT Server or the server will become a sensitive asset.
For more available options, please see the command line section.