1
0

server.yml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. # ntfy server config file
  2. #
  3. # Please refer to the documentation at https://ntfy.sh/docs/config/ for details.
  4. # All options also support underscores (_) instead of dashes (-) to comply with the YAML spec.
  5. # Public facing base URL of the service (e.g. https://ntfy.sh or https://ntfy.example.com)
  6. #
  7. # This setting is required for any of the following features:
  8. # - attachments (to return a download URL)
  9. # - e-mail sending (for the topic URL in the email footer)
  10. # - iOS push notifications for self-hosted servers (to calculate the Firebase poll_request topic)
  11. # - Matrix Push Gateway (to validate that the pushkey is correct)
  12. #
  13. # base-url:
  14. # Listen address for the HTTP & HTTPS web server. If "listen-https" is set, you must also
  15. # set "key-file" and "cert-file". Format: [<ip>]:<port>, e.g. "1.2.3.4:8080".
  16. #
  17. # To listen on all interfaces, you may omit the IP address, e.g. ":443".
  18. # To disable HTTP, set "listen-http" to "-".
  19. #
  20. # listen-http: ":80"
  21. # listen-https:
  22. # Listen on a Unix socket, e.g. /var/lib/ntfy/ntfy.sock
  23. # This can be useful to avoid port issues on local systems, and to simplify permissions.
  24. #
  25. # listen-unix: <socket-path>
  26. # listen-unix-mode: <linux permissions, e.g. 0700>
  27. # Path to the private key & cert file for the HTTPS web server. Not used if "listen-https" is not set.
  28. #
  29. # key-file: <filename>
  30. # cert-file: <filename>
  31. # If set, also publish messages to a Firebase Cloud Messaging (FCM) topic for your app.
  32. # This is optional and only required to save battery when using the Android app.
  33. #
  34. # firebase-key-file: <filename>
  35. # If "cache-file" is set, messages are cached in a local SQLite database instead of only in-memory.
  36. # This allows for service restarts without losing messages in support of the since= parameter.
  37. #
  38. # The "cache-duration" parameter defines the duration for which messages will be buffered
  39. # before they are deleted. This is required to support the "since=..." and "poll=1" parameter.
  40. # To disable the cache entirely (on-disk/in-memory), set "cache-duration" to 0.
  41. # The cache file is created automatically, provided that the correct permissions are set.
  42. #
  43. # The "cache-startup-queries" parameter allows you to run commands when the database is initialized,
  44. # e.g. to enable WAL mode (see https://phiresky.github.io/blog/2020/sqlite-performance-tuning/)).
  45. # Example:
  46. # cache-startup-queries: |
  47. # pragma journal_mode = WAL;
  48. # pragma synchronous = normal;
  49. # pragma temp_store = memory;
  50. # pragma busy_timeout = 15000;
  51. # vacuum;
  52. #
  53. # The "cache-batch-size" and "cache-batch-timeout" parameter allow enabling async batch writing
  54. # of messages. If set, messages will be queued and written to the database in batches of the given
  55. # size, or after the given timeout. This is only required for high volume servers.
  56. #
  57. # Debian/RPM package users:
  58. # Use /var/cache/ntfy/cache.db as cache file to avoid permission issues. The package
  59. # creates this folder for you.
  60. #
  61. # Check your permissions:
  62. # If you are running ntfy with systemd, make sure this cache file is owned by the
  63. # ntfy user and group by running: chown ntfy.ntfy <filename>.
  64. #
  65. # cache-file: <filename>
  66. # cache-duration: "12h"
  67. # cache-startup-queries:
  68. # cache-batch-size: 0
  69. # cache-batch-timeout: "0ms"
  70. # If set, access to the ntfy server and API can be controlled on a granular level using
  71. # the 'ntfy user' and 'ntfy access' commands. See the --help pages for details, or check the docs.
  72. #
  73. # - auth-file is the SQLite user/access database; it is created automatically if it doesn't already exist
  74. # - auth-default-access defines the default/fallback access if no access control entry is found; it can be
  75. # set to "read-write" (default), "read-only", "write-only" or "deny-all".
  76. # - auth-startup-queries allows you to run commands when the database is initialized, e.g. to enable
  77. # WAL mode. This is similar to cache-startup-queries. See above for details.
  78. # - auth-users is a list of users that are automatically created when the server starts.
  79. # Each entry is in the format "<username>:<password-hash>:<role>", e.g. "phil:$2a$10$YLiO8U21sX1uhZamTLJXHuxgVC0Z/GKISibrKCLohPgtG7yIxSk4C:user"
  80. # Use 'ntfy user hash' to generate the password hash from a password.
  81. # - auth-access is a list of access control entries that are automatically created when the server starts.
  82. # Each entry is in the format "<username>:<topic-pattern>:<access>", e.g. "phil:mytopic:rw" or "phil:phil-*:rw".
  83. # - auth-tokens is a list of access tokens that are automatically created when the server starts.
  84. # Each entry is in the format "<username>:<token>[:<label>]", e.g. "phil:tk_1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef:My token".
  85. # Use 'ntfy token generate' to generate a new access token.
  86. #
  87. # Debian/RPM package users:
  88. # Use /var/lib/ntfy/user.db as user database to avoid permission issues. The package
  89. # creates this folder for you.
  90. #
  91. # Check your permissions:
  92. # If you are running ntfy with systemd, make sure this user database file is owned by the
  93. # ntfy user and group by running: chown ntfy.ntfy <filename>.
  94. #
  95. # auth-file: <filename>
  96. # auth-default-access: "read-write"
  97. # auth-startup-queries:
  98. # auth-users:
  99. # auth-access:
  100. # auth-tokens:
  101. # If set, the X-Forwarded-For header (or whatever is configured in proxy-forwarded-header) is used to determine
  102. # the visitor IP address instead of the remote address of the connection.
  103. #
  104. # WARNING: If you are behind a proxy, you must set this, otherwise all visitors are rate-limited
  105. # as if they are one.
  106. #
  107. # - behind-proxy makes it so that the real visitor IP address is extracted from the header defined in
  108. # proxy-forwarded-header. Without this, the remote address of the incoming connection is used.
  109. # - proxy-forwarded-header is the header to use to identify visitors. It may be a single IP address (e.g. 1.2.3.4),
  110. # a comma-separated list of IP addresses (e.g. "1.2.3.4, 5.6.7.8"), or an RFC 7239-style header (e.g. "for=1.2.3.4;by=proxy.example.com, for=5.6.7.8").
  111. # - proxy-trusted-hosts is a comma-separated list of IP addresses, hostnames or CIDRs that are removed from the forwarded header
  112. # to determine the real IP address. This is only useful if there are multiple proxies involved that add themselves to
  113. # the forwarded header.
  114. #
  115. # behind-proxy: false
  116. # proxy-forwarded-header: "X-Forwarded-For"
  117. # proxy-trusted-hosts:
  118. # If enabled, clients can attach files to notifications as attachments. Minimum settings to enable attachments
  119. # are "attachment-cache-dir" and "base-url".
  120. #
  121. # - attachment-cache-dir is the cache directory for attached files
  122. # - attachment-total-size-limit is the limit of the on-disk attachment cache directory (total size)
  123. # - attachment-file-size-limit is the per-file attachment size limit (e.g. 300k, 2M, 100M)
  124. # - attachment-expiry-duration is the duration after which uploaded attachments will be deleted (e.g. 3h, 20h)
  125. #
  126. # attachment-cache-dir:
  127. # attachment-total-size-limit: "5G"
  128. # attachment-file-size-limit: "15M"
  129. # attachment-expiry-duration: "3h"
  130. # Template directory for message templates.
  131. #
  132. # When "X-Template: <name>" (aliases: "Template: <name>", "Tpl: <name>") or "?template=<name>" is set, transform the message
  133. # based on one of the built-in pre-defined templates, or on a template defined in the "template-dir" directory.
  134. #
  135. # Template files must have the ".yml" extension and must be formatted as YAML. They may contain "title" and "message" keys,
  136. # which are interpreted as Go templates.
  137. #
  138. # Example template file (e.g. /etc/ntfy/templates/grafana.yml):
  139. # title: |
  140. # {{- if eq .status "firing" }}
  141. # {{ .title | default "Alert firing" }}
  142. # {{- else if eq .status "resolved" }}
  143. # {{ .title | default "Alert resolved" }}
  144. # {{- end }}
  145. # message: |
  146. # {{ .message | trunc 2000 }}
  147. #
  148. # template-dir: "/etc/ntfy/templates"
  149. # If enabled, allow outgoing e-mail notifications via the 'X-Email' header. If this header is set,
  150. # messages will additionally be sent out as e-mail using an external SMTP server.
  151. #
  152. # As of today, only SMTP servers with plain text auth (or no auth at all), and STARTLS are supported.
  153. # Please also refer to the rate limiting settings below (visitor-email-limit-burst & visitor-email-limit-burst).
  154. #
  155. # - smtp-sender-addr is the hostname:port of the SMTP server
  156. # - smtp-sender-from is the e-mail address of the sender
  157. # - smtp-sender-user/smtp-sender-pass are the username and password of the SMTP user (leave blank for no auth)
  158. #
  159. # smtp-sender-addr:
  160. # smtp-sender-from:
  161. # smtp-sender-user:
  162. # smtp-sender-pass:
  163. # If enabled, ntfy will launch a lightweight SMTP server for incoming messages. Once configured, users can send
  164. # emails to a topic e-mail address to publish messages to a topic.
  165. #
  166. # - smtp-server-listen defines the IP address and port the SMTP server will listen on, e.g. :25 or 1.2.3.4:25
  167. # - smtp-server-domain is the e-mail domain, e.g. ntfy.sh
  168. # - smtp-server-addr-prefix is an optional prefix for the e-mail addresses to prevent spam. If set to "ntfy-",
  169. # for instance, only e-mails to ntfy-$topic@ntfy.sh will be accepted. If this is not set, all emails to
  170. # $topic@ntfy.sh will be accepted (which may be a spam problem).
  171. #
  172. # smtp-server-listen:
  173. # smtp-server-domain:
  174. # smtp-server-addr-prefix:
  175. # Web Push support (background notifications for browsers)
  176. #
  177. # If enabled, allows the ntfy web app to receive push notifications, even when the web app is closed. When enabled, users
  178. # can enable background notifications in the web app. Once enabled, ntfy will forward published messages to the push
  179. # endpoint, which will then forward it to the browser.
  180. #
  181. # You must configure web-push-public/private key, web-push-file, and web-push-email-address below to enable Web Push.
  182. # Run "ntfy webpush keys" to generate the keys.
  183. #
  184. # - web-push-public-key is the generated VAPID public key, e.g. AA1234BBCCddvveekaabcdfqwertyuiopasdfghjklzxcvbnm1234567890
  185. # - web-push-private-key is the generated VAPID private key, e.g. AA2BB1234567890abcdefzxcvbnm1234567890
  186. # - web-push-file is a database file to keep track of browser subscription endpoints, e.g. /var/cache/ntfy/webpush.db
  187. # - web-push-email-address is the admin email address send to the push provider, e.g. sysadmin@example.com
  188. # - web-push-startup-queries is an optional list of queries to run on startup`
  189. # - web-push-expiry-warning-duration defines the duration after which unused subscriptions are sent a warning (default is 55d`)
  190. # - web-push-expiry-duration defines the duration after which unused subscriptions will expire (default is 60d)
  191. #
  192. # web-push-public-key:
  193. # web-push-private-key:
  194. # web-push-file:
  195. # web-push-email-address:
  196. # web-push-startup-queries:
  197. # web-push-expiry-warning-duration: "55d"
  198. # web-push-expiry-duration: "60d"
  199. # If enabled, ntfy can perform voice calls via Twilio via the "X-Call" header.
  200. #
  201. # - twilio-account is the Twilio account SID, e.g. AC12345beefbeef67890beefbeef122586
  202. # - twilio-auth-token is the Twilio auth token, e.g. affebeef258625862586258625862586
  203. # - twilio-phone-number is the outgoing phone number you purchased, e.g. +18775132586
  204. # - twilio-verify-service is the Twilio Verify service SID, e.g. VA12345beefbeef67890beefbeef122586
  205. #
  206. # twilio-account:
  207. # twilio-auth-token:
  208. # twilio-phone-number:
  209. # twilio-verify-service:
  210. # Interval in which keepalive messages are sent to the client. This is to prevent
  211. # intermediaries closing the connection for inactivity.
  212. #
  213. # Note that the Android app has a hardcoded timeout at 77s, so it should be less than that.
  214. #
  215. # keepalive-interval: "45s"
  216. # Interval in which the manager prunes old messages, deletes topics
  217. # and prints the stats.
  218. #
  219. # manager-interval: "1m"
  220. # Defines topic names that are not allowed, because they are otherwise used. There are a few default topics
  221. # that cannot be used (e.g. app, account, settings, ...). To extend the default list, define them here.
  222. #
  223. # Example:
  224. # disallowed-topics:
  225. # - about
  226. # - pricing
  227. # - contact
  228. #
  229. # disallowed-topics:
  230. # Defines the root path of the web app, or disables the web app entirely.
  231. #
  232. # Can be any simple path, e.g. "/", "/app", or "/ntfy". For backwards-compatibility reasons,
  233. # the values "app" (maps to "/"), "home" (maps to "/app"), or "disable" (maps to "") to disable
  234. # the web app entirely.
  235. #
  236. # web-root: /
  237. # Various feature flags used to control the web app, and API access, mainly around user and
  238. # account management.
  239. #
  240. # - enable-signup allows users to sign up via the web app, or API
  241. # - enable-login allows users to log in via the web app, or API
  242. # - enable-reservations allows users to reserve topics (if their tier allows it)
  243. #
  244. # enable-signup: false
  245. # enable-login: false
  246. # enable-reservations: false
  247. # Server URL of a Firebase/APNS-connected ntfy server (likely "https://ntfy.sh").
  248. #
  249. # iOS users:
  250. # If you use the iOS ntfy app, you MUST configure this to receive timely notifications. You'll like want this:
  251. # upstream-base-url: "https://ntfy.sh"
  252. #
  253. # If set, all incoming messages will publish a "poll_request" message to the configured upstream server, containing
  254. # the message ID of the original message, instructing the iOS app to poll this server for the actual message contents.
  255. # This is to prevent the upstream server and Firebase/APNS from being able to read the message.
  256. #
  257. # - upstream-base-url is the base URL of the upstream server. Should be "https://ntfy.sh".
  258. # - upstream-access-token is the token used to authenticate with the upstream server. This is only required
  259. # if you exceed the upstream rate limits, or the uptream server requires authentication.
  260. #
  261. # upstream-base-url:
  262. # upstream-access-token:
  263. # Configures message-specific limits
  264. #
  265. # - message-size-limit defines the max size of a message body. Please note message sizes >4K are NOT RECOMMENDED,
  266. # and largely untested. If FCM and/or APNS is used, the limit should stay 4K, because their limits are around that size.
  267. # If you increase this size limit regardless, FCM and APNS will NOT work for large messages.
  268. # - message-delay-limit defines the max delay of a message when using the "Delay" header.
  269. #
  270. # message-size-limit: "4k"
  271. # message-delay-limit: "3d"
  272. # Rate limiting: Total number of topics before the server rejects new topics.
  273. #
  274. # global-topic-limit: 15000
  275. # Rate limiting: Number of subscriptions per visitor (IP address)
  276. #
  277. # visitor-subscription-limit: 30
  278. # Rate limiting: Allowed GET/PUT/POST requests per second, per visitor:
  279. # - visitor-request-limit-burst is the initial bucket of requests each visitor has
  280. # - visitor-request-limit-replenish is the rate at which the bucket is refilled
  281. # - visitor-request-limit-exempt-hosts is a comma-separated list of hostnames, IPs or CIDRs to be
  282. # exempt from request rate limiting. Hostnames are resolved at the time the server is started.
  283. # Example: "1.2.3.4,ntfy.example.com,8.7.6.0/24"
  284. #
  285. # visitor-request-limit-burst: 60
  286. # visitor-request-limit-replenish: "5s"
  287. # visitor-request-limit-exempt-hosts: ""
  288. # Rate limiting: Hard daily limit of messages per visitor and day. The limit is reset
  289. # every day at midnight UTC. If the limit is not set (or set to zero), the request
  290. # limit (see above) governs the upper limit.
  291. #
  292. # visitor-message-daily-limit: 0
  293. # Rate limiting: Allowed emails per visitor:
  294. # - visitor-email-limit-burst is the initial bucket of emails each visitor has
  295. # - visitor-email-limit-replenish is the rate at which the bucket is refilled
  296. #
  297. # visitor-email-limit-burst: 16
  298. # visitor-email-limit-replenish: "1h"
  299. # Rate limiting: IPv4/IPv6 address prefix bits used for rate limiting
  300. # - visitor-prefix-bits-ipv4: number of bits of the IPv4 address to use for rate limiting (default: 32, full address)
  301. # - visitor-prefix-bits-ipv6: number of bits of the IPv6 address to use for rate limiting (default: 64, /64 subnet)
  302. #
  303. # This is used to group visitors by their IP address or subnet. For example, if you set visitor-prefix-bits-ipv4 to 24,
  304. # all visitors in the 1.2.3.0/24 network are treated as one.
  305. #
  306. # By default, ntfy uses the full IPv4 address (32 bits) and the /64 subnet of the IPv6 address (64 bits).
  307. #
  308. # visitor-prefix-bits-ipv4: 32
  309. # visitor-prefix-bits-ipv6: 64
  310. # Rate limiting: Attachment size and bandwidth limits per visitor:
  311. # - visitor-attachment-total-size-limit is the total storage limit used for attachments per visitor
  312. # - visitor-attachment-daily-bandwidth-limit is the total daily attachment download/upload traffic limit per visitor
  313. #
  314. # visitor-attachment-total-size-limit: "100M"
  315. # visitor-attachment-daily-bandwidth-limit: "500M"
  316. # Rate limiting: Enable subscriber-based rate limiting (mostly used for UnifiedPush)
  317. #
  318. # If subscriber-based rate limiting is enabled, messages published on UnifiedPush topics** (topics starting with "up")
  319. # will be counted towards the "rate visitor" of the topic. A "rate visitor" is the first subscriber to the topic.
  320. #
  321. # Once enabled, a client subscribing to UnifiedPush topics via HTTP stream, or websockets, will be automatically registered as
  322. # a "rate visitor", i.e. the visitor whose rate limits will be used when publishing on this topic. Note that setting the rate visitor
  323. # requires **read-write permission** on the topic.
  324. #
  325. # If this setting is enabled, publishing to UnifiedPush topics will lead to a HTTP 507 response if
  326. # no "rate visitor" has been previously registered. This is to avoid burning the publisher's "visitor-message-daily-limit".
  327. #
  328. # visitor-subscriber-rate-limiting: false
  329. # Payments integration via Stripe
  330. #
  331. # - stripe-secret-key is the key used for the Stripe API communication. Setting this values
  332. # enables payments in the ntfy web app (e.g. Upgrade dialog). See https://dashboard.stripe.com/apikeys.
  333. # - stripe-webhook-key is the key required to validate the authenticity of incoming webhooks from Stripe.
  334. # Webhooks are essential up keep the local database in sync with the payment provider. See https://dashboard.stripe.com/webhooks.
  335. # - billing-contact is an email address or website displayed in the "Upgrade tier" dialog to let people reach
  336. # out with billing questions. If unset, nothing will be displayed.
  337. #
  338. # stripe-secret-key:
  339. # stripe-webhook-key:
  340. # billing-contact:
  341. # Metrics
  342. #
  343. # ntfy can expose Prometheus-style metrics via a /metrics endpoint, or on a dedicated listen IP/port.
  344. # Metrics may be considered sensitive information, so before you enable them, be sure you know what you are
  345. # doing, and/or secure access to the endpoint in your reverse proxy.
  346. #
  347. # - enable-metrics enables the /metrics endpoint for the default ntfy server (i.e. HTTP, HTTPS and/or Unix socket)
  348. # - metrics-listen-http exposes the metrics endpoint via a dedicated [IP]:port. If set, this option implicitly
  349. # enables metrics as well, e.g. "10.0.1.1:9090" or ":9090"
  350. #
  351. # enable-metrics: false
  352. # metrics-listen-http:
  353. # Profiling
  354. #
  355. # ntfy can expose Go's net/http/pprof endpoints to support profiling of the ntfy server. If enabled, ntfy will listen
  356. # on a dedicated listen IP/port, which can be accessed via the web browser on http://<ip>:<port>/debug/pprof/.
  357. # This can be helpful to expose bottlenecks, and visualize call flows. See https://pkg.go.dev/net/http/pprof for details.
  358. #
  359. # profile-listen-http:
  360. # Logging options
  361. #
  362. # By default, ntfy logs to the console (stderr), with an "info" log level, and in a human-readable text format.
  363. # ntfy supports five different log levels, can also write to a file, log as JSON, and even supports granular
  364. # log level overrides for easier debugging. Some options (log-level and log-level-overrides) can be hot reloaded
  365. # by calling "kill -HUP $pid" or "systemctl reload ntfy".
  366. #
  367. # - log-format defines the output format, can be "text" (default) or "json"
  368. # - log-file is a filename to write logs to. If this is not set, ntfy logs to stderr.
  369. # - log-level defines the default log level, can be one of "trace", "debug", "info" (default), "warn" or "error".
  370. # Be aware that "debug" (and particularly "trace") can be VERY CHATTY. Only turn them on briefly for debugging purposes.
  371. # - log-level-overrides lets you override the log level if certain fields match. This is incredibly powerful
  372. # for debugging certain parts of the system (e.g. only the account management, or only a certain visitor).
  373. # This is an array of strings in the format:
  374. # - "field=value -> level" to match a value exactly, e.g. "tag=manager -> trace"
  375. # - "field -> level" to match any value, e.g. "time_taken_ms -> debug"
  376. # Warning: Using log-level-overrides has a performance penalty. Only use it for temporary debugging.
  377. #
  378. # Check your permissions:
  379. # If you are running ntfy with systemd, make sure this log file is owned by the
  380. # ntfy user and group by running: chown ntfy.ntfy <filename>.
  381. #
  382. # Example (good for production):
  383. # log-level: info
  384. # log-format: json
  385. # log-file: /var/log/ntfy.log
  386. #
  387. # Example level overrides (for debugging, only use temporarily):
  388. # log-level-overrides:
  389. # - "tag=manager -> trace"
  390. # - "visitor_ip=1.2.3.4 -> debug"
  391. # - "time_taken_ms -> debug"
  392. #
  393. # log-level: info
  394. # log-level-overrides:
  395. # log-format: text
  396. # log-file: