ssh.scm 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2019 Jakob L. Kreuze <zerodaysfordays@sdf.org>
  3. ;;; Copyright © 2020-2022 Ludovic Courtès <ludo@gnu.org>
  4. ;;;
  5. ;;; This file is part of GNU Guix.
  6. ;;;
  7. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  8. ;;; under the terms of the GNU General Public License as published by
  9. ;;; the Free Software Foundation; either version 3 of the License, or (at
  10. ;;; your option) any later version.
  11. ;;;
  12. ;;; GNU Guix is distributed in the hope that it will be useful, but
  13. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;;; GNU General Public License for more details.
  16. ;;;
  17. ;;; You should have received a copy of the GNU General Public License
  18. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  19. (define-module (gnu machine ssh)
  20. #:use-module (gnu bootloader)
  21. #:use-module (gnu machine)
  22. #:autoload (gnu packages gnupg) (guile-gcrypt)
  23. #:use-module (gnu system)
  24. #:use-module (gnu system file-systems)
  25. #:use-module (gnu system uuid)
  26. #:use-module ((gnu services) #:select (sexp->system-provenance))
  27. #:use-module (guix diagnostics)
  28. #:use-module (guix memoization)
  29. #:use-module (guix gexp)
  30. #:use-module (guix i18n)
  31. #:use-module (guix modules)
  32. #:use-module (guix monads)
  33. #:use-module (guix pki)
  34. #:use-module (guix records)
  35. #:use-module (guix remote)
  36. #:use-module (guix scripts system reconfigure)
  37. #:use-module (guix ssh)
  38. #:use-module (guix store)
  39. #:use-module (guix utils)
  40. #:use-module ((guix self) #:select (make-config.scm))
  41. #:use-module ((guix inferior)
  42. #:select (inferior-exception?
  43. inferior-exception-arguments))
  44. #:use-module (gcrypt pk-crypto)
  45. #:use-module (ice-9 format)
  46. #:use-module (ice-9 match)
  47. #:use-module (ice-9 textual-ports)
  48. #:use-module (srfi srfi-1)
  49. #:use-module (srfi srfi-9)
  50. #:use-module (srfi srfi-19)
  51. #:use-module (srfi srfi-26)
  52. #:use-module (srfi srfi-34)
  53. #:use-module (srfi srfi-35)
  54. #:export (managed-host-environment-type
  55. machine-ssh-configuration
  56. machine-ssh-configuration?
  57. machine-ssh-configuration
  58. machine-ssh-configuration-host-name
  59. machine-ssh-configuration-build-locally?
  60. machine-ssh-configuration-authorize?
  61. machine-ssh-configuration-allow-downgrades?
  62. machine-ssh-configuration-port
  63. machine-ssh-configuration-user
  64. machine-ssh-configuration-host-key
  65. machine-ssh-configuration-session))
  66. ;;; Commentary:
  67. ;;;
  68. ;;; This module implements remote evaluation and system deployment for
  69. ;;; machines that are accessible over SSH and have a known host-name. In the
  70. ;;; sense of the broader "machine" interface, we describe the environment for
  71. ;;; such machines as 'managed-host.
  72. ;;;
  73. ;;; Code:
  74. ;;;
  75. ;;; Parameters for the SSH client.
  76. ;;;
  77. (define-record-type* <machine-ssh-configuration> machine-ssh-configuration
  78. make-machine-ssh-configuration
  79. machine-ssh-configuration?
  80. this-machine-ssh-configuration
  81. (host-name machine-ssh-configuration-host-name) ; string
  82. (system machine-ssh-configuration-system) ; string
  83. (build-locally? machine-ssh-configuration-build-locally? ; boolean
  84. (default #t))
  85. (authorize? machine-ssh-configuration-authorize? ; boolean
  86. (default #t))
  87. (allow-downgrades? machine-ssh-configuration-allow-downgrades? ; boolean
  88. (default #f))
  89. (safety-checks? machine-ssh-configuration-safety-checks? ;boolean
  90. (default #t))
  91. (port machine-ssh-configuration-port ; integer
  92. (default 22))
  93. (user machine-ssh-configuration-user ; string
  94. (default "root"))
  95. (identity machine-ssh-configuration-identity ; path to a private key
  96. (default #f))
  97. (session machine-ssh-configuration-session ; session
  98. (thunked)
  99. (default
  100. ;; By default, open the session once and cache it.
  101. (open-machine-ssh-session* this-machine-ssh-configuration)))
  102. (host-key machine-ssh-configuration-host-key ; #f | string
  103. (default #f)))
  104. (define (open-machine-ssh-session config)
  105. "Open an SSH session for CONFIG, a <machine-ssh-configuration> record."
  106. (let ((host-name (machine-ssh-configuration-host-name config))
  107. (user (machine-ssh-configuration-user config))
  108. (port (machine-ssh-configuration-port config))
  109. (identity (machine-ssh-configuration-identity config))
  110. (host-key (machine-ssh-configuration-host-key config)))
  111. (unless host-key
  112. (warning (G_ "<machine-ssh-configuration> without a 'host-key' \
  113. is deprecated~%")))
  114. (open-ssh-session host-name
  115. #:user user
  116. #:port port
  117. #:identity identity
  118. #:host-key host-key)))
  119. (define open-machine-ssh-session*
  120. (mlambdaq (config)
  121. "Memoizing variant of 'open-machine-ssh-session'."
  122. (open-machine-ssh-session config)))
  123. (define (machine-ssh-session machine)
  124. "Return the SSH session that was given in MACHINE's configuration, or create
  125. one from the configuration's parameters if one was not provided."
  126. (maybe-raise-unsupported-configuration-error machine)
  127. (let ((config (machine-configuration machine)))
  128. (or (machine-ssh-configuration-session config)
  129. (open-machine-ssh-session config))))
  130. ;;;
  131. ;;; Remote evaluation.
  132. ;;;
  133. (define (machine-become-command machine)
  134. "Return as a list of strings the program and arguments necessary to run a
  135. shell command with escalated privileges for MACHINE's configuration."
  136. (if (string= "root" (machine-ssh-configuration-user
  137. (machine-configuration machine)))
  138. '()
  139. '("/run/setuid-programs/sudo" "-n" "--")))
  140. (define (managed-host-remote-eval machine exp)
  141. "Internal implementation of 'machine-remote-eval' for MACHINE instances with
  142. an environment type of 'managed-host."
  143. (maybe-raise-unsupported-configuration-error machine)
  144. (let ((config (machine-configuration machine)))
  145. (remote-eval exp (machine-ssh-session machine)
  146. #:build-locally?
  147. (machine-ssh-configuration-build-locally? config)
  148. #:system
  149. (machine-ssh-configuration-system config)
  150. #:become-command
  151. (machine-become-command machine))))
  152. ;;;
  153. ;;; Safety checks.
  154. ;;;
  155. ;; Assertion to be executed remotely. This abstraction exists to allow us to
  156. ;; gather a list of expressions to be evaluated and eventually evaluate them
  157. ;; all at once instead of one by one. (This is pretty much a monad.)
  158. (define-record-type <remote-assertion>
  159. (remote-assertion exp proc)
  160. remote-assertion?
  161. (exp remote-assertion-expression)
  162. (proc remote-assertion-procedure))
  163. (define-syntax-rule (remote-let ((var exp)) body ...)
  164. "Return a <remote-assertion> that binds VAR to the result of evaluating EXP,
  165. a gexp, remotely, and evaluate BODY in that context."
  166. (remote-assertion exp (lambda (var) body ...)))
  167. (define (machine-check-file-system-availability machine)
  168. "Return a list of <remote-assertion> that raise a '&message' error condition
  169. if any of the file-systems specified in MACHINE's 'system' declaration do not
  170. exist on the machine."
  171. (define file-systems
  172. (filter (lambda (fs)
  173. (and (file-system-mount? fs)
  174. (not (member (file-system-type fs)
  175. %pseudo-file-system-types))
  176. ;; Don't try to validate network file systems.
  177. (not (string-prefix? "nfs" (file-system-type fs)))
  178. (not (memq 'bind-mount (file-system-flags fs)))))
  179. (operating-system-file-systems (machine-operating-system machine))))
  180. (define (check-literal-file-system fs)
  181. (remote-let ((errno #~(catch 'system-error
  182. (lambda ()
  183. (stat #$(file-system-device fs))
  184. #t)
  185. (lambda args
  186. (system-error-errno args)))))
  187. (when (number? errno)
  188. (raise (formatted-message (G_ "device '~a' not found: ~a")
  189. (file-system-device fs)
  190. (strerror errno))))))
  191. (define (check-labeled-file-system fs)
  192. (define remote-exp
  193. (with-imported-modules (source-module-closure
  194. '((gnu build file-systems)))
  195. #~(begin
  196. (use-modules (gnu build file-systems))
  197. (find-partition-by-label #$(file-system-label->string
  198. (file-system-device fs))))))
  199. (remote-let ((result remote-exp))
  200. (unless result
  201. (raise (formatted-message (G_ "no file system with label '~a'")
  202. (file-system-label->string
  203. (file-system-device fs)))))))
  204. (define (check-uuid-file-system fs)
  205. (define remote-exp
  206. (with-imported-modules (source-module-closure
  207. '((gnu build file-systems)
  208. (gnu system uuid)))
  209. #~(begin
  210. (use-modules (gnu build file-systems)
  211. (gnu system uuid))
  212. (let ((uuid (uuid #$(uuid->string (file-system-device fs))
  213. '#$(uuid-type (file-system-device fs)))))
  214. (find-partition-by-uuid uuid)))))
  215. (remote-let ((result remote-exp))
  216. (unless result
  217. (raise (formatted-message (G_ "no file system with UUID '~a'")
  218. (uuid->string (file-system-device fs)))))))
  219. (if (machine-ssh-configuration-safety-checks?
  220. (machine-configuration machine))
  221. (append (map check-literal-file-system
  222. (filter (lambda (fs)
  223. (string? (file-system-device fs)))
  224. file-systems))
  225. (map check-labeled-file-system
  226. (filter (lambda (fs)
  227. (file-system-label? (file-system-device fs)))
  228. file-systems))
  229. (map check-uuid-file-system
  230. (filter (lambda (fs)
  231. (uuid? (file-system-device fs)))
  232. file-systems)))
  233. '()))
  234. (define (machine-check-initrd-modules machine)
  235. "Return a list of <remote-assertion> that raise a '&message' error condition
  236. if any of the modules needed by 'needed-for-boot' file systems in MACHINE are
  237. not available in the initrd."
  238. (define file-systems
  239. (filter file-system-needed-for-boot?
  240. (operating-system-file-systems (machine-operating-system machine))))
  241. (define (missing-modules fs)
  242. (define remote-exp
  243. (let ((device (file-system-device fs)))
  244. (with-imported-modules (source-module-closure
  245. '((gnu build file-systems)
  246. (gnu build linux-modules)
  247. (gnu system uuid)))
  248. #~(begin
  249. (use-modules (gnu build file-systems)
  250. (gnu build linux-modules)
  251. (gnu system uuid))
  252. (define dev
  253. #$(cond ((string? device) device)
  254. ((uuid? device) #~(find-partition-by-uuid
  255. (string->uuid
  256. #$(uuid->string device))))
  257. ((file-system-label? device)
  258. #~(find-partition-by-label
  259. #$(file-system-label->string device)))))
  260. (missing-modules dev '#$(operating-system-initrd-modules
  261. (machine-operating-system machine)))))))
  262. (remote-let ((missing remote-exp))
  263. (unless (null? missing)
  264. (raise (formatted-message (G_ "missing modules for ~a:~{ ~a~}~%")
  265. (file-system-device fs)
  266. missing)))))
  267. (if (machine-ssh-configuration-safety-checks?
  268. (machine-configuration machine))
  269. (map missing-modules file-systems)
  270. '()))
  271. (define* (machine-check-forward-update machine)
  272. "Check whether we are making a forward update for MACHINE. Depending on its
  273. 'allow-upgrades?' field, raise an error or display a warning if we are
  274. potentially downgrading it."
  275. (define config
  276. (machine-configuration machine))
  277. (define validate-reconfigure
  278. (if (machine-ssh-configuration-allow-downgrades? config)
  279. warn-about-backward-reconfigure
  280. ensure-forward-reconfigure))
  281. (remote-let ((provenance #~(call-with-input-file
  282. "/run/current-system/provenance"
  283. read)))
  284. (define channels
  285. (sexp->system-provenance provenance))
  286. (check-forward-update validate-reconfigure
  287. #:current-channels channels)))
  288. (define (machine-check-building-for-appropriate-system machine)
  289. "Raise a '&message' error condition if MACHINE is configured to be built
  290. locally and the 'system' field does not match the '%current-system' reported
  291. by MACHINE."
  292. (let ((config (machine-configuration machine))
  293. (system (remote-system (machine-ssh-session machine))))
  294. (when (and (machine-ssh-configuration-build-locally? config)
  295. (not (string= system (machine-ssh-configuration-system config))))
  296. (raise (formatted-message (G_ "incorrect target system\
  297. ('~a' was given, while the system reports that it is '~a')~%")
  298. (machine-ssh-configuration-system config)
  299. system)))))
  300. (define (check-deployment-sanity machine)
  301. "Raise a '&message' error condition if it is clear that deploying MACHINE's
  302. 'system' declaration would fail."
  303. (define assertions
  304. (append (machine-check-file-system-availability machine)
  305. (machine-check-initrd-modules machine)
  306. (list (machine-check-forward-update machine))))
  307. (define aggregate-exp
  308. ;; Gather all the expressions so that a single round-trip is enough to
  309. ;; evaluate all the ASSERTIONS remotely.
  310. #~(map (lambda (file)
  311. (false-if-exception (primitive-load file)))
  312. '#$(map (lambda (assertion)
  313. (scheme-file "remote-assertion.scm"
  314. (remote-assertion-expression assertion)))
  315. assertions)))
  316. ;; First check MACHINE's system type--an incorrect value for 'system' would
  317. ;; cause subsequent invocations of 'remote-eval' to fail.
  318. (machine-check-building-for-appropriate-system machine)
  319. (mlet %store-monad ((values (machine-remote-eval machine aggregate-exp)))
  320. (for-each (lambda (proc value)
  321. (proc value))
  322. (map remote-assertion-procedure assertions)
  323. values)
  324. (return #t)))
  325. ;;;
  326. ;;; System deployment.
  327. ;;;
  328. (define not-config?
  329. ;; Select (guix …) and (gnu …) modules, except (guix config).
  330. (match-lambda
  331. (('guix 'config) #f)
  332. (('guix _ ...) #t)
  333. (('gnu _ ...) #t)
  334. (_ #f)))
  335. (define (machine-boot-parameters machine)
  336. "Monadic procedure returning a list of 'boot-parameters' for the generations
  337. of MACHINE's system profile, ordered from most recent to oldest."
  338. (define bootable-kernel-arguments
  339. (@@ (gnu system) bootable-kernel-arguments))
  340. (define remote-exp
  341. (with-extensions (list guile-gcrypt)
  342. (with-imported-modules `(((guix config) => ,(make-config.scm))
  343. ,@(source-module-closure
  344. '((guix profiles))
  345. #:select? not-config?))
  346. #~(begin
  347. (use-modules (guix config)
  348. (guix profiles)
  349. (ice-9 textual-ports))
  350. (define %system-profile
  351. (string-append %state-directory "/profiles/system"))
  352. (define (read-file path)
  353. (call-with-input-file path
  354. (lambda (port)
  355. (get-string-all port))))
  356. (map (lambda (generation)
  357. (let* ((system-path (generation-file-name %system-profile
  358. generation))
  359. (boot-parameters-path (string-append system-path
  360. "/parameters"))
  361. (time (stat:mtime (lstat system-path))))
  362. (list generation
  363. system-path
  364. time
  365. (read-file boot-parameters-path))))
  366. (reverse (generation-numbers %system-profile)))))))
  367. (mlet* %store-monad ((generations (machine-remote-eval machine remote-exp)))
  368. (return
  369. (map (lambda (generation)
  370. (match generation
  371. ((generation system-path time serialized-params)
  372. (let* ((params (call-with-input-string serialized-params
  373. read-boot-parameters))
  374. (root (boot-parameters-root-device params))
  375. (label (boot-parameters-label params))
  376. (version (boot-parameters-version params)))
  377. (boot-parameters
  378. (inherit params)
  379. (label
  380. (string-append label " (#"
  381. (number->string generation) ", "
  382. (let ((time (make-time time-utc 0 time)))
  383. (date->string (time-utc->date time)
  384. "~Y-~m-~d ~H:~M"))
  385. ")"))
  386. (kernel-arguments
  387. (append (bootable-kernel-arguments system-path root version)
  388. (boot-parameters-kernel-arguments params))))))))
  389. generations))))
  390. (define-syntax-rule (with-roll-back should-roll-back? mbody ...)
  391. "Catch exceptions that arise when binding MBODY, a monadic expression in
  392. %STORE-MONAD, and collect their arguments in a &deploy-error condition, with
  393. the 'should-roll-back' field set to SHOULD-ROLL-BACK?"
  394. (catch #t
  395. (lambda ()
  396. mbody ...)
  397. (lambda args
  398. (raise (condition (&deploy-error
  399. (should-roll-back should-roll-back?)
  400. (captured-args args)))))))
  401. (define (deploy-managed-host machine)
  402. "Internal implementation of 'deploy-machine' for MACHINE instances with an
  403. environment type of 'managed-host."
  404. (maybe-raise-unsupported-configuration-error machine)
  405. (when (machine-ssh-configuration-authorize?
  406. (machine-configuration machine))
  407. (unless (file-exists? %public-key-file)
  408. (raise (formatted-message (G_ "no signing key '~a'. \
  409. have you run 'guix archive --generate-key?'")
  410. %public-key-file)))
  411. (remote-authorize-signing-key (call-with-input-file %public-key-file
  412. (lambda (port)
  413. (string->canonical-sexp
  414. (get-string-all port))))
  415. (machine-ssh-session machine)
  416. (machine-become-command machine)))
  417. (mlet %store-monad ((_ (check-deployment-sanity machine))
  418. (boot-parameters (machine-boot-parameters machine)))
  419. (let* ((os (machine-operating-system machine))
  420. (host (machine-ssh-configuration-host-name
  421. (machine-configuration machine)))
  422. (eval (cut machine-remote-eval machine <>))
  423. (menu-entries (map boot-parameters->menu-entry boot-parameters))
  424. (bootloader-configuration (operating-system-bootloader os))
  425. (bootcfg (operating-system-bootcfg os menu-entries)))
  426. (define-syntax-rule (eval/error-handling condition handler ...)
  427. ;; Return a wrapper around EVAL such that HANDLER is evaluated if an
  428. ;; exception is raised.
  429. (lambda (exp)
  430. (lambda (store)
  431. (guard (condition ((inferior-exception? condition)
  432. (values (begin handler ...) store)))
  433. (values (run-with-store store (eval exp))
  434. store)))))
  435. (mbegin %store-monad
  436. (with-roll-back #f
  437. (switch-to-system (eval/error-handling c
  438. (raise (formatted-message
  439. (G_ "\
  440. failed to switch systems while deploying '~a':~%~{~s ~}")
  441. host
  442. (inferior-exception-arguments c))))
  443. os))
  444. (with-roll-back #t
  445. (mbegin %store-monad
  446. (upgrade-shepherd-services (eval/error-handling c
  447. (warning (G_ "\
  448. an error occurred while upgrading services on '~a':~%~{~s ~}~%")
  449. host
  450. (inferior-exception-arguments
  451. c)))
  452. os)
  453. (install-bootloader (eval/error-handling c
  454. (raise (formatted-message
  455. (G_ "\
  456. failed to install bootloader on '~a':~%~{~s ~}~%")
  457. host
  458. (inferior-exception-arguments c))))
  459. bootloader-configuration bootcfg)))))))
  460. ;;;
  461. ;;; Roll-back.
  462. ;;;
  463. (define (roll-back-managed-host machine)
  464. "Internal implementation of 'roll-back-machine' for MACHINE instances with
  465. an environment type of 'managed-host."
  466. (define remote-exp
  467. (with-extensions (list guile-gcrypt)
  468. (with-imported-modules (source-module-closure '((guix config)
  469. (guix profiles)))
  470. #~(begin
  471. (use-modules (guix config)
  472. (guix profiles))
  473. (define %system-profile
  474. (string-append %state-directory "/profiles/system"))
  475. (define target-generation
  476. (relative-generation %system-profile -1))
  477. (if target-generation
  478. (switch-to-generation %system-profile target-generation)
  479. 'error)))))
  480. (define roll-back-failure
  481. (condition (&message (message (G_ "could not roll-back machine")))))
  482. (mlet* %store-monad ((boot-parameters (machine-boot-parameters machine))
  483. (_ -> (if (< (length boot-parameters) 2)
  484. (raise roll-back-failure)))
  485. (entries -> (map boot-parameters->menu-entry
  486. (list (second boot-parameters))))
  487. (locale -> (boot-parameters-locale
  488. (second boot-parameters)))
  489. (crypto-dev -> (boot-parameters-store-crypto-devices
  490. (second boot-parameters)))
  491. (store-dir -> (boot-parameters-store-directory-prefix
  492. (second boot-parameters)))
  493. (old-entries -> (map boot-parameters->menu-entry
  494. (drop boot-parameters 2)))
  495. (bootloader -> (operating-system-bootloader
  496. (machine-operating-system machine)))
  497. (bootcfg (lower-object
  498. ((bootloader-configuration-file-generator
  499. (bootloader-configuration-bootloader
  500. bootloader))
  501. bootloader entries
  502. #:locale locale
  503. #:store-crypto-devices crypto-dev
  504. #:store-directory-prefix store-dir
  505. #:old-entries old-entries)))
  506. (remote-result (machine-remote-eval machine remote-exp)))
  507. (when (eqv? 'error remote-result)
  508. (raise roll-back-failure))))
  509. ;;;
  510. ;;; Environment type.
  511. ;;;
  512. (define managed-host-environment-type
  513. (environment-type
  514. (machine-remote-eval managed-host-remote-eval)
  515. (deploy-machine deploy-managed-host)
  516. (roll-back-machine roll-back-managed-host)
  517. (name 'managed-host-environment-type)
  518. (description "Provisioning for machines that are accessible over SSH
  519. and have a known host-name. This entails little more than maintaining an SSH
  520. connection to the host.")))
  521. (define (maybe-raise-unsupported-configuration-error machine)
  522. "Raise an error if MACHINE's configuration is not an instance of
  523. <machine-ssh-configuration>."
  524. (let ((config (machine-configuration machine))
  525. (environment (environment-type-name (machine-environment machine))))
  526. (unless (and config (machine-ssh-configuration? config))
  527. (raise (formatted-message (G_ "unsupported machine configuration '~a'
  528. for environment of type '~a'")
  529. config
  530. environment)))))
  531. ;; Local Variables:
  532. ;; eval: (put 'remote-let 'scheme-indent-function 1)
  533. ;; eval: (put 'with-roll-back 'scheme-indent-function 1)
  534. ;; eval: (put 'eval/error-handling 'scheme-indent-function 1)
  535. ;; End: