Reset OpenVPN Access Server

If your Access Server isn’t working (mine stopped listening on all ports, web interface wasn’t accessible), run the initialization script to set it up from scratch.

WARNING: DO NOT RUN THE COMMAND ON A WORKING SERVER. YOU WILL HAVE TO SET UP THE SERVER FROM THE BEGINNING.

Log into the console as root and run the following command:
/usr/local/openvpn_as/bin/ovpn-init –force

Advertisements

Nginx certbot server_names_hash error

Running certbot with nginx and getting this error:

root@vps:~# ./certbot-auto –nginx
Saving debug log to /var/log/letsencrypt/letsencrypt.log

Which names would you like to activate HTTPS for?
[..]
Generating key (1024 bits): /var/lib/letsencrypt/snakeoil/0004_key.pem
Cleaning up challenges
nginx restart failed:

nginx: [emerg] could not build server_names_hash, you should increase server_names_hash_bucket_size: 64

…despite the fact that server_names_hash_bucket_size: 64 was already in the nginx.conf file.

The fix? set it to 128 (instead of 64). Who knew?

Unless that’s saying to INCREASE it by 64, not set it to 64. That just occurred to me.

Linux mail users and aliases (Postfix, Dovecot)

/etc/aliases –  maps local system users to email.  So if an application running on the server needs to send mail, it can send to a system user (root) and the mail will be forwarded to an actual email address.

postmaster: webmaster@yourdomain.com 
root: webmaster@yourdomain.com 
www-data: webmaster@yourdomain.com

For example.

run the newaliases command, which will create a hashed version of the file (named /etc/aliases.db).

/etc/postfix/virtual – allow incoming Internet mail to alias@yourdomain.com to be redirected to an actual email account on the server.

Run postmap [file path] after editing.

/etc/postfix/virtual-mailbox-users – List all the email addresses for Postfix to handle email delivery. These would be the “real” users of the server (i.e. accounts that log into IMAP/SMTP)

 /etc/dovecot/passwd.db – holds the “real” users of the server.

Rundoveadm pw -s SSHA512to generate the user’s password hash, then copy it into the file like this (repeat process for each new user):

you@yourdomain.com:{SSHA512}OeR5ulGD3LZ0OHuj9muNqSvKB7hxsxnTquS…

Now the accounts are set up.

MySQL pad column values with zeroes

e.g. values are 1, 2, 33, 57, and you want them to be 001, 002, 033, 057

ALTER TABLE `[table name]` CHANGE `[column]` `[column]` VARCHAR(3) UNSIGNED ZEROFILL CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL;

From phpMyAdmin – click table > Structure tab > Change > Attributes > Unsigned Zerofill

Notepad++ insert characters at beginning or end of every line

To insert at the beginning of every line:

  • Press Ctrl+H for find and replace
  • Set “Find what” to ^ and change Search Mode to Regular expression.
  • Put whatever you want at the beginning of the lines in “Replace with”

To insert at the end of every line:

  • Set Search mode to Extended
  • Set “Find what” to \r\n (backslash r, backslash n if that gets eviscerated)
  • Enter what you want in “Replace with” followed by \r\n

 

Create a free website or blog at WordPress.com.

Up ↑