Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add script for getting info about recently registered users #10290

Merged
merged 7 commits into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/10290.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add script to print information about recently registered users.
6 changes: 6 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
matrix-synapse-py3 (1.37.1ubuntu1) UNRELEASED; urgency=medium

* Add synapse_review_recent_signups script

-- Erik Johnston <erikj@matrix.org> Thu, 01 Jul 2021 15:55:03 +0100

matrix-synapse-py3 (1.37.1) stable; urgency=medium

* New synapse release 1.37.1.
Expand Down
42 changes: 5 additions & 37 deletions debian/hash_password.1
Original file line number Diff line number Diff line change
@@ -1,90 +1,58 @@
.\" generated with Ronn/v0.7.3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random thought: I wonder if we should generate these at build time rather than checking them in...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That probably makes sense

.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "HASH_PASSWORD" "1" "February 2017" "" ""
.
.\" generated with Ronn-NG/v0.8.0
.\" http://github.com/apjanke/ronn-ng/tree/0.8.0
.TH "HASH_PASSWORD" "1" "July 2021" "" ""
.SH "NAME"
\fBhash_password\fR \- Calculate the hash of a new password, so that passwords can be reset
.
.SH "SYNOPSIS"
\fBhash_password\fR [\fB\-p\fR|\fB\-\-password\fR [password]] [\fB\-c\fR|\fB\-\-config\fR \fIfile\fR]
.
.SH "DESCRIPTION"
\fBhash_password\fR calculates the hash of a supplied password using bcrypt\.
.
.P
\fBhash_password\fR takes a password as an parameter either on the command line or the \fBSTDIN\fR if not supplied\.
.
.P
It accepts an YAML file which can be used to specify parameters like the number of rounds for bcrypt and password_config section having the pepper value used for the hashing\. By default \fBbcrypt_rounds\fR is set to \fB10\fR\.
.
.P
The hashed password is written on the \fBSTDOUT\fR\.
.
.SH "FILES"
A sample YAML file accepted by \fBhash_password\fR is described below:
.
.P
bcrypt_rounds: 17 password_config: pepper: "random hashing pepper"
.
.SH "OPTIONS"
.
.TP
\fB\-p\fR, \fB\-\-password\fR
Read the password form the command line if [password] is supplied\. If not, prompt the user and read the password form the \fBSTDIN\fR\. It is not recommended to type the password on the command line directly\. Use the STDIN instead\.
.
.TP
\fB\-c\fR, \fB\-\-config\fR
Read the supplied YAML \fIfile\fR containing the options \fBbcrypt_rounds\fR and the \fBpassword_config\fR section containing the \fBpepper\fR value\.
.
.SH "EXAMPLES"
Hash from the command line:
.
.IP "" 4
.
.nf

$ hash_password \-p "p@ssw0rd"
$2b$12$VJNqWQYfsWTEwcELfoSi4Oa8eA17movHqqi8\.X8fWFpum7SxZ9MFe
.
.fi
.
.IP "" 0
.
.P
Hash from the STDIN:
.
.IP "" 4
.
.nf

$ hash_password
Password:
Confirm password:
$2b$12$AszlvfmJl2esnyhmn8m/kuR2tdXgROWtWxnX\.rcuAbM8ErLoUhybG
.
.fi
.
.IP "" 0
.
.P
Using a config file:
.
.IP "" 4
.
.nf

$ hash_password \-c config\.yml
Password:
Confirm password:
$2b$12$CwI\.wBNr\.w3kmiUlV3T5s\.GT2wH7uebDCovDrCOh18dFedlANK99O
.
.fi
.
.IP "" 0
.
.SH "COPYRIGHT"
This man page was written by Rahul De <\fIrahulde@swecha\.net\fR> for Debian GNU/Linux distribution\.
.
This man page was written by Rahul De <\fI\%mailto:rahulde@swecha\.net\fR> for Debian GNU/Linux distribution\.
.SH "SEE ALSO"
synctl(1), synapse_port_db(1), register_new_matrix_user(1)
synctl(1), synapse_port_db(1), register_new_matrix_user(1), synapse_review_recent_signups(1)
2 changes: 1 addition & 1 deletion debian/hash_password.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ for Debian GNU/Linux distribution.

## SEE ALSO

synctl(1), synapse_port_db(1), register_new_matrix_user(1)
synctl(1), synapse_port_db(1), register_new_matrix_user(1), synapse_review_recent_signups(1)
1 change: 1 addition & 0 deletions debian/manpages
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
debian/hash_password.1
debian/register_new_matrix_user.1
debian/synapse_port_db.1
debian/synapse_review_recent_signups.1
debian/synctl.1
1 change: 1 addition & 0 deletions debian/matrix-synapse-py3.links
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
opt/venvs/matrix-synapse/bin/hash_password usr/bin/hash_password
opt/venvs/matrix-synapse/bin/register_new_matrix_user usr/bin/register_new_matrix_user
opt/venvs/matrix-synapse/bin/synapse_port_db usr/bin/synapse_port_db
opt/venvs/matrix-synapse/bin/synapse_review_recent_signups usr/bin/synapse_review_recent_signups
opt/venvs/matrix-synapse/bin/synctl usr/bin/synctl
37 changes: 6 additions & 31 deletions debian/register_new_matrix_user.1
Original file line number Diff line number Diff line change
@@ -1,72 +1,47 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "REGISTER_NEW_MATRIX_USER" "1" "February 2017" "" ""
.
.\" generated with Ronn-NG/v0.8.0
.\" http://github.com/apjanke/ronn-ng/tree/0.8.0
.TH "REGISTER_NEW_MATRIX_USER" "1" "July 2021" "" ""
.SH "NAME"
\fBregister_new_matrix_user\fR \- Used to register new users with a given home server when registration has been disabled
.
.SH "SYNOPSIS"
\fBregister_new_matrix_user\fR options\.\.\.
.
\fBregister_new_matrix_user\fR options\|\.\|\.\|\.
.SH "DESCRIPTION"
\fBregister_new_matrix_user\fR registers new users with a given home server when registration has been disabled\. For this to work, the home server must be configured with the \'registration_shared_secret\' option set\.
.
.P
This accepts the user credentials like the username, password, is user an admin or not and registers the user onto the homeserver database\. Also, a YAML file containing the shared secret can be provided\. If not, the shared secret can be provided via the command line\.
.
.P
By default it assumes the home server URL to be \fBhttps://localhost:8448\fR\. This can be changed via the \fBserver_url\fR command line option\.
.
.SH "FILES"
A sample YAML file accepted by \fBregister_new_matrix_user\fR is described below:
.
.IP "" 4
.
.nf

registration_shared_secret: "s3cr3t"
.
.fi
.
.IP "" 0
.
.SH "OPTIONS"
.
.TP
\fB\-u\fR, \fB\-\-user\fR
Local part of the new user\. Will prompt if omitted\.
.
.TP
\fB\-p\fR, \fB\-\-password\fR
New password for user\. Will prompt if omitted\. Supplying the password on the command line is not recommended\. Use the STDIN instead\.
.
.TP
\fB\-a\fR, \fB\-\-admin\fR
Register new user as an admin\. Will prompt if omitted\.
.
.TP
\fB\-c\fR, \fB\-\-config\fR
Path to server config file containing the shared secret\.
.
.TP
\fB\-k\fR, \fB\-\-shared\-secret\fR
Shared secret as defined in server config file\. This is an optional parameter as it can be also supplied via the YAML file\.
.
.TP
\fBserver_url\fR
URL of the home server\. Defaults to \'https://localhost:8448\'\.
.
.SH "EXAMPLES"
.
.nf

$ register_new_matrix_user \-u user1 \-p p@ssword \-a \-c config\.yaml
.
.fi
.
.SH "COPYRIGHT"
This man page was written by Rahul De <\fIrahulde@swecha\.net\fR> for Debian GNU/Linux distribution\.
.
This man page was written by Rahul De <\fI\%mailto:rahulde@swecha\.net\fR> for Debian GNU/Linux distribution\.
.SH "SEE ALSO"
synctl(1), synapse_port_db(1), hash_password(1)
synctl(1), synapse_port_db(1), hash_password(1), synapse_review_recent_signups(1)
2 changes: 1 addition & 1 deletion debian/register_new_matrix_user.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ for Debian GNU/Linux distribution.

## SEE ALSO

synctl(1), synapse_port_db(1), hash_password(1)
synctl(1), synapse_port_db(1), hash_password(1), synapse_review_recent_signups(1)
59 changes: 14 additions & 45 deletions debian/synapse_port_db.1
Original file line number Diff line number Diff line change
@@ -1,83 +1,56 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "SYNAPSE_PORT_DB" "1" "February 2017" "" ""
.
.\" generated with Ronn-NG/v0.8.0
.\" http://github.com/apjanke/ronn-ng/tree/0.8.0
.TH "SYNAPSE_PORT_DB" "1" "July 2021" "" ""
.SH "NAME"
\fBsynapse_port_db\fR \- A script to port an existing synapse SQLite database to a new PostgreSQL database\.
.
.SH "SYNOPSIS"
\fBsynapse_port_db\fR [\-v] \-\-sqlite\-database=\fIdbfile\fR \-\-postgres\-config=\fIyamlconfig\fR [\-\-curses] [\-\-batch\-size=\fIbatch\-size\fR]
.
.SH "DESCRIPTION"
\fBsynapse_port_db\fR ports an existing synapse SQLite database to a new PostgreSQL database\.
.
.P
SQLite database is specified with \fB\-\-sqlite\-database\fR option and PostgreSQL configuration required to connect to PostgreSQL database is provided using \fB\-\-postgres\-config\fR configuration\. The configuration is specified in YAML format\.
.
.SH "OPTIONS"
.
.TP
\fB\-v\fR
Print log messages in \fBdebug\fR level instead of \fBinfo\fR level\.
.
.TP
\fB\-\-sqlite\-database\fR
The snapshot of the SQLite database file\. This must not be currently used by a running synapse server\.
.
.TP
\fB\-\-postgres\-config\fR
The database config file for the PostgreSQL database\.
.
.TP
\fB\-\-curses\fR
Display a curses based progress UI\.
.
.SH "CONFIG FILE"
The postgres configuration file must be a valid YAML file with the following options\.
.
.IP "\(bu" 4
.IP "\[ci]" 4
\fBdatabase\fR: Database configuration section\. This section header can be ignored and the options below may be specified as top level keys\.
.
.IP "\(bu" 4
.IP "\[ci]" 4
\fBname\fR: Connector to use when connecting to the database\. This value must be \fBpsycopg2\fR\.
.
.IP "\(bu" 4
.IP "\[ci]" 4
\fBargs\fR: DB API 2\.0 compatible arguments to send to the \fBpsycopg2\fR module\.
.
.IP "\(bu" 4
.IP "\[ci]" 4
\fBdbname\fR \- the database name
.
.IP "\(bu" 4
.IP "\[ci]" 4
\fBuser\fR \- user name used to authenticate
.
.IP "\(bu" 4
.IP "\[ci]" 4
\fBpassword\fR \- password used to authenticate
.
.IP "\(bu" 4
.IP "\[ci]" 4
\fBhost\fR \- database host address (defaults to UNIX socket if not provided)
.
.IP "\(bu" 4
.IP "\[ci]" 4
\fBport\fR \- connection port number (defaults to 5432 if not provided)
.
.IP "" 0

.
.IP "\(bu" 4
.IP "\[ci]" 4
\fBsynchronous_commit\fR: Optional\. Default is True\. If the value is \fBFalse\fR, enable asynchronous commit and don\'t wait for the server to call fsync before ending the transaction\. See: https://www\.postgresql\.org/docs/current/static/wal\-async\-commit\.html
.
.IP "" 0

.
.IP "" 0
.
.P
Following example illustrates the configuration file format\.
.
.IP "" 4
.
.nf

database:
name: psycopg2
args:
Expand All @@ -86,13 +59,9 @@ database:
password: ORohmi9Eet=ohphi
host: localhost
synchronous_commit: false
.
.fi
.
.IP "" 0
.
.SH "COPYRIGHT"
This man page was written by Sunil Mohan Adapa <\fIsunil@medhas\.org\fR> for Debian GNU/Linux distribution\.
.
This man page was written by Sunil Mohan Adapa <\fI\%mailto:sunil@medhas\.org\fR> for Debian GNU/Linux distribution\.
.SH "SEE ALSO"
synctl(1), hash_password(1), register_new_matrix_user(1)
synctl(1), hash_password(1), register_new_matrix_user(1), synapse_review_recent_signups(1)
8 changes: 4 additions & 4 deletions debian/synapse_port_db.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ following options.
* `args`:
DB API 2.0 compatible arguments to send to the `psycopg2` module.

* `dbname` - the database name
* `dbname` - the database name

* `user` - user name used to authenticate

Expand All @@ -58,7 +58,7 @@ following options.

* `port` - connection port number (defaults to 5432 if not
provided)


* `synchronous_commit`:
Optional. Default is True. If the value is `False`, enable
Expand All @@ -76,12 +76,12 @@ Following example illustrates the configuration file format.
password: ORohmi9Eet=ohphi
host: localhost
synchronous_commit: false

## COPYRIGHT

This man page was written by Sunil Mohan Adapa <<sunil@medhas.org>> for
Debian GNU/Linux distribution.

## SEE ALSO

synctl(1), hash_password(1), register_new_matrix_user(1)
synctl(1), hash_password(1), register_new_matrix_user(1), synapse_review_recent_signups(1)
26 changes: 26 additions & 0 deletions debian/synapse_review_recent_signups.1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.\" generated with Ronn-NG/v0.8.0
.\" http://github.com/apjanke/ronn-ng/tree/0.8.0
.TH "SYNAPSE_REVIEW_RECENT_SIGNUPS" "1" "July 2021" "" ""
.SH "NAME"
\fBsynapse_review_recent_signups\fR \- Print users that have recently registered on Synapse
.SH "SYNOPSIS"
\fBsynapse_review_recent_signups\fR \fB\-c\fR|\fB\-\-config\fR \fIfile\fR [\fB\-s\fR|\fB\-\-since\fR \fIperiod\fR] [\fB\-e\fR|\fB\-\-exclude\-emails\fR] [\fB\-u\fR|\fB\-\-only\-users\fR]
.SH "DESCRIPTION"
\fBsynapse_review_recent_signups\fR prints out recently registered users on a Synapse server, as well as some basic information about the user\.
.P
\fBsynapse_review_recent_signups\fR must be supplied with the config of the Synapse server, so that it can fetch the database config and connect to the database\.
.SH "OPTIONS"
.TP
\fB\-c\fR, \fB\-\-config\fR
The config file(s) used by the Synapse server\.
.TP
\fB\-s\fR, \fB\-\-since\fR
How far back to search for newly registered users\. Defaults to 7d, i\.e\. up to seven days in the past\. Valid units are \'s\', \'m\', \'h\', \'d\', \'w\', or \'y\'\.
.TP
\fB\-e\fR, \fB\-\-exclude\-emails\fR
Do not print out users that have validated emails associated with their account\.
.TP
\fB\-u\fR, \fB\-\-only\-users\fR
Only print out the user IDs of recently registered users, without any additional information
.SH "SEE ALSO"
synctl(1), synapse_port_db(1), register_new_matrix_user(1), hash_password(1)
Loading